Skip to content

Commit

Permalink
Add version 0.4.0 of Au to conan
Browse files Browse the repository at this point in the history
Unfortunately, we discovered a small breakage in 0.4.0: we forgot to add
one of the headers to `CMakeLists.txt`.  I added a patch which fixes the
build.

Along the way, I also used Au's new options to avoid enabling tests and
bringing in the GTest dependency.  This means we don't need to keep
using a version of the existing patch file for 0.3.5.

I also updated the test file to be more idiomatic.

Fixes conan-io#26181.
  • Loading branch information
chiphogg committed Dec 15, 2024
1 parent 9a66422 commit 62558ad
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
7 changes: 7 additions & 0 deletions recipes/au/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ sources:
"0.3.5":
url: "https://github.com/aurora-opensource/au/archive/refs/tags/0.3.5.tar.gz"
sha256: "7ec826dc42968dc1633de56e4f9d06e70de73e820d2ac4788e8453343a622c9b"
"0.4.0":
url: "https://github.com/aurora-opensource/au/archive/refs/tags/0.4.0.tar.gz"
sha256: "a8ff2a145d30ce6345a59b4b8145d32516b1b6fe1f1e1b1b8af44df23d5a7f6c"
patches:
"0.3.5":
- patch_file: "patches/0001-v0.3.5-disable-gtest.patch"
patch_description: "Remove GTest dependency and disable tests build"
patch_type: "conan"
"0.4.0":
- patch_file: "patches/0001-v0.4.0-add-static-cast-checkers-to-cmake.patch"
patch_description: "Fix broken CMake build by adding static_cast_checkers"
patch_type: "conan"
2 changes: 2 additions & 0 deletions recipes/au/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def source(self):

def generate(self):
tc = CMakeToolchain(self)
tc.variables["AU_EXCLUDE_GTEST_DEPENDENCY"] = "ON"
tc.variables["AU_ENABLE_TESTING"] = "OFF"
tc.generate()

def build(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
From cbc9e0dcabad4216dcc39a6e5204c91bc08bda94 Mon Sep 17 00:00:00 2001
From: Chip Hogg <[email protected]>
Date: Sun, 15 Dec 2024 14:05:18 -0500
Subject: [PATCH] Add `static_cast_checkers` to CMake

This was apparently overlooked in #347.

Helps #359.
---
au/code/au/CMakeLists.txt | 9 +++++++++
1 file changed, 9 insertions(+)

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

2 changes: 1 addition & 1 deletion recipes/au/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace au;
int main(void) {
constexpr auto length = meters(100.0);

std::cout << length << " == " << length.in(kilo(meters)) <<" km" << std::endl;
std::cout << length << " == " << length.as(kilo(meters)) << std::endl;

return EXIT_SUCCESS;
}
2 changes: 2 additions & 0 deletions recipes/au/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"0.3.5":
folder: all
"0.4.0":
folder: all

0 comments on commit 62558ad

Please sign in to comment.