This project includes the following crates:
play-cpp-sdk
: the cpp sdk wrapperdefi-wallet-core-rs
: a dependency of play-cpp-sdkextra-cpp-bindings
: a dependency of play-cpp-sdkwallet-connect
: wallet connect implementation
No security audits of this project have ever been performed yet.
The project is still in development and is alpha quality.
USE AT YOUR OWN RISK!
- python 3.8 or newer
- rust 1.61 or newer
- C++ 14 or newer
- Optional: CMake
- Optional: GNU make for mac and linux, ninja for windows
- Optional: Visual Studio 2019 or newer for windows
Please download the archive file based on your OS release: https://github.com/cronos-labs/play-cpp-sdk/releases
- Visual Studio 2019 MSVC, x86_64, toolset 14.29 or newer:
play_cpp_sdk_Windows_x86_64.zip
- macOS 10.15 or newer:
play_cpp_sdk_Darwin_x86_64.tar.gz
- Ubuntu 20.04 or newer:
play_cpp_sdk_libstdc++_Linux_x86_64.tar.gz
orplay_cpp_sdk_libc++_Linux_x86_64.tar.gz
- Android:
play_cpp_sdk_$(TARGET)-$(NDK_VERSION).tar.gz
- IOS:
play_cpp_sdk_aarch64-apple-ios.tar.gz
Start with a C++ project with .sln
and .vcxproj
files:
- Clone the current repository
git clone https://github.com/cronos-labs/play-cpp-sdk.git
- Unzip the archive file into
demo
folder, and replace the originalsdk
folder - Open
demo.sln
which includes two projects:demo
(dynamic build) anddemostatic
(static build). If you use Visual Studio 2022, retarget project, and upgrade PlatformToolset to v143. - Select
Release
profile. - Right click
demo
ordemostatic
project, clickBuild
orRebuild
to build the project
Build modern, cross-platform C++ apps that don't depend on .sln
or .vcxproj
files:
- Open Visual Studio, then open a local folder in welcome window (or click
File
>Open
>Folder...
in the menu), locate thedemo
folder and open it - Select configuration
x64-Release
in the tool bar - Click
Build
>Build All
orRebuild All
to build the project
- Clone the current repository
git clone https://github.com/cronos-labs/play-cpp-sdk.git
- Unzip the archive file into
demo
folder, and replace the originalsdk
folder - Under
demo
folder and build thedemo
project with g++, clang++ or default compilermake CXX=g++ # Compile with g++ make CXX=clang++ # Compile with clang++ make # Compile with default compiler
- Clone the current repository
git clone https://github.com/cronos-labs/play-cpp-sdk.git
- Unzip the archive file into
demo
folder, and replace the originalsdk
folder - Under
demo
folder and build thedemo
project with g++, clang++ or default compilermake CXX=g++ # Compile with g++ make CXX=clang++ # Compile with clang++ make # Compile with default compiler
-
Unzip the archive file into the root folder of your project, you should see a folder named
sdk
and its subdirectories/files.- sdk - CMakeLists.txt - include: c++ source files and header files - lib: static and dynamic libraries - CHANGELOG.md - LICENSE
-
Include the following headers and use the namespaces in your source codes based on your need
#include "sdk/include/defi-wallet-core-cpp/src/contract.rs.h" // erc20, erc721, erc1155 supports #include "sdk/include/defi-wallet-core-cpp/src/lib.rs.h" // wallet, EIP4361, query, signing, broadcast etc, on crypto.org and cronos #include "sdk/include/defi-wallet-core-cpp/src/nft.rs.h" // crypto.org chain nft support #include "sdk/include/defi-wallet-core-cpp/src/uint.rs.h" // uint256 type support #include "sdk/include/defi-wallet-core-cpp/src/ethereum.rs.h" // dynamic contract support #include "sdk/include/extra-cpp-bindings/src/lib.rs.h" // etherscan/cronoscan, crypto.com pay, wallet connect support #include "sdk/include/rust/cxx.h" // the important data types, e.g., rust::String, rust::str, etc using namespace rust; using namespace org::defi_wallet_core; using namespace com::crypto::game_sdk;
-
Link the
play_cpp_sdk
static or dynamic library,cxxbridge1
static library, and sources (*.cc) into your build system (Visual Studio solution, CMake or Makefile). For more details, check out Cronos Play Docs.
If the Pre-built release does not support your platform, you can build the binaries and bindings on your own.
- Run
windows_build.bat
in x64 Native Tools Command Prompt for VS 2019. It will clone necessary submodules, buildplay-cpp-sdk
crate, finally setup and build the demo project. - Clean
~/.cargo/git/checkouts
if cxx fails to build, then runwindows_build.bat
again. - Run
windows_install.bat
, libraries and bindings will be copied into a new created folder:install
- Open
demo.sln
. If you use Visual Studio 2022, retarget project, and upgrade PlatformToolset tov143
before runningwindows_build.bat
- Run
make
- Run
make install
, libraries and bindings will be copied into a new created folder:install
- Run
make
- Run
make install
, libraries and bindings will be copied into a new created folder:install
- Install android NDK (e.g. 23.0.7599858) via Android Studio
- Run make for one of the following android targets on Mac or Linux
NDK_VERSION=23.0.7599858 make armv7-linux-androideabi NDK_VERSION=23.0.7599858 make aarch64-linux-android NDK_VERSION=23.0.7599858 make i686-linux-android NDK_VERSION=23.0.7599858 make x86_64-linux-android
- Run
make install
, libraries and bindings will be copied into a new created folder:install
- Run
make aarch64-apple-ios
- Run
make install
, libraries and bindings will be copied into a new created folder:install
If you are a game developer, please visit Cronos Play or fill this Contact Form for more information.