Skip to content

Commit

Permalink
Merge pull request #713 from thewtex/toolchain-updates
Browse files Browse the repository at this point in the history
Toolchain updates
  • Loading branch information
thewtex authored Jan 17, 2023
2 parents 8890f30 + 358f42b commit 9dfa2b8
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if(EMSCRIPTEN)
# -s WASM_ASYNC_COMPILATION=0
# -flto
set(common_link_flags " -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM=1 -s MODULARIZE=1 -s WASM=1 -lnodefs.js -s EXIT_RUNTIME=0 -s INVOKE_RUN=1 --post-js ${CMAKE_CURRENT_SOURCE_DIR}/emscripten-module/itkJSPost.js")
set(esm_link_flags " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0")
set(esm_link_flags " -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=1")
endif()

include(${CMAKE_CURRENT_SOURCE_DIR}/io/internal/pipelines/common/compress-stringify/BuildZstd.cmake)
Expand Down
7 changes: 0 additions & 7 deletions src/core/internal/loadEmscriptenModuleNode.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import fs from 'fs'
// Workaround for EXPORT_ES6
// https://github.com/emscripten-core/emscripten/issues/11792
import { dirname } from 'path'
import { createRequire } from 'module'

import EmscriptenModule from '../ITKWASMEmscriptenModule.js'
globalThis.__dirname = dirname(import.meta.url)
globalThis.require = createRequire(import.meta.url)

async function loadEmscriptenModuleNode (modulePath: string): Promise<EmscriptenModule> {
let modulePrefix = modulePath
Expand Down
6 changes: 3 additions & 3 deletions src/docker/itk-wasm-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_IMAGE=dockcross/web-wasm
FROM $BASE_IMAGE:20220705-d45d925
FROM $BASE_IMAGE:20230114-98aebd0
ARG BASE_IMAGE

LABEL maintainer="Matt McCormick <[email protected]>"
Expand All @@ -17,11 +17,11 @@ RUN git clone https://github.com/KitwareMedical/ITK.git && \
/ITK/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmopenjpeg/src/lib/openjp2/CMakeLists.txt

# Modify CMake variable to use patched DCMTK library
# GIT_TAG refers to DCMTK branch: 20220802_DCMTK_PATCHES_FOR_ITK-wasm
# GIT_TAG refers to DCMTK branch: 20230115_DCMTK_PATCHES_FOR_ITK-wasm
RUN sed -i -e '/^set(DCMTK_GIT_REPOSITORY/c\set(DCMTK_GIT_REPOSITORY "https://github.com/InsightSoftwareConsortium/DCMTK.git")' \
/ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake

RUN sed -i -e '/^set(DCMTK_GIT_TAG/c\set(DCMTK_GIT_TAG "2136aff6b9c32ae1a5c0bf6bc458c70043bdcd6f")' \
RUN sed -i -e '/^set(DCMTK_GIT_TAG/c\set(DCMTK_GIT_TAG "8e088dfdfdcd6ba29ea9aa0f5f18f3728086ba55")' \
/ITK/Modules/ThirdParty/DCMTK/DCMTKGitTag.cmake

ARG CMAKE_BUILD_TYPE=Release
Expand Down
6 changes: 3 additions & 3 deletions src/docker/itk-wasm/ITKWebAssemblyInterface.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ function(add_executable target)
kebab_to_camel(${target} targetCamel)
get_property(_link_flags TARGET ${target} PROPERTY LINK_FLAGS)
set(common_link_flags " -s FORCE_FILESYSTEM=1 -s EXPORTED_RUNTIME_METHODS='[\"callMain\",\"cwrap\",\"ccall\",\"writeArrayToMemory\",\"writeAsciiToMemory\",\"AsciiToString\"]' -flto -s ALLOW_MEMORY_GROWTH=1 -s WASM=1 -lnodefs.js -s WASM_ASYNC_COMPILATION=1 -s EXPORT_NAME=${targetCamel} -s MODULARIZE=1 -s EXIT_RUNTIME=0 -s INVOKE_RUN=0 --pre-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPipelinePre.js --post-js /ITKWebAssemblyInterface/src/emscripten-module/itkJSPost.js -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s EXPORTED_FUNCTIONS='[\"_main\"]' ${_link_flags}")
set_property(TARGET ${wasm_target} PROPERTY LINK_FLAGS "${common_link_flags} -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0")
set_property(TARGET ${wasm_target} PROPERTY LINK_FLAGS "${common_link_flags} -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=1")
set_property(TARGET ${umd_target} PROPERTY LINK_FLAGS "${common_link_flags}")

get_property(_link_flags_debug TARGET ${target} PROPERTY LINK_FLAGS_DEBUG)
set_property(TARGET ${wasm_target} PROPERTY LINK_FLAGS_DEBUG " -fno-lto -s SAFE_HEAP=1 -s DISABLE_EXCEPTION_CATCHING=0 --bind ${_link_flags_debug}")
set_property(TARGET ${umd_target} PROPERTY LINK_FLAGS_DEBUG " -fno-lto -s SAFE_HEAP=1 -s DISABLE_EXCEPTION_CATCHING=0 --bind ${_link_flags_debug}")
set_property(TARGET ${wasm_target} PROPERTY LINK_FLAGS_DEBUG " -s EXPORT_EXCEPTION_HANDLING_HELPERS=1 -fno-lto -s SAFE_HEAP=1 -s DISABLE_EXCEPTION_CATCHING=0 -lembind ${_link_flags_debug}")
set_property(TARGET ${umd_target} PROPERTY LINK_FLAGS_DEBUG " -s EXPORT_EXCEPTION_HANDLING_HELPERS=1 -fno-lto -s SAFE_HEAP=1 -s DISABLE_EXCEPTION_CATCHING=0 -lembind ${_link_flags_debug}")
else()
# WASI
set_property(TARGET ${wasm_target} PROPERTY SUFFIX ".wasi.wasm")
Expand Down
2 changes: 1 addition & 1 deletion src/itk-wasm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Command, Option } from 'commander/esm.mjs'
const program = new Command()


const defaultImageTag = '20221222-d37dad3f'
const defaultImageTag = '20230116-fcc852e2'

// Array of types that will require an import from itk-wasm
const typesRequireImport = ['Image']
Expand Down

0 comments on commit 9dfa2b8

Please sign in to comment.