Skip to content

Commit 9d18aeb

Browse files
authored
4x (#112)
* 4x * 4x * 4x * 4x * 4x * build * trigger * empackl * empackl * wip * tests pass * tests pass * tests pass
1 parent 226e5b9 commit 9d18aeb

File tree

16 files changed

+292
-276
lines changed

16 files changed

+292
-276
lines changed

.github/workflows/docs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: docs
33
on:
44
workflow_dispatch:
55
push:
6-
pull_request:
6+
branches:
7+
- main
8+
# pull_request:
79

810

911
defaults:
@@ -38,7 +40,7 @@ jobs:
3840
environment-name: pyjs-wasm
3941
condarc: |
4042
channels:
41-
- https://repo.mamba.pm/emscripten-forge
43+
- https://repo.mamba.pm/emscripten-forge-4x
4244
- conda-forge
4345
4446
- name: build the docs

.github/workflows/main.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ jobs:
1919

2020
strategy:
2121
fail-fast: false
22-
matrix:
23-
include:
24-
- emsdk_ver: "3.1.73"
25-
python_version: "3.13"
26-
pybind11_version: "<3"
22+
2723
steps:
2824
- uses: actions/checkout@v2
2925

@@ -34,7 +30,7 @@ jobs:
3430
environment-name: pyjs-wasm
3531
condarc: |
3632
channels:
37-
- https://repo.prefix.dev/emscripten-forge-dev
33+
- https://repo.prefix.dev/emscripten-forge-4x
3834
- conda-forge
3935
4036
@@ -48,14 +44,14 @@ jobs:
4844
4945
micromamba create -n pyjs-build-wasm \
5046
--platform=emscripten-wasm32 \
51-
-c https://repo.prefix.dev/emscripten-forge-dev\
47+
-c https://repo.prefix.dev/emscripten-forge-4x \
5248
-c https://repo.mamba.pm/conda-forge \
5349
--yes \
54-
python=${{matrix.python_version}} \
55-
"pybind11${{matrix.pybind11_version}}" \
50+
"python=3.13" \
51+
"pybind11<3" \
5652
nlohmann_json pybind11_json numpy \
5753
pytest bzip2 sqlite zlib zstd libffi \
58-
exceptiongroup emscripten-abi==${{matrix.emsdk_ver}} \
54+
exceptiongroup emscripten-abi>=4 \
5955
openssl liblzma
6056
6157
@@ -87,10 +83,10 @@ jobs:
8783
micromamba activate pyjs-wasm
8884
micromamba create -n pyjs-build-wasm-with-numpy \
8985
--platform=emscripten-wasm32 \
90-
-c https://repo.prefix.dev/emscripten-forge-dev\
86+
-c https://repo.prefix.dev/emscripten-forge-4x \
9187
-c https://repo.mamba.pm/conda-forge \
9288
--yes \
93-
"python=${{matrix.python_version}}" pytest numpy exceptiongroup
89+
"python=3.13" pytest numpy exceptiongroup
9490
9591
9692
- name: Test in browser-main
@@ -100,7 +96,7 @@ jobs:
10096
browser-main \
10197
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm-with-numpy \
10298
--mount $(pwd)/tests:/tests \
103-
--mount $(pwd)/module/pyjs:/lib/python${{matrix.python_version}}/site-packages/pyjs \
99+
--mount $(pwd)/module/pyjs:/lib/python3.13/site-packages/pyjs \
104100
--script main.py \
105101
--work-dir /tests \
106102
--pyjs-dir $(pwd)/build \
@@ -116,7 +112,7 @@ jobs:
116112
browser-worker \
117113
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm-with-numpy \
118114
--mount $(pwd)/tests:/tests \
119-
--mount $(pwd)/module/pyjs:/lib/python${{matrix.python_version}}/site-packages/pyjs \
115+
--mount $(pwd)/module/pyjs:/lib/python3.13/site-packages/pyjs \
120116
--script main.py \
121117
--work-dir /tests \
122118
--pyjs-dir $(pwd)/build \
@@ -128,10 +124,10 @@ jobs:
128124
micromamba activate pyjs-wasm
129125
micromamba create -n pyjs-build-wasm-no-numpy \
130126
--platform=emscripten-wasm32 \
131-
-c https://repo.prefix.dev/emscripten-forge-dev\
127+
-c https://repo.prefix.dev/emscripten-forge-4x \
132128
-c https://repo.mamba.pm/conda-forge \
133129
--yes \
134-
"python=${{matrix.python_version}}" pytest exceptiongroup
130+
"python=3.13" pytest exceptiongroup
135131
136132
- name: Test in browser-main-no-numpy
137133
run: |
@@ -142,7 +138,7 @@ jobs:
142138
browser-main \
143139
--conda-env $MAMBA_ROOT_PREFIX/envs/pyjs-build-wasm-no-numpy \
144140
--mount $(pwd)/tests:/tests \
145-
--mount $(pwd)/module/pyjs:/lib/python${{matrix.python_version}}/site-packages/pyjs \
141+
--mount $(pwd)/module/pyjs:/lib/python3.13/site-packages/pyjs \
146142
--script main.py \
147143
--work-dir /tests \
148144
--pyjs-dir $(pwd)/build \

CMakeLists.txt

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ target_link_libraries(pyjs PRIVATE ${PYTHON_UTIL_LIBS} pybind11::embed)
115115

116116
target_compile_options(pyjs
117117
PUBLIC --std=c++17
118+
PUBLIC -msimd128
118119
PUBLIC -Wno-deprecated
119-
PUBLIC "SHELL: -fexceptions"
120+
PUBLIC "SHELL: -fwasm-exceptions"
120121
)
121122

122123
target_link_options(pyjs
123-
PRIVATE -lembind
124124
PUBLIC -Wno-unused-command-line-argument
125-
PUBLIC "SHELL: -fexceptions"
125+
PUBLIC "SHELL: -fwasm-exceptions"
126+
PUBLIC "SHELL: -lembind"
127+
# PUBLIC "SHELL: -fsanitize=address"
126128
#PUBLIC "SHELL:-s EXPORT_EXCEPTION_HANDLING_HELPERS"
127129
#PUBLIC "SHELL:-s EXCEPTION_CATCHING_ALLOWED=['we only want to allow exception handling in side modules']"
128130
)
@@ -198,44 +200,54 @@ target_link_libraries(pyjs_runtime_browser PRIVATE pyjs pybind11::embed ${PYTHO
198200
target_compile_options(pyjs_runtime_browser
199201
PUBLIC --std=c++17
200202
PUBLIC -Wno-deprecated
203+
PUBLIC -msimd128
201204
PUBLIC "SHELL: -s ENVIRONMENT=${ENVIRONMENT}"
202-
PUBLIC "SHELL: -fexceptions"
203-
#PUBLIC "SHELL:-s EXPORT_EXCEPTION_HANDLING_HELPERS"
205+
PUBLIC "SHELL: -fwasm-exceptions"
206+
PUBLIC "SHELL: -sSUPPORT_LONGJMP"
207+
PUBLIC "SHELL: -s EXPORT_EXCEPTION_HANDLING_HELPERS"
204208
PUBLIC "SHELL: -s FORCE_FILESYSTEM"
205-
PUBLIC "SHELL: -s LZ4=1"
206-
PUBLIC "SHELL: -flto"
207-
# PUBLIC "SHELL: -s WASM_BIGINT"
209+
PUBLIC "SHELL: -s EXPORT_ALL=1"
210+
# PUBLIC "SHELL: -flto"
211+
# PUBLIC "SHELL: -s MAXIMUM_MEMORY=2GB"
212+
# PUBLIC "SHELL: -fsanitize=address"
208213
)
209214

210215
target_link_options(pyjs_runtime_browser
211-
PRIVATE -lembind
212216
PUBLIC -Wno-unused-command-line-argument
213217
PUBLIC "SHELL: -s MODULARIZE=1"
214218
PUBLIC "SHELL: -s EXPORT_NAME=\"createModule\""
215-
PUBLIC "SHELL: -s EXPORT_ES6=0"
216-
PUBLIC "SHELL: -s USE_ES6_IMPORT_META=0"
217-
PUBLIC "SHELL: -s DEMANGLE_SUPPORT=0"
218-
PUBLIC "SHELL: -s ASSERTIONS=0"
219+
PUBLIC "SHELL: -s EXPORT_ALL=1"
220+
PUBLIC "SHELL: -s EXPORT_EXCEPTION_HANDLING_HELPERS"
221+
# PUBLIC "SHELL: -s EXPORT_ES6=0"
222+
# PUBLIC "SHELL: -s DEMANGLE_SUPPORT=0"
223+
# PUBLIC "SHELL: -s ASSERTIONS=0"
219224
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
220-
PUBLIC "SHELL: -s EXIT_RUNTIME=1"
221-
PUBLIC "SHELL: -s WASM=1"
225+
# PUBLIC "SHELL: -s EXIT_RUNTIME=1"
226+
PUBLIC "SHELL: -s INITIAL_MEMORY=20971520"
227+
PUBLIC "SHELL: -s MAXIMUM_MEMORY=4GB"
228+
# PUBLIC "SHELL: -s WASM=1"
222229
PUBLIC "SHELL: -s USE_PTHREADS=0"
223230
PUBLIC "SHELL: -s ENVIRONMENT=${ENVIRONMENT}"
224-
PUBLIC "SHELL: -fexceptions"
231+
PUBLIC "SHELL: -fwasm-exceptions"
232+
PUBLIC "SHELL: -sSUPPORT_LONGJMP"
225233
PUBLIC "SHELL: -s MAIN_MODULE=1"
226-
PUBLIC "SHELL: -s ENVIRONMENT=${ENVIRONMENT}"
227-
PUBLIC "SHELL: -s TOTAL_STACK=16mb"
228-
PUBLIC "SHELL: -s INITIAL_MEMORY=64mb"
234+
# PUBLIC "SHELL: -s MAXIMUM_MEMORY=2GB"
229235
PUBLIC "SHELL: -s FORCE_FILESYSTEM"
230-
PUBLIC "SHELL: -s LZ4=1"
231236
PUBLIC "SHELL: --post-js pyjs_post.js"
232237
PUBLIC "SHELL: --pre-js pyjs_pre.js"
233-
PUBLIC "SHELL: -flto"
234-
PUBLIC "SHELL: -lidbfs.js"
235-
PUBLIC "SHELL: -s WASM_BIGINT"
238+
# PUBLIC "SHELL: -flto"
239+
# PUBLIC "SHELL: -lidbfs.js"
240+
PUBLIC "SHELL: -lembind"
241+
# PUBLIC "SHELL: -fsanitize=address"
236242
)
237243

238244

245+
# target_link_options(pyjs_runtime_browser PRIVATE
246+
# "-sEXPORTED_FUNCTIONS=['_emscripten_dlopen_promise','_dlerror','FS']"
247+
# )
248+
249+
250+
239251
install(TARGETS pyjs_runtime_browser
240252
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib_js/pyjs)
241253
install(FILES

build_mkdocs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if [ ! -d "$WASM_ENV_PREFIX" ]; then
1818
echo "Creating wasm env $WASM_ENV_NAME"
1919
micromamba create -n $WASM_ENV_NAME \
2020
--platform=emscripten-wasm32 \
21-
-c https://repo.prefix.dev/emscripten-forge-dev\
21+
-c https://repo.prefix.dev/emscripten-forge-4x\
2222
-c https://repo.prefix.dev/conda-forge \
2323
--yes \
2424
python=$PYTHON_VERSION "pybind11<3" nlohmann_json pybind11_json numpy \

environment-dev.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: pyjs-wasm
22
channels:
33
- conda-forge
4-
- https://repo.prefix.dev/emscripten-forge-dev
4+
- https://repo.prefix.dev/emscripten-forge-4x
5+
56
dependencies:
67
- cmake
78
- pip
@@ -19,15 +20,15 @@ dependencies:
1920
- mkdocstrings
2021
- mkdocstrings-python
2122
- mkdocs-material
22-
- empack >=3.2.0
23+
- empack >=6.0.0
2324
- jupyter_server # to enable contents
2425
- jupyterlite
2526
- jupyterlite-xeus >= 3.1.8
2627
- jupyterlite-sphinx
2728
- notebook >=7,<8 # to include the extension to switch between JupyterLab and Notebook
2829
# pyjs_code_runner dev deps
2930
- hatchling
30-
- emscripten_emscripten-wasm32
31+
- emscripten_emscripten-wasm32 == 4.0.9
3132
- pip:
3233
- JLDracula
3334
- pyjs_code_runner >= 3.0

include/pyjs/post_js/fixes.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ Module['PATH'] = PATH
77
Module['LDSO'] = LDSO
88
Module['getDylinkMetadata'] = getDylinkMetadata
99
Module['loadDynamicLibrary'] = loadDynamicLibrary
10+
Module['getPromise'] = getPromise
11+
Module['promiseMap'] = promiseMap
12+
13+
Module['stackSave'] = stackSave
14+
Module['stackRestore'] = stackRestore
15+
Module['runtimeKeepalivePush'] = runtimeKeepalivePush
16+
Module['UTF8ToString'] = UTF8ToString
17+
Module['stringToUTF8OnStack'] = stringToUTF8OnStack

0 commit comments

Comments
 (0)