comparison UnitTestsSources/CMakeLists.txt @ 1366:c4b0b4badae6 broker

unit test sources
author Benjamin Golinvaux <bgo@osimis.io>
date Sat, 18 Apr 2020 14:36:59 +0200
parents
children 1c2d065ba372
comparison
equal deleted inserted replaced
1365:c7d98d750224 1366:c4b0b4badae6
1 cmake_minimum_required(VERSION 2.8.3)
2 project(OrthancStone)
3
4 include(../Resources/CMake/OrthancStoneParameters.cmake)
5
6 set(ENABLE_STONE_DEPRECATED ON) # Need deprecated classes for these samples
7
8 if (OPENSSL_NO_CAPIENG)
9 add_definitions(-DOPENSSL_NO_CAPIENG=1)
10 endif()
11
12 set(ENABLE_SDL OFF CACHE BOOL "Target SDL Native application")
13 set(ENABLE_QT OFF CACHE BOOL "Target Qt Native application")
14 set(ENABLE_WASM OFF CACHE BOOL "Target WASM application")
15 set(ENABLE_UNITTESTS ON
16
17
18 if (ENABLE_WASM)
19 set(ORTHANC_SANDBOXED ON)
20 if (ENABLE_SDL)
21 message("ENABLE_SDL is only supported in native (incompatible with ENABLE_WASM)")
22 endif()
23 if (ENABLE_QT)
24 message("ENABLE_QT is only supported in native (incompatible with ENABLE_WASM)")
25 endif()
26 set(ENABLE_NATIVE OFF)
27 set(ORTHANC_SANDBOXED OFF)
28 set(ENABLE_CRYPTO_OPTIONS ON)
29 set(ENABLE_GOOGLE_TEST ON)
30 set(ENABLE_WEB_CLIENT ON)
31 elseif (ENABLE_QT OR ENABLE_SDL)
32 set(ENABLE_NATIVE ON)
33 set(ORTHANC_SANDBOXED OFF)
34 set(ENABLE_CRYPTO_OPTIONS ON)
35 set(ENABLE_GOOGLE_TEST ON)
36 set(ENABLE_WEB_CLIENT ON)
37 else()
38 set(ENABLE_NATIVE ON)
39 set(ENABLE_OPENGL OFF)
40 endif()
41
42 #####################################################################
43 ## Configuration for Orthanc
44 #####################################################################
45
46 if (ORTHANC_STONE_VERSION STREQUAL "mainline")
47 set(ORTHANC_FRAMEWORK_VERSION "mainline")
48 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
49 else()
50 set(ORTHANC_FRAMEWORK_VERSION "1.4.1")
51 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
52 endif()
53
54 set(ORTHANC_FRAMEWORK_SOURCE "${ORTHANC_FRAMEWORK_DEFAULT_SOURCE}" CACHE STRING "Source of the Orthanc source code (can be \"hg\", \"archive\", \"web\" or \"path\")")
55 set(ORTHANC_FRAMEWORK_ARCHIVE "" CACHE STRING "Path to the Orthanc archive, if ORTHANC_FRAMEWORK_SOURCE is \"archive\"")
56 set(ORTHANC_FRAMEWORK_ROOT "" CACHE STRING "Path to the Orthanc source directory, if ORTHANC_FRAMEWORK_SOURCE is \"path\"")
57
58 add_definitions(
59 -DORTHANC_ENABLE_LOGGING_PLUGIN=0
60 )
61
62 #####################################################################
63 ## Build a static library containing the Orthanc Stone framework
64 #####################################################################
65
66 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
67
68 include(../Resources/CMake/OrthancStoneConfiguration.cmake)
69
70 add_library(OrthancStone STATIC
71 ${ORTHANC_STONE_SOURCES}
72 )
73
74 include_directories(${ORTHANC_STONE_ROOT})
75
76 #####################################################################
77 ## Build the unit tests
78 #####################################################################
79
80 if (ENABLE_UNITTESTS)
81 add_executable(UnitTests
82 ${GOOGLE_TEST_SOURCES}
83 ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp
84 ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp
85 ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp
86 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp
87 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp
88 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp
89 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
90 ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
91 )
92
93 target_link_libraries(UnitTests OrthancStone)
94
95 add_custom_command(
96 TARGET UnitTests
97 POST_BUILD
98 COMMAND ${CMAKE_COMMAND} -E copy
99 "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
100 "$<TARGET_FILE_DIR:UnitTests>/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
101 )
102
103 endif()
104
105 #####################################################################
106 ## Generate the documentation if Doxygen is present
107 #####################################################################
108
109 find_package(Doxygen)
110 if (DOXYGEN_FOUND)
111 configure_file(
112 ${ORTHANC_STONE_ROOT}/Resources/OrthancStone.doxygen
113 ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
114 @ONLY)
115
116 add_custom_target(doc
117 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
118 COMMENT "Generating documentation with Doxygen" VERBATIM
119 )
120 else()
121 message("Doxygen not found. The documentation will not be built.")
122 endif()