Skip to content

Commit 6869da8

Browse files
authored
Change -Oz -flto solution to be cmake configure
1 parent de7101c commit 6869da8

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

.github/workflows/emscripten.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ jobs:
194194
-DLLVM_ENABLE_LIBPFM=OFF \
195195
-DCLANG_BUILD_TOOLS=OFF \
196196
-DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
197+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" \
198+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" \
199+
-DLLVM_ENABLE_LTO=Full \
197200
../llvm
198-
EMCC_CFLAGS="-Oz -flto" emmake ninja clang cling lld gtest_main
201+
emmake ninja clang cling lld gtest_main
199202
else
200203
# Apply patches
201204
llvm_vers=$(echo "${{ matrix.clang-runtime }}" | tr '[:lower:]' '[:upper:]')
@@ -225,8 +228,11 @@ jobs:
225228
-DCLANG_BUILD_TOOLS=OFF \
226229
-G Ninja \
227230
-DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
231+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" \
232+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" \
233+
-DLLVM_ENABLE_LTO=Full \
228234
../llvm
229-
EMCC_CFLAGS="-Oz -flto" emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
235+
emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
230236
fi
231237
cd ../
232238
rm -rf $(find . -maxdepth 1 ! -name "build" ! -name "llvm" ! -name "clang" ! -name ".")
@@ -295,8 +301,10 @@ jobs:
295301
-DLLVM_BUILD_TOOLS=OFF `
296302
-DLLVM_ENABLE_LIBPFM=OFF `
297303
-DCLANG_BUILD_TOOLS=OFF `
304+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" `
305+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" `
306+
-DLLVM_ENABLE_LTO=Full `
298307
..\llvm
299-
$env:EMCC_CFLAGS="-Oz -flto"
300308
emmake make clang cling lld gtest_main
301309
}
302310
else
@@ -336,9 +344,11 @@ jobs:
336344
-DLLVM_BUILD_TOOLS=OFF `
337345
-DLLVM_ENABLE_LIBPFM=OFF `
338346
-DCLANG_BUILD_TOOLS=OFF `
347+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" `
348+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" `
349+
-DLLVM_ENABLE_LTO=Full `
339350
-G Ninja `
340351
..\llvm
341-
$env:EMCC_CFLAGS="-Oz -flto"
342352
emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
343353
}
344354
cd ..\

Emscripten-build-instructions.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ emcmake cmake -DCMAKE_BUILD_TYPE=Release \
9999
-DLLVM_ENABLE_LIBPFM=OFF \
100100
-DCLANG_BUILD_TOOLS=OFF \
101101
-DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
102+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" \
103+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" \
104+
-DLLVM_ENABLE_LTO=Full \
102105
../llvm
103-
EMCC_CFLAGS="-Oz -flto" emmake make libclang -j $(nproc --all)
104-
EMCC_CFLAGS="-Oz -flto" emmake make clangInterpreter clangStaticAnalyzerCore -j $(nproc --all)
105-
EMCC_CFLAGS="-Oz -flto" emmake make lldWasm -j $(nproc --all)
106+
emmake make libclang -j $(nproc --all)
107+
emmake make clangInterpreter clangStaticAnalyzerCore -j $(nproc --all)
108+
emmake make lldWasm -j $(nproc --all)
106109
```
107110

108111
or executing
@@ -130,10 +133,11 @@ emcmake cmake -DCMAKE_BUILD_TYPE=Release `
130133
-DLLVM_ENABLE_LIBPFM=OFF `
131134
-DCLANG_BUILD_TOOLS=OFF `
132135
-G Ninja `
136+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" `
137+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" `
138+
-DLLVM_ENABLE_LTO=Full `
133139
..\llvm
134-
$env:EMCC_CFLAGS="-Oz -flto"
135140
emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
136-
$env:EMCC_CFLAGS=""
137141
```
138142

139143
on Windows. Once this finishes building we need to take note of where we built our llvm build. This can be done by executing the following on Linux and osx

docs/Emscripten-build-instructions.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,13 @@ and osx
119119
-DLLVM_ENABLE_LIBPFM=OFF \
120120
-DCLANG_BUILD_TOOLS=OFF \
121121
-DLLVM_NATIVE_TOOL_DIR=$NATIVE_DIR \
122+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" \
123+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" \
124+
-DLLVM_ENABLE_LTO=Full \
122125
../llvm
123-
EMCC_CFLAGS="-Oz -flto" emmake make libclang -j $(nproc --all)
124-
EMCC_CFLAGS="-Oz -flto" emmake make clangInterpreter clangStaticAnalyzerCore -j $(nproc --all)
125-
EMCC_CFLAGS="-Oz -flto" emmake make lldWasm -j $(nproc --all)
126+
emmake make libclang -j $(nproc --all)
127+
emmake make clangInterpreter clangStaticAnalyzerCore -j $(nproc --all)
128+
emmake make lldWasm -j $(nproc --all)
126129
127130
or executing
128131

@@ -150,10 +153,11 @@ or executing
150153
-DLLVM_ENABLE_LIBPFM=OFF `
151154
-DCLANG_BUILD_TOOLS=OFF `
152155
-G Ninja `
156+
-DCMAKE_C_FLAGS_RELEASE="-Oz -g0" `
157+
-DCMAKE_CXX_FLAGS_RELEASE="-Oz -g0" `
158+
-DLLVM_ENABLE_LTO=Full `
153159
..\llvm
154-
$env:EMCC_CFLAGS="-Oz -flto"
155160
emmake ninja libclang clangInterpreter clangStaticAnalyzerCore lldWasm
156-
$env:EMCC_CFLAGS=""
157161
158162
on Windows. Once this finishes building we need to take note of where we built our llvm build.
159163
This can be done by executing the following on Linux and osx

0 commit comments

Comments
 (0)