Skip to content

Commit 02d7aee

Browse files
Unix
1 parent 999278a commit 02d7aee

File tree

2 files changed

+19
-26
lines changed

2 files changed

+19
-26
lines changed

eng/native/gen-buildsys.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,26 @@ fi
9797
cmake_extra_defines_wasm=()
9898
if [[ "$host_arch" == "wasm" ]]; then
9999
if [[ "$target_os" == "browser" ]]; then
100+
if [[ -z "$EMSDK_PATH" ]]; then
101+
if [[ -d "$reporoot"/src/mono/browser/emsdk/ ]]; then
102+
export EMSDK_PATH="$reporoot"/src/mono/browser/emsdk/
103+
else
104+
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
105+
exit 1
106+
fi
107+
fi
108+
export EMSDK_QUIET=1 && source "$EMSDK_PATH"/emsdk_env.sh
100109
cmake_command="emcmake $cmake_command"
101110
elif [[ "$target_os" == "wasi" ]]; then
102-
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCLR_CMAKE_TARGET_ARCH=wasm" "-DWASI_SDK_PREFIX=$WASI_SDK_PATH" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_SYSROOT=${WASI_SDK_PATH}/share/wasi-sysroot" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
111+
if [[ -z "$WASI_SDK_PATH" ]]; then
112+
if [[ -d "$reporoot"/src/mono/wasi/wasi-sdk ]]; then
113+
export WASI_SDK_PATH="$reporoot"/src/mono/wasi/wasi-sdk
114+
else
115+
echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root."
116+
exit 1
117+
fi
118+
fi
119+
cmake_extra_defines_wasm=("-DCLR_CMAKE_TARGET_OS=wasi" "-DCLR_CMAKE_TARGET_ARCH=wasm" "-DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake" "-DCMAKE_CROSSCOMPILING_EMULATOR=node --experimental-wasm-bigint --experimental-wasi-unstable-preview1")
103120
else
104121
echo "target_os was not specified"
105122
exit 1

src/native/libs/build-native.sh

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,7 @@ __usePThreads=0
5353
source "$__RepoRootDir"/eng/native/build-commons.sh
5454

5555
# Set cross build
56-
if [[ "$__TargetOS" == browser ]]; then
57-
if [[ -z "$EMSDK_PATH" ]]; then
58-
if [[ -d "$__RepoRootDir"/src/mono/browser/emsdk/ ]]; then
59-
export EMSDK_PATH="$__RepoRootDir"/src/mono/browser/emsdk/
60-
else
61-
echo "Error: You need to set the EMSDK_PATH environment variable pointing to the emscripten SDK root."
62-
exit 1
63-
fi
64-
fi
65-
source "$EMSDK_PATH"/emsdk_env.sh
66-
export CLR_CC=$(which emcc)
67-
elif [[ "$__TargetOS" == wasi ]]; then
68-
if [[ -z "$WASI_SDK_PATH" ]]; then
69-
if [[ -d "$__RepoRootDir"/src/mono/wasi/wasi-sdk ]]; then
70-
export WASI_SDK_PATH="$__RepoRootDir"/src/mono/wasi/wasi-sdk
71-
else
72-
echo "Error: You need to set the WASI_SDK_PATH environment variable pointing to the WASI SDK root."
73-
exit 1
74-
fi
75-
fi
76-
export WASI_SDK_PATH="${WASI_SDK_PATH%/}/"
77-
export CLR_CC="$WASI_SDK_PATH"bin/clang
78-
export TARGET_BUILD_ARCH=wasm
79-
__CMakeArgs="-DCLR_CMAKE_TARGET_OS=wasi -DCLR_CMAKE_TARGET_ARCH=wasm -DWASI_SDK_PREFIX=$WASI_SDK_PATH -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p2.cmake $__CMakeArgs"
80-
elif [[ "$__TargetOS" == ios || "$__TargetOS" == iossimulator ]]; then
56+
if [[ "$__TargetOS" == browser || "$__TargetOS" == wasi || "$__TargetOS" == ios || "$__TargetOS" == iossimulator ]]; then
8157
# nothing to do here
8258
true
8359
elif [[ "$__TargetOS" == tvos || "$__TargetOS" == tvossimulator ]]; then

0 commit comments

Comments
 (0)