This is a tutorial of CMake for beginners. It starts from "HelloWorld" to "CrossPlatform Compile" step by step.
Run sample 01-07 use command like
cd cmake-tutorial-sample/01-helloworld
sh build.sh
The last sample 08-cross_platform should setup environment first.
Only verified on Mac, before run build.sh you should install
- Xcode/AndroidStudio
- CMake
- Ninjia
- NDK
- node
- electron
- git
then execute command
cd cmake-tutorial-sample/08-cross_platform
sh build.sh
If it sets up success, you will see
SET UP END:
* Already set up iOS/Android/Electron/Web Project
* All project can work with source C++ code
* Temp fold & files are emsdk/Xcode/WebAssembly
- Should use ./application/ios/Render.xcworkspace project
- Wrapper is a framework target named AlgorithmSDK
- AlgorithmSDK.xcodeproj was generated by cmake use -G "Xcode"
- Should use ./application/android as project root directory
- Wrapper is a AndroidLibray with package name com.sdk.sdk
- Wrapper is setup by manual at ./wrapper/JNI
- AndroidStudio is no need cmake generate
- Use CMakeLists.txt by configure "externalNativeBuild" at ./wrapper/JNI/sdk/build.gradle
- Use source code by configure ./application/android/settings.gradle
- Should use ./application/electron & ./application/web as project root
- Electron & Web share the AlgorithmSDK.js & AlgorithmSDK.wasm
- AlgorithmSDK need download emsdk as compiler
- Wrapper is a cmake generate build system with special emsdk toolchain
- AlgorithmSDK can build synchrony version, default is asynchrony
- Electron import wasm both via node & browser
- Web import wasm via browser and access via http server
- Run electron use "cd ./application/electron && sh build.sh"
- Run web use "cd ./application/web && sh build.sh"
The documents have publicized on my blog and written by Chinese.