Documentation
Cross Compiling
LibOSDP is written in C and does not depend on any other libraries. You cancompile it to practically any platform (including Windows). Follow thecross-compilation best practice for your platform. This document gives someideas on how to do this but is not exhaustive.
Using CMake
LibOSDP can be compiled with a cross-compiler by passing a toolchain file toCMake via -DCMAKE_TOOLCHAIN_FILE=/path/to/toolchain-file.cmake.
If your toolchain is installed at /opt/toolchain/armv8l-linux-gnueabihf/ andthe sysroot is at /opt/toolchain/armv8l-linux-gnueabihf/sysroot, thetoolchain-file.cmake should look like this:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
# specify the cross compiler and sysroot
set(TOOLCHAIN_INST_PATH /opt/toolchain/armv8l-linux-gnueabihf)
set(CMAKE_C_COMPILER ${TOOLCHAIN_INST_PATH}/bin/armv8l-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_INST_PATH}/bin/armv8l-linux-gnueabihf-g++)
set(CMAKE_SYSROOT ${TOOLCHAIN_INST_PATH}/sysroot)
# don't search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search for libraries and headers in the target directories only
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
Place the toolchain file in a common path (such as where the toolchain isinstalled) and reference it from your build directory:
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=/opt/toolchain/armv8l-linux-gnueabihf/toolchain-file.cmake ..
make
Using Make
Use the --cross-compile flag in configure.sh and then invoke make:
./configure.sh --cross-compile arm-none-
make
make DESTDIR=/opt/arm-none-sysroot/ install