2 Star 19 Fork 5

leo / UE4Protobuf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.81 KB
一键复制 编辑 原始数据 按行查看 历史
leo 提交于 2023-03-09 19:50 . 支持UE5

ue4pb

编译UE使用的protobuf

编译环境

  1. Windows下编译Win64及Android库及UE使用的Linux库

    • Visual Studio
    • Android NDK
    • CMake 并将cmake.exe所在目录加入系统变量PATH
    • 从UE官网下载 Cross-Compile Toolchains
  2. Mac机编译Mac及IOS库

    • XCode
    • CMake

使用说明

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

  2. 解压并改名为source目录

  3. 修改源代码

    • source\src\google\protobuf\compiler\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"
  4. 编译

    • 运行VS的x64 Native Tools Command Prompt for VS XXXcd到工程目录执行BuildWindows.bat
    • 修改BuildAndroid.batNDK的路径
    • 修改BuildLinux.bat中的UE所在路径
    • 编译Mac及IOS:
      • STEP.1 Windows下共享工程目录
      • STEP.2 Mac机下使用mount_smbfs指令挂载该目录
      • STEP.3 执行BuildIOSBuildMac
  5. UE4集成

    • 在项目Source/ThirdParty目录下建立文件夹Protobuf
    • include, lib, Protobuf.Build.cs拷贝到新建的目录下
    • 使用bin目录下生成protoc.exe生成*.pb.cc*.pb.h文件
C++
1
https://gitee.com/love_linger/UE4Protobuf.git
git@gitee.com:love_linger/UE4Protobuf.git
love_linger
UE4Protobuf
UE4Protobuf
master

搜索帮助