diff --git a/.github/workflows/cmake-client-build-and-test.yml b/.github/workflows/cmake-client-build-and-test.yml new file mode 100644 index 0000000..034fd37 --- /dev/null +++ b/.github/workflows/cmake-client-build-and-test.yml @@ -0,0 +1,47 @@ +# Copyright 2024 Aurora Operations, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: cmake-client-build-and-test + +on: + push: + branches: + - main + pull_request: + +jobs: + cmake-build-and-test: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b #v4.1.5 + - name: Setup CMake + uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be #v2.0.2 + with: + cmake-version: '3.29.x' + - name: Generate build files for Au + run: cmake -S . -B cmake/build -DAU_EXCLUDE_GTEST_DEPENDENCY=TRUE -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=TRUE + - name: Build Au + run: cmake --build cmake/build --target all all_verify_interface_header_sets + - name: Install Au + run: cmake --install cmake/build --prefix "$PWD/cmake/install" + - name: Generate build files for client + run: cmake -S . -B build -DCMAKE_PREFIX_PATH="$PWD/../cmake/install" + working-directory: test_package + - name: Build client + run: cmake --build build --target all + working-directory: test_package + - name: Run executable + run: ./build/test_au_client + working-directory: test_package diff --git a/.gitignore b/.gitignore index 3b3f18c..ab5c2f8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /bazel-* cmake/build* +cmake/install* +test_package/build* Testing 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/test_package/CMakeLists.txt b/test_package/CMakeLists.txt new file mode 100644 index 0000000..642ca0f --- /dev/null +++ b/test_package/CMakeLists.txt @@ -0,0 +1,23 @@ +# Copyright 2024 Aurora Operations, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required(VERSION 3.29) + +project(test_au_client LANGUAGES CXX) + +find_package(Au REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_au_client.cc) +target_link_libraries(${PROJECT_NAME} PRIVATE Au::au) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/test_package/test_au_client.cc b/test_package/test_au_client.cc new file mode 100644 index 0000000..d93011c --- /dev/null +++ b/test_package/test_au_client.cc @@ -0,0 +1,33 @@ +// Copyright 2024 Aurora Operations, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include "au/io.hh" +#include "au/prefix.hh" +#include "au/units/hours.hh" +#include "au/units/meters.hh" +#include "au/units/seconds.hh" + +using ::au::symbols::h; +using ::au::symbols::m; +using ::au::symbols::s; +constexpr auto km = ::au::kilo(m); + +int main(int argc, char **argv) { + constexpr auto v1 = 1 * m / s; + constexpr auto v2 = 1 * km / h; + std::cout << "(" << v1 << ") + (" << v2 << ") = " << (v1 + v2) << std::endl; + return 0; +}