CI: Allow ci_build.sh to set a different C compiler.

This commit is contained in:
Jia Tan 2023-11-22 21:12:15 +08:00
parent ff7badef53
commit db2b4aa068
1 changed files with 10 additions and 1 deletions

View File

@ -23,6 +23,7 @@ USAGE="Usage: $0
-d [encoders|decoders|bcj|delta|threads|shared|nls|small|ifunc|clmul|sandbox] -d [encoders|decoders|bcj|delta|threads|shared|nls|small|ifunc|clmul|sandbox]
-f [CFLAGS] -f [CFLAGS]
-l [destdir] -l [destdir]
-m [compiler]
-n [ARTIFACTS_DIR_NAME] -n [ARTIFACTS_DIR_NAME]
-p [all|build|test] -p [all|build|test]
-s [srcdir]" -s [srcdir]"
@ -55,7 +56,7 @@ ARTIFACTS_DIR_NAME="output"
# Parse arguments # # Parse arguments #
################### ###################
while getopts a:b:c:d:l:n:s:p:f:h opt; do while getopts a:b:c:d:l:m:n:s:p:f:h opt; do
# b option can have either value "autotools" OR "cmake" # b option can have either value "autotools" OR "cmake"
case ${opt} in case ${opt} in
h) h)
@ -97,6 +98,10 @@ while getopts a:b:c:d:l:n:s:p:f:h opt; do
;; ;;
l) DEST_DIR="$OPTARG" l) DEST_DIR="$OPTARG"
;; ;;
m)
CC="$OPTARG"
export CC
;;
n) ARTIFACTS_DIR_NAME="$OPTARG" n) ARTIFACTS_DIR_NAME="$OPTARG"
;; ;;
s) SRC_DIR="$OPTARG" s) SRC_DIR="$OPTARG"
@ -237,6 +242,10 @@ then
add_extra_option "$SMALL" "-DHAVE_SMALL=ON" "" add_extra_option "$SMALL" "-DHAVE_SMALL=ON" ""
if test -n "$CC" ; then
EXTRA_OPTIONS="$EXTRA_OPTIONS -DCMAKE_C_COMPILER=$CC"
fi
# Remove old cache file to clear previous settings. # Remove old cache file to clear previous settings.
rm -f "CMakeCache.txt" rm -f "CMakeCache.txt"
cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR" $EXTRA_OPTIONS -DADDITIONAL_CHECK_TYPES="$CHECK_TYPE" -G "Unix Makefiles" cmake "$SRC_DIR/CMakeLists.txt" -B "$DEST_DIR" $EXTRA_OPTIONS -DADDITIONAL_CHECK_TYPES="$CHECK_TYPE" -G "Unix Makefiles"