Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix simde finding on non pkg_config enabled installations #958

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions cmake/SfizzDeps.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include(CheckCXXSourceCompiles)

# Find system threads
find_package(Threads REQUIRED)

Expand Down Expand Up @@ -105,10 +107,25 @@ add_subdirectory("external/st_audiofile" EXCLUDE_FROM_ALL)
add_library(sfizz_simde INTERFACE)
add_library(sfizz::simde ALIAS sfizz_simde)
if(SFIZZ_USE_SYSTEM_SIMDE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SIMDE "simde" REQUIRED)
target_include_directories(sfizz_simde INTERFACE "${SIMDE_INCLUDE_DIRS}")
if(NOT SIMDE_VERSION OR SIMDE_VERSION VERSION_LESS_EQUAL "0.7.2")
find_path(SIMDE_INCLUDE_DIR "simde/simde-features.h")
if(NOT SIMDE_INCLUDE_DIR)
message(FATAL_ERROR "Cannot find simde")
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. \
It is recommended to either update if a newer version is available, or use the \
version bundled with this package. Refer to following issues: \
Expand Down