Enable use of OpenMP simd pragmas

This commit is contained in:
Jean Pierre Cimalando 2021-02-21 22:34:41 +01:00
parent b682fa28e4
commit 2473c57cc6
2 changed files with 19 additions and 0 deletions

View file

@ -1,6 +1,16 @@
# Find system threads # Find system threads
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
# Find OpenMP
find_package(OpenMP)
if(OPENMP_FOUND)
add_library(sfizz_openmp INTERFACE)
add_library(sfizz::openmp ALIAS sfizz_openmp)
target_compile_options(sfizz_openmp INTERFACE
$<$<COMPILE_LANGUAGE:C>:${OpenMP_C_FLAGS}>
$<$<COMPILE_LANGUAGE:CXX>:${OpenMP_CXX_FLAGS}>)
endif()
# Find macOS system libraries # Find macOS system libraries
if(APPLE) if(APPLE)
find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation") find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation")
@ -71,6 +81,9 @@ 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)
target_include_directories(sfizz_simde INTERFACE "external/simde") target_include_directories(sfizz_simde INTERFACE "external/simde")
if(TARGET sfizz::openmp)
target_link_libraries(sfizz_simde INTERFACE sfizz::openmp)
endif()
# The pugixml library # The pugixml library
add_library(sfizz_pugixml STATIC "src/external/pugixml/src/pugixml.cpp") add_library(sfizz_pugixml STATIC "src/external/pugixml/src/pugixml.cpp")

View file

@ -364,3 +364,9 @@ SFIZZ_C_FLAGS += -pthread
SFIZZ_CXX_FLAGS += -pthread SFIZZ_CXX_FLAGS += -pthread
SFIZZ_LINK_FLAGS += -pthread SFIZZ_LINK_FLAGS += -pthread
endif endif
### OpenMP dependency
SFIZZ_C_FLAGS += -fopenmp
SFIZZ_CXX_FLAGS += -fopenmp
SFIZZ_LINK_FLAGS += -fopenmp