CMake Integration
For some lib target already defined:
Add Scapix:
The same CMake project will build C++ library with bindings for different languages, depending on SCAPIX_BRIDGE parameter:
Supported values for SCAPIX_BRIDGE parameter:
- cpp (default, no bridge)
- java
- objc
- python
- js
- cs
scapix_add_target() / scapix_bridge_headers() parameters:
- target - your C++ library target
- domain - reverse domain name for your application (example: com.companyname.appname)
- bridge_headers - C++ headers to parse.
Info
For Python bridge, the order of headers passed to scapix_bridge_headers() matters: headers with base classes should come before headers with derived classes.
scapix_fix_sources()
Cosmetic: call scapix_fix_sources(lib) to organize sources in IDEs like Visual Studio and XCode (calls CMake source_group() function).
Configuration options
When using Java Bridge (SCAPIX_BRIDGE=java), you can specify the following options:
- SCAPIX_JNI_CACHE_CLASS_LOADER, default: ON
- SCAPIX_JNI_AUTO_ATTACH_THREAD, default: ON
- SCAPIX_JNI_STANDARD_UTF8, default: ON
See Scapix JNI documentation.
- SCAPIX_CUSTOM_JNI_ONLOAD
By default, Scapix generates JNI_OnLoad() function for target library. You can also use your own JNI_OnLoad(), which then needs to call scapix_JNI_OnLoad().
C++ dependency management
Scapix uses cmodule for CMake dependency management.
You can also add additional dependencies to your project
and cmodule will automatically download and build these libraries
for any target platform like iOS, Android, WebAssembly, etc.