@@ -22,6 +22,18 @@ if [[ ${SKIP_3RDPARTY} -eq 1 ]]; then
22
22
exit 0
23
23
fi
24
24
25
+ usage () {
26
+ echo " Usage: $0 [-o BUILD_OPENDAL] [-t BUILD_TYPE] [-h]"
27
+ echo " -o BUILD_OPENDAL Enable/disable OpenDAL build (ON/OFF, default: OFF)"
28
+ echo " -t BUILD_TYPE Set build type (Debug/Release/RelWithDebInfo/MinSizeRel, default: Release)"
29
+ echo " -h Show this help message"
30
+ echo " "
31
+ echo " Examples:"
32
+ echo " $0 # Build with default settings (Release, OpenDAL OFF)"
33
+ echo " $0 -t Debug # Build in Debug mode"
34
+ echo " $0 -o ON -t RelWithDebInfo # Build with OpenDAL enabled and RelWithDebInfo"
35
+ }
36
+
25
37
SOURCE=" ${BASH_SOURCE[0]} "
26
38
while [ -h " $SOURCE " ]; do # resolve $SOURCE until the file is no longer a symlink
27
39
DIR=" $( cd -P " $( dirname " $SOURCE " ) " && pwd ) "
@@ -30,14 +42,37 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
30
42
done
31
43
32
44
BUILD_OPENDAL=" OFF"
33
- while getopts " o:" arg; do
45
+ BUILD_TYPE=" Release"
46
+ while getopts " o:t:h" arg; do
34
47
case $arg in
35
48
o)
36
49
BUILD_OPENDAL=$OPTARG
37
50
;;
51
+ t)
52
+ BUILD_TYPE=$OPTARG
53
+ ;;
54
+ h)
55
+ usage
56
+ exit 0
57
+ ;;
58
+ * )
59
+ usage
60
+ exit 1
61
+ ;;
38
62
esac
39
63
done
40
64
65
+ # Validate build type
66
+ case " ${BUILD_TYPE} " in
67
+ Debug|Release)
68
+ echo " Build type: ${BUILD_TYPE} "
69
+ ;;
70
+ * )
71
+ echo " Invalid build type: ${BUILD_TYPE} . Valid options are: Debug, Release"
72
+ exit 1
73
+ ;;
74
+ esac
75
+
41
76
ROOT_DIR=" $( cd -P " $( dirname " $SOURCE " ) /.." && pwd ) "
42
77
CPP_SRC_DIR=" ${ROOT_DIR} /internal/core"
43
78
BUILD_OUTPUT_DIR=" ${ROOT_DIR} /cmake_build"
63
98
unameOut=" $( uname -s) "
64
99
case " ${unameOut} " in
65
100
Darwin* )
66
- conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s compiler=clang -s compiler.version=${llvm_version} -s compiler.libcxx=libc++ -s compiler.cppstd=17 -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
101
+ conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s build_type= ${BUILD_TYPE} -s compiler=clang -s compiler.version=${llvm_version} -s compiler.libcxx=libc++ -s compiler.cppstd=17 -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
67
102
;;
68
103
Linux* )
69
104
if [ -f /etc/os-release ]; then
@@ -75,9 +110,9 @@ case "${unameOut}" in
75
110
export CPU_TARGET=avx
76
111
GCC_VERSION=` gcc -dumpversion`
77
112
if [[ ` gcc -v 2>&1 | sed -n ' s/.*\(--with-default-libstdcxx-abi\)=\(\w*\).*/\2/p' ` == " gcc4" ]]; then
78
- conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s compiler.version=${GCC_VERSION} -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
113
+ conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s build_type= ${BUILD_TYPE} -s compiler.version=${GCC_VERSION} -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
79
114
else
80
- conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s compiler.version=${GCC_VERSION} -s compiler.libcxx=libstdc++11 -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
115
+ conan install ${CPP_SRC_DIR} --install-folder conan --build=missing -s build_type= ${BUILD_TYPE} -s compiler.version=${GCC_VERSION} -s compiler.libcxx=libstdc++11 -r default-conan-local -u || { echo ' conan install failed' ; exit 1; }
81
116
fi
82
117
;;
83
118
* )
0 commit comments