Skip to content
Open
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
8 changes: 7 additions & 1 deletion packages/openjphjs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/openjph/CMakeLists.txt")
endif()

if(EMSCRIPTEN)
option(OJPH_DISABLE_INTEL_SIMD "Disables the use of SIMD instructions and associated files" ON)
# OpenJPH 0.30.1 builds WASM SIMD by default (OJPH_DISABLE_SIMD=OFF) and emits
# -msimd128 + the *_wasm.cpp kernels. Do NOT set the deprecated
# OJPH_DISABLE_INTEL_SIMD: 0.30.1 bridges it onto OJPH_DISABLE_SIMD
# (extern/openjph/CMakeLists.txt), so the old "=ON" — which used to mean
# "skip Intel SIMD, use the WASM path" — now disables ALL SIMD and ships a
# ~2x-slower scalar wasm. Keep SIMD explicitly enabled.
set(OJPH_DISABLE_SIMD OFF CACHE BOOL "Enable OpenJPH WASM SIMD" FORCE)
endif()

option(BUILD_SHARED_LIBS "" OFF)
Expand Down
7 changes: 5 additions & 2 deletions packages/openjphjs/build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/sh
mkdir -p build
mkdir -p dist
(cd build && CXXFLAGS=-msimd128 emcmake cmake -DCMAKE_BUILD_TYPE=Debug ..)
#(cd build && CXXFLAGS=-msimd128 emcmake cmake ..)
(cd build && CXXFLAGS=-msimd128 emcmake cmake -DCMAKE_BUILD_TYPE=Release ..)
# NOTE: this shipped a Debug (-O0) wasm until now, which left the SIMD kernels
# unoptimized (SIMD intrinsics not inlined) — making decode/encode far slower
# and the binary far larger than they should be. Release (-O3) is the correct
# artifact for a published codec.
(cd build && emmake make VERBOSE=1 -j ${nprocs})
cp ./build/src/openjphjs.js ./dist
cp ./build/src/openjphjs.wasm ./dist
Expand Down
2 changes: 1 addition & 1 deletion packages/openjphjs/extern/openjph
Submodule openjph updated 117 files
12 changes: 11 additions & 1 deletion packages/openjphjs/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@

add_executable(openjphjs jslib.cpp)

target_link_libraries(openjphjs PRIVATE openjphsimd)
# OpenJPH 0.30.1 builds a single `openjph` library (SIMD is folded in,
# architecture-agnostic); the old separate `openjphsimd` target no longer
# exists. Upstream's own wasm wrapper links `openjph` too.
target_link_libraries(openjphjs PRIVATE openjph)
# OpenJPH 0.30.1 moved its public headers under src/core/openjph (and
# src/core/shared); older releases exposed them on a flatter include path, so
# our bare `#include <ojph_arch.h>` no longer resolves via the linked target
# alone. Add the 0.30.1 header roots explicitly.
target_include_directories(openjphjs PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../extern/openjph/src/core/openjph
${CMAKE_CURRENT_SOURCE_DIR}/../extern/openjph/src/core/shared)
target_compile_options(openjphjs PRIVATE -DOJPH_ENABLE_WASM_SIMD -msimd128)
target_compile_features(openjphjs PUBLIC cxx_std_11)
set_target_properties(
Expand Down
Loading