3 # builds the marnav library and tests if it is usable as library in
6 export SCRIPT_BASE
=$
(dirname `readlink -f $0`)
7 export BASE
=${SCRIPT_BASE}/..
8 export BUILD
=${BASE}/build
10 # TODO: activate this code after upgrading to cmake version > 3.11
11 #if [ `which nproc` ] ; then
12 # export NUM_PROC_ARG="-j ${NUM_PROC:-$(nproc --all --ignore=2)}"
14 # num_proc=${NUM_PROC:-$(($(cat /proc/cpuinfo | grep -E "^processor" | wc -l) - 2))}
15 # if [ ${num_proc} -gt 0 ] ; then
16 # export NUM_PROC_ARG="-j ${num_proc}"
18 # export NUM_PROC_ARG="-j 1"
21 export NUM_PROC_ARG
=""
23 function prepare_dir
()
26 if [ -d ${dir} ] ; then
32 function build_library
()
36 builddir
=${BUILD}/build-marnav
38 mkdir
-p ${install_prefix}
39 mkdir
-p ${tarballs_install}
41 prepare_dir
${builddir}
44 -DCMAKE_INSTALL_PREFIX=${install_prefix} \
45 -DCMAKE_BUILD_TYPE=Release \
46 -DENABLE_EXAMPLES=OFF \
50 cmake
--build .
${NUM_PROC_ARG}
51 cmake
--build .
--target install
53 mv marnav-
*.
tar.gz
${tarballs_install}
57 function test_example_use_installation
()
60 builddir
=${BUILD}/build-example-installed
62 prepare_dir
${builddir}
65 -DCMAKE_BUILD_TYPE=Release \
66 -DCMAKE_PREFIX_PATH=${install_prefix} \
67 ${BASE}/examples
/library
68 cmake
--build .
${NUM_PROC_ARG}
73 function test_example_use_tarball
()
76 builddir
=${BUILD}/build-example-tarball
77 unpackdir
=${builddir}/marnav
79 prepare_dir
${builddir}
82 tar --strip-components=1 -xzf ${tarball} -C ${unpackdir}
84 -DCMAKE_BUILD_TYPE=Release \
85 -DCMAKE_PREFIX_PATH=${unpackdir} \
86 ${BASE}/examples
/library
87 cmake
--build .
${NUM_PROC_ARG}
92 function test_example_use_externalproject_import
()
94 builddir
=${BUILD}/build-example-externalproject
96 prepare_dir
${builddir}
99 -DCMAKE_BUILD_TYPE=Release \
100 -DMARNAV_SOURCE_DIR=${BASE} \
101 ${BASE}/examples
/subproject
102 cmake
--build .
${NUM_PROC_ARG}
107 function test_example_use_subdirectory
()
109 builddir
=${BUILD}/build-example-subdirectory
111 prepare_dir
${builddir}
114 -DCMAKE_BUILD_TYPE=Release \
115 -DMARNAV_SOURCE_DIR=${BASE} \
116 ${BASE}/examples
/subdirectory
117 cmake
--build .
${NUM_PROC_ARG}
123 build_library
${BUILD}/install ${BUILD}/tarballs
124 test_example_use_installation
${BUILD}/install
125 test_example_use_tarball
${BUILD}/tarballs
/marnav-
*.
tar.gz
126 test_example_use_externalproject_import
127 test_example_use_subdirectory