CMakeLists.txt 4.3 KB

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