Skip to content

a-sit/liblongfellow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake Guide

Licenses

TODO: include external licenses:

  • BSD license: zstd, ios-cmake
  • GPLv3?: wolfSSL
  • Apache license: liblongfellow-zk

Dependencies

This library depends on cmake, clang/clang++ To pull and init external sources run:

git submodule update --init --recursive

Building manually with CMake

From within the project root directory just run the commands: Afterwards the shared library is stored inside install directory

Quick and dirty for local testing

cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
cmake --build build --config Release --parallel

Here 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 --parallel

Linux (KMP compatible)

The 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 --parallel

iOS

cmake -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 an XCFramework (optional)

  1. Build for the following 3 platforms by modifying -DPLATFORM=:
  • OS64
  • SIMULATOR64
  • SIMULATORARM64 (Unfortunately the SIMULATOR64COMBINED wont work, thats why we have to create a fat binary ourselves)
  1. Then assemble this structure with the corresponding dylibs and prepare iosSimulator directory
longfellow
├── iosArm64
│   └── liblongfellow_mdoc.dylib
├── iosSimulatorArm64
│   └── liblongfellow_mdoc.dylib
├── iosX64
│   └── liblongfellow_mdoc.dylib
└── iosSimulator
  1. Assemble the fat binary:
lipo -create \
longfellow/iosSimulatorArm64/liblongfellow_mdoc.dylib \
longfellow/iosX64/liblongfellow_mdoc.dylib \
-output longfellow/iosSimulator/liblongfellow_mdoc.dylib
  1. Build the XC Framework
xcodebuild -create-xcframework \
-library longfellow/iosArm64/liblongfellow_mdoc.dylib \
-library longfellow/iosSimulator/liblongfellow_mdoc.dylib \
-output Longfellow.xcframework

Android

More info

First 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published