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.

FindThirdPartyLSL.cmake 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # ---------------------------------
  2. # Finds LabStreamingLayer (LSL) library
  3. #
  4. # Sets LSL_FOUND
  5. # Sets LSL_INCLUDE_DIRS
  6. # Sets LSL_LIBRARY_DIRS
  7. # Sets LSL_LIBRARIES_RELEASE
  8. #
  9. # Adds library to target
  10. # Adds include path
  11. #
  12. # Script @author Jussi T. Lindgren / Inria
  13. #
  14. # @note On Windows, trying to use the debug library of LSL 1.12 in the same way we did with LSL 1.04
  15. # caused an obscure Windows error code when launching the linking app. To sidestep, we use only the
  16. # LSL release build library for now. To enable the debug lib, the following might be needed on Win
  17. # in addition to linking the debug lib (but did not seem to be sufficient to make it work):
  18. # SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DLSL_DEBUG_BINDINGS")
  19. #
  20. # ---------------------------------
  21. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyLSL)
  22. # The first ${..}/liblsl path is for Windows, the second ${..}/ for Linux
  23. FIND_PATH(PATH_LSL include/lsl_cpp.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES . liblsl NO_DEFAULT_PATH)
  24. FIND_PATH(PATH_LSL include/lsl_cpp.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES . liblsl)
  25. IF(PATH_LSL)
  26. SET(LSL_FOUND TRUE)
  27. SET(LSL_INCLUDE_DIRS ${PATH_LSL}/include/)
  28. SET(LSL_LIBRARY_DIRS ${PATH_LSL}/lib/)
  29. IF(WIN32)
  30. IF("${PLATFORM_TARGET}" STREQUAL "x64")
  31. SET(LSL_LIBRARIES_RELEASE liblsl64.lib)
  32. SET(LSL_LIBRARIES_RELEASE_DLL liblsl64.dll)
  33. ELSE()
  34. SET(LSL_LIBRARIES_RELEASE liblsl32.lib)
  35. SET(LSL_LIBRARIES_RELEASE_DLL liblsl32.dll)
  36. ENDIF()
  37. ELSEIF(UNIX)
  38. SET(LSL_LIBRARIES_RELEASE liblsl.so)
  39. ENDIF()
  40. ENDIF()
  41. IF(LSL_FOUND)
  42. OV_PRINT(OV_PRINTED " Found liblsl...")
  43. INCLUDE_DIRECTORIES(${LSL_INCLUDE_DIRS})
  44. SET(LSL_LIB_REL "LSL_LIB_REL-NOTFOUND")
  45. # OV_PRINT(OV_PRINTED "LSL: ${LSL_LIBRARIES_RELEASE} - ${LSL_LIBRARY_DIRS_RELEASE}")
  46. FIND_LIBRARY(LSL_LIB_REL NAMES ${LSL_LIBRARIES_RELEASE} PATHS ${LSL_LIBRARY_DIRS} NO_DEFAULT_PATH)
  47. IF(LSL_LIB_REL)
  48. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${LSL_LIB_REL}")
  49. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${LSL_LIB_REL})
  50. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${LSL_LIB_REL})
  51. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyLSL)
  52. IF(WIN32)
  53. INSTALL(FILES "${LSL_LIBRARY_DIRS}/${LSL_LIBRARIES_RELEASE_DLL}" DESTINATION "${DIST_BINDIR}" CONFIGURATIONS Release Debug)
  54. ENDIF()
  55. ELSE()
  56. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${LSL_LIB_REL}")
  57. ENDIF()
  58. ELSE()
  59. OV_PRINT(OV_PRINTED " FAILED to find liblsl (optional) ...")
  60. ENDIF()
  61. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyLSL "Yes")