From ed612380878e8bf631e7d9f7434a75ca850f0101 Mon Sep 17 00:00:00 2001 From: myd7349 Date: Tue, 21 May 2019 08:08:24 +0800 Subject: [PATCH] [xproperty] Add new port (#6316) --- ports/xproperty/CONTROL | 4 +++ ports/xproperty/fix-target.patch | 44 ++++++++++++++++++++++++++++++++ ports/xproperty/portfile.cmake | 30 ++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 ports/xproperty/CONTROL create mode 100644 ports/xproperty/fix-target.patch create mode 100644 ports/xproperty/portfile.cmake diff --git a/ports/xproperty/CONTROL b/ports/xproperty/CONTROL new file mode 100644 index 0000000000..ba2ed12ab6 --- /dev/null +++ b/ports/xproperty/CONTROL @@ -0,0 +1,4 @@ +Source: xproperty +Version: 0.8.1 +Build-Depends: xtl +Description: Traitlets-like C++ properties and implementation of the observer pattern diff --git a/ports/xproperty/fix-target.patch b/ports/xproperty/fix-target.patch new file mode 100644 index 0000000000..a838b29c8d --- /dev/null +++ b/ports/xproperty/fix-target.patch @@ -0,0 +1,44 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5dcddc2..9d99227 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,7 +7,7 @@ + ############################################################################ + + cmake_minimum_required(VERSION 3.1) +-project(xproperty) ++project(xproperty CXX) + + set(XPROPERTY_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) + +@@ -28,7 +28,8 @@ message(STATUS "xproperty v${${PROJECT_NAME}_VERSION}") + # Dependencies + # ============ + +-find_package(xtl 0.5.3 REQUIRED) ++set(xtl_REQUIRED_VERSION 0.5.3) ++find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED) + message(STATUS "Found xtl: ${xtl_INCLUDE_DIRS}/xtl") + + # Build +diff --git a/xpropertyConfig.cmake.in b/xpropertyConfig.cmake.in +index 192c04f..38b305a 100644 +--- a/xpropertyConfig.cmake.in ++++ b/xpropertyConfig.cmake.in +@@ -15,7 +15,12 @@ + + @PACKAGE_INIT@ + +-set(PN xproperty) +-set_and_check(${PN}_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@") +-set(${PN}_LIBRARY "") +-check_required_components(${PN}) ++include(CMakeFindDependencyMacro) ++find_dependency(xtl @xtl_REQUIRED_VERSION@) ++ ++if(NOT TARGET @PROJECT_NAME@) ++ include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") ++ get_target_property(@PROJECT_NAME@_INCLUDE_DIR @PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES) ++endif() ++ ++set(@PROJECT_NAME@_LIBRARY "") diff --git a/ports/xproperty/portfile.cmake b/ports/xproperty/portfile.cmake new file mode 100644 index 0000000000..8a415f2a16 --- /dev/null +++ b/ports/xproperty/portfile.cmake @@ -0,0 +1,30 @@ +# header-only library + +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO QuantStack/xproperty + REF 0.8.1 + SHA512 70fcce3a3cc84be98d844aa59c14686945907db3c8fa1c9a916f0bab811ef96512464031e53f00d29cba7db750a0032f4b59d6ca524f52bc7cfe8de5cebad5e5 + HEAD_REF master + PATCHES + fix-target.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DBUILD_TESTS=OFF + -DDOWNLOAD_GTEST=OFF +) + +vcpkg_install_cmake() + +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PORT}) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib) + +# Handle copyright +configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)