[new port] Ableton Link (#25438)

* Initial port for Ableton Link

* Added missing versions/a-/ableton.json file

* Added double quotes to all relative paths in portfile.cmake

* Removed CMakeLists.txt file from the installed files

* Use Catch2 only in CMakeLists.txt, when test features are enabled

* Made find_package asio conditional too
This commit is contained in:
JoergAtGithub 2022-07-06 00:49:35 +02:00 committed by GitHub
parent e2fb66462a
commit 06d29adda9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 257 additions and 0 deletions

View File

@ -0,0 +1,20 @@
diff --git "a/AbletonLinkConfig.cmake" "b/AbletonLinkConfig.cmake"
index 43b66e7..1e84fa5 100644
--- "a/AbletonLinkConfig.cmake"
+++ "b/AbletonLinkConfig.cmake"
@@ -5,7 +5,7 @@ endif()
add_library(Ableton::Link IMPORTED INTERFACE)
set_property(TARGET Ableton::Link APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES
- ${CMAKE_CURRENT_LIST_DIR}/include
+ ${CMAKE_CURRENT_LIST_DIR}/../../include/ableton
)
# Force C++11 support for consuming targets
@@ -46,5 +46,5 @@ set_property(TARGET Ableton::Link APPEND PROPERTY
set_property(TARGET Ableton::Link APPEND PROPERTY
INTERFACE_SOURCES
- ${CMAKE_CURRENT_LIST_DIR}/include/ableton/Link.hpp
+ ${CMAKE_CURRENT_LIST_DIR}/../../include/ableton/Link.hpp
)

View File

@ -0,0 +1,70 @@
#header-only library
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Ableton/link
REF 2641130bca65cdfb95794b31a6453a825333bd28
SHA512 a7c2e2904fe3e0b10affd5482f057c39634cf8935a09732a7ac3b33096754e6a5dbb4545cd51c327c74383065d2dd046ec40ff68fda3013ad1bf8ff4165b469f
HEAD_REF master
PATCHES
replace_local_asiostandalone_by_vcpkg_asio.patch
replace_local_catch_by_vcpkg_catch2.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"discoverytest" LinkDiscoveryTest
"coretest" LinkCoreTest
"hut" LinkHut
"hutsilent" LinkHutSilent
)
file(REMOVE_RECURSE "${SOURCE_PATH}/ci")
file(REMOVE_RECURSE "${SOURCE_PATH}/modules")
file(REMOVE_RECURSE "${SOURCE_PATH}/third_party")
set(NEED_CATCH2 OFF)
if ("coretest" IN_LIST FEATURES)
set(NEED_CATCH2 ON)
endif()
if ("discoverytest" IN_LIST FEATURES)
set(NEED_CATCH2 ON)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DNEED_CATCH2=${NEED_CATCH2}
)
if ("coretest" IN_LIST FEATURES)
vcpkg_cmake_build(TARGET LinkCoreTest)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/bin/LinkCoreTest${VCPKG_TARGET_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
if ("discoverytest" IN_LIST FEATURES)
vcpkg_cmake_build(TARGET LinkDiscoveryTest)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/bin/LinkDiscoveryTest${VCPKG_TARGET_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
if ("hut" IN_LIST FEATURES)
vcpkg_cmake_build(TARGET LinkHut)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/bin/LinkHut${VCPKG_TARGET_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
if ("hutsilent" IN_LIST FEATURES)
vcpkg_cmake_build(TARGET LinkHutSilent)
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/bin/LinkHutSilent${VCPKG_TARGET_EXECUTABLE_SUFFIX}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
endif()
# We must not correct the CMake include path before build
vcpkg_apply_patches(
SOURCE_PATH "${SOURCE_PATH}"
PATCHES
correct_cmake_include_directory.patch
)
file(INSTALL "${SOURCE_PATH}/AbletonLinkConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/")
file(INSTALL "${SOURCE_PATH}/cmake_include/" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/cmake_include/")
file(INSTALL "${SOURCE_PATH}/include/" DESTINATION "${CURRENT_PACKAGES_DIR}/include" PATTERN "CMakeLists.txt" EXCLUDE)
# Handle copyright
file(INSTALL "${SOURCE_PATH}/LICENSE.md" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -0,0 +1,21 @@
diff a/cmake_include/AsioStandaloneConfig.cmake b/AsioStandaloneConfig.cmake
--- a/cmake_include/AsioStandaloneConfig.cmake
+++ b/cmake_include/AsioStandaloneConfig.cmake
@@ -1,6 +1,12 @@
add_library(AsioStandalone::AsioStandalone IMPORTED INTERFACE)
+if (LINK_BUILD_ASIO MATCHES "ON")
-set_property(TARGET AsioStandalone::AsioStandalone APPEND PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES
- ${CMAKE_CURRENT_LIST_DIR}/../modules/asio-standalone/asio/include
-)
+ find_package(asio REQUIRED)
+ if(asio_FOUND)
+ message(STATUS "Dependency asio found in ${asio_DIR}")
+ set_property(TARGET AsioStandalone::AsioStandalone APPEND PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES
+ ${asio_DIR}/../../include
+ )
+ endif()
+endif()

View File

@ -0,0 +1,90 @@
--- ableton-link.orig/cmake_include/CatchConfig.cmake
+++ ableton-link/cmake_include/CatchConfig.cmake
@@ -1,6 +1,12 @@
-add_library(Catch::Catch IMPORTED INTERFACE)
+if (NEED_CATCH2 MATCHES "ON")
+ add_library(Catch::Catch IMPORTED INTERFACE)
-set_property(TARGET Catch::Catch APPEND PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES
- ${CMAKE_CURRENT_LIST_DIR}/../third_party/catch
-)
+ find_package(Catch2 CONFIG REQUIRED)
+ if(Catch2_FOUND)
+ message(STATUS "Dependency Catch2 found in ${Catch2_DIR}")
+ set_property(TARGET Catch::Catch APPEND PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES
+ ${Catch2_DIR}/../../include
+ )
+ endif()
+endif()
--- "a/src/CMakeLists.txt"
+++ "b/src/CMakeLists.txt"
@@ -78,7 +78,12 @@ function(configure_link_test_executable target)
if(CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD|GNU")
target_link_libraries(${target} atomic pthread)
endif()
- target_link_libraries(${target} Catch::Catch Ableton::Link)
+ if (NEED_CATCH2 MATCHES "ON")
+ target_link_libraries(${target} Catch2::Catch2WithMain Ableton::Link)
target_compile_definitions(${target} PRIVATE -DCATCH_CONFIG_ENABLE_BENCHMARKING=1)
+ else()
+ target_link_libraries(${target} Ableton::Link)
+ target_compile_definitions(${target} PRIVATE -DCATCH_CONFIG_ENABLE_BENCHMARKING=0)
+ endif()
endfunction()
--- "a/src/ableton/link/tst_LinearRegression.cpp"
+++ "b/src/ableton/link/tst_LinearRegression.cpp"
@@ -22,6 +22,8 @@
#include <array>
#include <vector>
+using Catch::Approx;
+
namespace ableton
{
namespace link
--- "a/src/ableton/link/tst_Beats.cpp"
+++ "b/src/ableton/link/tst_Beats.cpp"
@@ -20,6 +20,8 @@
#include <ableton/link/Beats.hpp>
#include <ableton/test/CatchWrapper.hpp>
+using Catch::Approx;
+
namespace ableton
{
namespace link
--- "a/src/ableton/link/tst_Median.cpp"
+++ "b/src/ableton/link/tst_Median.cpp"
@@ -22,6 +22,8 @@
#include <array>
#include <vector>
+using Catch::Approx;
+
namespace ableton
{
namespace link
--- "a/src/ableton/link/tst_Tempo.cpp"
+++ "b/src/ableton/link/tst_Tempo.cpp"
@@ -20,6 +20,8 @@
#include <ableton/link/Tempo.hpp>
#include <ableton/test/CatchWrapper.hpp>
+using Catch::Approx;
+
namespace ableton
{
namespace link

42
ports/ableton/vcpkg.json Normal file
View File

@ -0,0 +1,42 @@
{
"name": "ableton",
"version": "3.0.5",
"description": "Ableton Link, a technology that synchronizes musical beat, tempo, and phase across multiple applications running on one or more devices.",
"homepage": "https://www.ableton.com/en/link/",
"documentation": "http://ableton.github.io/link/",
"license": "GPL-2.0-or-later",
"dependencies": [
{
"name": "asio",
"platform": "windows"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"coretest": {
"description": "Build LinkCoreTest suite",
"dependencies": [
"catch2"
]
},
"discoverytest": {
"description": "Build LinkDiscoveryTest suite",
"dependencies": [
"catch2"
]
},
"hut": {
"description": "Build LinkHut command line tool"
},
"hutsilent": {
"description": "Build LinkHutSilent command line tool"
}
}
}

9
versions/a-/ableton.json Normal file
View File

@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "bac28c4912d6fd4e32ad716ec8bf4e197c9a4cb8",
"version": "3.0.5",
"port-version": 0
}
]
}

View File

@ -8,6 +8,11 @@
"baseline": "21.07",
"port-version": 1
},
"ableton": {
"baseline": "3.0.5",
"port-version": 0
},
"abseil": {
"baseline": "20211102.1",
"port-version": 0