TODO: include external licenses:
- BSD license: zstd, ios-cmake
- GPLv3?: wolfSSL
- Apache license: liblongfellow-zk
This library depends on cmake, clang/clang++ To pull and init external sources run:
git submodule update --init --recursiveFrom within the project root directory just run the commands:
Afterwards the shared library is stored inside install directory
cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build --config Release --parallelHere is an all-in-one command to rebuild from scrap:
rm -rf build install && cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ && cmake --build build --config Release --parallelThe additional requirement of IntelliJ and Kotlin Multiplatform is required for this to work
First set adequate TOOLCHAIN and SYSROOT
ExampleS:
export KDEP="$HOME/.konan/dependencies/"
export LLVM="$KDEP/llvm-19-x86_64-linux-essentials-100/bin"
export TOOLCHAIN="$KDEP/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2/"
export SYSROOT="$TOOLCHAIN/x86_64-unknown-linux-gnu/sysroot"Then run:
cmake -B build \
-DCMAKE_CXX_COMPILER="$LLVM/clang++" \
-DCMAKE_BUILD_TYPE=release \
-DCMAKE_C_COMPILER="$LLVM/clang" \
-DCMAKE_SYSROOT="$SYSROOT" \
-DCMAKE_C_FLAGS="--gcc-toolchain=$TOOLCHAIN"
cmake --build build --config Release --parallelcmake -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=external/ios-cmake/ios.toolchain.cmake -DDEPLOYMENT_TARGET=14.0 -DPLATFORM=OS64
cmake --build build --config Release --parallel
cmake --install build --config Release- Build for the following 3 platforms by modifying
-DPLATFORM=:
OS64SIMULATOR64SIMULATORARM64(Unfortunately theSIMULATOR64COMBINEDwont work, thats why we have to create a fat binary ourselves)
- Then assemble this structure with the corresponding dylibs and prepare
iosSimulatordirectory
longfellow
├── iosArm64
│ └── liblongfellow_mdoc.dylib
├── iosSimulatorArm64
│ └── liblongfellow_mdoc.dylib
├── iosX64
│ └── liblongfellow_mdoc.dylib
└── iosSimulator- Assemble the fat binary:
lipo -create \
longfellow/iosSimulatorArm64/liblongfellow_mdoc.dylib \
longfellow/iosX64/liblongfellow_mdoc.dylib \
-output longfellow/iosSimulator/liblongfellow_mdoc.dylib- Build the XC Framework
xcodebuild -create-xcframework \
-library longfellow/iosArm64/liblongfellow_mdoc.dylib \
-library longfellow/iosSimulator/liblongfellow_mdoc.dylib \
-output Longfellow.xcframeworkFirst set your NDK, PLATFORM and ABI
Examples:
export NDK=~/Android/Sdk/ndk/27.0.12077973
export PLATFORM="android-21"
export ABI="arm64-v8a"Then Run cmake with the toolchain:
cmake -B build -DCMAKE_TOOLCHAIN_FILE="${NDK}/build/cmake/android.toolchain.cmake" -DANDROID_PLATFORM=$PLATFORM -DANDROID_ABI=$ABI
cmake --build build --config Release --parallel