Code Monkey home page Code Monkey logo

ue4-protobuf's Introduction

What is this?

This is an Unreal Engine 4 plugin that integrates Protobuf into the project without requiring you to add system PATH or anything else.

How do use?

  1. add the plugin to the project and enable it.
  2. add the following property to build.cs of modules :
PublicDependencyModuleNames.Add("Protobuf");
  1. Create .proto file into project source code folder
  2. Launch the Project in Editor, Click the Protoc button.

Protobuf Versions

  • Protobuf v3.21.5
  • Protobuf v3.5.1

Upgrade Protobuf

For protobuf v3.21.x

1. Clone Protobuf repo

  1. Clone to disk git clone https://github.com/protocolbuffers/protobuf
  2. Switch to your desired branchs/tags git checkout <branchs/tags>

2. Convert Protobuf Source

  1. Use adapte script to convert protobuf source
  2. Copy the conversion result to Source/Protobuf/ThirdParty/google in ue4-protobuf dir

3. Compile Protoc

  1. Go to protobuf repo dir
  2. Alter source code
    • src/google/protobuf/compiler/cpp/file.cc -> FileGenerator::GenerateSourceIncludes
    format(
    "// Generated by the protocol buffer compiler.  DO NOT EDIT!\n"
    "// source: $filename$\n"
    +    "\n"
    +    "#ifdef _MSC_VER\n"
    +    "#\tpragma warning(disable: 4125)\n"
    +    "#\tpragma warning(disable: 4647)\n"
    +    "#\tpragma warning(disable: 4668)\n"
    +    "#\tpragma warning(disable: 4800)\n"
    +    "#\tpragma warning(disable: 4946)\n"
    +    "#endif\n"
    +    "\n"
    "#include $1$\n"
    
  3. Run cmd to complie protoc.exe
    cd <protobuf repo dir>
    
    call <Microsoft Visual Studio Program File>\VC\Auxiliary\Build\vcvars64.bat
    @REM For example: call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
    
    cmake ./cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_INSTALL_PREFIX=./ -DBUILD_SHARED_LIBS=OFF -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_CONFORMANCE=OFF -Dprotobuf_BUILD_EXAMPLES=OFF -Dprotobuf_BUILD_PROTOC_BINARIES=ON -Dprotobuf_MSVC_STATIC_RUNTIME=OFF
    
    nmake -nologo install
    
  4. Copy the /bin/protoc.exe binary file in protobuf repo dir to /Source/Protobuf/ThirdParty/bin/ in ue4-protobuf dir

ue4-protobuf's People

Contributors

augkit avatar indiest avatar meth-yzh avatar hxhb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.