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.

FindThirdPartyGMobiLabPlusAPI.cmake 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #
  2. # The gMobilab driver (Linux) was contributed by Lucie Daubigney from Supelec Metz
  3. #
  4. # Windows-compatibility added by Jussi T. Lindgren / Inria
  5. #
  6. # ---------------------------------
  7. # Finds GTecMobiLabPlus+
  8. # Adds library to target
  9. # Adds include path
  10. # ---------------------------------
  11. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyGMobiLabPlusAPI)
  12. IF(WIN32)
  13. # note that the API bitness must match the OV build bitness
  14. FIND_PATH(PATH_GMobiLabCAPI GMobiLabPlus.h PATHS
  15. "C:/Program Files/gtec/GMobiLabCAPI/Lib"
  16. "C:/Program Files (x86)/gtec/GMobiLabCAPI/Lib"
  17. ${LIST_DEPENDENCIES_PATH})
  18. IF("${PLATFORM_TARGET}" STREQUAL "x64")
  19. # We need to copy the DLL on install; note that System32 *is* the 64bit folder on 64bit arch
  20. FIND_PATH(PATH_GMobiLabDLL gMOBIlabplus.dll PATHS
  21. "C:/Windows/System32"
  22. ${LIST_DEPENDENCIES_PATH})
  23. FIND_LIBRARY(LIB_GMobiLabCAPI GMobiLabplus PATHS ${PATH_GMobiLabCAPI}/x64)
  24. ELSE()
  25. # We need to copy the DLL on install
  26. FIND_PATH(PATH_GMobiLabDLL gMOBIlabplus.dll PATHS
  27. "C:/Windows/System32"
  28. "C:/Windows/SysWOW64"
  29. ${LIST_DEPENDENCIES_PATH})
  30. FIND_LIBRARY(LIB_GMobiLabCAPI GMobiLabplus PATHS ${PATH_GMobiLabCAPI}/x86)
  31. ENDIF()
  32. IF(PATH_GMobiLabCAPI AND PATH_GMobiLabDLL AND LIB_GMobiLabCAPI)
  33. OV_PRINT(OV_PRINTED " Found gtec gMobiLabCAPI ...")
  34. OV_PRINT(OV_PRINTED " [ OK ] lib ${LIB_GMobiLabCAPI}")
  35. INCLUDE_DIRECTORIES(${PATH_GMobiLabCAPI})
  36. # Do not link to the dll! Its opened runtime with dlopen()
  37. # TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIB_GMobiLabCAPI} )
  38. INSTALL(PROGRAMS ${PATH_GMobiLabDLL}/gMOBIlabplus.dll DESTINATION ${DIST_BINDIR})
  39. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGMobiLabPlusAPI)
  40. SET(OV_ThirdPartyGMobilab "YES")
  41. ELSE()
  42. OV_PRINT(OV_PRINTED " FAILED to find gtec gMobiLabPlusAPI + lib + dll (optional driver)")
  43. #OV_PRINT(OV_PRINTED " Results were ${PATH_GMobiLabCAPI} AND ${PATH_GMobiLabDLL} AND ${LIB_GMobiLabCAPI}")
  44. ENDIF()
  45. ENDIF()
  46. IF(UNIX)
  47. FIND_LIBRARY(gMOBIlabplus_LIBRARY NAMES "gMOBIlabplus" "gmobilabplusapi" PATHS "/usr/lib" "/usr/local/lib")
  48. IF(gMOBIlabplus_LIBRARY)
  49. OV_PRINT(OV_PRINTED " Found gtec gMobiLabPlusAPI...")
  50. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${gMOBIlabplus_LIBRARY}")
  51. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyGMobiLabPlusAPI)
  52. # Do not link to the dll! Its opened runtime with dlopen()
  53. # TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gMOBIlabplus_LIBRARY} )
  54. ELSE()
  55. OV_PRINT(OV_PRINTED " FAILED to find gtec gMobiLabPlusAPI... (optional driver)")
  56. OV_PRINT(OV_PRINTED " : If it should be found, see that 'gmobilabapi.so' link exists on the fs, with no numeric suffixes in the filename.")
  57. OV_PRINT(OV_PRINTED " : e.g. do 'cd /usr/lib/ ; ln -s libgmobilabplusapi.so.1.12 libgmobilabplusapi.so' ")
  58. ENDIF()
  59. ENDIF()
  60. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyGMobiLabPlusAPI "Yes")