Skip to content

Latest commit

 

History

History
110 lines (82 loc) · 5.15 KB

build_sdk_source.md

File metadata and controls

110 lines (82 loc) · 5.15 KB

Build SDK Source

SDK binaries should be sufficent for the majority of development scenarios (also check the Unity and UE4 docs).

This document discusses building the SDK yourself. This may be necessary in the following situations:

As discussed here, the client SDK uses Apache Thrift. The Thrift interface definitions, C++/C# Visual Studio projects, and sourcecode for the Ruyi SDK are available from the SDK source repository.

C++

Prerequisites

Instructions

  1. Clone or download https://github.com/subor/sdk.git to sdk folder:
    git clone https://[email protected]/subor/sdk.git sdk

  2. Unzip external libs (listed above in prerequisites) to externals/ folder beside sdk/. Like this:

     +---externals
     |   +---boost_1_64_0
     |   |   +---boost
     |   |   \---lib
     |   |       \---x64
     |   +---jsoncpp
     |   |   +---include
     |   |   |   \---json
     |   |   \---src
     |   |       \---lib_json
     |   +---OpenSSL
     |   |   +---include
     |   |   |   \---openssl
     |   |   \---lib
     |   |       \---engines-1_1
     |   |   +---src
     |   |   |   \---thrift
     |   |   \---test
     |   +---thrift.csharp
     |   \---ZeroMQ
     |       +---include
     |       \---lib
     \---sdk
         +---RuyiLogger
         +---RuyiSDK
         +---RuyiSDKCpp
         +...
    
  3. Build external libs

    • If asked to retarget projects, for Windows SDK version pick 10.0.15063.0 and Platform Toolset Upgrade to v141 (or whatever is appropriate for your codebase)
    • Select Release and x64 when possible
  4. Open sdk/SDK.sln

    • Release is for libraries compiled with /MD
    • Release_mt is for libraries compiled with /MT
  5. Build the SDK

C Sharp/C#

Prerequisites

Instructions

  1. Open sdk/SDK.sln
    • .Net Framework 3.5 contains projects suitable for Unity 3D
    • .Net Standard contains projects targetting .Net Standard 2.0 (details)
  2. Build the SDK

Building

The runtime, layer0, checks the version of the SDK used by client applications. To satisfy this check the SDK should be compiled as the same version.

  1. Get version to build SDK for
    • Right-click Layer0/Layer0.exe, select Properties then Details tab and note File version value. It should be similar to a.b.c.d (e.g 0.7.2.1447).
  2. Build the SDK for that version
    • Pass /p:AssemblyMain and /p:AssemblyRevision (for C++) and /p:AssemblyVersion (for C#) options to msbuild:

      msbuild SDK.sln /p:AssemblyVersion=a.b.c.d /p:AssemblyMain=a.b.c /p:AssemblyRevision=d

      e.g. for 0.7.2.1447:

      msbuild SDK.sln /p:AssemblyVersion=0.7.2.1447 /p:AssemblyMain=0.7.2 /p:AssemblyRevision=1447

Thrift

The SDK source also includes the underlying Thrift interface definitions. This means the Ruyi SDK can be generated for a large number of different langauges.

Run thrift.exe --help for a full list of supported languages (generators) and options.

The API Tool provided with devtool provdes some assistance working with our Thrift files.

For example, to generate API similar to what we provide in SDK (see sdk source):

:: C++
DevTools\RuyiShell.exe -v Debug ApiTool --ThriftFiles=sdk\ThriftFiles --ThriftExe=..\tools\thrift\thrift.exe --Gen=cpp --ServiceOutput=sdk\ServiceGenerated\Generated --Options=OutputPrefix --Generate

:: C#
DevTools\RuyiShell.exe -v Debug ApiTool --ThriftFiles=sdk\ThriftFiles --ThriftExe=..\tools\thrift\thrift.exe --Gen="csharp:async,union" --ServiceOutput=sdk\ServiceGenerated\Generated --CommonOutput=sdk\ServiceCommon\Generated --Generate