[aurora-au] Update to version 0.4.0 and add test port (#42679)

Co-authored-by: Jon <v-zhli17@microsoft.com>
This commit is contained in:
JonLiu1993 2024-12-24 00:17:35 +08:00 committed by GitHub
parent 119d4fffcb
commit a08d0b196f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 92 additions and 49 deletions

View File

@ -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(

View File

@ -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

View File

@ -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(

View File

@ -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/",

View File

@ -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

View File

@ -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()

View File

@ -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)

View File

@ -0,0 +1,18 @@
#include <iostream>
#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;
}

View File

@ -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
}
]
}

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "291af3f0c1c91f4c93c000063b601e8a2f0636bd",
"version-semver": "0.4.0",
"port-version": 0
},
{
"git-tree": "843b8ff14fe6b933b9888e9badec1595bdcec3bf",
"version-semver": "0.3.5",

View File

@ -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",