CMakeLists.txt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. add_definitions(-DCC_TESTING_DEBUG)
  2. if (APPLE)
  3. add_definitions(-DGTEST_USE_OWN_TR1_TUPLE)
  4. add_definitions(-D__GLIBCXX__)
  5. endif (APPLE)
  6. # Download and unpack googletest at configure time
  7. configure_file(CMakeLists.txt.in ${CMAKE_BINARY_DIR}/tests/googletest-download/CMakeLists.txt)
  8. execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
  9. RESULT_VARIABLE result
  10. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests/googletest-download )
  11. if(result)
  12. message(FATAL_ERROR "CMake step for googletest failed: ${result}")
  13. endif()
  14. execute_process(COMMAND ${CMAKE_COMMAND} --build .
  15. RESULT_VARIABLE result
  16. WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/tests/googletest-download )
  17. if(result)
  18. message(FATAL_ERROR "Build step for googletest failed: ${result}")
  19. endif()
  20. # Prevent overriding the parent project's compiler/linker
  21. # settings on Windows
  22. set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
  23. # Add googletest directly to our build. This defines
  24. # the gtest and gtest_main targets.
  25. add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
  26. ${CMAKE_BINARY_DIR}/googletest-build
  27. EXCLUDE_FROM_ALL)
  28. # The gtest/gtest_main targets carry header search path
  29. # dependencies automatically when using CMake 2.8.11 or
  30. # later. Otherwise we have to add them here ourselves.
  31. if (CMAKE_VERSION VERSION_LESS 2.8.11)
  32. include_directories("${gtest_SOURCE_DIR}/include")
  33. endif()
  34. # Include the gtest library. gtest_SOURCE_DIR is available due to
  35. # 'project(gtest)' above.
  36. include_directories(${LIB_INCL_DIRS})
  37. ##############
  38. # Unit Tests
  39. ##############
  40. add_executable(testRingBuffer rb/testRingBuffer.cpp)
  41. target_link_libraries(testRingBuffer gtest gtest_main)
  42. target_link_libraries(testRingBuffer ${CERECONN_LIB_NAME})
  43. add_executable(testCommentRingBuffer rb/testCommentRingBuffer.cpp)
  44. # Standard linking to gtest stuff.
  45. target_link_libraries(testCommentRingBuffer gtest gtest_main)
  46. # Extra linking for the project.
  47. target_link_libraries(testCommentRingBuffer ${CERECONN_LIB_NAME})
  48. add_executable(testDigInEvRingBuffer rb/testDigInEvRingBuffer.cpp)
  49. # Standard linking to gtest stuff.
  50. target_link_libraries(testDigInEvRingBuffer gtest gtest_main)
  51. # Extra linking for the project.
  52. target_link_libraries(testDigInEvRingBuffer ${CERECONN_LIB_NAME})
  53. add_executable(testSampleGroupRingBuffer rb/testSampleGroupRingBuffer.cpp)
  54. target_link_libraries(testSampleGroupRingBuffer gtest gtest_main)
  55. # target_link_libraries(testSampleGroupRingBuffer gtest gtest_main ${CERECONN_LIB_NAME})
  56. add_executable(testCommonAverager car/testCommonAverager.cpp)
  57. target_link_libraries(testCommonAverager gtest gtest_main)
  58. add_executable(testCereConnBasics CereConn/testCereConnBasics.cpp)
  59. target_link_libraries(testCereConnBasics gtest gtest_main)
  60. target_link_libraries(testCereConnBasics ${CERECONN_LIB_NAME})
  61. add_executable(testCereConnRecord CereConn/testCereConnRecord.cpp)
  62. target_link_libraries(testCereConnRecord gtest gtest_main)
  63. target_link_libraries(testCereConnRecord ${CERECONN_LIB_NAME})
  64. add_executable(testCereConnHelpers CereConn/testCereConnHelpers.cpp)
  65. target_link_libraries(testCereConnHelpers gtest gtest_main)
  66. add_executable(testCereConnSBPE CereConn/testCereConnSBPE.cpp)
  67. target_link_libraries(testCereConnSBPE gtest gtest_main ${CERECONN_LIB_NAME})
  68. if (USE_CERELINK_STUB)
  69. add_executable(testCereConnRecordPerformance CereConn/testCereConnRecordPerformance.cpp)
  70. target_link_libraries(testCereConnRecordPerformance gtest gtest_main)
  71. target_link_libraries(testCereConnRecordPerformance ${CERECONN_LIB_NAME})
  72. endif(USE_CERELINK_STUB)
  73. add_executable(testSpikeRateEstimator sre/testSpikeRateEstimator.cpp)
  74. target_link_libraries(testSpikeRateEstimator gtest gtest_main ${CERECONN_LIB_NAME})
  75. add_executable(testUnitHist sre/testUnitHist.cpp)
  76. target_link_libraries(testUnitHist gtest gtest_main ${CERECONN_LIB_NAME})
  77. add_executable(testSpikeRateEstimationMethods sre/testSpikeRateEstimationMethods.cpp)
  78. target_link_libraries(testSpikeRateEstimationMethods gtest gtest_main ${CERECONN_LIB_NAME})
  79. add_executable(testSpikeRateEstimatorPerformance sre/testSpikeRateEstimatorPerformance.cpp)
  80. target_link_libraries(testSpikeRateEstimatorPerformance gtest gtest_main ${CERECONN_LIB_NAME})
  81. add_executable(testSpikeBandPowerEstimator sbpe/testSpikeBandPowerEstimator.cpp)
  82. target_link_libraries(testSpikeBandPowerEstimator gtest gtest_main ${CERECONN_LIB_NAME} ${ARMADILLO_LIBRARIES})
  83. add_executable(testSpikeBandPowerEstimatorPerformance sbpe/testSpikeBandPowerEstimatorPerformance.cpp)
  84. target_link_libraries(testSpikeBandPowerEstimatorPerformance gtest gtest_main ${CERECONN_LIB_NAME} ${ARMADILLO_LIBRARIES})
  85. include(GoogleTest)
  86. gtest_discover_tests(testRingBuffer)
  87. gtest_discover_tests(testCommentRingBuffer)
  88. gtest_discover_tests(testDigInEvRingBuffer)
  89. gtest_discover_tests(testSampleGroupRingBuffer)
  90. gtest_discover_tests(testCommonAverager)
  91. gtest_discover_tests(testCereConnBasics)
  92. gtest_discover_tests(testCereConnRecord)
  93. gtest_discover_tests(testCereConnHelpers)
  94. gtest_discover_tests(testCereConnSBPE)
  95. if (USE_CERELINK_STUB)
  96. gtest_discover_tests(testCereConnRecordPerformance)
  97. endif(USE_CERELINK_STUB)
  98. gtest_discover_tests(testSpikeRateEstimator)
  99. gtest_discover_tests(testUnitHist)
  100. gtest_discover_tests(testSpikeRateEstimationMethods)
  101. gtest_discover_tests(testSpikeRateEstimatorPerformance)
  102. gtest_discover_tests(testSpikeBandPowerEstimator)
  103. gtest_discover_tests(testSpikeBandPowerEstimatorPerformance)