CMakeLists.txt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. # Dummy plugin used by ctkAbstractPluginFactoryTest1
  2. add_definitions( -DCTKDummyPlugin)
  3. ctkMacroBuildLib(
  4. NAME "CTKDummyPlugin"
  5. EXPORT_DIRECTIVE "CTK_DUMMY_EXPORT"
  6. SRCS ctkDummyPlugin.h ctkDummyPlugin.cpp
  7. MOC_SRCS "ctkDummyPlugin.h"
  8. TARGET_LIBRARIES ${CTK_BASE_LIBRARIES}
  9. LIBRARY_TYPE "SHARED"
  10. )
  11. remove_definitions(-DCTKDummyPlugin)
  12. set(KIT ${PROJECT_NAME})
  13. #
  14. # Test sources
  15. #
  16. set(KITTests_SRCS
  17. ctkAbstractFactoryTest1.cpp
  18. ctkAbstractLibraryFactoryTest1.cpp
  19. ctkAbstractObjectFactoryTest1.cpp
  20. ctkAbstractPluginFactoryTest1.cpp
  21. ctkAbstractQObjectFactoryTest1.cpp
  22. ctkBackTraceTest.cpp
  23. ctkBooleanMapperTest.cpp
  24. ctkCallbackTest1.cpp
  25. ctkCommandLineParserTest1.cpp
  26. ctkExceptionTest.cpp
  27. ctkFileLoggerTest.cpp
  28. ctkHighPrecisionTimerTest.cpp
  29. ctkLinearValueProxyTest.cpp
  30. ctkLoggerTest1.cpp
  31. ctkModelTesterTest1.cpp
  32. ctkModelTesterTest2.cpp
  33. ctkUtilsCopyDirRecursivelyTest1.cpp
  34. ctkUtilsQtHandleToStringTest1.cpp
  35. ctkUtilsTest.cpp
  36. ctkUtilsTest1.cpp
  37. ctkUtilsTest2.cpp
  38. ctkUtilsTest3.cpp
  39. ctkUtilsTest4.cpp
  40. ctkDependencyGraphTest1.cpp
  41. ctkDependencyGraphTest2.cpp
  42. ctkPimplTest1.cpp
  43. ctkScopedCurrentDirTest1.cpp
  44. ctkSingletonTest1.cpp
  45. ctkWorkflowTest1.cpp
  46. ctkWorkflowTest2.cpp
  47. ctkWorkflowTest3.cpp
  48. )
  49. if(HAVE_BFD)
  50. list(APPEND KITTests_SRCS
  51. ctkBinaryFileDescriptorTest1.cpp
  52. )
  53. endif()
  54. include_directories(
  55. ${CMAKE_SOURCE_DIR}/Libs/Testing
  56. ${CMAKE_CURRENT_BINARY_DIR}
  57. )
  58. create_test_sourcelist(Tests ${KIT}CppTests.cpp
  59. ${KITTests_SRCS}
  60. #EXTRA_INCLUDE TestingMacros.h
  61. )
  62. set(TestsToRun ${Tests})
  63. remove(TestsToRun ${KIT}CppTests.cpp)
  64. set(LIBRARY_NAME ${PROJECT_NAME})
  65. #
  66. # Tests Helpers sources
  67. #
  68. set(Tests_Helpers_SRCS
  69. ctkBranchingWorkflowStep.h
  70. ctkExampleDerivedWorkflowStep.cpp
  71. ctkExampleDerivedWorkflowStep.h
  72. ctkExampleWorkflowStepUsingSignalsAndSlots.cpp
  73. ctkExampleWorkflowStepUsingSignalsAndSlots.h
  74. ctkSingletonTestHelper.cpp
  75. ctkSingletonTestHelper.h
  76. )
  77. set(Tests_Helpers_MOC_SRCS
  78. ctkExampleWorkflowStepUsingSignalsAndSlots.h
  79. )
  80. set(Tests_Helpers_MOC_CPPS
  81. ctkBooleanMapperTest.cpp
  82. ctkFileLoggerTest.cpp
  83. ctkLinearValueProxyTest.cpp
  84. ctkUtilsTest.cpp
  85. )
  86. set(Tests_Helpers_MOC_CPP)
  87. if(CTK_QT_VERSION VERSION_GREATER "4")
  88. qt5_wrap_cpp(Tests_Helpers_MOC_CPP ${Tests_Helpers_MOC_SRCS})
  89. qt5_generate_mocs(${Tests_Helpers_MOC_CPPS})
  90. else()
  91. QT4_WRAP_CPP(Tests_Helpers_MOC_CPP ${Tests_Helpers_MOC_SRCS})
  92. QT4_GENERATE_MOCS(${Tests_Helpers_MOC_CPPS})
  93. endif()
  94. if(HAVE_BFD)
  95. add_executable(ctkBinaryFileDescriptorTestHelper ctkBinaryFileDescriptorTestHelper.cpp)
  96. endif()
  97. if(WIN32)
  98. add_definitions( /D _CRT_SECURE_NO_WARNINGS)
  99. endif()
  100. #
  101. # Test executable
  102. #
  103. add_executable(${KIT}CppTests ${Tests} ${Tests_Helpers_SRCS} ${Tests_Helpers_MOC_CPP})
  104. target_link_libraries(${KIT}CppTests ${LIBRARY_NAME} ${CTK_BASE_LIBRARIES} CTKDummyPlugin)
  105. if(CTK_QT_VERSION VERSION_GREATER "4")
  106. qt5_use_modules(${KIT}CppTests Test Widgets)
  107. endif()
  108. if(UNIX AND NOT APPLE)
  109. target_link_libraries(${KIT}CppTests rt)
  110. endif()
  111. #
  112. # Add Tests
  113. #
  114. SIMPLE_TEST( ctkAbstractFactoryTest1 )
  115. SIMPLE_TEST( ctkAbstractLibraryFactoryTest1 $<TARGET_FILE:CTKDummyPlugin> )
  116. SIMPLE_TEST( ctkAbstractObjectFactoryTest1 )
  117. SIMPLE_TEST( ctkAbstractPluginFactoryTest1 $<TARGET_FILE:CTKDummyPlugin> )
  118. SIMPLE_TEST( ctkAbstractQObjectFactoryTest1 )
  119. SIMPLE_TEST( ctkBackTraceTest )
  120. if(HAVE_BFD)
  121. SIMPLE_TEST( ctkBinaryFileDescriptorTest1 $<TARGET_FILE:ctkBinaryFileDescriptorTestHelper> )
  122. endif()
  123. SIMPLE_TEST( ctkBooleanMapperTest )
  124. SIMPLE_TEST( ctkCallbackTest1 )
  125. SIMPLE_TEST( ctkCommandLineParserTest1 )
  126. SIMPLE_TEST( ctkDependencyGraphTest1 )
  127. SIMPLE_TEST( ctkDependencyGraphTest2 )
  128. SIMPLE_TEST( ctkExceptionTest )
  129. SIMPLE_TEST( ctkFileLoggerTest )
  130. SIMPLE_TEST( ctkHighPrecisionTimerTest )
  131. SIMPLE_TEST( ctkLinearValueProxyTest )
  132. SIMPLE_TEST( ctkLoggerTest1 )
  133. set_property(TEST ctkLoggerTest1 PROPERTY PASS_REGULAR_EXPRESSION "logger.debug\nlogger.info\nlogger.trace\nlogger.warn\nlogger.error\nlogger.fatal")
  134. SIMPLE_TEST( ctkModelTesterTest1 )
  135. SIMPLE_TEST( ctkModelTesterTest2 )
  136. SIMPLE_TEST( ctkPimplTest1 )
  137. SIMPLE_TEST( ctkScopedCurrentDirTest1 )
  138. SIMPLE_TEST( ctkSingletonTest1 )
  139. SIMPLE_TEST( ctkUtilsCopyDirRecursivelyTest1 )
  140. SIMPLE_TEST( ctkUtilsQtHandleToStringTest1 )
  141. SIMPLE_TEST( ctkUtilsTest )
  142. SIMPLE_TEST( ctkUtilsTest1 )
  143. SIMPLE_TEST( ctkUtilsTest2 )
  144. SIMPLE_TEST( ctkUtilsTest3 )
  145. SIMPLE_TEST( ctkUtilsTest4 )
  146. SIMPLE_TEST( ctkWorkflowTest1 )
  147. SIMPLE_TEST( ctkWorkflowTest2 )
  148. SIMPLE_TEST( ctkWorkflowTest3 )