File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -10,12 +10,25 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
10
10
11
11
cmake_policy (SET CMP0094 NEW )
12
12
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 ()
15
21
16
22
pybind11_add_module (python-samplerate src/samplerate.cpp )
17
23
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 ()
19
32
20
33
if (MSVC )
21
34
target_compile_options (python-samplerate PRIVATE /EHsc /MP /bigobj )
@@ -43,4 +56,3 @@ set_target_properties(
43
56
LINKER_LANGUAGE C
44
57
)
45
58
46
- target_link_libraries (python-samplerate PUBLIC samplerate )
You can’t perform that action at this time.
0 commit comments