UE4Protobuf: UE4中编译最新Protobuf 3.11.2的脚本 (gitee.com)

UE4中编译最新Protobuf 3.11.2的脚本

编译环境

  1. Windows下编译Win64及Android库

    • Visual Studio
    • Android NDK
    • CMake 并将cmake.exe所在目录加入系统变量PATH
  2. Mac机编译IOS库

    • XCode
    • CMake

使用说明

  1. 下载Google Protobuf最新版(protobuf-cpp-x.x.x.zip)。

  2. 解压到source目录下

  3. 修改源代码

    • src/google/protobuf/compiler/cpp/cpp_file.cc

      // 方法:FileGenerator::GenerateSourceIncludes
      format(
      
    • cmake/CMakeLists.txt

        add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
      + add_definitions(-DGOOGLE_PROTOBUF_NO_RTTI=1)
  4. 编译

    • 修改BuildWindows.bat中VC的路径为自己安装的路径
    • 修改BuildAndroid.bat中NDK的路径
    • Windows下运行BuildWindows.bat
    • Windows下运行BuildAndroid.bat
    • Mac下运行BuildIOS.sh
  5. UE4集成

    • 在项目Source/ThirdParty目录下建立文件夹Protobuf
    • includelibProtobuf.Build.cs拷贝到新建的目录下
    • 使用bin目录下生成protoc.exe生成*.pb.cc*.pb.h文件
    • 由于最新的Protobuf已经使用c++11重写,所以不需要再引入AllowWindowsPlatformTypes.h等文件了,基本不需要改动

相关文章:

  • 2021-06-30
  • 2021-12-05
  • 2022-12-23
  • 2021-11-04
  • 2022-01-18
  • 2022-12-23
  • 2021-04-01
猜你喜欢
  • 2021-11-16
  • 2021-10-26
  • 2021-11-11
  • 2022-12-23
  • 2021-04-18
  • 2022-01-02
相关资源
相似解决方案