2 Star 8 Fork 1

leo / UE4Protobuf

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

UE4Protobuf

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(
          "// Generated by the protocol buffer compiler.  DO NOT EDIT!\n"
          "// source: $filename$\n"
      +    "\n"
      +    "// Disable UE4 VS warnings\n"
      +    "#ifdef _MSC_VER\n"
      +    "#\tpragma warning(disable: 4946)\n"
      +    "#\tpragma warning(disable: 4125)\n"
      +    "#\tpragma warning(disable: 4647)\n"
      +    "#\tpragma warning(disable: 4668)\n"
      +    "#\tpragma warning(disable: 4800)\n"
      +    "#endif\n"
      +    "\n"
          "#include $1$\n"
    • cmake/CMakeLists.txt

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

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

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

Comments ( 2 )

Sign in for post a comment

About

UE4中编译最新Protobuf 3.11.2的脚本 spread retract
Cancel

Releases

No release

Contributors

All

Activities

load more
can not load any more
C++
1
https://gitee.com/love_linger/UE4Protobuf.git
git@gitee.com:love_linger/UE4Protobuf.git
love_linger
UE4Protobuf
UE4Protobuf
master

Search