diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2020-11-03 10:05:33 +0100 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2020-11-09 09:45:55 +0100 |
commit | 90302fc5e74bed533f68dbedb25163e98906121d (patch) | |
tree | 09ef5dedd12529c0d693e83c66cbb6a94d5d8eec | |
parent | 2821345eacb71222ed9acf31f193eda81daeec3f (diff) | |
download | dlfcn-win32-90302fc5e74bed533f68dbedb25163e98906121d.tar.gz dlfcn-win32-90302fc5e74bed533f68dbedb25163e98906121d.tar.bz2 dlfcn-win32-90302fc5e74bed533f68dbedb25163e98906121d.zip |
Add cmake building support to Travis CI
To make it easier to extend the CI support and to be able to execute
the contained tests locally, a dedicated shell script tools/ci_build.sh
was added to execute the tests.
-rw-r--r-- | .travis.yml | 9 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rwxr-xr-x | tools/ci-build.sh | 49 |
3 files changed, 56 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml index 3205fa9..4df8ce7 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -9,8 +9,11 @@ addons: | |||
9 | packages: | 9 | packages: |
10 | - gcc-mingw-w64 | 10 | - gcc-mingw-w64 |
11 | - wine | 11 | - wine |
12 | - cmake | ||
13 | |||
14 | env: | ||
15 | - ci_buildsys=cmake | ||
16 | - ci_buildsys=Makefile | ||
12 | 17 | ||
13 | script: | 18 | script: |
14 | - ./configure --enable-shared --enable-static --enable-wine --cross-prefix=${CC%-*}- | 19 | - ci_target=${CC%-*} ./tools/ci-build.sh |
15 | - make | ||
16 | - make test | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c6fe4c..ec52939 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -6,7 +6,7 @@ endif () | |||
6 | 6 | ||
7 | project (dlfcn-win32 C) | 7 | project (dlfcn-win32 C) |
8 | 8 | ||
9 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") | 9 | list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules") |
10 | include(Macros) | 10 | include(Macros) |
11 | 11 | ||
12 | option(BUILD_SHARED_LIBS "shared/static libs" ON) | 12 | option(BUILD_SHARED_LIBS "shared/static libs" ON) |
diff --git a/tools/ci-build.sh b/tools/ci-build.sh new file mode 100755 index 0000000..a7d79b1 --- /dev/null +++ b/tools/ci-build.sh | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | set -euo pipefail | ||
4 | set -x | ||
5 | |||
6 | # ci_buildsys: | ||
7 | # Build system under test: Makefile or cmake | ||
8 | : "${ci_buildsys:=cmake}" | ||
9 | |||
10 | # ci_target: | ||
11 | # target to build for | ||
12 | : "${ci_target:=${CROSS_COMPILE%-}}" | ||
13 | |||
14 | install_prefix=$(${ci_target}-gcc --print-sysroot)/${ci_target} | ||
15 | |||
16 | case "$ci_buildsys" in | ||
17 | (Makefile) | ||
18 | ./configure --enable-shared --enable-static --enable-wine --cross-prefix=${ci_target}- | ||
19 | make | ||
20 | make test | ||
21 | ;; | ||
22 | |||
23 | (cmake) | ||
24 | cmake --version | ||
25 | rm -rf build | ||
26 | mkdir build | ||
27 | cd build | ||
28 | cmake \ | ||
29 | --no-warn-unused-cli \ | ||
30 | -DCMAKE_FIND_ROOT_PATH=$install_prefix \ | ||
31 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
32 | -DCMAKE_C_COMPILER=$(which ${ci_target}-gcc) \ | ||
33 | -DCMAKE_SYSTEM_PROCESSOR=${ci_target%-*-*} \ | ||
34 | -DCMAKE_CROSSCOMPILING=TRUE \ | ||
35 | -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ | ||
36 | -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ | ||
37 | -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY \ | ||
38 | -DCMAKE_SYSTEM_NAME=Windows \ | ||
39 | -DBUILD_TESTS=1 \ | ||
40 | -DENABLE_WINE=ON \ | ||
41 | -DWINE_EXECUTABLE=/usr/bin/wine \ | ||
42 | .. | ||
43 | make | ||
44 | ctest --output-on-failure | ||
45 | make install DESTDIR=$(pwd)/DESTDIR | ||
46 | ;; | ||
47 | esac | ||
48 | |||
49 | # vim:set sw=4 sts=4 et: | ||