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:
- You use a supported programming language whose API we don't provide
- You need libraries built with a particular toolchain or compiler/linker flags
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.
Prerequisites
- See C++ prerequsites
- External C++ libraries provided by us, or built on your own:
Instructions
-
Clone or download
https://github.com/subor/sdk.git
to sdk folder:
git clone https://[email protected]/subor/sdk.git sdk
-
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 +...
-
Build external libs
- If asked to retarget projects, for Windows SDK version pick
10.0.15063.0
and Platform ToolsetUpgrade to v141
(or whatever is appropriate for your codebase) - Select Release and x64 when possible
- If asked to retarget projects, for Windows SDK version pick
-
Open
sdk/SDK.sln
- Release is for libraries compiled with
/MD
- Release_mt is for libraries compiled with
/MT
- Release is for libraries compiled with
Prerequisites
Instructions
- Open
sdk/SDK.sln
.Net Framework 3.5
contains projects suitable for Unity 3D.Net Standard
contains projects targetting .Net Standard 2.0 (details)
- Build the SDK
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.
- 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 toa.b.c.d
(e.g0.7.2.1447
).
- Right-click
- 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
-
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