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