Skip to content

Commit

Permalink
Updated build_script to take in custom cmake arguement
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbourelly999 committed Dec 18, 2024
1 parent cd07e54 commit b67b60b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scripts/build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ help()
echo "h Print this Help."
echo "p Generate a Debian package using CPack."
echo "s Suffix to append to version for Debian packaging."
echo "D Pass CMake options to build command (e.i -DBUILD_TESTS=ON)"
echo
}

Expand All @@ -23,7 +24,7 @@ GENERATE_COVERAGE=0
GENERATE_DEBIAN_PACKAGE=0

# Get the options
while getopts "cdhps:" option; do
while getopts "cdhpsD:" option; do
case $option in
c) # generate coverage report
GENERATE_COVERAGE=1
Expand All @@ -37,6 +38,9 @@ while getopts "cdhps:" option; do
s) # Debian package version suffix
PACKAGE_VERSION_SUFFIX="-DPACKAGE_VERSION_SUFFIX=${OPTARG}"
;;
D) # Pass CMake options
cmake_options+=("-D$OPTARG")
;;
h) # display Help
help
exit;;
Expand All @@ -58,7 +62,7 @@ if [ $GENERATE_COVERAGE -eq 1 ]; then
COVERAGE_FLAGS=-DGENERATE_COVERAGE=True
fi

cmake -B${BUILD_DIR} ${TOOLCHAIN_ARG} -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${PACKAGE_VERSION_SUFFIX} ${COVERAGE_FLAGS}
cmake -B${BUILD_DIR} ${TOOLCHAIN_ARG} -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" ${PACKAGE_VERSION_SUFFIX} ${COVERAGE_FLAGS} "${cmake_options[@]}"
cd ${BUILD_DIR}
cmake --build .
if [ $GENERATE_DEBIAN_PACKAGE -eq 1 ]; then
Expand Down

0 comments on commit b67b60b

Please sign in to comment.