diff options
author | Alex Chronopoulos <[email protected]> | 2018-10-17 11:59:16 +0200 |
---|---|---|
committer | Matthew Gregan <[email protected]> | 2018-10-18 10:18:18 +1300 |
commit | d4b8c31cfd0a1de95f3925c5d88612baa41a2590 (patch) | |
tree | 355b105b077ad8f63805eb009d79887f83589f3f /CMakeLists.txt | |
parent | 455981555e37a0153e5dd4d4517f073262946519 (diff) | |
download | cubeb-d4b8c31cfd0a1de95f3925c5d88612baa41a2590.tar.gz cubeb-d4b8c31cfd0a1de95f3925c5d88612baa41a2590.zip |
Build and link pulse rust backend if available.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d7c0467..810fe67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ project(cubeb option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_TESTS "Build tests" ON) +option(BUILD_RUST_LIBS "Build rust backends" OFF) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING @@ -39,6 +40,12 @@ if(BUILD_TESTS) endif() endif() +if (BUILD_RUST_LIBS) + if(EXISTS "${PROJECT_SOURCE_DIR}/src/cubeb-pulse-rs") + set(USE_PULSE_RUST 1) + endif() +endif() + # On OS/2, visibility attribute is not supported. if(NOT OS2) set(CMAKE_C_VISIBILITY_PRESET hidden) @@ -222,6 +229,24 @@ if(USE_KAI) target_link_libraries(cubeb PRIVATE kai) endif() +if(USE_PULSE_RUST) + include(ExternalProject) + set_directory_properties(PROPERTIES EP_PREFIX ${CMAKE_BINARY_DIR}/rust) + ExternalProject_Add( + cubeb_pulse_rs + DOWNLOAD_COMMAND "" + CONFIGURE_COMMAND "" + BUILD_COMMAND cargo build COMMAND cargo build --release + BINARY_DIR "${CMAKE_SOURCE_DIR}/src/cubeb-pulse-rs" + INSTALL_COMMAND "" + LOG_BUILD ON) + add_dependencies(cubeb cubeb_pulse_rs) + target_compile_definitions(cubeb PRIVATE USE_PULSE_RUST) + target_link_libraries(cubeb PRIVATE + debug "${CMAKE_SOURCE_DIR}/src/cubeb-pulse-rs/target/debug/libcubeb_pulse.a" + optimized "${CMAKE_SOURCE_DIR}/src/cubeb-pulse-rs/target/release/libcubeb_pulse.a") +endif() + find_package(Doxygen) if(DOXYGEN_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile @ONLY) |