Fix simde finding on non pkg_config enabled installations

This commit is contained in:
Pete Savage 2021-07-22 15:51:00 +01:00 committed by GitHub
parent 63ad88c671
commit 7ddebc5c3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,5 @@
include(CheckCXXSourceCompiles)
# Find system threads # Find system threads
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -105,10 +107,25 @@ add_subdirectory("external/st_audiofile" EXCLUDE_FROM_ALL)
add_library(sfizz_simde INTERFACE) add_library(sfizz_simde INTERFACE)
add_library(sfizz::simde ALIAS sfizz_simde) add_library(sfizz::simde ALIAS sfizz_simde)
if(SFIZZ_USE_SYSTEM_SIMDE) if(SFIZZ_USE_SYSTEM_SIMDE)
find_package(PkgConfig REQUIRED) find_path(SIMDE_INCLUDE_DIR "simde/simde-features.h")
pkg_check_modules(SIMDE "simde" REQUIRED) if(NOT SIMDE_INCLUDE_DIR)
target_include_directories(sfizz_simde INTERFACE "${SIMDE_INCLUDE_DIRS}") message(FATAL_ERROR "Cannot find simde")
if(NOT SIMDE_VERSION OR SIMDE_VERSION VERSION_LESS_EQUAL "0.7.2") endif()
target_include_directories(sfizz_simde INTERFACE "${SIMDE_INCLUDE_DIR}")
function(sfizz_ensure_simde_version result major minor micro)
set(CMAKE_REQUIRED_INCLUDES "${SIMDE_INCLUDE_DIR}")
check_cxx_source_compiles(
"#include <simde/simde-common.h>
#if SIMDE_VERSION < HEDLEY_VERSION_ENCODE(${major}, ${minor}, ${micro})
# error Version check failed
#endif
int main() { return 0; }"
"${result}")
endfunction()
sfizz_ensure_simde_version(SFIZZ_SIMDE_AT_LEAST_0_7_3 0 7 3)
if(NOT SFIZZ_SIMDE_AT_LEAST_0_7_3)
message(WARNING "The version of SIMDe on this system has known issues. \ message(WARNING "The version of SIMDe on this system has known issues. \
It is recommended to either update if a newer version is available, or use the \ It is recommended to either update if a newer version is available, or use the \
version bundled with this package. Refer to following issues: \ version bundled with this package. Refer to following issues: \