From 3a016513e42c082c6b7b509bf93f63066a1b65f8 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Mon, 28 Dec 2020 12:29:13 +0100 Subject: CI: Add static building for cmake --- tools/ci-build.sh | 81 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 22 deletions(-) (limited to 'tools') diff --git a/tools/ci-build.sh b/tools/ci-build.sh index 366a407..196fd92 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -9,35 +9,72 @@ set -x # ci_target: # target to build for -: "${ci_target:=${CROSS_COMPILE%-}}" +: "${ci_target:=x86_64-linux-gnu-gcc}" + +# ci_variant: +# variant to build e.g shared, static +: "${ci_variant:=shared}" + +if test -v CROSS_COMPILE; then + ci_target=${CROSS_COMPILE%-} +fi case "$ci_buildsys" in (Makefile) - ./configure --enable-shared --enable-static --enable-wine --cross-prefix=${ci_target}- - make - make test + case "$ci_target" in + (*mingw32*) + ./configure --enable-shared --enable-static --enable-wine --cross-prefix=${ci_target}- + make + make test + ;; + esac ;; (cmake) + cmake_options=" + --no-warn-unused-cli + -DBUILD_TESTS=1 + -DCMAKE_BUILD_TYPE=RelWithDebInfo + " + case "$ci_variant" in + (shared) + cmake_options+=" -DBUILD_SHARED_LIBS=ON" + ;; + (static) + cmake_options+=" -DBUILD_SHARED_LIBS=OFF" + ;; + esac + cmake --version - rm -rf build - mkdir build - cd build - cmake \ - --no-warn-unused-cli \ - -DCMAKE_FIND_ROOT_PATH=$(${ci_target}-gcc --print-sysroot)/${ci_target} \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_C_COMPILER=$(which ${ci_target}-gcc) \ - -DCMAKE_SYSTEM_PROCESSOR=${ci_target%-*-*} \ - -DCMAKE_CROSSCOMPILING=TRUE \ - -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ - -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ - -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ - -DCMAKE_SYSTEM_NAME=Windows \ - -DBUILD_TESTS=1 \ - -DENABLE_WINE=ON \ - -DWINE_EXECUTABLE=/usr/bin/wine \ - .. + + # create build dir + rm -rf ci-build-${ci_variant}-${ci_target} + mkdir -p ci-build-${ci_variant}-${ci_target} + cd ci-build-${ci_variant}-${ci_target} + + case "$ci_target" in + (*mingw32*) + cmake \ + -DCMAKE_FIND_ROOT_PATH=$(${ci_target}-gcc --print-sysroot)/${ci_target} \ + -DCMAKE_C_COMPILER=$(which ${ci_target}-gcc) \ + -DCMAKE_SYSTEM_PROCESSOR=${ci_target%-*-*} \ + -DCMAKE_CROSSCOMPILING=TRUE \ + -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ + -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ + -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ + -DCMAKE_SYSTEM_NAME=Windows \ + -DENABLE_WINE=ON \ + -DWINE_EXECUTABLE=/usr/bin/wine \ + $cmake_options \ + .. + ;; + (*linux*) + cmake \ + $cmake_options \ + .. + ;; + esac + make ctest --output-on-failure make install DESTDIR=$(pwd)/DESTDIR -- cgit v1.2.3-55-g6feb