You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 5.2KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. PROJECT(OpenViBESDKTest)
  2. # ------------------
  3. # Project variables
  4. # ------------------
  5. SET(OVT_GLOBAL_VERSION_MAJOR 0)
  6. SET(OVT_GLOBAL_VERSION_MINOR 1)
  7. SET(OVT_GLOBAL_VERSION_PATCH 0)
  8. SET(OVT_GLOBAL_VERSION_STRING "${OVT_GLOBAL_VERSION_MAJOR}.${OVT_GLOBAL_VERSION_MINOR}.${OVT_GLOBAL_VERSION_PATCH}")
  9. IF(NOT DEFINED OVT_TEST_DATA_DIR)
  10. MESSAGE(FATAL_ERROR "Path to tests input data files is not set")
  11. ENDIF()
  12. # Set the test ouptut directory for output tests files storage
  13. SET(OVT_VALIDATION_TEST_OUTPUT_DIR ${PROJECT_BINARY_DIR}/validation-test-output/ CACHE PATH "Path for the output result and configuration file create during test")
  14. # ----------------------
  15. # Project configuration
  16. # ----------------------
  17. # Add python tools path
  18. SET(OVT_PYTHON_TOOL_DIR ${PROJECT_SOURCE_DIR}/python-toolkit/)
  19. # ---------------------
  20. # Project dependencies
  21. # ---------------------
  22. # Add some search directory to module path
  23. SET(OVT_CMAKE_DIR ${OV_BASE_DIR}/cmake-modules)
  24. SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OVT_CMAKE_DIR})
  25. # Modify library prefixes and suffixes to comply to Windows or Linux naming
  26. IF(WIN32)
  27. SET(CMAKE_FIND_LIBRARY_PREFIXES "")
  28. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
  29. ELSEIF(APPLE)
  30. SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
  31. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".a")
  32. ELSE()
  33. SET(CMAKE_FIND_LIBRARY_PREFIXES "lib")
  34. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".so" ".a")
  35. ENDIF()
  36. # Find main dependency
  37. if(DEFINED Python3_EXECUTABLE AND NOT DEFINED Python3_Interpreter_FOUND)
  38. # Python exec was supplied through command line, just set it in the files and don't ask questions
  39. set(Python3_Interpreter_FOUND TRUE)
  40. else()
  41. SET(Python_ADDITIONAL_VERSIONS 3.7)
  42. FIND_PACKAGE(Python3 COMPONENTS Interpreter Development)
  43. endif()
  44. if(NOT Python3_Interpreter_FOUND)
  45. # This is likely a messed-up PYTHONPATH/HOME ISSUE
  46. message(WARNING "Current PYTHONPATH likely not suitable for a Python 3 executable, \
  47. please check that the following values are plausible :\n\
  48. \$ENV{PYTHONPATH} = $ENV{PYTHONPATH}\n\
  49. \$ENV{PYTHONHOME} = $ENV{PYTHONHOME}\n\
  50. If the previous environement is inconsistent, please set it correctly \
  51. or directly give Python3 executable path at build time using \"--python-exec\"\n\
  52. These tests will be generated with a generic \"python\" call, please use the \"--python-dir\" \
  53. option of the launcher to set the path to a working python3 directory.")
  54. else()
  55. message(STATUS "Found Python3 at ${Python3_EXECUTABLE}")
  56. endif()
  57. # --------------------
  58. # Test configuration
  59. # --------------------
  60. # On Windows and Linux, some environment setting scripts are needed to ease the testing process
  61. SET(OVT_SCRIPT_DIR ${OV_BASE_BIN_DIR}/scripts)
  62. IF(WIN32)
  63. # Wrapper script that set the environment and launch ctest
  64. # It is located at build directory root to be as close as possible as standard ctest use
  65. CONFIGURE_FILE(${OV_BASE_DIR}/scripts/windows-ctest-launcher.cmd-base
  66. ${OV_BASE_BIN_DIR}/ctest-launcher.cmd)
  67. ELSEIF(UNIX)
  68. # Wrapper script that set the environment and launch ctest
  69. # It is located at build directory root to be as close as possible as standard ctest use
  70. CONFIGURE_FILE(${OV_BASE_DIR}/scripts/unix-ctest-launcher.sh-base
  71. ${OV_BASE_BIN_DIR}/ctest-launcher.sh)
  72. ENDIF()
  73. # ${PROJECT_BINARY_DIR}/Testing/Temporary is automatically created by CTest for log files
  74. # We create a temporary subdir for our test that will be create before each test is run
  75. # and removed afterwards (see CTestCustom.cmake.in)
  76. SET(OVT_TEST_TEMPORARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary/OVT/)
  77. # Create test data directory for big or binary files
  78. FILE(MAKE_DIRECTORY ${OVT_TEST_DATA_DIR})
  79. # Ctest custom options
  80. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake @ONLY)
  81. # Timeout must be set first
  82. SET (DART_TESTING_TIMEOUT 72000 CACHE STRING "Maximum time allowed before CTest will kill the test." FORCE)
  83. INCLUDE(CTest)
  84. ENABLE_TESTING()
  85. # It might be useful to set some configuration token from cmake variable
  86. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/data/openvibe/openvibe.conf.in ${CMAKE_CURRENT_BINARY_DIR}/data/openvibe/openvibe.conf @ONLY)
  87. # Utility variable for subproject
  88. SET(OVT_OPENVIBE_DATA ${CMAKE_CURRENT_BINARY_DIR}/data/openvibe)
  89. if(DEFINED DIST_BINDIR_ABSOLUTE)
  90. set(OVT_OPENVIBE_PLAYER ${DIST_BINDIR_ABSOLUTE}/openvibe-scenario-player${CMAKE_EXECUTABLE_SUFFIX})
  91. else()
  92. set(OVT_OPENVIBE_PLAYER ${DIST_BINDIR}/openvibe-scenario-player${CMAKE_EXECUTABLE_SUFFIX})
  93. endif()
  94. IF(UNIX)
  95. SET(OVT_OPENVIBE_PLAYER_LOG_FILE "$ENV{HOME}/.config/${OV_CONFIG_SUBDIR}/log/openvibe-scenario-player.log")
  96. ELSEIF(WIN32)
  97. SET(OVT_OPENVIBE_PLAYER_LOG_FILE "\"$ENV{APPDATA}/${OV_CONFIG_SUBDIR}/log/openvibe-scenario-player.log\"")
  98. ENDIF()
  99. FILE(TO_CMAKE_PATH ${OVT_OPENVIBE_PLAYER_LOG_FILE} OVT_OPENVIBE_PLAYER_LOG_FILE)
  100. SET(OVT_VALIDATION_TOOLKIT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/python-toolkit)
  101. # ----------------------
  102. # CMake tree processing
  103. # ----------------------
  104. # Process validation tests
  105. # When adding a new set of validation tests, test directory must be added here
  106. #ADD_SUBDIRECTORY(openvibe-file-io-csv)
  107. ADD_SUBDIRECTORY(openvibe-file-io-openvibe)
  108. ADD_SUBDIRECTORY(openvibe-stimulation-timeout)
  109. ADD_SUBDIRECTORY(openvibe-regularized-csp)
  110. ADD_SUBDIRECTORY(openvibe-classification-lda)