CMakeLists.txt 4.4 KB

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