diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-06 14:57:18 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-11-06 14:57:18 +0000 |
commit | 16f40922716b4d896e9dc3967fae03b32c4da4c4 (patch) | |
tree | e4e05f0f166c8795784ad8d8e67566357e17e251 | |
parent | 690d055653ecacd83000b8b0981f3e483ed10650 (diff) | |
download | rspamd-16f40922716b4d896e9dc3967fae03b32c4da4c4.tar.gz rspamd-16f40922716b4d896e9dc3967fae03b32c4da4c4.zip |
[Minor] Fix openblas detection logic (or try to)
-rw-r--r-- | CMakeLists.txt | 29 | ||||
-rw-r--r-- | contrib/kann/CMakeLists.txt | 5 |
2 files changed, 19 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d1087f2e..c6b446cac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,7 +372,7 @@ ENDFUNCTION(INSTALL_IF_NOT_EXISTS) # MODULES - modules to search using pkg_config MACRO(ProcessPackage PKG_NAME) - CMAKE_PARSE_ARGUMENTS(PKG "OPTIONAL" "ROOT;INCLUDE" + CMAKE_PARSE_ARGUMENTS(PKG "OPTIONAL;OPTIONAL_INCLUDE" "ROOT;INCLUDE" "LIBRARY;INCLUDE_SUFFIXES;LIB_SUFFIXES;MODULES;LIB_OUTPUT" ${ARGN}) IF(NOT PKG_LIBRARY) @@ -435,29 +435,38 @@ MACRO(ProcessPackage PKG_NAME) PATH_SUFFIXES ${PKG_INCLUDE_SUFFIXES} include PATHS {RSPAMD_DEFAULT_INCLUDE_PATHS}) IF(NOT _incl) - IF(PKG_OPTIONAL) + IF(PKG_OPTIONAL OR PKG_OPTIONAL_INCLUDE) MESSAGE(STATUS "Cannot find header ${PKG_INCLUDE} for package ${PKG_NAME}") ELSE() MESSAGE(FATAL_ERROR "Cannot find header ${PKG_INCLUDE} for package ${PKG_NAME}") ENDIF() + ELSE() + STRING(REGEX REPLACE "/[^/]+$" "" _incl_path "${PKG_INCLUDE}") + STRING(REGEX REPLACE "${_incl_path}/$" "" _stripped_incl "${_incl}") + INCLUDE_DIRECTORIES("${_stripped_incl}") + SET(${PKG_NAME}_INCLUDE "${_stripped_incl}" CACHE INTERNAL "") ENDIF(NOT _incl) - IF(_incl AND _lib) + IF(_lib) # We need to apply heuristic to find the real dir name - STRING(REGEX REPLACE "/[^/]+$" "" _incl_path "${PKG_INCLUDE}") - STRING(REGEX REPLACE "${_incl_path}/$" "" _stripped_incl "${_incl}") GET_FILENAME_COMPONENT(_lib_path "${_lib}" PATH) - INCLUDE_DIRECTORIES("${_stripped_incl}") LINK_DIRECTORIES("${_lib_path}") LIST(APPEND ${PKG_LIB_OUTPUT} ${_lib}) - SET(${PKG_NAME}_INCLUDE "${_stripped_incl}" CACHE INTERNAL "") SET(${PKG_NAME}_LIBRARY_PATH "${_lib_path}" CACHE INTERNAL "") SET(${PKG_NAME}_LIBRARY "${_lib}" CACHE INTERNAL "") + ENDIF() + + IF(_incl AND _lib) + MESSAGE(STATUS "Found package ${PKG_NAME} in '${_lib_path}' (${_lib}) and '${_stripped_incl}' (${PKG_INCLUDE}).") SET(${PKG_NAME}_GUESSED 1 CACHE INTERNAL "") SET(WITH_${PKG_NAME} 1 CACHE INTERNAL "") - MESSAGE(STATUS "Found package ${PKG_NAME} in '${_lib_path}' (${_lib}) and '${_stripped_incl}' (${PKG_INCLUDE}).") + ELSEIF(_lib) + IF(PKG_OPTIONAL_INCLUDE) + SET(${PKG_NAME}_GUESSED 1 INTERNAL "") + SET(WITH_${PKG_NAME} 1 INTERNAL "") + ENDIF() + MESSAGE(STATUS "Found incomplete package ${PKG_NAME} in '${_lib_path}' (${_lib}); no includes.") ENDIF() - ELSE() MESSAGE(STATUS "Found package ${PKG_NAME} (cached)") INCLUDE_DIRECTORIES("${${PKG_NAME}_INCLUDE}") @@ -647,7 +656,7 @@ ProcessPackage(SODIUM LIBRARY sodium INCLUDE sodium.h ROOT ${LIBSODIUM_ROOT_DIR} MODULES libsodium>=1.0.0) IF(ENABLE_BLAS MATCHES "ON") -ProcessPackage(BLAS LIBRARY openblas blas +ProcessPackage(BLAS OPTIONAL_INCLUDE LIBRARY openblas blas INCLUDE cblas.h INCLUDE_SUFFIXES include/openblas include/blas ROOT ${BLAS_ROOT_DIR} diff --git a/contrib/kann/CMakeLists.txt b/contrib/kann/CMakeLists.txt index 5b3ea024b..2bf32c92e 100644 --- a/contrib/kann/CMakeLists.txt +++ b/contrib/kann/CMakeLists.txt @@ -8,11 +8,6 @@ ENDIF() ADD_LIBRARY(rspamd-kann SHARED ${LIBKANNSRC}) -ProcessPackage(BLAS OPTIONAL LIBRARY openblas blas - INCLUDE cblas.h INCLUDE_SUFFIXES include/openblas - include/blas - ROOT ${BLAS_ROOT_DIR} - LIB_OUTPUT BLAS_REQUIRED_LIBRARIES) IF(WITH_BLAS) MESSAGE(STATUS "Use openblas to accelerate kann") TARGET_LINK_LIBRARIES(rspamd-kann ${BLAS_REQUIRED_LIBRARIES}) |