Mercurial > hg > orthanc
changeset 2515:7c8a246e8652
fix WebAssembly build
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Mar 2018 10:08:06 +0200 |
parents | 38d666a40860 |
children | 48db5c1fcbf3 |
files | Resources/CMake/BoostConfiguration.cmake Resources/CMake/DcmtkConfiguration.cmake |
diffstat | 2 files changed, 37 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/Resources/CMake/BoostConfiguration.cmake Thu Mar 29 08:55:32 2018 +0200 +++ b/Resources/CMake/BoostConfiguration.cmake Thu Mar 29 10:08:06 2018 +0200 @@ -145,6 +145,7 @@ ) elseif (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") + # No support for threads in WebAssembly else() message(FATAL_ERROR "Support your platform here")
--- a/Resources/CMake/DcmtkConfiguration.cmake Thu Mar 29 08:55:32 2018 +0200 +++ b/Resources/CMake/DcmtkConfiguration.cmake Thu Mar 29 10:08:06 2018 +0200 @@ -100,33 +100,16 @@ message("The patches for DCMTK have already been applied") endif() + IF (CMAKE_CROSSCOMPILING) if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_SYSTEM_NAME STREQUAL "Windows") # MinGW SET(C_CHAR_UNSIGNED 1 CACHE INTERNAL "Whether char is unsigned.") elseif(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or asm.js - # Check out "../WebAssembly/arith.h" - UNSET(SIZEOF_VOID_P CACHE) - UNSET(SIZEOF_CHAR CACHE) - UNSET(SIZEOF_DOUBLE CACHE) - UNSET(SIZEOF_FLOAT CACHE) - UNSET(SIZEOF_INT CACHE) - UNSET(SIZEOF_LONG CACHE) - UNSET(SIZEOF_SHORT CACHE) - UNSET(SIZEOF_VOID_P CACHE) - UNSET(C_CHAR_UNSIGNED CACHE) - SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") - SET(SIZEOF_CHAR 1 CACHE INTERNAL "") - SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") - SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") - SET(SIZEOF_INT 4 CACHE INTERNAL "") - SET(SIZEOF_LONG 4 CACHE INTERNAL "") - SET(SIZEOF_SHORT 2 CACHE INTERNAL "") - SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") - SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") - + # Check out "../WebAssembly/ArithmeticTests/" to regenerate the + # "arith.h" file configure_file( ${ORTHANC_ROOT}/Resources/WebAssembly/arith.h ${DCMTK_SOURCES_DIR}/config/include/dcmtk/config/arith.h @@ -158,6 +141,35 @@ include(${DCMTK_SOURCES_DIR}/CMake/CheckFunctionWithHeaderExists.cmake) include(${DCMTK_SOURCES_DIR}/CMake/GenerateDCMTKConfigure.cmake) + + if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten") # WebAssembly or + # asm.js The macros below are not properly discovered by DCMTK + # when using WebAssembly. Check out "../WebAssembly/arith.h" for + # how we produced these values. This step MUST be after + # "GenerateDCMTKConfigure" and before the generation of + # "osconfig.h". + UNSET(SIZEOF_VOID_P CACHE) + UNSET(SIZEOF_CHAR CACHE) + UNSET(SIZEOF_DOUBLE CACHE) + UNSET(SIZEOF_FLOAT CACHE) + UNSET(SIZEOF_INT CACHE) + UNSET(SIZEOF_LONG CACHE) + UNSET(SIZEOF_SHORT CACHE) + UNSET(SIZEOF_VOID_P CACHE) + UNSET(C_CHAR_UNSIGNED CACHE) + + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + SET(SIZEOF_CHAR 1 CACHE INTERNAL "") + SET(SIZEOF_DOUBLE 8 CACHE INTERNAL "") + SET(SIZEOF_FLOAT 4 CACHE INTERNAL "") + SET(SIZEOF_INT 4 CACHE INTERNAL "") + SET(SIZEOF_LONG 4 CACHE INTERNAL "") + SET(SIZEOF_SHORT 2 CACHE INTERNAL "") + SET(SIZEOF_VOID_P 4 CACHE INTERNAL "") + SET(C_CHAR_UNSIGNED 0 CACHE INTERNAL "") + endif() + + set(DCMTK_PACKAGE_VERSION_SUFFIX "") set(DCMTK_PACKAGE_VERSION_NUMBER ${DCMTK_VERSION_NUMBER}) @@ -407,6 +419,10 @@ /usr/share/libdcmtk14 /usr/share/libdcmtk15 /usr/share/libdcmtk16 + /usr/share/libdcmtk17 + /usr/share/libdcmtk18 + /usr/share/libdcmtk19 + /usr/share/libdcmtk20 /usr/local/share/dcmtk )