Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: CI
on:

workflow_dispatch:
pull_request:
push:
branches:
- main
- main

schedule:
- cron: '0 2 * * *' # run at 2 AM UTC
Expand All @@ -17,8 +16,7 @@ jobs:

strategy:
fail-fast: false
matrix:
emsdk_ver: ["3.1.45"]


steps:
- uses: actions/checkout@v4
Expand All @@ -32,31 +30,20 @@ jobs:
environment-file: environment-wasm-build.yml
environment-name: xeus-javascript-wasm-build

################################################################
# emsdk itself
################################################################
- name: Setup emsdk
shell: bash -l {0}
run: |

emsdk install ${{ matrix.emsdk_ver }}

################################################################
# C++ build
################################################################
- name: Build
shell: bash -l {0}
run: |

emsdk activate ${{ matrix.emsdk_ver }}

source $CONDA_EMSDK_DIR/emsdk_env.sh
micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32

micromamba create -f environment-wasm-host.yml --platform=emscripten-wasm32 --yes

mkdir build
pushd build

export EMPACK_PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-javascript-wasm-build
export PREFIX=$MAMBA_ROOT_PREFIX/envs/xeus-javascript-wasm-host
export CMAKE_PREFIX_PATH=$PREFIX
export CMAKE_SYSTEM_PREFIX_PATH=$PREFIX
Expand Down Expand Up @@ -97,7 +84,7 @@ jobs:
# upload to github pages
################################################################
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: _output

Expand Down Expand Up @@ -126,4 +113,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v3 # or specific "vX.X.X" version tag for this action
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#The full license is in the file LICENSE, distributed with this software.
#############################################################################

cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 4.0.0)
project(xeus-javascript)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")

Expand Down Expand Up @@ -57,7 +57,7 @@ if(EMSCRIPTEN)
SET(XEUS_JAVASCRIPT_BUILD_STATIC ON)
SET(XEUS_JAVASCRIPT_BUILD_SHARED OFF)
SET(XEUS_JAVASCRIPT_BUILD_EXECUTABLE OFF)
SET(XEUS_JAVASCRIPT_USE_SHARED_XEUS OFF)
SET(XEUS_JAVASCRIPT_USE_SHARED_XEUS ON)
SET(XEUS_JAVASCRIPT_USE_SHARED_XEUS_JAVASCRIPT OFF)
SET(XEUS_JAVASCRIPT_BUILD_TESTS OFF)
endif()
Expand Down Expand Up @@ -261,17 +261,28 @@ if (XEUS_JAVASCRIPT_BUILD_STATIC)
list(APPEND XEUS_JAVASCRIPT_TARGETS xeus-javascript-static)
endif ()

target_link_options(xeus-javascript-static
PUBLIC "SHELL: -s WASM_BIGINT=1"
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
)

include(WasmBuildOptions)

add_executable(xjavascript src/main_emscripten_kernel.cpp )
target_compile_options(xjavascript PRIVATE -fPIC)
target_compile_options(xjavascript
PRIVATE "-fPIC"
PUBLIC "SHELL: -s WASM_BIGINT=1"
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
)
XEUS_JAVASCRIPT_set_kernel_options(xjavascript)
xeus_wasm_compile_options(xjavascript)
xeus_wasm_link_options(xjavascript "web,worker")

#
target_link_options(xjavascript
PUBLIC "SHELL: -s WASM_BIGINT=1"
PUBLIC "SHELL: -s ALLOW_MEMORY_GROWTH=1"
PUBLIC "SHELL: -s MAIN_MODULE=1"
PUBLIC "SHELL: -s NO_EXIT_RUNTIME=1"
PUBLIC "SHELL: -s FORCE_FILESYSTEM=1"
PUBLIC "SHELL: --pre-js ${CMAKE_CURRENT_SOURCE_DIR}/src/pre.js"
Expand Down
6 changes: 4 additions & 2 deletions environment-wasm-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: xeus-javascript-wasm-build
channels:
- https://repo.prefix.dev/emscripten-forge-dev
- conda-forge
dependencies:
- cmake
- pkg-config
- emscripten_emscripten-wasm32==3.1.73
- anywidget
- cmake
- emsdk >=3.1.46
- empack >=3.2.0
- jupyter_server # to enable contents
- jupyterlite-core
- jupyterlite-xeus
Expand Down
6 changes: 3 additions & 3 deletions environment-wasm-host.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: xeus-javascript-wasm-host
channels:
- https://repo.mamba.pm/emscripten-forge
- https://repo.prefix.dev/emscripten-forge-dev
- https://repo.mamba.pm/conda-forge
dependencies:
- nlohmann_json
- xeus-lite >=3.0.0,<4.0
- xeus >=5.0.0,<6.0
- xeus-lite >= 4.0.0
- xeus >= 2.4.0
12 changes: 8 additions & 4 deletions src/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,12 @@ Module._complete_request = _complete_request;
Module.FS = FS;
Module.ijs = ijs;

if (!('wasmTable' in Module)) {
Module['wasmTable'] = wasmTable
}

// function get_comm_manager(){
// return Module._com_manager;
// }
// Module.get_comm_manager = get_comm_manager;
Module['FS'] = FS
Module['PATH'] = PATH
Module['LDSO'] = LDSO
Module['getDylinkMetadata'] = getDylinkMetadata
Module['loadDynamicLibrary'] = loadDynamicLibrary