3 include(ExternalProject)
5 set(proj PT)
# Means ProjectTemplate (use a short name due to Windows limitations)
6 set(MITK-ProjectTemplate_SOURCE_DIR
"${MITK_BINARY_DIR}/${proj}")
7 set(MITK-ProjectTemplate_BINARY_DIR "${MITK_BINARY_DIR}/${proj}-bin
")
9 add_test(NAME mitkProjectTemplateRmSrcTest
10 COMMAND ${CMAKE_COMMAND} -E remove_directory "${MITK-ProjectTemplate_SOURCE_DIR}
"
12 set_tests_properties(mitkProjectTemplateRmSrcTest PROPERTIES
13 LABELS "MITK;BlueBerry
")
15 add_test(NAME mitkProjectTemplateRmBinTest
16 COMMAND ${CMAKE_COMMAND} -E remove_directory "${MITK-ProjectTemplate_BINARY_DIR}
"
18 set_tests_properties(mitkProjectTemplateRmBinTest PROPERTIES
19 LABELS "MITK;BlueBerry
")
21 add_test(NAME mitkProjectTemplateMakeBinTest
22 COMMAND ${CMAKE_COMMAND} -E make_directory "${MITK-ProjectTemplate_BINARY_DIR}
"
24 set_tests_properties(mitkProjectTemplateMakeBinTest PROPERTIES
25 DEPENDS mitkProjectTemplateRmBinTest
26 LABELS "MITK;BlueBerry
")
28 add_test(NAME mitkProjectTemplateCloneTest
29 COMMAND ${GIT_EXECUTABLE} clone https://phabricator.mitk.org/diffusion/MPT/mitk-projecttemplate.git ${MITK-ProjectTemplate_SOURCE_DIR}
31 set_tests_properties(mitkProjectTemplateCloneTest PROPERTIES
32 DEPENDS mitkProjectTemplateRmSrcTest
33 LABELS "MITK;BlueBerry
")
36 -DMITK_DIR:PATH=${MITK_BINARY_DIR}
37 -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
38 -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
39 -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
40 -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
41 -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
42 -DAwesomeProject_BUILD_ALL_PLUGINS:BOOL=ON
43 -DAwesomeProject_BUILD_ALL_APPS:BOOL=ON
45 -C "${MITK_BINARY_DIR}/mitkTestInitialCache.txt
"
49 string (REPLACE ";
" "$<SEMICOLON>
" CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}
")
50 list(APPEND configure_options -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH})
53 if(CMAKE_CONFIGURATION_TYPES)
54 foreach(config ${CMAKE_CONFIGURATION_TYPES})
55 add_test(NAME mitkProjectTemplateConfigureTest-${config} CONFIGURATIONS ${config}
56 WORKING_DIRECTORY "${MITK-ProjectTemplate_BINARY_DIR}
"
57 COMMAND ${CMAKE_COMMAND} ${configure_options}
58 "${MITK-ProjectTemplate_SOURCE_DIR}
")
59 set_tests_properties(mitkProjectTemplateConfigureTest-${config} PROPERTIES
60 DEPENDS "mitkProjectTemplateCloneTest;mitkProjectTemplateMakeBinTest
"
61 LABELS "MITK;BlueBerry
")
63 add_test(NAME mitkProjectTemplateBuildTest-${config} CONFIGURATIONS ${config}
64 COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config ${config})
65 set_tests_properties(mitkProjectTemplateBuildTest-${config} PROPERTIES
66 DEPENDS mitkProjectTemplateConfigureTest-${config}
67 LABELS "MITK;BlueBerry
")
70 add_test(NAME mitkProjectTemplateConfigureTest-${CMAKE_BUILD_TYPE}
71 WORKING_DIRECTORY "${MITK-ProjectTemplate_BINARY_DIR}
"
72 COMMAND ${CMAKE_COMMAND} ${configure_options}
73 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
74 "${MITK-ProjectTemplate_SOURCE_DIR}
")
75 set_tests_properties(mitkProjectTemplateConfigureTest-${CMAKE_BUILD_TYPE} PROPERTIES
76 DEPENDS "mitkProjectTemplateCloneTest;mitkProjectTemplateMakeBinTest
"
77 LABELS "MITK;BlueBerry
")
79 add_test(NAME mitkProjectTemplateBuildTest-${CMAKE_BUILD_TYPE}
80 COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR} --config ${CMAKE_BUILD_TYPE})
81 set_tests_properties(mitkProjectTemplateBuildTest-${CMAKE_BUILD_TYPE} PROPERTIES
82 DEPENDS mitkProjectTemplateConfigureTest-${CMAKE_BUILD_TYPE}
83 LABELS "MITK;BlueBerry
")
86 set(package_test_configurations)
88 # Only test packaging if build type is "Release
" on Windows
89 set(package_test_configurations CONFIGURATIONS Release)
92 if(NOT MITK_FAST_TESTING)
95 # Only test packaging if build type is "Release
" on Windows
96 add_test(NAME mitkProjectTemplatePackageTest CONFIGURATIONS Release
97 COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR}/AwesomeProject-build --config Release --target package)
98 set_tests_properties(mitkProjectTemplatePackageTest PROPERTIES
99 DEPENDS mitkProjectTemplateBuildTest-Release
101 LABELS "MITK;BlueBerry;PACKAGE_TESTS
")
102 elseif(CMAKE_BUILD_TYPE)
103 add_test(NAME mitkProjectTemplatePackageTest
104 COMMAND ${CMAKE_COMMAND} --build ${MITK-ProjectTemplate_BINARY_DIR}/AwesomeProject-build --config ${CMAKE_BUILD_TYPE} --target package)
105 set_tests_properties(mitkProjectTemplatePackageTest PROPERTIES
106 DEPENDS mitkProjectTemplateBuildTest-${CMAKE_BUILD_TYPE}
108 LABELS "MITK;BlueBerry;PACKAGE_TESTS
")