zoukankan      html  css  js  c++  java
  • UE4中集成ProtoBuf

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

    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!
        "
            "// source: $filename$
        "
        +    "
        "
        +    "// Disable UE4 VS warnings
        "
        +    "#ifdef _MSC_VER
        "
        +    "#	pragma warning(disable: 4946)
        "
        +    "#	pragma warning(disable: 4125)
        "
        +    "#	pragma warning(disable: 4647)
        "
        +    "#	pragma warning(disable: 4668)
        "
        +    "#	pragma warning(disable: 4800)
        "
        +    "#endif
        "
        +    "
        "
            "#include $1$
        "
      • 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等文件了,基本不需要改动
  • 相关阅读:
    正则表达式(RegExp)
    文本处理工具(cut,sort,tr,grep等)
    权限和ACL练习题
    访问控制列表ACL
    权限和ACL访问控制-02-特殊权限
    数据库的高级操作
    数据表三范式&范式理论
    数据表之间的关系
    数据表的列类型
    修改表结构
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/14919794.html
Copyright © 2011-2022 走看看