Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.1..3.18)

if (BUILD_MULTI_THREADING)
set(MULTI_THREADING 1)
add_definitions(-DMULTI_THREADING)
endif()

# Policies

# Include file check macros honor CMAKE_REQUIRED_LIBRARIES, CMake >= 3.12
Expand Down
10 changes: 10 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ add_library(samplerate
# ALIAS to use if libsamplerate is included from other project with add_subdirectory()
add_library(SampleRate::samplerate ALIAS samplerate)

if(MULTI_THREADING)
if(MSVC)
target_link_libraries(samplerate PRIVATE libomp)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /openmp:llvm")
else()
target_link_libraries(samplerate PRIVATE omp)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fopenmp")
endif()
endif()

# CMake generates wrong DLL names for MinGW and Cygwin, fix it
if(BUILD_SHARED_LIBS AND WIN32)
if(LIBSAMPLERATE_COMPATIBLE_NAME)
Expand Down
Loading