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.

FindThirdPartyITPP.cmake 4.2KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. # ---------------------------------
  2. # Finds ITPP toolkit
  3. #
  4. # Sets ITPP_FOUND
  5. # Sets ITPP_LIBRARIES
  6. # Sets ITPP_LIBRARY_DIRS
  7. # Sets ITPP_LDFLAGS
  8. # Sets ITPP_LDFLAGS_OTHERS
  9. # Sets ITPP_INCLUDE_DIRS
  10. # Sets ITPP_CFLAGS
  11. # Sets ITPP_CFLAGS_OTHERS
  12. #
  13. # Adds library to target
  14. # Adds include path
  15. # ---------------------------------
  16. GET_PROPERTY(OV_PRINTED GLOBAL PROPERTY OV_TRIED_ThirdPartyITPP)
  17. IF(WIN32)
  18. FIND_PATH(PATH_ITPP include/itpp/itbase.h PATHS ${LIST_DEPENDENCIES_PATH} PATH_SUFFIXES itpp)
  19. IF(PATH_ITPP)
  20. SET(ITPP_FOUND TRUE)
  21. SET(ITPP_INCLUDE_DIRS ${PATH_ITPP}/include)
  22. # Currently the different versions we package for different VS have a bit different lib names...
  23. STRING(REGEX MATCH "vc100.*" MSVC_VER100 ${MSVC_SERVICE_PACK})
  24. STRING(REGEX MATCH "vc120.*" MSVC_VER120 ${MSVC_SERVICE_PACK})
  25. IF(MSVC_VER100)
  26. SET(ITPP_LIBRARIES libblas.a libfftw3-3 liblapack.a libgcc.a libg2c.a)
  27. SET(ITPP_LIBRARIES_RELEASE itpp)
  28. SET(ITPP_LIBRARIES_DEBUG itppd)
  29. ENDIF(MSVC_VER100)
  30. IF(MSVC_VER120)
  31. IF("${PLATFORM_TARGET}" STREQUAL "x64")
  32. SET(ITPP_LIBRARIES libfftw3-3_win64)
  33. SET(ITPP_LIBRARIES_RELEASE blas_win64_MT lapack_win64_MT itpp)
  34. SET(ITPP_LIBRARIES_DEBUG blas_win64_MT lapack_win64_MT itpp) # we dont have a good 64bit debug build, just use release
  35. ELSE()
  36. SET(ITPP_LIBRARIES libfftw3-3_win32)
  37. SET(ITPP_LIBRARIES_RELEASE blas_win32_MT lapack_win32_MT itpp)
  38. SET(ITPP_LIBRARIES_DEBUG blas_win32_MTd lapack_win32_MTd itppd)
  39. ENDIF()
  40. ENDIF(MSVC_VER120)
  41. SET(ITPP_LIBRARY_DIRS ${PATH_ITPP}/lib )
  42. ENDIF(PATH_ITPP)
  43. ENDIF(WIN32)
  44. IF(UNIX)
  45. INCLUDE("FindThirdPartyPkgConfig")
  46. FIND_PATH(PATH_ITPP include/itpp PATHS ${LIST_DEPENDENCIES_PATH})
  47. IF(PATH_ITPP)
  48. FIND_LIBRARY(ITPP_LIBRARY itpp PATHS ${PATH_ITPP}/lib)
  49. SET(ITPP_FOUND TRUE)
  50. SET(ITPP_INCLUDE_DIRS ${PATH_ITPP}/include/)
  51. GET_FILENAME_COMPONENT(ITPP_LIBRARY_DIRS ${ITPP_LIBRARY} DIRECTORY)
  52. SET(ITPP_LIBRARIES_RELEASE libitpp.so)
  53. ELSE()
  54. pkg_check_modules(ITPP itpp)
  55. ENDIF()
  56. ENDIF(UNIX)
  57. IF(ITPP_FOUND)
  58. OV_PRINT(OV_PRINTED " Found it++...")
  59. SET(ITPP_LOADING_FAILURE FALSE)
  60. INCLUDE_DIRECTORIES(${ITPP_INCLUDE_DIRS})
  61. ADD_DEFINITIONS(${ITPP_CFLAGS})
  62. ADD_DEFINITIONS(${ITPP_CFLAGS_OTHERS})
  63. # LINK_DIRECTORIES(${ITPP_LIBRARY_DIRS})
  64. FOREACH(ITPP_LIB ${ITPP_LIBRARIES})
  65. SET(ITPP_LIB1 "ITPP_LIB1-NOTFOUND")
  66. FIND_LIBRARY(ITPP_LIB1 NAMES ${ITPP_LIB} PATHS ${ITPP_LIBRARY_DIRS} ${ITPP_LIBDIR} NO_DEFAULT_PATH)
  67. IF(ITPP_LIB1)
  68. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${ITPP_LIB1}")
  69. TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ITPP_LIB1})
  70. IF(WIN32)
  71. INSTALL(FILES "${ITPP_LIBRARY_DIRS}/../bin/${ITPP_LIB}.dll" DESTINATION "${DIST_BINDIR}")
  72. ENDIF()
  73. ELSE()
  74. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${ITPP_LIB}")
  75. SET(ITPP_LOADING_FAILURE TRUE)
  76. ENDIF()
  77. ENDFOREACH()
  78. FOREACH(ITPP_LIB ${ITPP_LIBRARIES_RELEASE})
  79. SET(ITPP_LIB1 "ITPP_LIB1-RELEASE-NOTFOUND")
  80. FIND_LIBRARY(ITPP_LIB1 NAMES ${ITPP_LIB} PATHS ${ITPP_LIBRARY_DIRS} ${ITPP_LIBDIR} NO_DEFAULT_PATH)
  81. IF(ITPP_LIB1)
  82. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${ITPP_LIB1}")
  83. TARGET_LINK_LIBRARIES(${PROJECT_NAME} optimized ${ITPP_LIB1})
  84. IF(WIN32)
  85. INSTALL(FILES "${ITPP_LIBRARY_DIRS}/../bin/${ITPP_LIB}.dll" DESTINATION "${DIST_BINDIR}" CONFIGURATIONS Release)
  86. ENDIF()
  87. ELSE()
  88. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${ITPP_LIB}")
  89. SET(ITPP_LOADING_FAILURE TRUE)
  90. ENDIF()
  91. ENDFOREACH()
  92. FOREACH(ITPP_LIB ${ITPP_LIBRARIES_DEBUG})
  93. SET(ITPP_LIB1 "ITPP_LIB1-DEBUG-NOTFOUND")
  94. FIND_LIBRARY(ITPP_LIB1 NAMES ${ITPP_LIB} PATHS ${ITPP_LIBRARY_DIRS} ${ITPP_LIBDIR} NO_DEFAULT_PATH)
  95. IF(ITPP_LIB1)
  96. OV_PRINT(OV_PRINTED " [ OK ] Third party lib ${ITPP_LIB1}")
  97. TARGET_LINK_LIBRARIES(${PROJECT_NAME} debug ${ITPP_LIB1})
  98. IF(WIN32)
  99. INSTALL(FILES "${ITPP_LIBRARY_DIRS}/../bin/${ITPP_LIB}.dll" DESTINATION "${DIST_BINDIR}" CONFIGURATIONS Debug)
  100. ENDIF()
  101. ELSE()
  102. OV_PRINT(OV_PRINTED " [FAILED] Third party lib ${ITPP_LIB}")
  103. SET(ITPP_LOADING_FAILURE TRUE)
  104. ENDIF()
  105. ENDFOREACH()
  106. # We only add ITPP if everything was found
  107. IF(NOT ITPP_LOADING_FAILURE)
  108. ADD_DEFINITIONS(-DTARGET_HAS_ThirdPartyITPP)
  109. ENDIF()
  110. ELSE(ITPP_FOUND)
  111. OV_PRINT(OV_PRINTED " FAILED to find it++...")
  112. ENDIF()
  113. SET_PROPERTY(GLOBAL PROPERTY OV_TRIED_ThirdPartyITPP "Yes")