Skip to content

Commit 91926d7

Browse files
authored
fix: Build the emscripten bindings with EXPORT_ES6=1 (#106)
1 parent 7792714 commit 91926d7

File tree

7 files changed

+15
-9
lines changed

7 files changed

+15
-9
lines changed

.devcontainer/emscripten_dev/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM emscripten/emsdk:3.1.42
22

33
RUN apt-get update && apt-get install -y \
4+
bash-completion \
45
ninja-build \
56
wget \
67
unzip

.devcontainer/emscripten_dev/devcontainer.json

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"cmake.configureArgs": [
2020
"-DCMAKE_TOOLCHAIN_FILE=/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake",
2121
"-DFLATBUFFERS_FLATC_EXECUTABLE=/usr/bin/flatc",
22+
"-DCMAKE_BUILD_TYPE=MinSizeRel",
2223
"-DKWGEN_EXECUTABLE=/usr/bin/kwgen"
2324
],
2425
"cmake.buildDirectory": "${workspaceFolder}/build.em",

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ jobs:
7575
- name: Test
7676
working-directory: packages/cxx-frontend/examples
7777
run: |
78-
node dump.mjs
78+
for i in *.mjs; do
79+
node dump.mjs
80+
done
7981
8082
- name: Upload artifacts
8183
uses: actions/upload-artifact@v3

packages/cxx-frontend/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
"keywords": [
1818
"c++",
1919
"compiler",
20+
"lexer",
2021
"parser",
22+
"preprocessor",
2123
"syntax"
2224
],
2325
"author": {

scripts/build-emscripten.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ project_root=$(cd "$me/.." && pwd)
88

99
CMAKE_CONFIGURE_OPTIONS="
1010
-DCMAKE_INSTALL_PREFIX=build.em/install/usr \
11-
-DCMAKE_BUILD_TYPE=MinSizeRel \
12-
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=1 \
13-
-DKWGEN_EXECUTABLE=/usr/bin/kwgen \
14-
-DFLATBUFFERS_FLATC_EXECUTABLE=/usr/bin/flatc"
11+
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-MinSizeRel} \
12+
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=${CMAKE_INTERPROCEDURAL_OPTIMIZATION:-1} \
13+
-DKWGEN_EXECUTABLE=${KWGEN_EXECUTABLE:-/usr/bin/kwgen} \
14+
-DFLATBUFFERS_FLATC_EXECUTABLE=${FLATBUFFERS_FLATC_EXECUTABLE:-/usr/bin/flatc}"
1515

1616
if [ ! -z "${CODESPACES}" ] && [ ! -z "${EMSDK}" ]; then
17-
cmake -G Ninja ${CMAKE_CONFIGURE_OPTIONS} -S ${project_root} -B ${project_root}/build.em
17+
if [ ! -d "${project_root}/build.em" ]; then
18+
cmake -G Ninja ${CMAKE_CONFIGURE_OPTIONS} -S ${project_root} -B ${project_root}/build.em
19+
fi
1820
cmake --build $project_root/build.em
1921
exit 0
2022
fi

src/js/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ target_link_libraries(cxx-js cxx-parser)
3030
target_link_options(cxx-js PUBLIC
3131
"SHELL:--bind"
3232
"SHELL:-s ENVIRONMENT=web"
33+
"SHELL:-s EXPORT_ES6=1"
3334
"SHELL:-s WASM_ASYNC_COMPILATION=1"
3435
"SHELL:-s MODULARIZE=1"
3536
"SHELL:-s MALLOC=emmalloc"
3637
"SHELL:-s ALLOW_MEMORY_GROWTH=1"
3738
"SHELL:-s FILESYSTEM=0"
3839
"SHELL:-s NO_DYNAMIC_EXECUTION=1"
3940
"SHELL:-s WASM_BIGINT=1"
40-
"SHELL:--extern-post-js ${CMAKE_CURRENT_SOURCE_DIR}/cxx/suffix.js"
4141
)
4242

src/js/cxx/suffix.js

-2
This file was deleted.

0 commit comments

Comments
 (0)