From 6aa109d9acbfc790f8719a44170c2ac5b883d84e Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Sat, 4 Jan 2020 17:37:53 +0100 Subject: [PATCH] Added macros for linking --- cmake/SfizzConfig.cmake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/cmake/SfizzConfig.cmake b/cmake/SfizzConfig.cmake index 90450eb1..80e5f710 100644 --- a/cmake/SfizzConfig.cmake +++ b/cmake/SfizzConfig.cmake @@ -16,8 +16,33 @@ if (UNIX) add_compile_options(-ffast-math) add_compile_options(-fno-omit-frame-pointer) # For debugging purposes add_compile_options(-fPIC) + endif() + +if (WIN32) + find_package(LibSndFile REQUIRED) + find_path(SNDFILE_INCLUDE_DIR sndfile.hh) + find_path(SAMPLERATE_INCLUDE_DIR samplerate.h) + add_compile_options(/std:c++17) endif() +function(SFIZZ_LINK_LIBSNDFILE TARGET) + if (WIN32) + target_link_libraries (${TARGET} PRIVATE sndfile-shared) + target_include_directories(${TARGET} PRIVATE ${SNDFILE_INCLUDE_DIR}) + else() + target_link_libraries(${TARGET} PRIVATE sndfile) + endif() +endfunction(SFIZZ_LINK_LIBSNDFILE) + +function(SFIZZ_LINK_LIBSAMPLERATE TARGET) + if (WIN32) + target_link_libraries (${TARGET} PRIVATE libsamplerate-0) + target_include_directories(${TARGET} PRIVATE ${SAMPLERATE_INCLUDE_DIR}) + else() + target_link_libraries(${TARGET} PRIVATE samplerate) + endif() +endfunction(SFIZZ_LINK_LIBSAMPLERATE) + # If we build with Clang use libc++ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT ANDROID) set(USE_LIBCPP ON CACHE BOOL "Use libc++ with clang")