From 6bcfb246a245a74b18e226527665ce8eaca81434 Mon Sep 17 00:00:00 2001 From: castix Date: Tue, 25 Oct 2022 05:33:50 +0200 Subject: [PATCH 1/3] restore jack backend for portaudio --- CMakeLists.txt | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3e2caa3..01971759 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,23 @@ cmake_minimum_required(VERSION 3.1) # we use target_sources() project(Extempore VERSION 0.8.9) -# for backwards compatibility with CMake older than 3.19 -cmake_policy(SET CMP0114 OLD) +if(POLICY CMP0114) + # for backwards compatibility with CMake older than 3.19 + cmake_policy(SET CMP0114 OLD) +endif() + +if(POLICY CMP0051) + cmake_policy(SET CMP0051 NEW) +endif() + +if(POLICY CMP0075) + cmake_policy(SET CMP0075 NEW) +endif() + +if(POLICY CMP0135) + # to suppress warning about DOWNLOAD_EXTRACT_TIMESTAMP using cmake 3.24+ + cmake_policy(SET CMP0135 NEW) +endif() option(ASSETS "download multimedia assets (approx 500MB)" OFF) option(BUILD_TESTS "build test targets (including examples)" ON) @@ -15,7 +30,7 @@ set(EXTERNAL_SHLIBS (EXTERNAL_SHLIBS_AUDIO OR EXTERNAL_SHLIBS_GRAPHICS)) option(EXT_DYLIB "build extempore as a dynamic library" OFF) ## see note about the status of the Jack backend in BUILDING.md -option(JACK "use the Jack Portaudio backend" OFF) +option(JACK "use the Jack Portaudio backend" ON) ## this is useful because we can group targets together (e.g. all the AOT libs) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -350,6 +365,10 @@ target_include_directories(extempore ${CMAKE_BINARY_DIR}/portaudio/include # installed by ExternalProject ${EXT_LLVM_DIR}/include) +if(JACK) + # jack is actually cross-platform + target_link_libraries(extempore PRIVATE jack) +endif() target_link_directories(extempore PRIVATE ${CMAKE_BINARY_DIR}/portaudio/lib) target_link_libraries(extempore PRIVATE pcre portaudio${CMAKE_STATIC_LIBRARY_SUFFIX} ${LLVM_LIBRARIES}) if(UNIX AND NOT APPLE) From efd37e86c14e9308c6b0b498b96b75179a466f40 Mon Sep 17 00:00:00 2001 From: castix Date: Wed, 26 Oct 2022 01:59:24 +0200 Subject: [PATCH 2/3] restore jack backend for portaudio: attempt first with pkg-config then with find_library, making it optional if not found --- CMakeLists.txt | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01971759..a7a291b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,9 +365,36 @@ target_include_directories(extempore ${CMAKE_BINARY_DIR}/portaudio/include # installed by ExternalProject ${EXT_LLVM_DIR}/include) + if(JACK) - # jack is actually cross-platform - target_link_libraries(extempore PRIVATE jack) + #[[ + jack is actually cross-platform. + according to this comment + https://github.com/PortAudio/portaudio/blob/2dc8b6eb17ac5fda1f89722cfa0889bfc6e73434/cmake/modules/FindJACK.cmake#L17 + pipewire's jack implementation is only found by pkg-config + I don't feel like this is required anymore, since I am testing with: + $ pkg-config --modversion jack + 1.9.17 + $ pkg-config --list-all | grep jack + jack jack - PipeWire JACK API + and by commenting out the pkgconfig here it is found by find_library + so keeping mostly for backward compatibilty + ]] + find_package(PkgConfig QUIET) + if(PkgConfig_FOUND) + pkg_check_modules(JackCheck jack) + if(JackCheck_FOUND) + target_link_libraries(extempore PRIVATE jack) + endif() + else() + find_library(JackCheck_FOUND + NAMES jack + DOC "JACK library" + ) + if(JackCheck_FOUND) + target_link_libraries(extempore PRIVATE jack) + endif() + endif() endif() target_link_directories(extempore PRIVATE ${CMAKE_BINARY_DIR}/portaudio/lib) target_link_libraries(extempore PRIVATE pcre portaudio${CMAKE_STATIC_LIBRARY_SUFFIX} ${LLVM_LIBRARIES}) From 4ad65071f995aecbd20960b8ce3881f9f0a2e707 Mon Sep 17 00:00:00 2001 From: castix Date: Wed, 26 Oct 2022 03:33:19 +0200 Subject: [PATCH 3/3] restore jack backend for portaudio: disable jack if not found (unnoticed before because of cmake caching) --- CMakeLists.txt | 70 ++++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a291b9..7977ca28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -190,12 +190,49 @@ if(PACKAGE) PRIVATE -mtune=generic) endif() +######## +# JACK # +######## + +if(JACK) + #[[ + jack is actually cross-platform. + according to this comment + https://github.com/PortAudio/portaudio/blob/2dc8b6eb17ac5fda1f89722cfa0889bfc6e73434/cmake/modules/FindJACK.cmake#L17 + pipewire's jack implementation is only found by pkg-config + I don't feel like this is required anymore, since I am testing with: + $ pkg-config --modversion jack + 1.9.17 + $ pkg-config --list-all | grep jack + jack jack - PipeWire JACK API + and by commenting out the pkgconfig here it is found by find_library + so keeping mostly for backward compatibilty + ]] + find_package(PkgConfig QUIET) + if(PkgConfig_FOUND) + pkg_check_modules(JackCheck jack) + if(NOT JackCheck_FOUND) + message(NOTICE "JACK disabled because not found") + set(JACK OFF) + endif() + else() + find_library(JackCheck + NAMES jack + DOC "JACK library" + ) + if(NOT JackCheck) + message(NOTICE "JACK disabled because not found") + set(JACK OFF) + endif() + endif() +endif() + + ############# # portaudio # ############# include(ExternalProject) - ExternalProject_Add(portaudio_static PREFIX portaudio URL https://github.com/PortAudio/portaudio/archive/3f7bee79a65327d2e0965e8a74299723ed6f072d.zip @@ -365,37 +402,10 @@ target_include_directories(extempore ${CMAKE_BINARY_DIR}/portaudio/include # installed by ExternalProject ${EXT_LLVM_DIR}/include) - if(JACK) - #[[ - jack is actually cross-platform. - according to this comment - https://github.com/PortAudio/portaudio/blob/2dc8b6eb17ac5fda1f89722cfa0889bfc6e73434/cmake/modules/FindJACK.cmake#L17 - pipewire's jack implementation is only found by pkg-config - I don't feel like this is required anymore, since I am testing with: - $ pkg-config --modversion jack - 1.9.17 - $ pkg-config --list-all | grep jack - jack jack - PipeWire JACK API - and by commenting out the pkgconfig here it is found by find_library - so keeping mostly for backward compatibilty - ]] - find_package(PkgConfig QUIET) - if(PkgConfig_FOUND) - pkg_check_modules(JackCheck jack) - if(JackCheck_FOUND) - target_link_libraries(extempore PRIVATE jack) - endif() - else() - find_library(JackCheck_FOUND - NAMES jack - DOC "JACK library" - ) - if(JackCheck_FOUND) - target_link_libraries(extempore PRIVATE jack) - endif() - endif() + target_link_libraries(extempore PRIVATE jack) endif() + target_link_directories(extempore PRIVATE ${CMAKE_BINARY_DIR}/portaudio/lib) target_link_libraries(extempore PRIVATE pcre portaudio${CMAKE_STATIC_LIBRARY_SUFFIX} ${LLVM_LIBRARIES}) if(UNIX AND NOT APPLE)