1 Star 0 Fork 5

linkaka / UE4Protobuf

forked from leo / UE4Protobuf 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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等文件了,基本不需要改动
MIT License Copyright (c) 2019 leo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

UE4中编译最新Protobuf 3.11.2的脚本 展开 收起
C++
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C++
1
https://gitee.com/linkaka/UE4Protobuf.git
git@gitee.com:linkaka/UE4Protobuf.git
linkaka
UE4Protobuf
UE4Protobuf
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891