diff Resources/CMake/OrthancStoneConfiguration.cmake @ 749:f3a7092ed10e

fix wasm build
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 May 2019 16:15:24 +0200
parents ab236bb5dbc7
children 4a3b96630e6c
line wrap: on
line diff
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Wed May 22 14:46:26 2019 +0200
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Wed May 22 16:15:24 2019 +0200
@@ -65,6 +65,7 @@
     message(FATAL_ERROR "WebAssembly target requires the emscripten compiler")    
   endif()
 
+  set(ENABLE_THREADS OFF)
   add_definitions(-DORTHANC_ENABLE_WASM=1)
 else()
   if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR
@@ -74,6 +75,7 @@
     message(FATAL_ERROR "Trying to use a Web compiler for a native build")
   endif()
 
+  set(ENABLE_THREADS ON)
   add_definitions(-DORTHANC_ENABLE_WASM=0)
 endif()
   
@@ -109,7 +111,6 @@
   message("SDL is enabled")
   include(${CMAKE_CURRENT_LIST_DIR}/SdlConfiguration.cmake)
   add_definitions(
-    -DORTHANC_ENABLE_THREADS=1
     -DORTHANC_ENABLE_QT=0
     -DORTHANC_ENABLE_SDL=1
     )
@@ -117,7 +118,6 @@
   message("QT is enabled")
   include(${CMAKE_CURRENT_LIST_DIR}/QtConfiguration.cmake)
   add_definitions(
-    -DORTHANC_ENABLE_THREADS=1
     -DORTHANC_ENABLE_QT=1
     -DORTHANC_ENABLE_SDL=0
     )
@@ -127,11 +127,17 @@
   add_definitions(
     -DORTHANC_ENABLE_SDL=0
     -DORTHANC_ENABLE_QT=0
-    -DORTHANC_ENABLE_THREADS=0
     )
 endif()
 
 
+if (ENABLE_THREADS)
+  add_definitions(-DORTHANC_ENABLE_THREADS=1)
+else()
+  add_definitions(-DORTHANC_ENABLE_THREADS=0)
+endif()
+
+
 if (ENABLE_OPENGL AND CMAKE_SYSTEM_NAME STREQUAL "Windows")
   include(${CMAKE_CURRENT_LIST_DIR}/GlewConfiguration.cmake)
   add_definitions(
@@ -356,6 +362,13 @@
 endif()
 
 
+if (ENABLE_THREADS)
+  list(APPEND ORTHANC_STONE_SOURCES
+    ${ORTHANC_STONE_ROOT}/Framework/Oracle/ThreadedOracle.cpp
+    )
+endif()
+
+
 list(APPEND ORTHANC_STONE_SOURCES
   #${ORTHANC_STONE_ROOT}/Framework/Layers/SeriesFrameRendererFactory.cpp
   #${ORTHANC_STONE_ROOT}/Framework/Layers/SingleFrameRendererFactory.cpp
@@ -433,7 +446,6 @@
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/GetOrthancWebViewerJpegCommand.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/OracleCommandWithPayload.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Oracle/OrthancRestApiCommand.cpp
-  ${ORTHANC_STONE_ROOT}/Framework/Oracle/ThreadedOracle.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Radiography/RadiographyAlphaLayer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Radiography/RadiographyDicomLayer.cpp
   ${ORTHANC_STONE_ROOT}/Framework/Radiography/RadiographyLayer.cpp