Skip to content

Commit 2c80958

Browse files
committed
[workflows] Add build script option to allow customization
This patch adds the -x option which lets the user specify additional CMake options when configuring classic-flang-llvm-project.
1 parent 6f0748e commit 2c80958

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

build-llvm-project.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ USE_SUDO="0"
1111
C_COMPILER_PATH="/usr/bin/gcc"
1212
CXX_COMPILER_PATH="/usr/bin/g++"
1313
LLVM_ENABLE_PROJECTS="clang;openmp"
14+
EXTRA_CMAKE_OPTS=""
1415
VERBOSE=""
1516

1617
set -e # Exit script on first error.
@@ -37,21 +38,24 @@ function print_usage {
3738
echo " -a C compiler path. Default: /usr/bin/gcc";
3839
echo " -b C++ compiler path. Default: /usr/bin/g++";
3940
echo " -e List of the LLVM sub-projects to build. Default: clang;openmp";
41+
echo " -x Extra CMake options. Default: ''";
4042
echo " -v Enable verbose output";
4143
}
42-
while getopts "t:d:p:n:c?i?s?a:b:e:v" opt; do
44+
45+
while getopts "t:d:p:n:cisa:b:e:x:v?" opt; do
4346
case "$opt" in
44-
t) TARGET=$OPTARG;;
45-
d) BUILD_TYPE=$OPTARG;;
46-
p) INSTALL_PREFIX=$OPTARG;;
47-
n) NPROC=$OPTARG;;
48-
c) USE_CCACHE="1";;
49-
i) DO_INSTALL="1";;
50-
s) USE_SUDO="1";;
51-
a) C_COMPILER_PATH=$OPTARG;;
52-
b) CXX_COMPILER_PATH=$OPTARG;;
53-
e) LLVM_ENABLE_PROJECTS=$OPTARG;;
54-
v) VERBOSE="1";;
47+
t) TARGET=$OPTARG;;
48+
d) BUILD_TYPE=$OPTARG;;
49+
p) INSTALL_PREFIX=$OPTARG;;
50+
n) NPROC=$OPTARG;;
51+
c) USE_CCACHE="1";;
52+
i) DO_INSTALL="1";;
53+
s) USE_SUDO="1";;
54+
a) C_COMPILER_PATH=$OPTARG;;
55+
b) CXX_COMPILER_PATH=$OPTARG;;
56+
e) LLVM_ENABLE_PROJECTS=$OPTARG;;
57+
x) EXTRA_CMAKE_OPTS="$OPTARG";;
58+
v) VERBOSE="1";;
5559
?) print_usage; exit 0;;
5660
esac
5761
done
@@ -73,6 +77,10 @@ if [ $USE_CCACHE == "1" ]; then
7377
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
7478
fi
7579

80+
if [ -n "$EXTRA_CMAKE_OPTS" ]; then
81+
CMAKE_OPTIONS="$CMAKE_OPTIONS $EXTRA_CMAKE_OPTS"
82+
fi
83+
7684
# Build and install
7785
mkdir -p build && cd build
7886
if [ -n "$VERBOSE" ]; then

0 commit comments

Comments
 (0)