File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,12 +10,25 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
1010
1111cmake_policy (SET CMP0094 NEW )
1212
13- # adds the external dependencies
14- add_subdirectory (external )
13+
14+ option (USE_SYSTEM_LIBRARIES "Use system libsamplerate and pybind instead of building separate versions" OFF )
15+ if (USE_SYSTEM_LIBRARIES)
16+ find_package (pybind11 REQUIRED )
17+ else ()
18+ # adds the external dependencies
19+ add_subdirectory (external )
20+ endif ()
1521
1622pybind11_add_module (python-samplerate src/samplerate.cpp )
1723
18- target_include_directories (python-samplerate PRIVATE ./external/libsamplerate/include )
24+ if (USE_SYSTEM_LIBRARIES)
25+ find_package (PkgConfig REQUIRED )
26+ pkg_check_modules (SAMPLERATE REQUIRED IMPORTED_TARGET GLOBAL samplerate )
27+ target_link_libraries (python-samplerate PUBLIC PkgConfig::SAMPLERATE )
28+ else ()
29+ target_include_directories (python-samplerate PRIVATE ./external/libsamplerate/include )
30+ target_link_libraries (python-samplerate PUBLIC samplerate )
31+ endif ()
1932
2033if (MSVC )
2134 target_compile_options (python-samplerate PRIVATE /EHsc /MP /bigobj )
@@ -43,4 +56,3 @@ set_target_properties(
4356 LINKER_LANGUAGE C
4457 )
4558
46- target_link_libraries (python-samplerate PUBLIC samplerate )
You can’t perform that action at this time.
0 commit comments