From 44015706042227176071fdbb373cf8fb825229e1 Mon Sep 17 00:00:00 2001 From: efesxzc Date: Sun, 19 May 2024 00:17:30 +0500 Subject: [PATCH 1/9] [hdr-histogram] add new port --- ports/hdr-histogram/portfile.cmake | 30 ++++++++++++++++++++++++++++++ ports/hdr-histogram/usage | 22 ++++++++++++++++++++++ ports/hdr-histogram/vcpkg.json | 17 +++++++++++++++++ 3 files changed, 69 insertions(+) create mode 100644 ports/hdr-histogram/portfile.cmake create mode 100644 ports/hdr-histogram/usage create mode 100644 ports/hdr-histogram/vcpkg.json diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake new file mode 100644 index 00000000000000..1f44f8bcc73287 --- /dev/null +++ b/ports/hdr-histogram/portfile.cmake @@ -0,0 +1,30 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO HdrHistogram/HdrHistogram_c + REF ${VERSION} + SHA512 2ede4b8412c4f0070d555515498e163397de5edebe7560eaea13adcb95a52b7fea99686aed06bbca0c6e8afdf65715483c3889d750f6b5b727bcf43c4fbe18d4 +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + # Do not build tests and examples + -DHDR_HISTOGRAM_BUILD_PROGRAMS="OFF" +) + +vcpkg_cmake_install() + +vcpkg_cmake_config_fixup( + PACKAGE_NAME hdr_histogram + CONFIG_PATH lib/cmake/hdr_histogram +) + +vcpkg_fixup_pkgconfig() + +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt" "${SOURCE_PATH}/COPYING.txt") + +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") diff --git a/ports/hdr-histogram/usage b/ports/hdr-histogram/usage new file mode 100644 index 00000000000000..113e6c132e8821 --- /dev/null +++ b/ports/hdr-histogram/usage @@ -0,0 +1,22 @@ +The package hdr_histogram can be used via CMake: + + find_path(HDR_HISTOGRAM_INCLUDE_DIR NAMES "hdr/hdr_histogram.h" REQUIRED) + target_include_directories(main PRIVATE ${HDR_HISTOGRAM_INCLUDE_DIR}) + + find_library(HDR_HISTOGRAM_LIB_STATIC hdr_histogram_static REQUIRED) + target_link_libraries(main PRIVATE ${HDR_HISTOGRAM_LIB}) + + # Or you can also use dynamic linkage: + find_library(HDR_HISTOGRAM_LIB hdr_histogram REQUIRED) + target_link_libraries(main PRIVATE ${HDR_HISTOGRAM_LIB_STATIC}) + +The package hdr_histogram can be imported via CMake FindPkgConfig module: + + find_package(hdr_histogram CONFIG REQUIRED) + + find_path(HDR_HISTOGRAM_INCLUDE_DIR NAMES "hdr/hdr_histogram.h" REQUIRED) + target_include_directories(main PRIVATE ${HDR_HISTOGRAM_INCLUDE_DIR}) + + target_link_libraries(main PRIVATE hdr_histogram::hdr_histogram_static) + # Or you can also use dynamic linkage: + target_link_libraries(main PRIVATE hdr_histogram::hdr_histogram) diff --git a/ports/hdr-histogram/vcpkg.json b/ports/hdr-histogram/vcpkg.json new file mode 100644 index 00000000000000..5a5781ffcb1ba6 --- /dev/null +++ b/ports/hdr-histogram/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "hdr-histogram", + "version-semver": "0.11.8", + "description": "'C' port of High Dynamic Range (HDR) Histogram", + "homepage": "https://github.com/HdrHistogram/HdrHistogram_c", + "license": "CC0-1.0", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} From d16ca281839d0b7ec866a645edf2f5e3d7f0836a Mon Sep 17 00:00:00 2001 From: efesxzc Date: Sun, 19 May 2024 00:32:07 +0500 Subject: [PATCH 2/9] run ./vcpkg x-add-version --all --- versions/baseline.json | 4 ++++ versions/h-/hdr-histogram.json | 9 +++++++++ 2 files changed, 13 insertions(+) create mode 100644 versions/h-/hdr-histogram.json diff --git a/versions/baseline.json b/versions/baseline.json index 9a70e2da564c3c..efedfe49a7d5d2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3376,6 +3376,10 @@ "baseline": "1.14.2", "port-version": 0 }, + "hdr-histogram": { + "baseline": "0.11.8", + "port-version": 0 + }, "healpix": { "baseline": "1.12.10", "port-version": 9 diff --git a/versions/h-/hdr-histogram.json b/versions/h-/hdr-histogram.json new file mode 100644 index 00000000000000..f196be30c27d66 --- /dev/null +++ b/versions/h-/hdr-histogram.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "ffa0e79cdd6c84b83167e0e543d43588e6386c12", + "version-semver": "0.11.8", + "port-version": 0 + } + ] +} From baaedc81ee7841899f5946a994e8a18afbaf1836 Mon Sep 17 00:00:00 2001 From: efesxzc Date: Sun, 19 May 2024 01:07:19 +0500 Subject: [PATCH 3/9] add a dependency on zlib --- ports/hdr-histogram/vcpkg.json | 3 ++- versions/h-/hdr-histogram.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ports/hdr-histogram/vcpkg.json b/ports/hdr-histogram/vcpkg.json index 5a5781ffcb1ba6..1cf1579b768798 100644 --- a/ports/hdr-histogram/vcpkg.json +++ b/ports/hdr-histogram/vcpkg.json @@ -12,6 +12,7 @@ { "name": "vcpkg-cmake-config", "host": true - } + }, + "zlib" ] } diff --git a/versions/h-/hdr-histogram.json b/versions/h-/hdr-histogram.json index f196be30c27d66..7ca70810b0f439 100644 --- a/versions/h-/hdr-histogram.json +++ b/versions/h-/hdr-histogram.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "ffa0e79cdd6c84b83167e0e543d43588e6386c12", + "git-tree": "20cb84e000ce2c777beb2f2f9eede50aa61395b1", "version-semver": "0.11.8", "port-version": 0 } From bbcfd4aa0f2f861a1c9ea904d2c228f18c7c7c8e Mon Sep 17 00:00:00 2001 From: efesxzc Date: Sun, 19 May 2024 16:28:15 +0500 Subject: [PATCH 4/9] add some features --- ports/hdr-histogram/portfile.cmake | 21 +++++++++++++++++++-- ports/hdr-histogram/usage | 22 ++-------------------- ports/hdr-histogram/vcpkg.json | 13 ++++++++++--- versions/h-/hdr-histogram.json | 2 +- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index 1f44f8bcc73287..cd0fe8963d9e62 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -5,11 +5,28 @@ vcpkg_from_github( SHA512 2ede4b8412c4f0070d555515498e163397de5edebe7560eaea13adcb95a52b7fea99686aed06bbca0c6e8afdf65715483c3889d750f6b5b727bcf43c4fbe18d4 ) +vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS + FEATURES + log HDR_LOG_REQUIRED +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_BUILD_STATIC:BOOL=OFF") + list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_INSTALL_STATIC:BOOL=OFF") +else() + list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_BUILD_SHARED:BOOL=OFF") + list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_INSTALL_SHARED:BOOL=OFF") +endif() + +# Do not build tests and examples +list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_BUILD_PROGRAMS:BOOL=OFF") + +message(STATUS "Using the following features: ${FEATURE_OPTIONS}") + vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - # Do not build tests and examples - -DHDR_HISTOGRAM_BUILD_PROGRAMS="OFF" + ${FEATURE_OPTIONS} ) vcpkg_cmake_install() diff --git a/ports/hdr-histogram/usage b/ports/hdr-histogram/usage index 113e6c132e8821..5eaa6dce03bd79 100644 --- a/ports/hdr-histogram/usage +++ b/ports/hdr-histogram/usage @@ -1,22 +1,4 @@ -The package hdr_histogram can be used via CMake: - - find_path(HDR_HISTOGRAM_INCLUDE_DIR NAMES "hdr/hdr_histogram.h" REQUIRED) - target_include_directories(main PRIVATE ${HDR_HISTOGRAM_INCLUDE_DIR}) - - find_library(HDR_HISTOGRAM_LIB_STATIC hdr_histogram_static REQUIRED) - target_link_libraries(main PRIVATE ${HDR_HISTOGRAM_LIB}) - - # Or you can also use dynamic linkage: - find_library(HDR_HISTOGRAM_LIB hdr_histogram REQUIRED) - target_link_libraries(main PRIVATE ${HDR_HISTOGRAM_LIB_STATIC}) - -The package hdr_histogram can be imported via CMake FindPkgConfig module: +hdr_histogram provides CMake targets: find_package(hdr_histogram CONFIG REQUIRED) - - find_path(HDR_HISTOGRAM_INCLUDE_DIR NAMES "hdr/hdr_histogram.h" REQUIRED) - target_include_directories(main PRIVATE ${HDR_HISTOGRAM_INCLUDE_DIR}) - - target_link_libraries(main PRIVATE hdr_histogram::hdr_histogram_static) - # Or you can also use dynamic linkage: - target_link_libraries(main PRIVATE hdr_histogram::hdr_histogram) + target_link_libraries(main PRIVATE $,hdr_histogram::hdr_histogram,hdr_histogram::hdr_histogram_static>) diff --git a/ports/hdr-histogram/vcpkg.json b/ports/hdr-histogram/vcpkg.json index 1cf1579b768798..38d3976327e285 100644 --- a/ports/hdr-histogram/vcpkg.json +++ b/ports/hdr-histogram/vcpkg.json @@ -12,7 +12,14 @@ { "name": "vcpkg-cmake-config", "host": true - }, - "zlib" - ] + } + ], + "features": { + "log": { + "description": "Logging support for HdrHistogram", + "dependencies": [ + "zlib" + ] + } + } } diff --git a/versions/h-/hdr-histogram.json b/versions/h-/hdr-histogram.json index 7ca70810b0f439..5220a78bcdab67 100644 --- a/versions/h-/hdr-histogram.json +++ b/versions/h-/hdr-histogram.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "20cb84e000ce2c777beb2f2f9eede50aa61395b1", + "git-tree": "1ec0bb5a30e4afe708b464a0cc9c19b8f26fbecd", "version-semver": "0.11.8", "port-version": 0 } From 3fbee5c566184a2726ef116639c31acd6a15a8e7 Mon Sep 17 00:00:00 2001 From: EfesX Date: Mon, 20 May 2024 20:42:00 +0500 Subject: [PATCH 5/9] Update ports/hdr-histogram/portfile.cmake Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com> --- ports/hdr-histogram/portfile.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index cd0fe8963d9e62..194c902d9cd488 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -3,6 +3,7 @@ vcpkg_from_github( REPO HdrHistogram/HdrHistogram_c REF ${VERSION} SHA512 2ede4b8412c4f0070d555515498e163397de5edebe7560eaea13adcb95a52b7fea99686aed06bbca0c6e8afdf65715483c3889d750f6b5b727bcf43c4fbe18d4 + HEAD_REF main ) vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS From 3448201d80de53964c44e127bdb370756bf1d717 Mon Sep 17 00:00:00 2001 From: EfesX Date: Mon, 20 May 2024 20:42:23 +0500 Subject: [PATCH 6/9] Update ports/hdr-histogram/portfile.cmake Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com> --- ports/hdr-histogram/portfile.cmake | 2 -- 1 file changed, 2 deletions(-) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index 194c902d9cd488..7ca2799d8955d7 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -22,8 +22,6 @@ endif() # Do not build tests and examples list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_BUILD_PROGRAMS:BOOL=OFF") -message(STATUS "Using the following features: ${FEATURE_OPTIONS}") - vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS From a0d86e554655b0f75a637a8f75d84de75a4dc05c Mon Sep 17 00:00:00 2001 From: efesxzc Date: Mon, 20 May 2024 20:53:21 +0500 Subject: [PATCH 7/9] fix 'log' feature --- ports/hdr-histogram/portfile.cmake | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index 7ca2799d8955d7..cd399b61b8ed25 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -6,10 +6,11 @@ vcpkg_from_github( HEAD_REF main ) -vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS - FEATURES - log HDR_LOG_REQUIRED -) +if("log" IN_LIST FEATURES) + list(APPEND FEATURE_OPTIONS "-DHDR_LOG_REQUIRED=ON") +else() + list(APPEND FEATURE_OPTIONS "-DHDR_LOG_REQUIRED=DISABLED") +endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") list(APPEND FEATURE_OPTIONS "-DHDR_HISTOGRAM_BUILD_STATIC:BOOL=OFF") @@ -44,3 +45,9 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt" "${SOURCE_PATH}/COPYING.txt") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +# hdr_histogram needs zlib only for 'log' option, but cmake-config.in contains a hardcoded dependecy on zlib +if("log" IN_LIST FEATURES) +else() + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/hdr_histogram/hdr_histogram-config.cmake" "find_package(ZLIB)" "") +endif() From d40bfdf0ec0cf5b9fbc8981a2d8db0bf6373d08f Mon Sep 17 00:00:00 2001 From: efesxzc Date: Mon, 20 May 2024 21:39:50 +0500 Subject: [PATCH 8/9] fix build on windows hdr_histogram doesn't generate a .lib file for dynamic linking, so it is not possible to compile with MSVC --- ports/hdr-histogram/portfile.cmake | 4 ++++ versions/h-/hdr-histogram.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index cd399b61b8ed25..ff6c8ec16296c0 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -1,3 +1,7 @@ +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_check_linkage(ONLY_STATIC_LIBRARY) +endif() + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO HdrHistogram/HdrHistogram_c diff --git a/versions/h-/hdr-histogram.json b/versions/h-/hdr-histogram.json index 5220a78bcdab67..94fb3abecd9198 100644 --- a/versions/h-/hdr-histogram.json +++ b/versions/h-/hdr-histogram.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "1ec0bb5a30e4afe708b464a0cc9c19b8f26fbecd", + "git-tree": "23ce0cb5e86b6c3dd7df184512119dd0f33f68a3", "version-semver": "0.11.8", "port-version": 0 } From 466ef4efdc1cca63a57060e970ecb6728ad8fbb7 Mon Sep 17 00:00:00 2001 From: efesxzc Date: Mon, 20 May 2024 22:06:05 +0500 Subject: [PATCH 9/9] zlib as a necessary dependency Because the Android platform requires it, there was a compilation error after the previous commit: Package 'zlib', required by 'hdr_histogram', not found. --- ports/hdr-histogram/portfile.cmake | 6 ------ ports/hdr-histogram/vcpkg.json | 3 ++- versions/h-/hdr-histogram.json | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ports/hdr-histogram/portfile.cmake b/ports/hdr-histogram/portfile.cmake index ff6c8ec16296c0..265e72bb9e3196 100644 --- a/ports/hdr-histogram/portfile.cmake +++ b/ports/hdr-histogram/portfile.cmake @@ -49,9 +49,3 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt" "${SOURCE_PATH}/COPYING.txt") file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") - -# hdr_histogram needs zlib only for 'log' option, but cmake-config.in contains a hardcoded dependecy on zlib -if("log" IN_LIST FEATURES) -else() - vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/hdr_histogram/hdr_histogram-config.cmake" "find_package(ZLIB)" "") -endif() diff --git a/ports/hdr-histogram/vcpkg.json b/ports/hdr-histogram/vcpkg.json index 38d3976327e285..a09be7dd1fd084 100644 --- a/ports/hdr-histogram/vcpkg.json +++ b/ports/hdr-histogram/vcpkg.json @@ -12,7 +12,8 @@ { "name": "vcpkg-cmake-config", "host": true - } + }, + "zlib" ], "features": { "log": { diff --git a/versions/h-/hdr-histogram.json b/versions/h-/hdr-histogram.json index 94fb3abecd9198..c3c2af4ed6db35 100644 --- a/versions/h-/hdr-histogram.json +++ b/versions/h-/hdr-histogram.json @@ -1,7 +1,7 @@ { "versions": [ { - "git-tree": "23ce0cb5e86b6c3dd7df184512119dd0f33f68a3", + "git-tree": "e7c8179ec8d0d5a49010bea92f143f011de137da", "version-semver": "0.11.8", "port-version": 0 }