Skip to content

Building from source

Arnelle Balane edited this page Dec 30, 2020 · 2 revisions

Prebuilt binaries of the libraries can be downloaded from the Releases page. To create a custom build, we can build it from source.

Dependencies

Be sure to have the following build tools installed before proceeding:

Clone the repository

git clone --recurse-submodules https://github.com/idpass/idpass-lite.git

Debug and release builds

./build.sh

This generates the debug and release builds for x86-64 platform inside the build directory. libidpasslite.so can be found in build/{debug,release}/lib/src/libidpasslite.so. We can copy this file into our project to start using it.

Additionally, coverage reports for the build are written in the build/html directory.

Specific builds

It's also possible to generate specific builds by passing the desired build as arguments to build.sh.

./build.sh desktop
./build.sh debug
./build.sh release
./build.sh android
./build.sh android arm64-v8a
./build.sh android arm32-v7a
./build.sh android x86_64
./build.sh android x86

Building on host machine

All the builds (except for desktop) are done inside a container. It might be possible to use the host machine for the builds if we can supply these environment variables:

TOOLCHAIN_FILE=/opt/android/android-ndk-r20/build/cmake/android.toolchain.cmake
ANDROID_NDK_HOME=/opt/android/android-ndk-r20

# Example, to build for "android arm64-v8a"
abi=arm64-v8a

# Then run these commands to build
mkdir arm64-v8a.build
cd arm64-v8a.build

cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_FILE \
    -DANDROID_NDK=$ANDROID_NDK_HOME \
    -DANDROID_TOOLCHAIN=clang \
    -DCMAKE_ANDROID_ARCH_ABI=$abi \
    -DANDROID_ABI=$abi \
    -DANDROID_LINKER_FLAGS="-landroid -llog" \
    -DANDROID_NATIVE_API_LEVEL=23 \
    -DANDROID_STL=c++_static \
    -DANDROID_CPP_FEATURES="rtti exceptions" ..

cmake --build .

Here's a screencast of these build commands performed to create a build:

asciicast