From a08d0b196fdac369716b908ccef452f18221d024 Mon Sep 17 00:00:00 2001 From: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Date: Tue, 24 Dec 2024 00:17:35 +0800 Subject: [PATCH] [aurora-au] Update to version 0.4.0 and add test port (#42679) Co-authored-by: Jon --- ports/aurora-au/disable-googletest.patch | 41 ------------------- ports/aurora-au/fix-usage.patch | 27 ++++++++++++ ports/aurora-au/portfile.cmake | 13 ++++-- ports/aurora-au/vcpkg.json | 3 +- scripts/ci.baseline.txt | 1 + .../vcpkg-ci-aurora-au/portfile.cmake | 7 ++++ .../vcpkg-ci-aurora-au/project/CMakeLists.txt | 9 ++++ .../project/test_au_client.cc | 18 ++++++++ .../test_ports/vcpkg-ci-aurora-au/vcpkg.json | 13 ++++++ versions/a-/aurora-au.json | 5 +++ versions/baseline.json | 4 +- 11 files changed, 92 insertions(+), 49 deletions(-) delete mode 100644 ports/aurora-au/disable-googletest.patch create mode 100644 ports/aurora-au/fix-usage.patch create mode 100644 scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake create mode 100644 scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt create mode 100644 scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc create mode 100644 scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json diff --git a/ports/aurora-au/disable-googletest.patch b/ports/aurora-au/disable-googletest.patch deleted file mode 100644 index ff6f750daf..0000000000 --- a/ports/aurora-au/disable-googletest.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b18407f..f1be4c0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,9 +52,6 @@ FetchContent_Declare( - # For Windows: Prevent overriding the parent project's compiler/linker settings - set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) - --FetchContent_MakeAvailable(googletest) --include(GoogleTest) -- - add_subdirectory(au) - - # Configure how Au will be installed. -diff --git a/cmake/AuConfig.cmake.in b/cmake/AuConfig.cmake.in -index b121f76..65da38a 100644 ---- a/cmake/AuConfig.cmake.in -+++ b/cmake/AuConfig.cmake.in -@@ -14,9 +14,6 @@ - - @PACKAGE_INIT@ - --include(CMakeFindDependencyMacro) --find_dependency(googletest 1.12.1) -- - include(${CMAKE_CURRENT_LIST_DIR}/AuHeaders.cmake) - - check_required_components(Au) -diff --git a/cmake/HeaderOnlyLibrary.cmake b/cmake/HeaderOnlyLibrary.cmake -index 28daf00..f2bf389 100644 ---- a/cmake/HeaderOnlyLibrary.cmake -+++ b/cmake/HeaderOnlyLibrary.cmake -@@ -75,7 +75,7 @@ function(header_only_library) - ) - - # Add the test, if requested. -- if (DEFINED ARG_GTEST_SRCS) -+ if (0) - add_executable("${ARG_NAME}_test") - target_sources("${ARG_NAME}_test" PRIVATE ${ARG_GTEST_SRCS}) - target_link_libraries( diff --git a/ports/aurora-au/fix-usage.patch b/ports/aurora-au/fix-usage.patch new file mode 100644 index 0000000000..05655a9879 --- /dev/null +++ b/ports/aurora-au/fix-usage.patch @@ -0,0 +1,27 @@ +diff --git a/au/code/au/CMakeLists.txt b/au/code/au/CMakeLists.txt +index edb965c..7c518bf 100644 +--- a/au/code/au/CMakeLists.txt ++++ b/au/code/au/CMakeLists.txt +@@ -39,6 +39,7 @@ header_only_library( + quantity.hh + quantity_point.hh + rep.hh ++ static_cast_checkers.hh + unit_of_measure.hh + unit_symbol.hh + wrapper_operations.hh +@@ -465,6 +466,14 @@ gtest_based_test( + au + ) + ++gtest_based_test( ++ NAME static_cast_checkers_test ++ SRCS ++ static_cast_checkers_test.cc ++ DEPS ++ au ++) ++ + gtest_based_test( + NAME stdx_test + SRCS diff --git a/ports/aurora-au/portfile.cmake b/ports/aurora-au/portfile.cmake index afd21242bc..d1a40500d4 100644 --- a/ports/aurora-au/portfile.cmake +++ b/ports/aurora-au/portfile.cmake @@ -4,13 +4,18 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO aurora-opensource/au REF "${VERSION}" - SHA512 4aa3282f6b76fbadd04ca572734f72c86b1b0b4e85fc21a03d1ab00b83d3aea319ab2dac3934361b5f6fa7c4a0dccece94fe0a57f3d73d208315b51b1950e374 + SHA512 7e78ac2502037ad87d3171c366c8c91b030678af26d6db75cf12384faa077e40b159b570ddd774b76bc7ca34d74d1898958b6d6b33d56a8eb5ca1f96c1a9ed66 HEAD_REF main - PATCHES - disable-googletest.patch + PATCHES + fix-usage.patch ) -vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + -DAU_EXCLUDE_GTEST_DEPENDENCY=1 + ) + vcpkg_cmake_install() vcpkg_cmake_config_fixup( diff --git a/ports/aurora-au/vcpkg.json b/ports/aurora-au/vcpkg.json index 25454f090e..ea4edb496a 100644 --- a/ports/aurora-au/vcpkg.json +++ b/ports/aurora-au/vcpkg.json @@ -1,8 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "aurora-au", - "version-semver": "0.3.5", - "port-version": 1, + "version-semver": "0.4.0", "description": "A C++14-compatible physical units library with no dependencies and a single-file delivery option. Emphasis on safety, accessibility, performance, and developer experience.", "homepage": "https://github.com/aurora-opensource/au", "documentation": "https://aurora-opensource.github.io/au/main/", diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 0d7523c889..27ef17c35b 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1239,6 +1239,7 @@ vcpkg-ci-arrow:x64-windows-static=pass vcpkg-ci-arrow:x64-windows-static-md=pass vcpkg-ci-arrow:x64-osx=pass vcpkg-ci-arrow:x64-linux=pass +vcpkg-ci-aurora-au:x64-linux=pass vcpkg-ci-boost:arm-neon-android=pass vcpkg-ci-boost:arm64-android=pass vcpkg-ci-boost:arm64-uwp=pass diff --git a/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake b/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake new file mode 100644 index 0000000000..4c14b7079f --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake @@ -0,0 +1,7 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") + +vcpkg_cmake_build() diff --git a/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt b/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt new file mode 100644 index 0000000000..6e3b93330d --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.29) + +project(vcpkg-ci-aurora-au LANGUAGES CXX) + +find_package(Au CONFIG REQUIRED) + +add_executable(test_au_client test_au_client.cc) +target_link_libraries(test_au_client PRIVATE Au::au) +target_compile_features(test_au_client PRIVATE cxx_std_14) diff --git a/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc b/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc new file mode 100644 index 0000000000..1b5e0fe72c --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc @@ -0,0 +1,18 @@ +#include + +#include "au/au.hh" +#include "au/io.hh" +#include "au/units/hours.hh" +#include "au/units/meters.hh" +#include "au/units/miles.hh" + +using ::au::symbols::h; +using ::au::symbols::mi; +constexpr auto km = ::au::kilo(::au::symbols::m); + +int main(int argc, char **argv) { + constexpr auto v = 65.0 * mi / h; + std::cout << v << ", in km/h, rounded to nearest integer, is " + << round_as(km / h, v) << std::endl; + return 0; +} diff --git a/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json b/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json new file mode 100644 index 0000000000..35f87ebbc6 --- /dev/null +++ b/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "vcpkg-ci-aurora-au", + "version-string": "ci", + "description": "Testing packages which provide AURORA-AU", + "license": null, + "dependencies": [ + "aurora-au", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/a-/aurora-au.json b/versions/a-/aurora-au.json index bcae8431ee..6d26a82cd4 100644 --- a/versions/a-/aurora-au.json +++ b/versions/a-/aurora-au.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "291af3f0c1c91f4c93c000063b601e8a2f0636bd", + "version-semver": "0.4.0", + "port-version": 0 + }, { "git-tree": "843b8ff14fe6b933b9888e9badec1595bdcec3bf", "version-semver": "0.3.5", diff --git a/versions/baseline.json b/versions/baseline.json index de88536770..694ec98b1f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -357,8 +357,8 @@ "port-version": 2 }, "aurora-au": { - "baseline": "0.3.5", - "port-version": 1 + "baseline": "0.4.0", + "port-version": 0 }, "autobahn": { "baseline": "20.8.1",