view Platforms/Generic/CMakeLists.txt @ 284:38b0ac8055b9 am-2

Qt: catch and forward keyboard events
author am@osimis.io
date Tue, 28 Aug 2018 11:09:37 +0200
parents 829163c6efc1
children 3c190e2bb3af
line wrap: on
line source

cmake_minimum_required(VERSION 2.8)
project(OrthancStone)


#####################################################################
## Configuration for Orthanc
#####################################################################

include(../../Resources/CMake/Version.cmake)

if (ORTHANC_STONE_VERSION STREQUAL "mainline")
  set(ORTHANC_FRAMEWORK_VERSION "mainline")
  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
else()
  set(ORTHANC_FRAMEWORK_VERSION "1.3.2")
  set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
endif()

set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
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
#####################################################################

include(../../Resources/CMake/OrthancStoneParameters.cmake)

LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)

SET(ENABLE_SDL OFF)
SET(ENABLE_QT ON)
SET(ORTHANC_SANDBOXED OFF)
SET(ENABLE_CRYPTO_OPTIONS ON)
SET(ENABLE_GOOGLE_TEST ON)
SET(ENABLE_WEB_CLIENT ON)

include(../../Resources/CMake/OrthancStoneConfiguration.cmake)

add_library(OrthancStone STATIC
  ${ORTHANC_STONE_SOURCES}
  )


#####################################################################
## Build all the sample applications
#####################################################################

if (ENABLE_QT)
  list(APPEND APPLICATIONS_SOURCES
    ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.cpp
    ${ORTHANC_STONE_ROOT}/Applications/Samples/Qt/MainWindow.ui
    )
endif()

macro(BuildSample Target Header Sample)
  add_executable(${Target}
    ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleMainNative.cpp
    ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleInteractor.h
    ${ORTHANC_STONE_ROOT}/Applications/Samples/SampleApplicationBase.h
    ${ORTHANC_STONE_ROOT}/Applications/Samples/${Header}
    ${APPLICATIONS_SOURCES}
    )
  set_target_properties(${Target} PROPERTIES COMPILE_DEFINITIONS ORTHANC_STONE_SAMPLE=${Sample})
  target_link_libraries(${Target} OrthancStone)
endmacro()


# TODO - Re-enable all these samples!

#BuildSample(OrthancStoneEmpty EmptyApplication.h 1)
#BuildSample(OrthancStoneTestPattern TestPatternApplication.h 2)
#BuildSample(OrthancStoneSingleFrame SingleFrameApplication.h 3)
#BuildSample(OrthancStoneSingleVolume SingleVolumeApplication.h 4)
##BuildSample(OrthancStoneBasicPetCtFusion 5)
##BuildSample(OrthancStoneSynchronizedSeries 6)
##BuildSample(OrthancStoneLayoutPetCtFusion 7)
BuildSample(OrthancStoneSimpleViewer SimpleViewerApplication.h 8)


#####################################################################
## Build the unit tests
#####################################################################

add_executable(UnitTests
  ${GOOGLE_TEST_SOURCES}
  ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp
  ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
  )

target_link_libraries(UnitTests OrthancStone)


#####################################################################
## Generate the documentation if Doxygen is present
#####################################################################

find_package(Doxygen)
if (DOXYGEN_FOUND)
  configure_file(
    ${ORTHANC_STONE_ROOT}/Resources/OrthancStone.doxygen
    ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
    @ONLY)

  add_custom_target(doc
    ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
    COMMENT "Generating documentation with Doxygen" VERBATIM
    )
else()
  message("Doxygen not found. The documentation will not be built.")
endif()