This document summarizes platform build commands and options.
mkdir build && cd build
cmake .. -DSWEETLINE_BUILD_TESTS=ON
cmake --build .SweetLine can be embedded as a source dependency from another CMake project:
add_subdirectory(path/to/SweetLine)
target_link_libraries(my_target PRIVATE sweetline_static)Use sweetline when you want the shared library target instead.
cd platform/Android
./gradlew :sweetline:assembleReleasecd platform/Java22
./gradlew :sweetline:build
./gradlew :demo:runJava 22 module notes:
- Build scripts are configured with
--enable-preview. - Runtime needs
--enable-native-access=ALL-UNNAMED. - If native library is not auto-discovered, set
-Dsweetline.lib.path=<native-lib-dir>. - For JAR packaging scenarios, you can use
NativeLibraryExtractor.extractToDefaultDir().
mkdir build-wasm && cd build-wasm
emcmake cmake .. -DCMAKE_BUILD_TYPE=Release
emmake make| CMake Option | Default | Description |
|---|---|---|
SWEETLINE_BUILD_TESTS |
ON for top-level builds, OFF as a subproject | Whether to build tests |
SWEETLINE_BUILD_SHARED |
ON | Whether to build shared library target |
SWEETLINE_BUILD_STATIC |
ON | Whether to build static library target |
SWEETLINE_BUILD_WASM_EMBIND |
ON | Whether to build the Emscripten embind target |
Notes:
- When
EMSCRIPTENis enabled,SWEETLINE_BUILD_SHAREDis skipped because normal dynamic libraries are not used there. - Unit tests are skipped automatically on Android/OHOS/Emscripten.