Global definition of LIBATOMIC_FOUND for arm benchmarks

This commit is contained in:
Paul Ferrand 2020-03-07 14:18:47 +01:00 committed by Paul Fd
parent 2e020cb213
commit 57eadc7a93
3 changed files with 11 additions and 7 deletions

View file

@ -27,7 +27,10 @@ macro(sfizz_add_benchmark TARGET)
target_link_libraries("${TARGET}" target_link_libraries("${TARGET}"
PRIVATE absl::span absl::algorithm PRIVATE absl::span absl::algorithm
PRIVATE benchmark::benchmark benchmark::benchmark_main PRIVATE benchmark::benchmark benchmark::benchmark_main
PRIVATE bm_simd bm_ftz) PRIVATE bm_simd bm_ftz)
if (LIBATOMIC_FOUND)
target_link_libraries ("${TARGET}" PRIVATE atomic)
endif()
target_include_directories("${TARGET}" PRIVATE ../src/sfizz ../src/external) target_include_directories("${TARGET}" PRIVATE ../src/sfizz ../src/external)
endmacro() endmacro()

View file

@ -66,6 +66,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID)
endif() endif()
endif() endif()
include (CheckLibraryExists)
if (UNIX AND NOT APPLE)
check_library_exists(atomic __atomic_load "" LIBATOMIC_FOUND)
endif()
# Don't show build information when building a different project # Don't show build information when building a different project
function (show_build_info_if_needed) function (show_build_info_if_needed)
if (CMAKE_PROJECT_NAME STREQUAL "sfizz") if (CMAKE_PROJECT_NAME STREQUAL "sfizz")

View file

@ -1,5 +1,4 @@
include (GNUInstallDirs) include (GNUInstallDirs)
include (CheckLibraryExists)
set (SFIZZ_SOURCES set (SFIZZ_SOURCES
sfizz/Synth.cpp sfizz/Synth.cpp
@ -55,11 +54,8 @@ endif()
add_library (sfizz::parser ALIAS sfizz_parser) add_library (sfizz::parser ALIAS sfizz_parser)
add_library (sfizz::sfizz ALIAS sfizz_static) add_library (sfizz::sfizz ALIAS sfizz_static)
if (UNIX AND NOT APPLE) if (LIBATOMIC_FOUND)
check_library_exists(atomic __atomic_load "" LIBATOMIC_FOUND) target_link_libraries (sfizz_static PRIVATE atomic)
if (LIBATOMIC_FOUND)
target_link_libraries (sfizz_static PRIVATE atomic)
endif()
endif() endif()
# Shared library and installation target # Shared library and installation target