CI: Add static building for cmake
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
diff --git a/.travis.yml b/.travis.yml
index 3584048..ba1a8f6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,18 +1,21 @@
language: c
compiler:
+ - x86_64-linux-gnu-gcc
- i686-w64-mingw32-gcc
- x86_64-w64-mingw32-gcc
addons:
apt:
packages:
+ - gcc
- gcc-mingw-w64
- wine
- cmake
env:
- - ci_buildsys=cmake
+ - ci_buildsys=cmake ci_variant=static
+ - ci_buildsys=cmake ci_variant=shared
- ci_buildsys=Makefile
jobs:
@@ -39,5 +42,12 @@ jobs:
# Check that we have a real i586-mingw32msvc-gcc compiler as sometimes it is just a symlink to i686-w64-mingw32-gcc
before_script: "i586-mingw32msvc-gcc -v 2>&1 | grep -q -x 'Target: i586-mingw32msvc'"
+ exclude:
+ # unsupported
+ - compiler: i686-linux-gnu-gcc
+ env: ci_buildsys=Makefile
+ - compiler: x86_64-linux-gnu-gcc
+ env: ci_buildsys=Makefile
+
script:
- ci_target=${CC%-*} ./tools/ci-build.sh
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