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.

FindThirdPartyNeuroelectricsEnobio3G.cmake 3.3KB

3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. # ---------------------------------
  2. # Finds the ENOBIO API & library
  3. # Adds library to target
  4. # Adds include path
  5. # ---------------------------------
  6. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyNeuroelectricsEnobio3G)
  7. IF(WIN32)
  8. FIND_PATH(PATH_ENOBIOAPI enobio3g.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES sdk_enobio3g/enobio3g)
  9. IF(NOT PATH_ENOBIOAPI)
  10. OV_PRINT(OV_PRINTED " FAILED to find ENOBIO API (optional driver) - cmake looked in '${LIST_DEPENDENCIES_PATH}', skipping Enobio.")
  11. RETURN()
  12. ENDIF(NOT PATH_ENOBIOAPI)
  13. OV_PRINT(OV_PRINTED " Found ENOBIO API...")
  14. FIND_LIBRARY(LIB_ENOBIOAPI Enobio3GAPI PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES sdk_enobio3g/MSVC)
  15. IF(NOT LIB_ENOBIOAPI)
  16. OV_PRINT(OV_PRINTED " [FAILED] Enobio libs not found, skipping Enobio.")
  17. RETURN()
  18. ENDIF(NOT LIB_ENOBIOAPI)
  19. INCLUDE_DIRECTORIES("${PATH_ENOBIOAPI}")
  20. INSTALL(DIRECTORY "${PATH_ENOBIOAPI}/../MSVC/" DESTINATION "${DIST_BINDIR}/" FILES_MATCHING PATTERN "*.dll")
  21. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_ENOBIOAPI} )
  22. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyEnobioAPI)
  23. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_ENOBIOAPI}")
  24. ENDIF(WIN32)
  25. # For now, the Linux building of Enobio3G is disabled as it has not been tested with a recent Neuroelectrics lib.
  26. IF(UNIX)
  27. OV_PRINT(OV_PRINTED " Skipped Enobio3G, its work in progress.")
  28. RETURN()
  29. ENDIF(UNIX)
  30. IF(UNIX)
  31. SET(QTCORE_INCLUDE_PREFIX /usr/share/qt4/include/)
  32. SET(QTCORE_LIB_PREFIX /usr/lib/x86_64-linux-gnu/)
  33. FIND_PATH(PATH_ENOBIOAPI enobio3g.h PATHS $ENV{OpenViBE_dependencies} ${OV_BASE_DIR}/contrib/plugins/server-drivers/enobio3G/Enobio3GAPI.linux/)
  34. IF(PATH_ENOBIOAPI)
  35. OV_PRINT(OV_PRINTED " Found ENOBIO API...")
  36. INCLUDE_DIRECTORIES(${PATH_ENOBIOAPI})
  37. FIND_PATH(PATH_QTCORE_INCLUDE QtCore/QtCore ${QTCORE_INCLUDE_PREFIX})
  38. IF(PATH_QTCORE_INCLUDE)
  39. OV_PRINT(OV_PRINTED " [ OK ] QtCore include ${PATH_QTCORE_INCLUDE}/")
  40. INCLUDE_DIRECTORIES(${PATH_QTCORE_INCLUDE}/)
  41. ELSE(PATH_QTCORE_INCLUDE)
  42. OV_PRINT(OV_PRINTED " FAILED TO FIND QtCore include PATH")
  43. ENDIF(PATH_QTCORE_INCLUDE)
  44. FIND_LIBRARY(LIB_ENOBIOAPI Enobio3GAPI PATHS ${PATH_ENOBIOAPI}/libs/ )
  45. IF(LIB_ENOBIOAPI)
  46. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_ENOBIOAPI}")
  47. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_ENOBIOAPI} )
  48. ELSE(LIB_ENOBIOAPI)
  49. OV_PRINT(OV_PRINTED " [FAILED] lib ENOBIO")
  50. ENDIF(LIB_ENOBIOAPI)
  51. FIND_LIBRARY(LIB_QT QtCore ${QTCORE_LIB_PREFIX})
  52. IF(LIB_QT)
  53. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_QT}")
  54. TARGET_LINK_LIBRARIES(${PROJECT_NAME} -L${LIB_QT} -lQtCore)
  55. ELSE(LIB_QT)
  56. OV_PRINT(OV_PRINTED " [ FAILED ] lib QT ${QTCORE_LIB_PREFIX}")
  57. ENDIF(LIB_QT)
  58. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyEnobioAPI)
  59. # Copying the DLL file at postbuild
  60. ADD_CUSTOM_COMMAND(
  61. TARGET ${PROJECT_NAME}
  62. POST_BUILD
  63. COMMAND ${CMAKE_COMMAND}
  64. ARGS -E copy "${LIB_ENOBIOAPI}" "${PROJECT_SOURCE_DIR}/bin"
  65. COMMENT " ---> Copying lib file ${LIB_ENOBIOAPI} for the Neuroelectrics Enobio driver."
  66. VERBATIM)
  67. ELSE(PATH_ENOBIOAPI)
  68. OV_PRINT(OV_PRINTED " FAILED to find ENOBIO API - cmake looked in $ENV{OpenViBE_dependencies} and in ${OV_BASE_DIR}/contrib/plugins/server-drivers/enobio3G/Enobio3GAPI/")
  69. ENDIF(PATH_ENOBIOAPI)
  70. ENDIF(UNIX)
  71. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyNeuroelectricsEnobio3G "Yes")