Mercurial > hg > orthanc-stone
diff 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 |
line wrap: on
line diff
--- a/Applications/Samples/CMakeLists.txt Fri Dec 28 10:40:34 2018 +0100 +++ b/Applications/Samples/CMakeLists.txt Wed Jan 16 16:24:45 2019 +0100 @@ -1,9 +1,19 @@ -# Usage (Linux): -# to build the WASM samples -# 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 -# to build the Qt samples +# Usage: see README file cmake_minimum_required(VERSION 2.8.3) + +# Automatically link Qt executables to qtmain target on Windows +# ("OLD" == do not link) +if(POLICY CMP0020) + cmake_policy(SET CMP0020 OLD) +endif() + +# Only interpret if() arguments as variables or keywords when unquoted. +# NEW = do NOT dereference *quoted* variables +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() + project(OrthancStone) include(../../Resources/CMake/OrthancStoneParameters.cmake) @@ -14,6 +24,8 @@ set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application") set(ENABLE_WASM OFF CACHE BOOL "Target WASM application") +# TODO: replace or compute STONE_SOURCES_DIR from CMAKE_CURRENT_LIST_FILE + if (ENABLE_WASM) ##################################################################### ## Configuration of the Emscripten compiler for WebAssembly target @@ -65,15 +77,14 @@ set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"") set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"") - ##################################################################### ## Build a static library containing the Orthanc Stone framework ##################################################################### - LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options) include(../../Resources/CMake/OrthancStoneConfiguration.cmake) +include(../../Resources/CMake/FlatBuffersConfiguration.cmake) add_library(OrthancStone STATIC ${ORTHANC_STONE_SOURCES} @@ -132,6 +143,16 @@ ) set_target_properties(${Target} PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=${Sample}) target_link_libraries(${Target} OrthancStone) + + if (ENABLE_QT AND (CMAKE_SYSTEM_NAME STREQUAL "Windows")) + message("(ENABLE_QT and (CMAKE_SYSTEM_NAME matches \"Windows\")) is true") + add_custom_command( + TARGET ${Target} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Core> $<TARGET_FILE_DIR:${Target}> + COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Widgets> $<TARGET_FILE_DIR:${Target}> + COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:Qt5::Gui> $<TARGET_FILE_DIR:${Target}> + ) + endif() endmacro() #BuildSingleFileSample(OrthancStoneEmpty EmptyApplication.h 1) @@ -148,6 +169,12 @@ if (ENABLE_QT OR ENABLE_WASM) + GenerateCodeFromFlatBufferSchema("${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/ApplicationCommands.fbs") + + list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${FLATC_AUTOGENERATED_SOURCES}) + message(STATUS "SIMPLE_VIEWER_APPLICATION_SOURCES = ${SIMPLE_VIEWER_APPLICATION_SOURCES}") + message(STATUS "FLATC_AUTOGENERATED_SOURCES = ${FLATC_AUTOGENERATED_SOURCES}") + if (ENABLE_QT) list(APPEND SIMPLE_VIEWER_APPLICATION_SOURCES ${ORTHANC_STONE_ROOT}/Applications/Samples/SimpleViewer/Qt/SimpleViewerMainWindow.cpp