Example for Scapix Language Bridge
On the fly code generation to bridge C++ to Java, Objective-C, Swift, Python, JavaScript (WebAssembly) and C#.
- Change your C++ code and build your project (bindings generated as part of the build).
- Call newly changed C++ code from Java, Objective-C, Swift, Python, JavaScript or C#.
$ git clone https://github.com/scapix-com/example1build.sh script (or build.cmd on Windows) runs CMake configure and build steps using selected CMake preset.
- Run buildscript without parameters to see list of available CMake presets.
- Run buildscript specifying one the the presets to create and build library project (chatlib).
- Open corresponding platform specific application project in ui folder (chat).
- Run: ./build.sh xcode-objc
- Open in Xcode: ui/macos/chat.xcworkspace
- Run: ./build.sh xcode-objc-ios
- Open in Xcode: ui/ios/chat.xcworkspace
- Run: ./build.sh xcode-objc-tvos
- Run: ./build.sh xcode-objc-watchos
- Run: ./build.sh xcode-objc-visionos
- Open in Android Studio: ui/android
- Requires: Ninja, see Install CMake and Ninja
$ ./build.sh python
$ cd ui/python
$ ./run.pyYou can also specify CMake generator explicitly and then open generated project in corresponding IDE:
$ build vs2019-python
$ build vs2022-python
$ ./build.sh xcode-python$ ./build.sh javaYou can also specify CMake generator explicitly and then open generated project in corresponding IDE:
$ build vs2019-java
$ build vs2022-java
$ ./build.sh xcode-javaInstall Emscripten SDK
$ ./build.sh js
$ cd ui/js
$ ./serve.shOn Windows use ninja-js preset, as Emscripten SDK doesn't support Visual Studio CMake generators:
$ build ninja-js
$ cd ui/js
$ serve.sh$ build vs2022-csOpen Visual Studio solution: build\vs2022-cs\ui\cs\chat.sln