-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAOT-LLVM] add support for building WASI and browser debug & release on Linux #2605
Changes from all commits
c548c19
3851fb9
2d11a40
252de09
956b5a2
d63c3a9
e6a2f60
e3d1d02
7cdb862
65eba09
7b9e291
6aa3cc2
a1ad87d
8bf20e9
ede31c0
918c041
07d7a43
2af3505
a5c8cc9
bd5aac5
589aed9
22f145b
67a40f1
199f246
7451bbb
41331b4
775b6ee
80695e0
186f8ca
7f5ed09
87552df
d4f0b94
04294da
21ac4f7
bc4e580
d5c980f
2234927
2142e30
87fdc26
35c9e1d
34371cf
eb95f4e
bd93b70
c234965
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -51,6 +51,23 @@ else | |||||||
git clone https://github.com/llvm/llvm-project --branch $LlvmProjectTag $DepthOption | ||||||||
} | ||||||||
|
||||||||
|
||||||||
# Set the compiler for CI on non-Windows | ||||||||
if (!$IsWindows) { | ||||||||
$RepoDir = Split-path $PSScriptRoot | Split-Path | Split-Path | ||||||||
|
||||||||
bash -c "build_arch=amd64 compiler=clang source $RepoDir/eng/common/native/init-compiler.sh && set | grep -e CC -e CXX -e LDFLAGS" | | ||||||||
ForEach-Object { | ||||||||
if ($CI) | ||||||||
{ | ||||||||
# Split the "<name>=<value>" line into the variable's name and value. | ||||||||
$name, $value = $_ -split '=', 2 | ||||||||
# Define it as a process-level environment variable in PowerShell. | ||||||||
Set-Content ENV:$name $value | ||||||||
} | ||||||||
} | ||||||||
} | ||||||||
|
||||||||
# There is no [C/c]hecked LLVM config, so change to Debug | ||||||||
foreach ($Config in $Configs | % { if ($_ -eq "Checked") { "Debug" } else { $_ } } | Select-Object -Unique) | ||||||||
{ | ||||||||
|
@@ -71,7 +88,7 @@ foreach ($Config in $Configs | % { if ($_ -eq "Checked") { "Debug" } else { $_ } | |||||||
$CmakeGenerator = "Unix Makefiles" | ||||||||
} | ||||||||
|
||||||||
$CmakeConfigureCommandLine = "-G", "$CmakeGenerator", "-DLLVM_INCLUDE_BENCHMARKS=OFF" | ||||||||
$CmakeConfigureCommandLine = "-G", "$CmakeGenerator", "-DLLVM_INCLUDE_BENCHMARKS=OFF", "-DLLVM_ENABLE_TERMINFO=0" | ||||||||
$CmakeConfigureCommandLine += "-S", $SourceDirName, "-B", $BuildDirPath | ||||||||
if ($Config -eq "Release") | ||||||||
{ | ||||||||
|
@@ -90,6 +107,11 @@ foreach ($Config in $Configs | % { if ($_ -eq "Checked") { "Debug" } else { $_ } | |||||||
} | ||||||||
} | ||||||||
$CmakeConfigureCommandLine += "-DCMAKE_BUILD_TYPE=$LlvmConfig" | ||||||||
|
||||||||
if (!$IsWindows) | ||||||||
{ | ||||||||
$CmakeConfigureCommandLine += "-DCMAKE_SYSROOT=/crossrootfs/x64", "-DCMAKE_INSTALL_PREFIX=/usr/local/llvm-cross" | ||||||||
} | ||||||||
|
||||||||
Write-Host "Invoking CMake configure: 'cmake $CmakeConfigureCommandLine'" | ||||||||
cmake @CmakeConfigureCommandLine | ||||||||
|
@@ -118,6 +140,8 @@ foreach ($Config in $Configs | % { if ($_ -eq "Checked") { "Debug" } else { $_ } | |||||||
if ($CI) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||||||||
{ | ||||||||
Write-Output "##vso[task.setvariable variable=$LlvmCmakeConfigEnvVarName]$LlvmCmakeConfigPath" | ||||||||
# We need LLVM_DIR for Linux | ||||||||
Write-Output "##vso[task.setvariable variable=LLVM_DIR]$LlvmCmakeConfigPath" | ||||||||
} | ||||||||
else | ||||||||
{ | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo '##vso[task.setvariable variable=EMSDK_PYTHON]'/usr/bin/python3 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
exename=$(basename "$1" .wasm) | ||
exename=$(basename "$exename" .dll) | ||
exename=$(basename "$exename" .js) | ||
dirname=$(dirname "$1") | ||
|
||
node="node --stack_trace_limit=100" | ||
WASM_HOST_ARGS_SEPERATOR="" | ||
|
||
if [ -e "${dirname}/${exename}.js" ]; then | ||
WASM_HOST_EXECUTABLE=$node | ||
WASM_BINARY_TO_EXECUTE="${dirname}/${exename}.js" | ||
elif [ -e "${dirname}/main.js" ]; then | ||
WASM_HOST_EXECUTABLE=$node | ||
WASM_BINARY_TO_EXECUTE="${dirname}/main.js" | ||
elif [ -e "${dirname}/${exename}.mjs" ]; then | ||
WASM_HOST_EXECUTABLE=$node | ||
WASM_BINARY_TO_EXECUTE="${dirname}/${exename}.mjs" | ||
elif [ -e "${dirname}/main.mjs" ]; then | ||
WASM_HOST_EXECUTABLE=$node | ||
WASM_BINARY_TO_EXECUTE="${dirname}/main.mjs" | ||
elif [ -e "${dirname}/${exename}.wasm" ]; then | ||
WASM_HOST_EXECUTABLE=$WASMTIME_EXECUTABLE | ||
WASM_HOST_ARGS_SEPERATOR="--" | ||
WASM_BINARY_TO_EXECUTE="${dirname}/${exename}.wasm" | ||
fi |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) | ||
|
||
source $SCRIPT_DIR/FindWasmHostExecutable.sh "$1" | ||
|
||
if [ -n "${WASM_HOST_EXECUTABLE}" ]; then | ||
shift | ||
echo $WASM_HOST_EXECUTABLE "$WASM_BINARY_TO_EXECUTE" $WASM_HOST_ARGS_SEPERATOR "$@" | ||
$WASM_HOST_EXECUTABLE "$WASM_BINARY_TO_EXECUTE" $WASM_HOST_ARGS_SEPERATOR "$@" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added log, thanks. |
||
else | ||
echo WASM_HOST_EXECUTABLE not set. | ||
exit 1 | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logging deleted intentionally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, thanks