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
4 changes: 2 additions & 2 deletions .github/workflows/deploy-github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Github-page

steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
with:
fetch-depth: 0

Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
--XeusAddon.prefix=${{ env.PREFIX }} \
--XeusAddon.mounts=$PREFIX/share/octave:/share/octave \
--XeusAddon.mounts=$PREFIX/share/xeus-octave:/share/xeus-octave \
--XeusAddon.default_channels=https://repo.prefix.dev/emscripten-forge-dev \
--XeusAddon.default_channels=https://repo.prefix.dev/emscripten-forge-4x \
--XeusAddon.default_channels=https://repo.prefix.dev/conda-forge \
--contents notebooks/xeus-octave-wasm.ipynb \
--output-dir dist
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Install micromamba
uses: mamba-org/setup-micromamba@v2
with:
Expand All @@ -45,7 +45,7 @@ jobs:
static-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Install micromamba
uses: mamba-org/setup-micromamba@v2
with:
Expand All @@ -54,7 +54,7 @@ jobs:
cache-downloads: true
- name: Set PYTHON_HASH
run: echo "PYTHON_HASH=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: ~/.cache/pre-commit
key: precommit-v1-${{ env.PYTHON_HASH }}-${{ hashFiles('.pre-commit-config.yaml') }}
Expand All @@ -64,7 +64,7 @@ jobs:
test-doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- name: Install micromamba
uses: mamba-org/setup-micromamba@v2
with:
Expand Down
54 changes: 31 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,6 @@ set(
)
message(STATUS "Building xeus-octave v${${PROJECT_NAME}_VERSION}")

# Configuration
# =============

include(GNUInstallDirs)

if(NOT DEFINED XEUS_OCTAVE_KERNELSPEC_PATH)
set(XEUS_OCTAVE_KERNELSPEC_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/")
endif()

if(EMSCRIPTEN)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel_wasm.json.in"
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json"
)
else()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json.in"
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json"
)
endif()

# Build options
# =============

Expand Down Expand Up @@ -104,6 +83,32 @@ endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(octinterp REQUIRED IMPORTED_TARGET GLOBAL octinterp>=10.0)

# Configuration
# =============

include(GNUInstallDirs)

if(NOT DEFINED XEUS_OCTAVE_KERNELSPEC_PATH)
set(XEUS_OCTAVE_KERNELSPEC_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/")
endif()

if(EMSCRIPTEN)
# Requires version variable, octinterp_VERSION, set by Octave dependency
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel_wasm.json.in"
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json"
)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/wasm/env_vars.js.in"
"${CMAKE_CURRENT_SOURCE_DIR}/wasm/env_vars.js"
)
else()
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json.in"
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xoctave/kernel.json"
)
endif()

# Compiler flags
# ==============

Expand Down Expand Up @@ -267,9 +272,12 @@ macro(xeus_octave_create_target target_name linkage output_name)

if(EMSCRIPTEN)
include(WasmBuildOptions)
target_compile_options(${target_name} PRIVATE ${octinterp_CFLAGS})
xeus_wasm_compile_options(${target_name})
target_link_libraries(${target_name} PUBLIC xeus ${octinterp_STATIC_LIBRARIES})
target_link_libraries(
${target_name}
PUBLIC xeus PkgConfig::octinterp
PRIVATE FortranRuntime
)
else()
target_link_libraries(
${target_name}
Expand Down
4 changes: 2 additions & 2 deletions environment-wasm-build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: xeus-octave-wasm-build
channels:
- https://repo.prefix.dev/emscripten-forge-dev
- https://repo.prefix.dev/emscripten-forge-4x
- conda-forge
dependencies:
# Xeus-Octave
- cmake
- make
- pkg-config
- emscripten_emscripten-wasm32==3.1.73
- emscripten_emscripten-wasm32
# JupyterLite
- jupyterlite-core
- jupyter_server
Expand Down
6 changes: 4 additions & 2 deletions environment-wasm-host.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
name: xeus-octave-wasm-host
channels:
- https://repo.prefix.dev/emscripten-forge-dev
- https://repo.prefix.dev/emscripten-forge-4x
- conda-forge
dependencies:
- xeus
- xeus-lite
- nlohmann_json
- nlohmann_json-abi
- octave
- octave-fuzzy-logic-toolkit
- libpng
- zlib
- libflang
Expand All @@ -17,3 +16,6 @@ dependencies:
- liblapack
- freetype
- plotly
# Optional
- octave-fuzzy-logic-toolkit
- octave-splines
12 changes: 7 additions & 5 deletions share/jupyter/kernels/xoctave/kernel_wasm.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
],
"language": "Octave",
"metadata": {
"debugger": false,
"shared": {
"libxeus.so": "lib/libxeus.so",
"libz.so": "lib/libz.so"
}
"debugger": false,
"shared": {
"libxeus.so": "lib/libxeus.so",
"liboctinterp.so": "lib/octave/@octinterp_VERSION@/liboctinterp.so",
"liboctave.so": "lib/octave/@octinterp_VERSION@/liboctave.so",
"libz.so": "lib/libz.so"
}
}
}
12 changes: 5 additions & 7 deletions src/xinterpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,6 @@ void xoctave_interpreter::configure_impl()
// Initialize interpreter
m_octave_interpreter.execute();

#ifdef XEUS_OCTAVE_PKG_REBUILD
// Run pkg rebuild upon starting the kernel
std::string pkg_rebuild("pkg rebuild");
int status = 0;
m_octave_interpreter.eval_string(pkg_rebuild, true, status);
#endif

// Fix disp function and clear display function
m_octave_interpreter.get_symbol_table().install_built_in_function("display", octave_value());

Expand Down Expand Up @@ -493,6 +486,11 @@ void xoctave_interpreter::configure_impl()
m_octave_interpreter.get_symbol_table().install_built_in_function(
"XOCTAVE", new octave_builtin([](octave_value_list const&, int) { return ovl(XEUS_OCTAVE_VERSION); }, "XOCTAVE")
);

#ifdef XEUS_OCTAVE_PKG_REBUILD
// Rebuild package database
octave::feval("pkg", ovl("rebuild"));
#endif
}

namespace
Expand Down
10 changes: 0 additions & 10 deletions wasm/env_vars.js

This file was deleted.

10 changes: 10 additions & 0 deletions wasm/env_vars.js.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Module["onRuntimeInitialized"] = () => {
console.log("Octave is ready!");
}

Module["preRun"] = () => {
ENV["OCTAVE_HOME"] = "/";
ENV["OCTAVE_PATH"] = "/share/xeus-octave::/share/octave/site/m:/share/octave/site/m/startup:/share/octave/@octinterp_VERSION@/m:/share/octave/@octinterp_VERSION@/m/audio:/share/octave/@octinterp_VERSION@/m/deprecated:/share/octave/@octinterp_VERSION@/m/elfun:/share/octave/@octinterp_VERSION@/m/general:/share/octave/@octinterp_VERSION@/m/geometry:/share/octave/@octinterp_VERSION@/m/gui:/share/octave/@octinterp_VERSION@/m/help:/share/octave/@octinterp_VERSION@/m/image:/share/octave/@octinterp_VERSION@/m/io:/share/octave/@octinterp_VERSION@/m/legacy:/share/octave/@octinterp_VERSION@/m/linear-algebra:/share/octave/@octinterp_VERSION@/m/miscellaneous:/share/octave/@octinterp_VERSION@/m/ode:/share/octave/@octinterp_VERSION@/m/optimization:/share/octave/@octinterp_VERSION@/m/path:/share/octave/@octinterp_VERSION@/m/pkg:/share/octave/@octinterp_VERSION@/m/plot:/share/octave/@octinterp_VERSION@/m/plot/appearance:/share/octave/@octinterp_VERSION@/m/plot/draw:/share/octave/@octinterp_VERSION@/m/plot/util:/share/octave/@octinterp_VERSION@/m/polynomial:/share/octave/@octinterp_VERSION@/m/prefs:/share/octave/@octinterp_VERSION@/m/profiler:/share/octave/@octinterp_VERSION@/m/set:/share/octave/@octinterp_VERSION@/m/signal:/share/octave/@octinterp_VERSION@/m/sparse:/share/octave/@octinterp_VERSION@/m/specfun:/share/octave/@octinterp_VERSION@/m/special-matrix:/share/octave/@octinterp_VERSION@/m/startup:/share/octave/@octinterp_VERSION@/m/statistics:/share/octave/@octinterp_VERSION@/m/strings:/share/octave/@octinterp_VERSION@/m/testfun:/share/octave/@octinterp_VERSION@/m/time:/share/octave/@octinterp_VERSION@/m/web:/share/octave/@octinterp_VERSION@/data";
ENV["OCTAVE_BUILT_IN_DOCSTRINGS_FILE"] = "/share/octave/@octinterp_VERSION@/etc/built-in-docstrings";
ENV["OCTAVE_TEXI_MACROS_FILE"] = "/share/octave/@octinterp_VERSION@/etc/macros.texi";
};