comparison Applications/Samples/CMakeLists.txt @ 445:ee41b6a017d7 bgo-commands-codegen

dumb change
author bgo-osimis
date Wed, 16 Jan 2019 16:24:45 +0100
parents 26b90b110719
children 5055031f4a06
comparison
equal deleted inserted replaced
440:a750f11892ec 445:ee41b6a017d7
1 # Usage (Linux): 1 # Usage: see README file
2 # to build the WASM samples
3 # source ~/Downloads/emsdk/emsdk_env.sh && cmake -DCMAKE_TOOLCHAIN_FILE=${EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake -DCMAKE_BUILD_TYPE=Release -DSTONE_SOURCES_DIR=$currentDir/../../../orthanc-stone -DORTHANC_FRAMEWORK_SOURCE=path -DORTHANC_FRAMEWORK_ROOT=$currentDir/../../../orthanc -DALLOW_DOWNLOADS=ON .. -DENABLE_WASM=ON
4 # to build the Qt samples
5 2
6 cmake_minimum_required(VERSION 2.8.3) 3 cmake_minimum_required(VERSION 2.8.3)
4
5 # Automatically link Qt executables to qtmain target on Windows
6 # ("OLD" == do not link)
7 if(POLICY CMP0020)
8 cmake_policy(SET CMP0020 OLD)
9 endif()
10
11 # Only interpret if() arguments as variables or keywords when unquoted.
12 # NEW = do NOT dereference *quoted* variables
13 if(POLICY CMP0054)
14 cmake_policy(SET CMP0054 NEW)
15 endif()
16
7 project(OrthancStone) 17 project(OrthancStone)
8 18
9 include(../../Resources/CMake/OrthancStoneParameters.cmake) 19 include(../../Resources/CMake/OrthancStoneParameters.cmake)
10 20
11 #set(ENABLE_DCMTK ON) 21 #set(ENABLE_DCMTK ON)
12 22
13 set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application") 23 set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application")
14 set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application") 24 set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application")
15 set(ENABLE_WASM OFF CACHE BOOL "Target WASM application") 25 set(ENABLE_WASM OFF CACHE BOOL "Target WASM application")
26
27 # TODO: replace or compute STONE_SOURCES_DIR from CMAKE_CURRENT_LIST_FILE
16 28
17 if (ENABLE_WASM) 29 if (ENABLE_WASM)
18 ##################################################################### 30 #####################################################################
19 ## Configuration of the Emscripten compiler for WebAssembly target 31 ## Configuration of the Emscripten compiler for WebAssembly target
20 ##################################################################### 32 #####################################################################
63 75
64 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")") 76 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
65 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") 77 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
66 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") 78 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
67 79
68
69 ##################################################################### 80 #####################################################################
70 ## Build a static library containing the Orthanc Stone framework 81 ## Build a static library containing the Orthanc Stone framework
71 ##################################################################### 82 #####################################################################
72 83
73
74 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) 84 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
75 85
76 include(../../Resources/CMake/OrthancStoneConfiguration.cmake) 86 include(../../Resources/CMake/OrthancStoneConfiguration.cmake)
87 include(../../Resources/CMake/FlatBuffersConfiguration.cmake)
77 88
78 add_library(OrthancStone STATIC 89 add_library(OrthancStone STATIC
79 ${ORTHANC_STONE_SOURCES} 90 ${ORTHANC_STONE_SOURCES}
80 ) 91 )
81 92
130 ${ORTHANC_STONE_ROOT}/Applications/Samples/${Header} 141 ${ORTHANC_STONE_ROOT}/Applications/Samples/${Header}
131 ${SAMPLE_APPLICATIONS_SOURCES} 142 ${SAMPLE_APPLICATIONS_SOURCES}
132 ) 143 )
133 set_target_properties(${Target} PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=${Sample}) 144 set_target_properties(${Target} PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=${Sample})
134 target_link_libraries(${Target} OrthancStone) 145 target_link_libraries(${Target} OrthancStone)
146
147 if (ENABLE_QT AND (CMAKE_SYSTEM_NAME STREQUAL "Windows"))
148 message("(ENABLE_QT and (CMAKE_SYSTEM_NAME matches \"Windows\")) is true")
149 add_custom_command(
150 TARGET ${Target} POST_BUILD
151 COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:${Target}>
152 COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:${Target}>
153 COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:${Target}>
154 )
155 endif()
135 endmacro() 156 endmacro()
136 157
137 #BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1) 158 #BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1)
138 #BuildSingleFileSample(OrthancStoneTestPattern TestPatternApplication.h 2) 159 #BuildSingleFileSample(OrthancStoneTestPattern TestPatternApplication.h 2)
139 BuildSingleFileSample(OrthancStoneSingleFrame SingleFrameApplication.h 3) 160 BuildSingleFileSample(OrthancStoneSingleFrame SingleFrameApplication.h 3)
146 167
147 ##### SimpleViewer sample (Qt and WASM only) ####### 168 ##### SimpleViewer sample (Qt and WASM only) #######
148 169
149 if (ENABLE_QT OR ENABLE_WASM) 170 if (ENABLE_QT OR ENABLE_WASM)
150 171
172 GenerateCodeFromFlatBufferSchema("${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/ApplicationCommands.fbs")
173
174 list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${FLATC_AUTOGENERATED_SOURCES})
175 message(STATUS "SIMPLE_VIEWER_APPLICATION_SOURCES = ${SIMPLE_VIEWER_APPLICATION_SOURCES}")
176 message(STATUS "FLATC_AUTOGENERATED_SOURCES = ${FLATC_AUTOGENERATED_SOURCES}")
177
151 if (ENABLE_QT) 178 if (ENABLE_QT)
152 list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES 179 list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES
153 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp 180 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp
154 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.ui 181 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.ui
155 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/mainQt.cpp 182 ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/mainQt.cpp