annotate UnitTestsSources/CMakeLists.txt @ 1397:1c2d065ba372

cleanup
author Alain Mazy <alain@mazy.be>
date Wed, 29 Apr 2020 20:41:36 +0200
parents c4b0b4badae6
children 5630c2fb7b0f
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_WASM OFF CACHE BOOL "Target WASM application")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
14 set(ENABLE_UNITTESTS ON
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
15
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 if (ENABLE_WASM)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
18 set(ORTHANC_SANDBOXED ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
19 if (ENABLE_SDL)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
20 message("ENABLE_SDL is only supported in native (incompatible with ENABLE_WASM)")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
21 endif()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
22 set(ENABLE_NATIVE OFF)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
23 set(ORTHANC_SANDBOXED OFF)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
24 set(ENABLE_CRYPTO_OPTIONS ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
25 set(ENABLE_GOOGLE_TEST ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
26 set(ENABLE_WEB_CLIENT ON)
1397
1c2d065ba372 cleanup
Alain Mazy <alain@mazy.be>
parents: 1366
diff changeset
27 elseif (ENABLE_SDL)
1366
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
28 set(ENABLE_NATIVE ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
29 set(ORTHANC_SANDBOXED OFF)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
30 set(ENABLE_CRYPTO_OPTIONS ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
31 set(ENABLE_GOOGLE_TEST ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
32 set(ENABLE_WEB_CLIENT ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
33 else()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
34 set(ENABLE_NATIVE ON)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
35 set(ENABLE_OPENGL OFF)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
36 endif()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
37
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
38 #####################################################################
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
39 ## Configuration for Orthanc
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
40 #####################################################################
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 if (ORTHANC_STONE_VERSION STREQUAL "mainline")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
43 set(ORTHANC_FRAMEWORK_VERSION "mainline")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
44 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "hg")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
45 else()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
46 set(ORTHANC_FRAMEWORK_VERSION "1.4.1")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
47 set(ORTHANC_FRAMEWORK_DEFAULT_SOURCE "web")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
48 endif()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
49
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
50 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
51 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
52 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
53
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
54 add_definitions(
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
55 -DORTHANC_ENABLE_LOGGING_PLUGIN=0
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
56 )
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 #####################################################################
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
59 ## Build a static library containing the Orthanc Stone framework
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 LIST(APPEND ORTHANC_BOOST_COMPONENTS program_options)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
63
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
64 include(../Resources/CMake/OrthancStoneConfiguration.cmake)
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 add_library(OrthancStone STATIC
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
67 ${ORTHANC_STONE_SOURCES}
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
68 )
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 include_directories(${ORTHANC_STONE_ROOT})
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
71
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 ## Build the unit tests
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
74 #####################################################################
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 if (ENABLE_UNITTESTS)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
77 add_executable(UnitTests
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
78 ${GOOGLE_TEST_SOURCES}
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
79 ${ORTHANC_STONE_ROOT}/UnitTestsSources/GenericToolboxTests.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
80 ${ORTHANC_STONE_ROOT}/UnitTestsSources/ImageToolboxTests.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
81 ${ORTHANC_STONE_ROOT}/UnitTestsSources/PixelTestPatternsTests.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
82 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestCommands.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
83 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestMessageBroker.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
84 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStrategy.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
85 ${ORTHANC_STONE_ROOT}/UnitTestsSources/TestStructureSet.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
86 ${ORTHANC_STONE_ROOT}/UnitTestsSources/UnitTestsMain.cpp
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
87 )
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
88
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
89 target_link_libraries(UnitTests OrthancStone)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
90
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
91 add_custom_command(
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
92 TARGET UnitTests
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
93 POST_BUILD
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
94 COMMAND ${CMAKE_COMMAND} -E copy
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
95 "${ORTHANC_STONE_ROOT}/UnitTestsSources/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
96 "$<TARGET_FILE_DIR:UnitTests>/72c773ac-5059f2c4-2e6a9120-4fd4bca1-45701661.json"
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
97 )
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
98
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
99 endif()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
100
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 ## Generate the documentation if Doxygen is present
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
103 #####################################################################
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 find_package(Doxygen)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
106 if (DOXYGEN_FOUND)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
107 configure_file(
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
108 ${ORTHANC_STONE_ROOT}/Resources/OrthancStone.doxygen
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
109 ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
110 @ONLY)
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
111
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
112 add_custom_target(doc
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
113 ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/OrthancStone.doxygen
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
114 COMMENT "Generating documentation with Doxygen" VERBATIM
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 else()
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
117 message("Doxygen not found. The documentation will not be built.")
c4b0b4badae6 unit test sources
Benjamin Golinvaux <bgo@osimis.io>
parents:
diff changeset
118 endif()