-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathbld
executable file
·109 lines (85 loc) · 3.24 KB
/
bld
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
#!/usr/bin/env bash
# A script to build and install the C++ library
set -eu -o pipefail
# parse arguments
# -------------------------------------------------------------------
arg() { echo "$1" | sed "s/^${2-[^=]*=}//" | sed "s/:/;/g"; }
build="Release"
prefix=""
tiledb=""
cmake_verbose="false"
no_tiledb_deprecated="false"
werror="false"
while test $# != 0; do
case "$1" in
--build=*) build=$(arg "$1");;
--prefix=*) prefix=$(arg "$1");;
--tiledb=*) tiledb=$(arg "$1");;
--cmake-verbose=*) cmake_verbose=$(arg "$1");;
--no-tiledb-deprecated=*) no_tiledb_deprecated=$(arg "$1");;
--werror=*) werror=$(arg "$1");;
esac
shift
done
# find number of cpus
# -------------------------------------------------------------------
if [ "$(uname)" == "Darwin" ]; then
nproc=$(sysctl -n hw.ncpu)
else
nproc=$(nproc)
fi
# set extra cmake options
# -------------------------------------------------------------------
extra_opts=""
if [ "${build}" != "Release" ] && [ -z "${tiledb}" ]; then
# Debug build of TileDB from source
extra_opts+=" -DDOWNLOAD_TILEDB_PREBUILT=OFF"
fi
if [ "$(uname -m)" == "aarch64" ]; then
# build TileDB from source on arm
extra_opts+=" -DDOWNLOAD_TILEDB_PREBUILT=OFF"
fi
# NOTE: set to true to debug the cmake build
if [ "$cmake_verbose" = "true" ]; then
# This is _incredibly_ helpful in that it reveals the actual compile lines etc which make itself
# shows by default but which cmake-driven make hides by default. Use this for any non-trivial
# cmake debugging.
extra_opts+=" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
# TILEDB_WERROR=OFF is necessary to build core with XCode 14; doesn't hurt for XCode 13.
extra_opts+=" -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DTILEDB_WERROR=OFF -DTILEDBSOMA_ENABLE_WERROR=OFF"
# Debug cmake find commands
extra_opts+=" --debug-find"
# Also (pro-tip), set nproc=1 to get a more deterministic ordering of output lines.
nproc=1
elif [ "$werror" = "true" ]; then
extra_opts+=" -DTILEDBSOMA_ENABLE_WERROR=ON"
fi
if [ "$no_tiledb_deprecated" = "true" ]; then
extra_opts+=" -DTILEDB_REMOVE_DEPRECATIONS=ON"
fi
# set installation path
if [ -n "${prefix}" ]; then
extra_opts+=" -DCMAKE_INSTALL_PREFIX=${prefix} -DOVERRIDE_INSTALL_PREFIX=OFF"
else
extra_opts+=" -DOVERRIDE_INSTALL_PREFIX=ON"
fi
# build with custom tiledb
if [ -n "${tiledb}" ]; then
echo "Build with TileDB: $tiledb"
extra_opts+=" -DFORCE_BUILD_TILEDB=OFF"
export TileDB_DIR="${tiledb}"
export LD_LIBRARY_PATH="${tiledb}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export DYLD_LIBRARY_PATH="${tiledb}${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
fi
# run cmake
# -------------------------------------------------------------------
echo "Building ${build} build"
# cd to the top level directory of the repo
cd "$(dirname "$0")/.."
rm -rf build
mkdir -p build
if [ -z ${TILEDBSOMA_COVERAGE+x} ]; then TILEDBSOMA_COVERAGE=""; fi
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake -B build -S libtiledbsoma -DCMAKE_BUILD_TYPE=${build} ${extra_opts}
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build -j ${nproc}
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build --target install-libtiledbsoma
TILEDBSOMA_COVERAGE="${TILEDBSOMA_COVERAGE}" cmake --build build/libtiledbsoma --target build_tests -j ${nproc}