3 set(proj GP)
# Means GenerateProject (use a short name due to Windows limitations)
4 set(test_project_out_dir
"${MITK_BINARY_DIR}")
5 set(test_project_source_dir "${MITK_BINARY_DIR}/${proj}
")
6 set(test_project_binary_dir "${MITK_BINARY_DIR}/${proj}-bin
")
8 add_test(NAME mitkPluginGeneratorCleanTest
9 COMMAND ${CMAKE_COMMAND} -E remove_directory "${test_project_source_dir}
"
11 set_tests_properties(mitkPluginGeneratorCleanTest PROPERTIES
12 LABELS "MITK;BlueBerry
")
14 add_test(NAME mitkPluginGeneratorCleanTest2
15 COMMAND ${CMAKE_COMMAND} -E remove_directory "${test_project_binary_dir}
"
17 set_tests_properties(mitkPluginGeneratorCleanTest2 PROPERTIES
18 LABELS "MITK;BlueBerry
")
20 add_test(NAME mitkPluginGeneratorCleanTest3
21 COMMAND ${CMAKE_COMMAND} -E make_directory "${test_project_binary_dir}
"
23 set_tests_properties(mitkPluginGeneratorCleanTest3 PROPERTIES
24 DEPENDS mitkPluginGeneratorCleanTest2
25 LABELS "MITK;BlueBerry
")
27 add_test(NAME mitkPluginGeneratorCreateTest
28 COMMAND ${exec_target} --project-name "${proj}
" --project-app-name "TestApp
"
29 -ps org.test.plugin -pn "Test Plugin
" -vn "Test View
"
30 -o ${test_project_out_dir} -y -n
32 set_tests_properties(mitkPluginGeneratorCreateTest PROPERTIES
33 DEPENDS "${exec_target};mitkPluginGeneratorCleanTest;mitkPluginGeneratorCleanTest3
"
34 LABELS "MITK;BlueBerry
")
37 -DMITK_DIR:PATH=${MITK_BINARY_DIR}
38 -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
39 -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
40 -DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
41 -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET}
42 -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}
44 -C "${MITK_BINARY_DIR}/mitkTestInitialCache.txt
"
48 string (REPLACE ";
" "$<SEMICOLON>
" CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}
")
49 list(APPEND configure_options -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH})
52 if(CMAKE_CONFIGURATION_TYPES)
53 foreach(config ${CMAKE_CONFIGURATION_TYPES})
54 add_test(NAME mitkPluginGeneratorConfigureTest-${config} CONFIGURATIONS ${config}
55 WORKING_DIRECTORY "${test_project_binary_dir}
"
56 COMMAND ${CMAKE_COMMAND} ${configure_options}
57 "${test_project_source_dir}
")
58 set_tests_properties(mitkPluginGeneratorConfigureTest-${config} PROPERTIES
59 DEPENDS mitkPluginGeneratorCreateTest
60 LABELS "MITK;BlueBerry
")
62 add_test(NAME mitkPluginGeneratorBuildTest-${config} CONFIGURATIONS ${config}
63 COMMAND ${CMAKE_COMMAND} --build ${test_project_binary_dir} --config ${config})
64 set_tests_properties(mitkPluginGeneratorBuildTest-${config} PROPERTIES
65 DEPENDS mitkPluginGeneratorConfigureTest-${config}
66 LABELS "MITK;BlueBerry
")
69 add_test(NAME mitkPluginGeneratorConfigureTest-${CMAKE_BUILD_TYPE}
70 WORKING_DIRECTORY "${test_project_binary_dir}
"
71 COMMAND ${CMAKE_COMMAND} ${configure_options}
72 -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
73 "${test_project_source_dir}
")
74 set_tests_properties(mitkPluginGeneratorConfigureTest-${CMAKE_BUILD_TYPE} PROPERTIES
75 DEPENDS mitkPluginGeneratorCreateTest
76 LABELS "MITK;BlueBerry
")
78 add_test(NAME mitkPluginGeneratorBuildTest-${CMAKE_BUILD_TYPE}
79 COMMAND ${CMAKE_COMMAND} --build ${test_project_binary_dir} --config ${CMAKE_BUILD_TYPE})
80 set_tests_properties(mitkPluginGeneratorBuildTest-${CMAKE_BUILD_TYPE} PROPERTIES
81 DEPENDS mitkPluginGeneratorConfigureTest-${CMAKE_BUILD_TYPE}
82 LABELS "MITK;BlueBerry
")
85 set(package_test_configurations)
87 # Only test packaging if build type is "Release
" on Windows
88 set(package_test_configurations CONFIGURATIONS Release)
91 if(NOT MITK_FAST_TESTING)
94 # Only test packaging if build type is "Release
" on Windows
95 add_test(NAME mitkPluginGeneratorPackageTest CONFIGURATIONS Release
96 COMMAND ${CMAKE_COMMAND} --build ${test_project_binary_dir}/${proj}-build --config Release --target package)
97 set_tests_properties(mitkPluginGeneratorPackageTest PROPERTIES
98 DEPENDS mitkPluginGeneratorBuildTest-Release
100 LABELS "MITK;BlueBerry;PACKAGE_TESTS
")
101 elseif(CMAKE_BUILD_TYPE)
102 add_test(mitkPluginGeneratorPackageTest
103 ${CMAKE_COMMAND} --build ${test_project_binary_dir}/${proj}-build --config ${CMAKE_BUILD_TYPE} --target package)
104 set_tests_properties(mitkPluginGeneratorPackageTest PROPERTIES
105 DEPENDS mitkPluginGeneratorBuildTest-${CMAKE_BUILD_TYPE}
107 LABELS "MITK;BlueBerry;PACKAGE_TESTS
")