Skip to content

Commit 8616e0c

Browse files
author
Jianchun Xu
committed
xplat: support disabling experimental features
Enable disabling experimental features in parallel of msbuild support. ``` build.sh --without=Simdjs ``` Translates to `-DCOMPILE_DISABLE_Simdjs=1`. Note: - Experimental feature name is case sensitive.
1 parent 4756731 commit 8616e0c

2 files changed

Lines changed: 26 additions & 4 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
2121
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
2222
add_definitions(
2323
-DPLATFORM_UNIX
24-
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
24+
-DU_DISABLE_RENAMING=1 #in case we link against to an older binary of icu
2525
)
2626

2727
set(CLR_CMAKE_PLATFORM_UNIX 1)
@@ -84,7 +84,7 @@ if(CLR_CMAKE_PLATFORM_UNIX)
8484
)
8585

8686
# todo: fix general visibility of the interface
87-
# do not set to `fvisibility=hidden` as it is going to
87+
# do not set to `fvisibility=hidden` as it is going to
8888
# prevent the required interface is being exported
8989
# clang by default sets fvisibility=default
9090

@@ -139,7 +139,7 @@ endif()
139139
-fno-optimize-sibling-calls\
140140
-mno-omit-leaf-frame-pointer" # this is for compat reasons. i.e. It is a noop with gcc
141141
)
142-
142+
143143
# CXX / CC COMPILER FLAGS
144144
add_compile_options(
145145
-fms-extensions
@@ -177,6 +177,10 @@ if(CLR_CMAKE_PLATFORM_UNIX)
177177
add_definitions(-DFEATURE_PAL)
178178
endif(CLR_CMAKE_PLATFORM_UNIX)
179179

180+
if(WITHOUT_FEATURES)
181+
add_definitions(${WITHOUT_FEATURES})
182+
endif(WITHOUT_FEATURES)
183+
180184
enable_language(ASM)
181185

182186
include_directories(

build.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ PRINT_USAGE() {
3131
echo " -t, --test-build Test build (by default Release build)"
3232
echo " --static Build as static library (by default shared library)"
3333
echo " -v, --verbose Display verbose output including all options"
34+
echo " --without=FEATURE,FEATURE,..."
35+
echo " Disable FEATUREs from JSRT experimental"
36+
echo " features."
3437
echo ""
3538
echo "example:"
3639
echo " ./build.sh --cxx=/path/to/clang++ --cc=/path/to/clang -j"
@@ -49,6 +52,7 @@ MAKE=make
4952
MULTICORE_BUILD=""
5053
ICU_PATH=""
5154
STATIC_LIBRARY=""
55+
WITHOUT_FEATURES=""
5256

5357
while [[ $# -gt 0 ]]; do
5458
case "$1" in
@@ -116,6 +120,20 @@ while [[ $# -gt 0 ]]; do
116120
STATIC_LIBRARY="-DSTATIC_LIBRARY=1"
117121
;;
118122

123+
--without=*)
124+
FEATURES=$1
125+
FEATURES=${FEATURES:10} # value after --without=
126+
for x in ${FEATURES//,/ } # replace comma with space then split
127+
do
128+
if [[ "$WITHOUT_FEATURES" == "" ]]; then
129+
WITHOUT_FEATURES="-DWITHOUT_FEATURES="
130+
else
131+
WITHOUT_FEATURES="$WITHOUT_FEATURES;"
132+
fi
133+
WITHOUT_FEATURES="${WITHOUT_FEATURES}-DCOMPILE_DISABLE_${x}=1"
134+
done
135+
;;
136+
119137
*)
120138
echo "Unknown option $1"
121139
PRINT_USAGE
@@ -196,7 +214,7 @@ fi
196214
pushd $build_directory > /dev/null
197215

198216
echo Generating $BUILD_TYPE makefiles
199-
cmake $CMAKE_GEN $CC_PREFIX $ICU_PATH $STATIC_LIBRARY -DCMAKE_BUILD_TYPE=$BUILD_TYPE ../..
217+
cmake $CMAKE_GEN $CC_PREFIX $ICU_PATH $STATIC_LIBRARY -DCMAKE_BUILD_TYPE=$BUILD_TYPE $WITHOUT_FEATURES ../..
200218

201219
_RET=$?
202220
if [[ $? == 0 ]]; then

0 commit comments

Comments
 (0)