From fc1ac31e3b689b299e7c58171c659acf20e33f76 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Fri, 12 Apr 2024 13:21:17 -0700 Subject: [PATCH 01/16] ci: Try clang-18 via pkgx [ci skip] --- .github/workflows/linux-clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index 5f466479e..26b78285c 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v1 with: - +: clang@17 + +: clang@18 - run: clang --version From 0dba85536292d04663c4e9e9f16b6b19b58326c6 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 13 Apr 2024 11:58:30 -0700 Subject: [PATCH 02/16] ci: Fix when checks run More checks run on pull requests. Switch to using M1 macOS runner. --- .github/workflows/clang-format-check.yml | 2 +- .github/workflows/codecov-upload.yml | 4 ---- .github/workflows/codeql-analysis.yml | 4 ---- .github/workflows/cppcheck.yml | 8 +------- .github/workflows/doxygen.yml | 4 ---- .github/workflows/linux-clang.yml | 8 +------- .github/workflows/linux-gcc.yml | 8 +------- .github/workflows/macos.yml | 2 +- .github/workflows/sonarcloud.yml | 3 --- 9 files changed, 5 insertions(+), 38 deletions(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index f673e0b90..35ebae0d5 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -15,6 +15,6 @@ jobs: - name: Run clang-format style check for C/C++/Protobuf programs. uses: jidicula/clang-format-action@v4.11.0 with: - clang-format-version: '17' + clang-format-version: '18' check-path: ${{ matrix.path }} fallback-style: 'Google' # optional \ No newline at end of file diff --git a/.github/workflows/codecov-upload.yml b/.github/workflows/codecov-upload.yml index a8dcaa093..89d72e8b9 100644 --- a/.github/workflows/codecov-upload.yml +++ b/.github/workflows/codecov-upload.yml @@ -5,10 +5,6 @@ on: branches: - main - develop - pull_request: - branches: - - main - - develop workflow_dispatch: concurrency: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 5d37cb16e..42adcefab 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -17,10 +17,6 @@ on: - main - develop pull_request: - # The branches below must be a subset of the branches above - branches: - - main - - develop schedule: - cron: '26 7 * * 0' workflow_dispatch: diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 95c757645..7c490abb6 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -1,12 +1,6 @@ name: Cppcheck -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index ddc62b2ab..3e76377db 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -5,10 +5,6 @@ on: branches: - main - develop - pull_request: - branches: - - main - - develop workflow_dispatch: jobs: diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index 26b78285c..174f210fa 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -1,12 +1,6 @@ name: Linux Clang -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/linux-gcc.yml b/.github/workflows/linux-gcc.yml index 28076a060..55359bc28 100644 --- a/.github/workflows/linux-gcc.yml +++ b/.github/workflows/linux-gcc.yml @@ -1,12 +1,6 @@ name: Linux GCC -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a87284c92..20d70332a 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -14,7 +14,7 @@ concurrency: jobs: build: - runs-on: macos-13 + runs-on: macos-latest-xlarge steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index a0fea53ba..f03f2ff41 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -6,9 +6,6 @@ on: - main - develop pull_request: - branches: - - main - - develop workflow_dispatch: concurrency: From c9733e4a836c18883463a5fd41fc01066eedcd6a Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 13 Apr 2024 12:02:55 -0700 Subject: [PATCH 03/16] ci: Update to clang-18 --- .github/workflows/asan.yml | 2 +- .github/workflows/cpp-linter.yml | 4 ++-- .github/workflows/lsan.yml | 2 +- .github/workflows/msan.yml | 2 +- .github/workflows/tsan.yml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index c6dbf33c6..089abdbd0 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v1 with: - +: clang@17 + +: clang@18 - run: clang --version diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index c69cdcfb0..35ab0f945 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -7,14 +7,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: cpp-linter/cpp-linter-action@v2 + - uses: cpp-linter/cpp-linter-action@v2.11.0 id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: style: file tidy-checks: '' - version: 16 + version: 18 - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 diff --git a/.github/workflows/lsan.yml b/.github/workflows/lsan.yml index 8dd0c44f2..b89426d46 100644 --- a/.github/workflows/lsan.yml +++ b/.github/workflows/lsan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v1 with: - +: clang@17 + +: clang@18 - run: clang --version diff --git a/.github/workflows/msan.yml b/.github/workflows/msan.yml index a5555a345..16dce49fb 100644 --- a/.github/workflows/msan.yml +++ b/.github/workflows/msan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v1 with: - +: clang@17 + +: clang@18 - run: clang --version diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index fccd39a51..8d752d1c4 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v1 with: - +: clang@17 + +: clang@18 - run: clang --version From 805d5ed1ad3a9721826e75f0d039a6b95a9d3945 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 13 Apr 2024 13:02:10 -0700 Subject: [PATCH 04/16] ci, style: clang-format and macOS Fix clang-format changes. Go back down to the free tier for macOS. Update code-ql action. --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/macos.yml | 2 +- include/Ergodic_moves_3.hpp | 27 ++++++++++++--------------- include/Foliated_triangulation.hpp | 2 +- include/Geometry.hpp | 2 +- include/Metropolis.hpp | 2 +- include/Move_tracker.hpp | 2 +- include/Utilities.hpp | 16 +++++++--------- 8 files changed, 25 insertions(+), 30 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 42adcefab..978564e1e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -48,7 +48,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 20d70332a..f5dd80233 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -14,7 +14,7 @@ concurrency: jobs: build: - runs-on: macos-latest-xlarge + runs-on: macos-latest steps: - uses: actions/checkout@v3 diff --git a/include/Ergodic_moves_3.hpp b/include/Ergodic_moves_3.hpp index 04c2617eb..3ad50df54 100644 --- a/include/Ergodic_moves_3.hpp +++ b/include/Ergodic_moves_3.hpp @@ -333,9 +333,8 @@ namespace ergodic_moves /// @param manifold The simplicial manifold /// @param candidate The vertex to check /// @returns True if (6,2) move is possible - [[nodiscard]] inline auto is_62_movable(Manifold const& manifold, - Vertex_handle const& candidate) - -> bool + [[nodiscard]] inline auto is_62_movable( + Manifold const& manifold, Vertex_handle const& candidate) -> bool { if (manifold.dimensionality() != 3) { @@ -485,8 +484,8 @@ namespace ergodic_moves /// @see /// https://github.com/CGAL/cgal/blob/8430d04539179f25fb8e716f99e19d28589beeda/TDS_3/include/CGAL/Triangulation_data_structure_3.h#L2094 [[nodiscard]] inline auto incident_cells_from_edge( - Delaunay_t<3> const& triangulation, Edge_handle const& edge) - -> std::optional + Delaunay_t<3> const& triangulation, + Edge_handle const& edge) -> std::optional { if (!triangulation.tds().is_edge(edge.first, edge.second, edge.third)) { @@ -519,8 +518,8 @@ namespace ergodic_moves /// @param t_edge_candidate The edge to check /// @returns A container of incident cells if there are exactly 4 or nullopt [[nodiscard]] inline auto find_bistellar_flip_location( - Delaunay const& triangulation, Edge_handle const& t_edge_candidate) - -> std::optional + Delaunay const& triangulation, + Edge_handle const& t_edge_candidate) -> std::optional { if (auto incident_cells = incident_cells_from_edge(triangulation, t_edge_candidate); @@ -565,10 +564,9 @@ namespace ergodic_moves /// @param top Top vertex of the cells being flipped /// @param bottom Bottom vertex of the cells being flipped /// @returns A flipped triangulation or nullopt - [[nodiscard]] inline auto bistellar_flip(Delaunay triangulation, - Edge_handle edge, Vertex_handle top, - Vertex_handle bottom) - -> std::optional + [[nodiscard]] inline auto bistellar_flip( + Delaunay triangulation, Edge_handle edge, Vertex_handle top, + Vertex_handle bottom) -> std::optional { // Get the cells incident to the edge auto incident_cells = get_incident_cells(triangulation, edge); @@ -841,10 +839,9 @@ namespace ergodic_moves /// @param t_after The manifold after the move /// @param t_move The type of move /// @return True if the move correctly changed the triangulation - [[nodiscard]] inline auto check_move(Manifold const& t_before, - Manifold const& t_after, - move_tracker::move_type const& t_move) - -> bool + [[nodiscard]] inline auto check_move( + Manifold const& t_before, Manifold const& t_after, + move_tracker::move_type const& t_move) -> bool { switch (t_move) { diff --git a/include/Foliated_triangulation.hpp b/include/Foliated_triangulation.hpp index 2594a9306..4b5e23849 100644 --- a/include/Foliated_triangulation.hpp +++ b/include/Foliated_triangulation.hpp @@ -901,7 +901,7 @@ namespace foliated_triangulations { causal_vertices.emplace_back(*gen++, i + 1); } // j - } // i + } // i return causal_vertices; } // make_foliated_ball diff --git a/include/Geometry.hpp b/include/Geometry.hpp index daae3714b..192f98da8 100644 --- a/include/Geometry.hpp +++ b/include/Geometry.hpp @@ -99,7 +99,7 @@ struct [[nodiscard("This contains data!")]] Geometry<3> swap(swap_from.N1_SL, swap_into.N1_SL); swap(swap_from.N0, swap_into.N0); } // swap -}; // struct Geometry<3> +}; // struct Geometry<3> using Geometry_3 = Geometry<3>; diff --git a/include/Metropolis.hpp b/include/Metropolis.hpp index 6b66f2af2..3c2def28f 100644 --- a/include/Metropolis.hpp +++ b/include/Metropolis.hpp @@ -493,7 +493,7 @@ class MoveStrategy m_failed_moves.four_four_moves()); } } // print_results -}; // Metropolis +}; // Metropolis using Metropolis_3 = MoveStrategy; diff --git a/include/Move_tracker.hpp b/include/Move_tracker.hpp index d85f8c161..c8616e211 100644 --- a/include/Move_tracker.hpp +++ b/include/Move_tracker.hpp @@ -79,7 +79,7 @@ namespace move_tracker if (dim == 3) { return NUMBER_OF_3D_MOVES; } if (dim == 4) { return NUMBER_OF_4D_MOVES; } return 0; // Error condition - } // moves_per_dimension + } // moves_per_dimension /** * \brief The data and methods to track ergodic moves diff --git a/include/Utilities.hpp b/include/Utilities.hpp index 9daf4eda2..a65dc1359 100644 --- a/include/Utilities.hpp +++ b/include/Utilities.hpp @@ -49,8 +49,8 @@ enum class topology_type /// @param t_os The output stream /// @param t_topology The topology /// @returns An output string of the topology -inline auto operator<<(std::ostream& t_os, topology_type const& t_topology) - -> std::ostream& +inline auto operator<<(std::ostream& t_os, + topology_type const& t_topology) -> std::ostream& { switch (t_topology) { @@ -90,13 +90,11 @@ namespace utilities /// @param t_initial_radius The radius of the first foliation t=1 /// @param t_foliation_spacing The spacing between foliations /// @returns A filename - [[nodiscard]] inline auto make_filename(topology_type const& t_topology, - Int_precision t_dimension, - Int_precision t_number_of_simplices, - Int_precision t_number_of_timeslices, - double t_initial_radius, - double t_foliation_spacing) noexcept - -> std::filesystem::path + [[nodiscard]] inline auto make_filename( + topology_type const& t_topology, Int_precision t_dimension, + Int_precision t_number_of_simplices, Int_precision t_number_of_timeslices, + double t_initial_radius, + double t_foliation_spacing) noexcept -> std::filesystem::path { std::string filename; if (t_topology == topology_type::SPHERICAL) { filename += "S"; } From e00cc471ca675ef1d035ac3dcedd08b23f7f83e7 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sun, 14 Apr 2024 15:21:28 -0700 Subject: [PATCH 05/16] test: format/fix tests --- tests/Ergodic_moves_3_test.cpp | 2 +- tests/Foliated_triangulation_test.cpp | 8 ++-- tests/Manifold_test.cpp | 10 ++--- tests/Tetrahedron_test.cpp | 2 +- tests/Utilities_test.cpp | 55 +++++++++++++-------------- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/tests/Ergodic_moves_3_test.cpp b/tests/Ergodic_moves_3_test.cpp index 7ca90aa36..9e5a78491 100644 --- a/tests/Ergodic_moves_3_test.cpp +++ b/tests/Ergodic_moves_3_test.cpp @@ -388,7 +388,7 @@ SCENARIO("Perform ergodic moves on the minimal manifold necessary (4,4) moves" * }; vector timevalues{0, 1, 1, 1, 1, 2}; auto causal_vertices = make_causal_vertices<3>(vertices, timevalues); - Manifold_3 manifold(causal_vertices, 0, 1); + Manifold_3 manifold(causal_vertices, 0, 1); // Verify we have 4 vertices, 4 edges, 4 faces, and 4 simplices REQUIRE_EQ(manifold.vertices(), 6); REQUIRE_EQ(manifold.edges(), 13); diff --git a/tests/Foliated_triangulation_test.cpp b/tests/Foliated_triangulation_test.cpp index 3fade86de..5cf7181e6 100644 --- a/tests/Foliated_triangulation_test.cpp +++ b/tests/Foliated_triangulation_test.cpp @@ -128,10 +128,10 @@ SCENARIO("FoliatedTriangulation free functions" * GIVEN("A vector of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1, 2}; + vector const Timevalues{1, 1, 1, 2}; WHEN("Causal vertices are created.") { auto causal_vertices = make_causal_vertices<3>(Vertices, Timevalues); @@ -152,10 +152,10 @@ SCENARIO("FoliatedTriangulation free functions" * } GIVEN("A mismatched set of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1}; + vector const Timevalues{1, 1, 1}; WHEN("Causal vertices are created.") { THEN("An exception is thrown.") diff --git a/tests/Manifold_test.cpp b/tests/Manifold_test.cpp index f6cd34f23..886c0bd4e 100644 --- a/tests/Manifold_test.cpp +++ b/tests/Manifold_test.cpp @@ -118,10 +118,10 @@ SCENARIO("Manifold free functions" * doctest::test_suite("manifold")) GIVEN("A vector of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1, 2}; + vector const Timevalues{1, 1, 1, 2}; WHEN("Causal vertices are created.") { auto causal_vertices = @@ -143,10 +143,10 @@ SCENARIO("Manifold free functions" * doctest::test_suite("manifold")) } GIVEN("A mismatched set of points and timevalues.") { - vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), + vector const Vertices{Point_t<3>(1, 0, 0), Point_t<3>(0, 1, 0), Point_t<3>(0, 0, 1), Point_t<3>(RADIUS_2, RADIUS_2, RADIUS_2)}; - vector const Timevalues{1, 1, 1}; + vector const Timevalues{1, 1, 1}; WHEN("Causal vertices are created.") { THEN("An exception is thrown.") @@ -468,7 +468,7 @@ SCENARIO("3-Manifold function checks" * doctest::test_suite("manifold")) THEN("There is only one vertex, the infinite vertex.") { Manifold_3 const manifold; - auto&& vertices = + auto&& vertices = manifold.get_triangulation().get_delaunay().tds().vertices(); auto&& vertex = vertices.begin(); diff --git a/tests/Tetrahedron_test.cpp b/tests/Tetrahedron_test.cpp index ef3fa45f7..67b4e2c68 100644 --- a/tests/Tetrahedron_test.cpp +++ b/tests/Tetrahedron_test.cpp @@ -24,7 +24,7 @@ static inline auto constexpr RADIUS_2 = 2.0 * std::numbers::inv_sqrt3_v; SCENARIO("Construct a tetrahedron in a Delaunay triangulation" * doctest::test_suite("tetrahedron")) { - using Point = Point_t<3>; + using Point = Point_t<3>; GIVEN("A vector of 4 vertices.") { vector vertices{ diff --git a/tests/Utilities_test.cpp b/tests/Utilities_test.cpp index eb7fb8252..f4e056c33 100644 --- a/tests/Utilities_test.cpp +++ b/tests/Utilities_test.cpp @@ -17,8 +17,6 @@ using namespace std; using namespace utilities; -// static inline auto constexpr NUMBER_OF_VALUES = 6; - SCENARIO("Various string/stream/time utilities" * doctest::test_suite("utilities")) { @@ -57,7 +55,7 @@ SCENARIO("Various string/stream/time utilities" * { // Update test yearly auto const result = current_date_time(); - auto const year = result.find("2023"); + auto const year = result.find("2024"); CHECK_NE(year, std::string::npos); // Human verification fmt::print("Current date and time is: {}\n", current_date_time()); @@ -165,8 +163,7 @@ SCENARIO("Reading and writing Delaunay triangulations to files" * } } -SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * - doctest::may_fail()) +SCENARIO("Randomizing functions" * doctest::test_suite("utilities")) { spdlog::debug("Randomizing functions.\n"); GIVEN("A PCG die roller") @@ -199,15 +196,15 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six different random integers within the range.") { - auto constexpr min = 64; - auto constexpr max = 6400; - auto const value1 = generate_random_int(min, max); - auto const value2 = generate_random_int(min, max); - auto const value3 = generate_random_int(min, max); - auto const value4 = generate_random_int(min, max); - auto const value5 = generate_random_int(min, max); - auto const value6 = generate_random_int(min, max); - array container = {value1, value2, value3, value4, value5, value6}; + auto constexpr min = 64; + auto constexpr max = 6400; + auto const value1 = generate_random_int(min, max); + auto const value2 = generate_random_int(min, max); + auto const value3 = generate_random_int(min, max); + auto const value4 = generate_random_int(min, max); + auto const value5 = generate_random_int(min, max); + auto const value6 = generate_random_int(min, max); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all fall within the range and all be different.") { // All elements are >= min @@ -230,14 +227,14 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six different timeslices within the range.") { - auto constexpr max = 256; - auto const value1 = generate_random_timeslice(max); - auto const value2 = generate_random_timeslice(max); - auto const value3 = generate_random_timeslice(max); - auto const value4 = generate_random_timeslice(max); - auto const value5 = generate_random_timeslice(max); - auto const value6 = generate_random_timeslice(max); - array container = {value1, value2, value3, value4, value5, value6}; + auto constexpr max = 256; + auto const value1 = generate_random_timeslice(max); + auto const value2 = generate_random_timeslice(max); + auto const value3 = generate_random_timeslice(max); + auto const value4 = generate_random_timeslice(max); + auto const value5 = generate_random_timeslice(max); + auto const value6 = generate_random_timeslice(max); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all fall within the range and be different.") { auto constexpr min = 1; @@ -275,13 +272,13 @@ SCENARIO("Randomizing functions" * doctest::test_suite("utilities") * { WHEN("We generate six probabilities.") { - auto const value1 = generate_probability(); - auto const value2 = generate_probability(); - auto const value3 = generate_probability(); - auto const value4 = generate_probability(); - auto const value5 = generate_probability(); - auto const value6 = generate_probability(); - array container = {value1, value2, value3, value4, value5, value6}; + auto const value1 = generate_probability(); + auto const value2 = generate_probability(); + auto const value3 = generate_probability(); + auto const value4 = generate_probability(); + auto const value5 = generate_probability(); + auto const value6 = generate_probability(); + array container = {value1, value2, value3, value4, value5, value6}; THEN("They should all be different.") { From 9217f3496c6c70eaa6681d8c70dbf8d128859562 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sun, 14 Apr 2024 18:28:56 -0700 Subject: [PATCH 06/16] feat: Switch from docopt to boost::program_options Docopt isn't being maintained anymore, has long-standing reported bugs, and generates different linker targets depending on platform. In particular, building for HPC was getting to be a pain. This explores using boost::program_options, since I already need Boost for CGAL. --- CMakeLists.txt | 2 + src/CMakeLists.txt | 11 +++-- src/initialize.cpp | 114 +++++++++++++++++++++++++++++++-------------- vcpkg.json | 1 + 4 files changed, 89 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eb8547d9..a27c879fe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,6 +104,8 @@ find_package(Microsoft.GSL CONFIG REQUIRED) # https://www.pcg-random.org find_path(PCG_INCLUDE_DIRS "pcg_extras.hpp") +find_package(Boost REQUIRED COMPONENTS program_options) + # https://github.com/gabime/spdlog find_package(spdlog CONFIG REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 84df5894c..801aeaadb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,7 +13,8 @@ if(WIN32 OR APPLE) Eigen3::Eigen spdlog::spdlog_header_only TBB::tbb - CGAL::CGAL) + CGAL::CGAL + Boost::program_options) else() target_link_libraries( initialize @@ -119,17 +120,17 @@ set_tests_properties(cdt-dimensionality PROPERTIES PASS_REGULAR_EXPRESSION "Curr add_test(NAME cdt-toroidal COMMAND $ --t -n64 -t3 -a0.6 -k1.1 -l0.1) set_tests_properties(cdt-toroidal PROPERTIES PASS_REGULAR_EXPRESSION "Toroidal triangulations not yet supported.") -add_test(NAME initialize COMMAND $ --s -n640 -t4 -o) +add_test(NAME initialize COMMAND $ -s -n640 -t4 -o) set_tests_properties(initialize PROPERTIES PASS_REGULAR_EXPRESSION "Writing to file S3-4") -add_test(NAME initialize-minimum-simplices COMMAND $ --s -n1 -t1 -o) +add_test(NAME initialize-minimum-simplices COMMAND $ -s -n1 -t1 -o) set_tests_properties(initialize-minimum-simplices PROPERTIES PASS_REGULAR_EXPRESSION "Simplices and timeslices should be greater or equal to 2.") -add_test(NAME initialize-dimensionality COMMAND $ --s -n64 -t3 -d4 -o) +add_test(NAME initialize-dimensionality COMMAND $ -s -n64 -t3 -d4 -o) set_tests_properties(initialize-dimensionality PROPERTIES PASS_REGULAR_EXPRESSION "Currently, dimensions cannot be >3.") -add_test(NAME initialize-toroidal COMMAND $ --t -n64 -t3 -o) +add_test(NAME initialize-toroidal COMMAND $ -e -n64 -t3 -o) set_tests_properties(initialize-toroidal PROPERTIES PASS_REGULAR_EXPRESSION "Toroidal triangulations not yet supported.") diff --git a/src/initialize.cpp b/src/initialize.cpp index 361cc15aa..4128e6716 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -8,14 +8,14 @@ /// @brief Generates initial spacetimes /// @author Adam Getchell -#include +#include #include "Manifold.hpp" using namespace std; +namespace po = boost::program_options; -/// Help message parsed by docopt into options -static string_view constexpr USAGE{ +static string_view constexpr INTRO{ R"(Causal Dynamical Triangulations in C++ using CGAL. Copyright (c) 2014 Adam Getchell @@ -23,48 +23,94 @@ Copyright (c) 2014 Adam Getchell A program that generates d-dimensional triangulated spacetimes with a defined causal structure. Specify the topology of the triangulation (spherical or toroidal), the desired number of simplices, and the -desired number of timeslices. Optionally, the spacetime dimension may -also be given. +desired number of timeslices. -Usage:./initialize (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] [-i INIT] [-f FOL] [-o] +There are a number of optional arguments. Examples: -./initialize --spherical -n 32000 -t 11 --init 1 --foliate 1 -./initialize --s -n32000 -t11 - -Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INIT Initial radius [default: 1] - -f --foliate FOL Foliation spacing [default: 1] - -o --output Save triangulation into OFF file -)"}; +./initialize --spherical --simplices 32000 --timeslices 11 --init 1.0 --foliate 1.0 --output +./initialize -s -n32000 -t11 -i1.0 -f1.0 -o + +Options)"}; auto main(int const argc, char* const argv[]) -> int try { - // docopt option parser - std::string const usage_string{USAGE}; - std::map args = docopt::docopt( - usage_string, {argv + 1, argv + argc}, true, "initializer 1.0"); - - auto const simplices = stoll(args["-n"].asString()); - auto const timeslices = stoll(args["-t"].asString()); - auto const dimensions = stoll(args["-d"].asString()); - auto const initial_radius = stod(args["--init"].asString()); - auto const foliation_spacing = stod(args["--foliate"].asString()); - auto const save_file = args["--output"].asBool(); + std::string const intro{INTRO}; + // Parsed arguments + topology_type topology; + long long simplices; + long long timeslices; + long long dimensions; + double initial_radius; + double foliation_spacing; + bool save_file; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("spherical,s", "Spherical topology")( + "toroidal,e", "Toroidal topology")("simplices,n", + po::value(&simplices), + "Approximate number of simplices")( + "timeslices,t", po::value(×lices), + "Number of timeslices")( + "dimensions,d", po::value(&dimensions)->default_value(3), + "Dimensionality")("init,i", + po::value(&initial_radius)->default_value(1.0), + "Initial radius")( + "foliate,f", po::value(&foliation_spacing)->default_value(1.0), + "Foliation spacing")("output,o", "Save triangulation into OFF file"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); + + if (args.count("help")) + { + cout << description << "\n"; + return EXIT_SUCCESS; + } + + if (args.count("version")) + { + fmt::print("CDT initializer version 1.0\n"); + return EXIT_SUCCESS; + } + + if (args.count("spherical")) { topology = topology_type::SPHERICAL; } + else if (args.count("toroidal")) { topology = topology_type::TOROIDAL; } + else + { + fmt::print("Topology not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("simplices")) + { + simplices = args["simplices"].as(); + } + else + { + fmt::print("Number of simplices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("timeslices")) + { + timeslices = args["timeslices"].as(); + } + else + { + fmt::print("Number of timeslices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("output")) { save_file = true; } + else { save_file = false; } // Initialize triangulation manifolds::Manifold_3 universe; - // Topology of simulation - auto const topology = args["--spherical"].asBool() ? topology_type::SPHERICAL - : topology_type::TOROIDAL; - // Display job parameters fmt::print("Topology is {}\n", utilities::topology_to_str(topology)); fmt::print("Number of dimensions = {}\n", dimensions); diff --git a/vcpkg.json b/vcpkg.json index 06029b2bf..d24dc97ef 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,6 +2,7 @@ "name": "cdt-plusplus", "version": "0.1.8", "dependencies": [ + "boost-program-options", "doctest", "date", "docopt", From f3eb66b4f1e89e9000a63e65b9be079811077d91 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Mon, 15 Apr 2024 14:17:53 -0700 Subject: [PATCH 07/16] ci, fix: macOS and Linux builds Enable macOS builds on all pull requests. Add linker target for boost::program_options on Linux. --- .github/workflows/macos.yml | 8 +---- src/CMakeLists.txt | 63 ++++++++++++++++++++++--------------- 2 files changed, 38 insertions(+), 33 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index f5dd80233..036fe7ec9 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,12 +1,6 @@ name: macOS -on: - push: - branches: - - main - - develop - pull_request: - workflow_dispatch: +on: [push, pull_request, workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 801aeaadb..74f09c51a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,32 +2,43 @@ add_executable(initialize ${PROJECT_SOURCE_DIR}/src/initialize.cpp) # On macOS and Linux docopt builds an intermediate object, thus different targets than Windows See # https://github.com/microsoft/vcpkg/issues/8666 -if(WIN32 OR APPLE) - target_link_libraries( - initialize - PRIVATE project_options - project_warnings - date::date-tz - docopt - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL - Boost::program_options) -else() - target_link_libraries( - initialize - PRIVATE project_options - project_warnings - date::date-tz - docopt_s - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -endif() +#if(WIN32 OR APPLE) +# target_link_libraries( +# initialize +# PRIVATE project_options +# project_warnings +# date::date-tz +# docopt +# fmt::fmt-header-only +# Eigen3::Eigen +# spdlog::spdlog_header_only +# TBB::tbb +# CGAL::CGAL +# Boost::program_options) +#else() +# target_link_libraries( +# initialize +# PRIVATE project_options +# project_warnings +# date::date-tz +# docopt_s +# fmt::fmt-header-only +# Eigen3::Eigen +# spdlog::spdlog_header_only +# TBB::tbb +# CGAL::CGAL) +#endif() +target_link_libraries( + initialize + PRIVATE project_options + project_warnings + date::date-tz + Boost::program_options + fmt::fmt-header-only + Eigen3::Eigen + spdlog::spdlog_header_only + TBB::tbb + CGAL::CGAL) target_compile_features(initialize PRIVATE cxx_std_20) add_executable(cdt-opt ${PROJECT_SOURCE_DIR}/src/cdt-opt.cpp) From d423ad4290157bdf75f7e6663de5095480945f54 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Mon, 15 Apr 2024 18:37:20 -0700 Subject: [PATCH 08/16] feat: Replace docopt on cdt Add usage message back to initialize. Swap out docopt for boost::program_options on cdt executable. --- src/CMakeLists.txt | 73 +++++----------------- src/cdt.cpp | 147 ++++++++++++++++++++++++++++++--------------- src/initialize.cpp | 10 ++- 3 files changed, 122 insertions(+), 108 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74f09c51a..b0c8314ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,33 +1,4 @@ add_executable(initialize ${PROJECT_SOURCE_DIR}/src/initialize.cpp) - -# On macOS and Linux docopt builds an intermediate object, thus different targets than Windows See -# https://github.com/microsoft/vcpkg/issues/8666 -#if(WIN32 OR APPLE) -# target_link_libraries( -# initialize -# PRIVATE project_options -# project_warnings -# date::date-tz -# docopt -# fmt::fmt-header-only -# Eigen3::Eigen -# spdlog::spdlog_header_only -# TBB::tbb -# CGAL::CGAL -# Boost::program_options) -#else() -# target_link_libraries( -# initialize -# PRIVATE project_options -# project_warnings -# date::date-tz -# docopt_s -# fmt::fmt-header-only -# Eigen3::Eigen -# spdlog::spdlog_header_only -# TBB::tbb -# CGAL::CGAL) -#endif() target_link_libraries( initialize PRIVATE project_options @@ -55,31 +26,17 @@ target_link_libraries( target_compile_features(cdt-opt PRIVATE cxx_std_20) add_executable(cdt ${PROJECT_SOURCE_DIR}/src/cdt.cpp) -if(WIN32 OR APPLE) - target_link_libraries( - cdt - PRIVATE project_options - project_warnings - date::date-tz - docopt - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -else() - target_link_libraries( - cdt - PRIVATE project_options - project_warnings - date::date-tz - docopt_s - fmt::fmt-header-only - Eigen3::Eigen - spdlog::spdlog_header_only - TBB::tbb - CGAL::CGAL) -endif() +target_link_libraries( + cdt + PRIVATE project_options + project_warnings + date::date-tz + Boost::program_options + fmt::fmt-header-only + Eigen3::Eigen + spdlog::spdlog_header_only + TBB::tbb + CGAL::CGAL) target_compile_features(cdt PRIVATE cxx_std_20) # Build cdt-viewer locally, but not in CI since QT takes more than an hour to build there @@ -119,16 +76,16 @@ endif() # Tests ## # -add_test(NAME cdt COMMAND $ --s -n127 -t4 -a0.6 -k1.1 -l0.1 -p10) +add_test(NAME cdt COMMAND $ -s -n127 -t4 -a0.6 -k1.1 -l0.1 -p10) set_tests_properties(cdt PROPERTIES PASS_REGULAR_EXPRESSION "Writing to file S3-4-") -add_test(NAME cdt-triangle-inequalities COMMAND $ --s -n64 -t3 -a0.4 -k1.1 -l0.1) +add_test(NAME cdt-triangle-inequalities COMMAND $ -s -n64 -t3 -a0.4 -k1.1 -l0.1) set_tests_properties(cdt-triangle-inequalities PROPERTIES PASS_REGULAR_EXPRESSION "Triangle inequalities violated") -add_test(NAME cdt-dimensionality COMMAND $ --s -n64 -t3 -d4 -a0.4 -k1.1 -l0.1) +add_test(NAME cdt-dimensionality COMMAND $ -s -n64 -t3 -d4 -a0.4 -k1.1 -l0.1) set_tests_properties(cdt-dimensionality PROPERTIES PASS_REGULAR_EXPRESSION "Currently, dimensions cannot be >3.") -add_test(NAME cdt-toroidal COMMAND $ --t -n64 -t3 -a0.6 -k1.1 -l0.1) +add_test(NAME cdt-toroidal COMMAND $ -e -n64 -t3 -a0.6 -k1.1 -l0.1) set_tests_properties(cdt-toroidal PROPERTIES PASS_REGULAR_EXPRESSION "Toroidal triangulations not yet supported.") add_test(NAME initialize COMMAND $ -s -n640 -t4 -o) diff --git a/src/cdt.cpp b/src/cdt.cpp index 0894bb676..f37f9d55d 100644 --- a/src/cdt.cpp +++ b/src/cdt.cpp @@ -11,13 +11,14 @@ /// https://github.com/ucdavis/CDT. #include -#include +#include #include using Timer = CGAL::Real_timer; using namespace std; +namespace po = boost::program_options; /// Help message parsed by docopt into options static string_view constexpr USAGE{ @@ -31,29 +32,23 @@ to the Metropolis algorithm. Specify the number of passes to control how much evolution is desired. Each pass attempts a number of ergodic moves equal to the number of simplices in the simulation. -Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] - [--init INITIAL] [--foliate FOLIATION] -k K --alpha ALPHA - --lambda LAMBDA [-p PASSES] [-c CHECKPOINT] +Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + -k K + --alpha ALPHA + --lambda LAMBDA + [-p PASSES] + [-c CHECKPOINT] + +Optional arguments are in square brackets. Examples: ./cdt --spherical -n 32000 -t 11 --alpha 0.6 -k 1.1 --lambda 0.1 --passes 1000 -./cdt --s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 - -Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INITIAL Initial radius [default: 1] - --foliate FOLIATION Foliation spacing between timeslices [default: 1] - -a --alpha ALPHA Negative squared geodesic length of 1-d - timelike edges - -k K K = 1/(8*pi*G_newton) - -l --lambda LAMBDA K * Cosmological constant - -p --passes PASSES Number of passes [default: 100] - -c --checkpoint CHECKPOINT Checkpoint every n passes [default: 10] -)"}; +./cdt -s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 + +Options)"}; /// @brief The main path of the CDT++ program /// @param argc Argument count = 1 + number of arguments @@ -62,33 +57,86 @@ Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] auto main(int const argc, char* const argv[]) -> int try { - // Start running time - Timer timer; - timer.start(); - fmt::print("cdt started at {}\n", utilities::current_date_time()); + std::string const intro{USAGE}; + // Parsed arguments + topology_type topology; + long long simplices; + long long timeslices; + long long dimensions; + double initial_radius; + double foliation_spacing; + long double alpha; + long double k; + long double lambda; + long long passes; + long long checkpoint; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("spherical,s", "Spherical topology")( + "toroidal,e", "Toroidal topology")("simplices,n", + po::value(&simplices), + "Approximate number of simplices")( + "timeslices,t", po::value(×lices), + "Number of timeslices")( + "dimensions,d", po::value(&dimensions)->default_value(3), + "Dimensionality")("init,i", + po::value(&initial_radius)->default_value(1.0), + "Initial radius")( + "foliate,f", po::value(&foliation_spacing)->default_value(1.0), + "Foliation spacing")( + "alpha,a", po::value(&alpha), + "Negative squared geodesic length of 1-d timelike edges")( + "k,k", po::value(&k), "K = 1/(8*pi*G_newton)")( + "lambda,l", po::value(&lambda), "K * Cosmological constant")( + "passes,p", po::value(&passes)->default_value(100), + "Number of passes")("checkpoint,c", + po::value(&checkpoint)->default_value(10), + "Checkpoint every n passes"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); - // docopt option parser - std::string const usage_string{USAGE}; - std::map> args = - docopt::docopt(usage_string, {argv + 1, argv + argc}, - true, // print help message automatically - "CDT 0.1.8"); // Version - - // Parse docopt::values in args map - auto const simplices = stoll(args["-n"].asString()); - auto const timeslices = stoll(args["-t"].asString()); - auto const dimensions = stoll(args["-d"].asString()); - auto const initial_radius = stod(args["--init"].asString()); - auto const foliation_spacing = stod(args["--foliate"].asString()); - auto const alpha = stold(args["--alpha"].asString()); - auto const k = stold(args["-k"].asString()); // NOLINT - auto const lambda = stold(args["--lambda"].asString()); - auto const passes = stoll(args["--passes"].asString()); - auto const checkpoint = stoll(args["--checkpoint"].asString()); - - // Topology of simulation - auto const topology = args["--spherical"].asBool() ? topology_type::SPHERICAL - : topology_type::TOROIDAL; + if (args.count("help")) + { + cout << description << "\n"; + return EXIT_SUCCESS; + } + + if (args.count("version")) + { + fmt::print("CDT++ version 0.1.8\n"); + return EXIT_SUCCESS; + } + + if (args.count("spherical")) { topology = topology_type::SPHERICAL; } + else if (args.count("toroidal")) { topology = topology_type::TOROIDAL; } + else + { + fmt::print("Topology not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("simplices")) + { + simplices = args["simplices"].as(); + } + else + { + fmt::print("Number of simplices not specified.\n"); + return EXIT_FAILURE; + } + + if (args.count("timeslices")) + { + timeslices = args["timeslices"].as(); + } + else + { + fmt::print("Number of timeslices not specified.\n"); + return EXIT_FAILURE; + } // Display job parameters fmt::print("Topology is {}\n", utilities::topology_to_str(topology)); @@ -104,6 +152,11 @@ try fmt::print("K: {}\n", k); fmt::print("Lambda: {}\n", lambda); + // Start running time + Timer timer; + timer.start(); + fmt::print("cdt started at {}\n", utilities::current_date_time()); + if (simplices < 2 || timeslices < 2) { timer.stop(); diff --git a/src/initialize.cpp b/src/initialize.cpp index 4128e6716..6d22fe684 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -15,7 +15,7 @@ using namespace std; namespace po = boost::program_options; -static string_view constexpr INTRO{ +static string_view constexpr USAGE{ R"(Causal Dynamical Triangulations in C++ using CGAL. Copyright (c) 2014 Adam Getchell @@ -25,7 +25,11 @@ with a defined causal structure. Specify the topology of the triangulation (spherical or toroidal), the desired number of simplices, and the desired number of timeslices. -There are a number of optional arguments. +Usage:./initialize (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + [--output] Examples: ./initialize --spherical --simplices 32000 --timeslices 11 --init 1.0 --foliate 1.0 --output @@ -36,7 +40,7 @@ Options)"}; auto main(int const argc, char* const argv[]) -> int try { - std::string const intro{INTRO}; + std::string const intro{USAGE}; // Parsed arguments topology_type topology; long long simplices; From a339af598b3a039101e56a4d50014332dca918a7 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Tue, 16 Apr 2024 11:26:36 -0700 Subject: [PATCH 09/16] feat: Replace docopt on cdt-viewer Also remove docopt from vcpkg. --- CMakeLists.txt | 3 --- src/CMakeLists.txt | 2 +- src/bistellar-flip.cpp | 2 +- src/cdt-viewer.cpp | 53 ++++++++++++++++++++++++++++-------------- src/initialize.cpp | 2 ++ vcpkg.json | 1 - 6 files changed, 39 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a27c879fe..4bfdf30a7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,9 +86,6 @@ set(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE TRUE) # https://howardhinnant.github.io/date/date.html find_package(date CONFIG REQUIRED) -# https://github.com/docopt/docopt.cpp -find_package(docopt CONFIG REQUIRED) - # https://github.com/doctest/doctest find_package(doctest CONFIG REQUIRED) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b0c8314ba..2566b8688 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,7 +47,7 @@ if(APPLE AND NOT ($ENV{CI})) PRIVATE project_options project_warnings date::date-tz - docopt + Boost::program_options fmt::fmt-header-only Eigen3::Eigen spdlog::spdlog_header_only diff --git a/src/bistellar-flip.cpp b/src/bistellar-flip.cpp index 064edcfa5..b2fc4721c 100644 --- a/src/bistellar-flip.cpp +++ b/src/bistellar-flip.cpp @@ -18,7 +18,7 @@ Copyright © 2023 Adam Getchell #endif #define DOCTEST_CONFIG_IMPLEMENT -#include + #include #include diff --git a/src/cdt-viewer.cpp b/src/cdt-viewer.cpp index 0fd94889e..f2a498490 100644 --- a/src/cdt-viewer.cpp +++ b/src/cdt-viewer.cpp @@ -14,14 +14,17 @@ Copyright © 2022 Adam Getchell #include #define DOCTEST_CONFIG_IMPLEMENT -#include + #include #include +#include + #include "Manifold.hpp" #include "Utilities.hpp" -/// Help message parsed by docopt into command line arguments +namespace po = boost::program_options; + static auto constexpr USAGE = R"(Causal Dynamical Triangulations in C++ using CGAL. @@ -31,13 +34,9 @@ A program that views 3D triangulated spacetimes with a defined causal structure. Specify the filename of the triangulation to view. Usage: - cdt-viewer [options] + cdt-viewer -f FILENAME -Options: - -h --help Show this screen. - --version Show version. - --dry-run Don't actually do anything. -)"; +Options)"; auto main(int const argc, char* const argv[]) -> int try @@ -58,24 +57,42 @@ try // used during the next evaluation of RUN_ALL_TESTS, // which will lead to wrong results - // docopt option parser - std::string const usage_string{USAGE}; - std::map args = - docopt::docopt(usage_string, {argv + 1, argv + argc}, - true, // show help if requested - "cdt-viewer 1.0"); // version string + std::string const intro{USAGE}; + // Parsed arguments + std::string filename; + + po::options_description description(intro); + description.add_options()("help,h", "Show this message")( + "version,v", "Show program version")("dry-run", + "Don't actually do anything")( + "filename,f", po::value(&filename), + "Filename of triangulation to view"); + + po::variables_map args; + po::store(po::parse_command_line(argc, argv, description), args); + po::notify(args); + + if (args.count("help")) + { + std::cout << description << "\n"; + return res + EXIT_SUCCESS; + } - // Parse filename from arguments - auto filename = args[""].asString(); + if (args.count("version")) + { + fmt::print("cdt-viewer 1.0\n"); + return res + EXIT_SUCCESS; + } - if (args["--dry-run"].asBool()) + if (args.count("dry-run")) { fmt::print("Dry run. Exiting.\n"); return res + EXIT_SUCCESS; } fmt::print("cdt-viewer started at {}\n", utilities::current_date_time()); - fmt::print("Reading triangulation from file {}\n", filename); + fmt::print("Reading triangulation from file {}\n", + std::string_view(filename)); // Read from file auto const dt_in = utilities::read_file>(filename); diff --git a/src/initialize.cpp b/src/initialize.cpp index 6d22fe684..0ac7b47c3 100644 --- a/src/initialize.cpp +++ b/src/initialize.cpp @@ -31,6 +31,8 @@ Usage:./initialize (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [--foliate FOLIATION SPACING] [--output] +Optional arguments are in square brackets. + Examples: ./initialize --spherical --simplices 32000 --timeslices 11 --init 1.0 --foliate 1.0 --output ./initialize -s -n32000 -t11 -i1.0 -f1.0 -o diff --git a/vcpkg.json b/vcpkg.json index d24dc97ef..7877a8e36 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -5,7 +5,6 @@ "boost-program-options", "doctest", "date", - "docopt", "fmt", "ms-gsl", "eigen3", From 634398d7d35c1ef539a9def8c51208ad73700588 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Tue, 16 Apr 2024 12:13:22 -0700 Subject: [PATCH 10/16] docs: Update documentation [ci skip] Remove references to docopt and update help screen. --- README.md | 56 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 183301149..9765f6d9f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ including the foundations and recent results, please see the [wiki](https://gith [Causal Dynamical Triangulations][CDT] in [C++] uses the [Computational Geometry Algorithms Library][CGAL], [Boost], [TBB], and [Eigen]. Arbitrary-precision numbers and functions are by [MPFR] and [GMP]. -[docopt] provides a beautiful command-line interface. [Melissa E. O'Neill's Permuted Congruential Generators][PCG] library provides high-quality RNGs that pass L'Ecuyer's [TestU01] statistical tests. [doctest] provides [BDD]/[TDD]. @@ -71,7 +70,6 @@ Arbitrary-precision numbers and functions are by [MPFR] and [GMP]. - [x] 3D Simplex - [x] 3D Spherical triangulation - [x] 2+1 foliation -- [x] Integrate [docopt] CLI - [x] S3 Bulk action - [x] 3D Ergodic moves - [x] High-quality Random Number Generation with M.E. O'Neill's [PCG] library @@ -211,13 +209,12 @@ along with several others. ## Usage -CDT-plusplus uses [docopt] to parse options from the help message, and so +CDT-plusplus uses [program_options] to parse options from the help message, and so understands long or short argument formats, provided the short argument given is an unambiguous match to a longer one. The help message should be instructive: ~~~text ./build/src/cdt --help -cdt started at 2023-01-03.14:44:22PST Causal Dynamical Triangulations in C++ using CGAL. Copyright (c) 2013 Adam Getchell @@ -228,28 +225,38 @@ to the Metropolis algorithm. Specify the number of passes to control how much evolution is desired. Each pass attempts a number of ergodic moves equal to the number of simplices in the simulation. -Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES [-d DIM] - [--init INITIAL] [--foliate FOLIATION] -k K --alpha ALPHA - --lambda LAMBDA [-p PASSES] [-c CHECKPOINT] +Usage:./cdt (--spherical | --toroidal) -n SIMPLICES -t TIMESLICES + [-d DIM] + [--init INITIAL RADIUS] + [--foliate FOLIATION SPACING] + -k K + --alpha ALPHA + --lambda LAMBDA + [-p PASSES] + [-c CHECKPOINT] + +Optional arguments are in square brackets. Examples: ./cdt --spherical -n 32000 -t 11 --alpha 0.6 -k 1.1 --lambda 0.1 --passes 1000 -./cdt --s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 +./cdt -s -n32000 -t11 -a.6 -k1.1 -l.1 -p1000 Options: - -h --help Show this message - --version Show program version - -n SIMPLICES Approximate number of simplices - -t TIMESLICES Number of timeslices - -d DIM Dimensionality [default: 3] - -i --init INITIAL Initial radius [default: 1] - --foliate FOLIATION Foliation spacing between timeslices [default: 1] - -a --alpha ALPHA Negative squared geodesic length of 1-d - timelike edges - -k K K = 1/(8*pi*G_newton) - -l --lambda LAMBDA K * Cosmological constant - -p --passes PASSES Number of passes [default: 100] - -c --checkpoint CHECKPOINT Checkpoint every n passes [default: 10] + -h [ --help ] Show this message + -v [ --version ] Show program version + -s [ --spherical ] Spherical topology + -e [ --toroidal ] Toroidal topology + -n [ --simplices ] arg Approximate number of simplices + -t [ --timeslices ] arg Number of timeslices + -d [ --dimensions ] arg (=3) Dimensionality + -i [ --init ] arg (=1) Initial radius + -f [ --foliate ] arg (=1) Foliation spacing + -a [ --alpha ] arg Negative squared geodesic length of 1-d + timelike edges + -k [ --k ] arg K = 1/(8*pi*G_newton) + -l [ --lambda ] arg K * Cosmological constant + -p [ --passes ] arg (=100) Number of passes + -c [ --checkpoint ] arg (=10) Checkpoint every n passes ~~~ The dimensionality of the spacetime is such that each slice of spacetime is @@ -262,8 +269,7 @@ links (in 2+1 spacetime), and the timelike faces (in 3+1 spacetime). ## Documentation -Online documentation is at automatically -generated by [Travis-CI]. +Online documentation is at . If you have [Doxygen] installed you can generate the same information locally using the configuration file in `docs\Doxyfile` by simply typing at the top @@ -407,10 +413,8 @@ Optional: - [vcpkg]'s version of [date] has an unfixed bug [#23637] which produces `use-of-uninitialized-value` in [MemorySanitizer]. -- [docopt] also has a `use-of-uninitialized-value` bug ([#149]). [#23637]: https://github.com/microsoft/vcpkg/issues/23637 -[#149]: https://github.com/docopt/docopt.cpp/issues/149 [CDT]: https://arxiv.org/abs/hep-th/0105267 [CGAL]: https://www.cgal.org [CMake]: https://www.cmake.org @@ -425,7 +429,7 @@ Optional: [Doxygen]: http://www.doxygen.org [Homebrew]: https://brew.sh [Ninja]: https://ninja-build.org -[docopt]: https://github.com/docopt/docopt.cpp +[program_options]: https://www.boost.org/doc/libs/1_85_0/doc/html/program_options/tutorial.html [Mathjax]: https://www.mathjax.org [GraphViz]: https://www.graphviz.org [Eigen]: http://eigen.tuxfamily.org/index.php?title=Main_Page From 754094f3f7b03b17b06f0a2611de3e6a1c3fe801 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 24 Aug 2024 12:26:03 -0700 Subject: [PATCH 11/16] ci, fix: Fix fmt::join, update Github actions --- .github/workflows/asan.yml | 2 +- .github/workflows/clang-format-check.yml | 4 ++-- .github/workflows/codecov-upload.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/cpp-linter.yml | 4 ++-- .github/workflows/cppcheck.yml | 2 +- .github/workflows/doxygen.yml | 2 +- .github/workflows/linux-clang.yml | 2 +- .github/workflows/linux-gcc.yml | 2 +- .github/workflows/lsan.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/msan.yml | 2 +- .github/workflows/sonarcloud.yml | 4 ++-- .github/workflows/tsan.yml | 2 +- .github/workflows/valgrind.yml | 2 +- .github/workflows/whitespace.yml | 2 +- .github/workflows/windows-msvc.yml | 2 +- .github/workflows/windows-pkgx.yml | 2 +- tests/Utilities_test.cpp | 1 + 19 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index 089abdbd0..acceb7ce7 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 35ebae0d5..c060f97c5 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -11,9 +11,9 @@ jobs: - 'src' - 'include' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run clang-format style check for C/C++/Protobuf programs. - uses: jidicula/clang-format-action@v4.11.0 + uses: jidicula/clang-format-action@v4.13.0 with: clang-format-version: '18' check-path: ${{ matrix.path }} diff --git a/.github/workflows/codecov-upload.yml b/.github/workflows/codecov-upload.yml index 89d72e8b9..df01073d4 100644 --- a/.github/workflows/codecov-upload.yml +++ b/.github/workflows/codecov-upload.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -67,7 +67,7 @@ jobs: popd - name: Submit to codecov.io - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: # directory: build/gcov-reports fail_ci_if_error: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 978564e1e..bd8f54d29 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,7 +44,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL @@ -80,4 +80,4 @@ jobs: run: cmake --build build -j 2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 35ab0f945..1e81a1121 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -6,8 +6,8 @@ jobs: cpp-linter: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: cpp-linter/cpp-linter-action@v2.11.0 + - uses: actions/checkout@v4 + - uses: cpp-linter/cpp-linter-action@v2 id: linter env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 7c490abb6..83256b88f 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 3e76377db..3c579f2da 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -11,7 +11,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: DenverCoder1/doxygen-github-pages-action@v1.3.0 + - uses: DenverCoder1/doxygen-github-pages-action@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index 174f210fa..bdb59360f 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/linux-gcc.yml b/.github/workflows/linux-gcc.yml index 55359bc28..af2183054 100644 --- a/.github/workflows/linux-gcc.yml +++ b/.github/workflows/linux-gcc.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/lsan.yml b/.github/workflows/lsan.yml index b89426d46..6183fa9d1 100644 --- a/.github/workflows/lsan.yml +++ b/.github/workflows/lsan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 036fe7ec9..83cf7381a 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -11,7 +11,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/msan.yml b/.github/workflows/msan.yml index 16dce49fb..c809395de 100644 --- a/.github/workflows/msan.yml +++ b/.github/workflows/msan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index f03f2ff41..9e8c00ce8 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -19,7 +19,7 @@ jobs: env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -36,7 +36,7 @@ jobs: - run: gcc --version - name: Install sonar-scanner and build-wrapper - uses: sonarsource/sonarcloud-github-c-cpp@v2 + uses: sonarsource/sonarcloud-github-c-cpp@v3 - name: Restore artifacts or setup vcpkg uses: lukka/run-vcpkg@v11 diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 8d752d1c4..af5341234 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index a8257dda8..ef4c3ea6c 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml index 81801448c..430d1310c 100644 --- a/.github/workflows/whitespace.yml +++ b/.github/workflows/whitespace.yml @@ -7,5 +7,5 @@ jobs: name: Find Trailing Whitespace runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: erictleung/find-file-whitespace@main \ No newline at end of file diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml index a75c22358..97cacc50f 100644 --- a/.github/workflows/windows-msvc.yml +++ b/.github/workflows/windows-msvc.yml @@ -15,7 +15,7 @@ jobs: VCPKG_ROOT: C:\vcpkg steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/.github/workflows/windows-pkgx.yml b/.github/workflows/windows-pkgx.yml index 54b59a1d9..b4b313ced 100644 --- a/.github/workflows/windows-pkgx.yml +++ b/.github/workflows/windows-pkgx.yml @@ -15,7 +15,7 @@ jobs: VCPKG_ROOT: C:\vcpkg steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 submodules: true diff --git a/tests/Utilities_test.cpp b/tests/Utilities_test.cpp index f4e056c33..a8773ca1a 100644 --- a/tests/Utilities_test.cpp +++ b/tests/Utilities_test.cpp @@ -10,6 +10,7 @@ /// @details Tests for random, conversion, and datetime functions. #include +#include #include #include From 6e6e5dd9fa98c507b6cdf7b562e124c4577e726a Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 24 Aug 2024 13:11:18 -0700 Subject: [PATCH 12/16] ci: update GitHub Actions --- .github/workflows/doxygen.yml | 2 +- .github/workflows/linux-clang.yml | 2 +- .github/workflows/linux-gcc.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/doxygen.yml b/.github/workflows/doxygen.yml index 3c579f2da..c5faed706 100644 --- a/.github/workflows/doxygen.yml +++ b/.github/workflows/doxygen.yml @@ -11,7 +11,7 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: DenverCoder1/doxygen-github-pages-action@v2 + - uses: DenverCoder1/doxygen-github-pages-action@v2.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: gh-pages diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index bdb59360f..7530b2eee 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -22,7 +22,7 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: +: clang@18 diff --git a/.github/workflows/linux-gcc.yml b/.github/workflows/linux-gcc.yml index af2183054..248c1163e 100644 --- a/.github/workflows/linux-gcc.yml +++ b/.github/workflows/linux-gcc.yml @@ -22,9 +22,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version From 2dc894595dec3375c7a48fc5d13c5c670a22adaf Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 24 Aug 2024 13:39:32 -0700 Subject: [PATCH 13/16] ci: Update remaining actions Fix SonarCloud, remove building on macOS until fontconfig issue resolved. --- .github/workflows/asan.yml | 2 +- .github/workflows/codecov-upload.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 4 ++-- .github/workflows/cppcheck.yml | 4 ++-- .github/workflows/lsan.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/msan.yml | 2 +- .github/workflows/sonarcloud.yml | 4 ++-- .github/workflows/tsan.yml | 2 +- .github/workflows/valgrind.yml | 4 ++-- .github/workflows/windows-pkgx.yml | 4 ++-- README.md | 3 ++- sonar-project.properties | 3 ++- 13 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index acceb7ce7..a0af81c18 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -28,7 +28,7 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: +: clang@18 diff --git a/.github/workflows/codecov-upload.yml b/.github/workflows/codecov-upload.yml index df01073d4..ce21b5194 100644 --- a/.github/workflows/codecov-upload.yml +++ b/.github/workflows/codecov-upload.yml @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bd8f54d29..6f308f1b0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -62,9 +62,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/cppcheck.yml b/.github/workflows/cppcheck.yml index 83256b88f..1a22c2f1c 100644 --- a/.github/workflows/cppcheck.yml +++ b/.github/workflows/cppcheck.yml @@ -22,9 +22,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache cppcheck - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/lsan.yml b/.github/workflows/lsan.yml index 6183fa9d1..7679d91d4 100644 --- a/.github/workflows/lsan.yml +++ b/.github/workflows/lsan.yml @@ -28,7 +28,7 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: +: clang@18 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 83cf7381a..8deafba94 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,6 +1,6 @@ name: macOS -on: [push, pull_request, workflow_dispatch] +on: [workflow_dispatch] concurrency: group: ${{ github.workflow }}-${{ github.ref }} diff --git a/.github/workflows/msan.yml b/.github/workflows/msan.yml index c809395de..968b6481e 100644 --- a/.github/workflows/msan.yml +++ b/.github/workflows/msan.yml @@ -28,7 +28,7 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: +: clang@18 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index 9e8c00ce8..2fde63be8 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -29,9 +29,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache lcov - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index af5341234..54766d36b 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -28,7 +28,7 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: +: clang@18 diff --git a/.github/workflows/valgrind.yml b/.github/workflows/valgrind.yml index ef4c3ea6c..7c03d2b4e 100644 --- a/.github/workflows/valgrind.yml +++ b/.github/workflows/valgrind.yml @@ -28,9 +28,9 @@ jobs: sudo apt-get install build-essential automake autoconf autoconf-archive texinfo libtool-bin yasm ninja-build ccache valgrind - name: Setup GCC - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: gcc@13 + +: gcc@14 - run: gcc --version diff --git a/.github/workflows/windows-pkgx.yml b/.github/workflows/windows-pkgx.yml index b4b313ced..2a04b2177 100644 --- a/.github/workflows/windows-pkgx.yml +++ b/.github/workflows/windows-pkgx.yml @@ -21,9 +21,9 @@ jobs: submodules: true - name: Setup Clang - uses: pkgxdev/setup@v1 + uses: pkgxdev/setup@v2 with: - +: clang@16 + +: clang@18 - name: Restore artifacts, or setup vcpkg uses: lukka/run-vcpkg@v11 diff --git a/README.md b/README.md index 9765f6d9f..24775d5ef 100644 --- a/README.md +++ b/README.md @@ -412,8 +412,9 @@ Optional: ## Issues - [vcpkg]'s version of [date] has an unfixed bug [#23637] which produces `use-of-uninitialized-value` in [MemorySanitizer]. +- [vcpkg] has issues with `fontconfig:arm64-osx` [#40623]. - +[#40623]: https://github.com/microsoft/vcpkg/issues/40623 [#23637]: https://github.com/microsoft/vcpkg/issues/23637 [CDT]: https://arxiv.org/abs/hep-th/0105267 [CGAL]: https://www.cgal.org diff --git a/sonar-project.properties b/sonar-project.properties index 9fdb36345..9bb091ec9 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -14,7 +14,8 @@ sonar.organization=acgetchell-github # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=src,include sonar.tests=tests -sonar.cfamily.build-wrapper-output=build_wrapper_output_directory +#sonar.cfamily.build-wrapper-output=build_wrapper_output_directory +sonar.cfamily.compile-commands=build/compile_commands.json #sonar.cfamily.cache.enabled=true #sonar.cfamily.cache.path=.sonar sonar.cfamily.threads=2 From 63785d69e7cde773d1eda09c845c171d1f2c9713 Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Sat, 24 Aug 2024 14:29:50 -0700 Subject: [PATCH 14/16] fix: MSVC error The error message indicates that the Clang compiler does not recognize the `/utf-8` option, which is a Microsoft Visual C++ (MSVC) specific option. To resolve this issue, you need to conditionally add the `/utf-8` flag only when using the MSVC compiler. Here's how you can modify your `CMakeLists.txt` to conditionally add the `/utf-8` flag: 1. Check if the compiler is MSVC. 2. If it is, add the `/utf-8` flag. --- cmake/StandardProjectSettings.cmake | 6 ++++++ sonar-project.properties | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmake/StandardProjectSettings.cmake b/cmake/StandardProjectSettings.cmake index 71f29a853..28910bdf2 100644 --- a/cmake/StandardProjectSettings.cmake +++ b/cmake/StandardProjectSettings.cmake @@ -54,3 +54,9 @@ add_definitions(-DCGAL_TRIANGULATION_NO_ASSERTIONS -DCGAL_TRIANGULATION_NO_POSTC # Easier navigation in an IDE when projects are organized in folders. set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +# Check if the compiler is MSVC +if (MSVC) + # Add /utf-8 flag to MSVC + add_compile_options(/utf-8) +endif() diff --git a/sonar-project.properties b/sonar-project.properties index 9bb091ec9..9fdb36345 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -14,8 +14,7 @@ sonar.organization=acgetchell-github # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows. sonar.sources=src,include sonar.tests=tests -#sonar.cfamily.build-wrapper-output=build_wrapper_output_directory -sonar.cfamily.compile-commands=build/compile_commands.json +sonar.cfamily.build-wrapper-output=build_wrapper_output_directory #sonar.cfamily.cache.enabled=true #sonar.cfamily.cache.path=.sonar sonar.cfamily.threads=2 From 771f01d503552aed6fbabe3622cbec90d5bfa46e Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Mon, 23 Sep 2024 13:08:46 -0700 Subject: [PATCH 15/16] ci: Check if clang-19 available [skip ci] --- .github/workflows/linux-clang.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linux-clang.yml b/.github/workflows/linux-clang.yml index 7530b2eee..04e911b67 100644 --- a/.github/workflows/linux-clang.yml +++ b/.github/workflows/linux-clang.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version From cc17bc15352d51ef89c1305f360c24c8f5aca49e Mon Sep 17 00:00:00 2001 From: Adam Getchell Date: Mon, 23 Sep 2024 13:48:09 -0700 Subject: [PATCH 16/16] ci: Update to clang-19 --- .github/workflows/asan.yml | 2 +- .github/workflows/cpp-linter.yml | 2 +- .github/workflows/lsan.yml | 2 +- .github/workflows/msan.yml | 2 +- .github/workflows/tsan.yml | 2 +- .github/workflows/windows-pkgx.yml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/asan.yml b/.github/workflows/asan.yml index a0af81c18..399e63ebd 100644 --- a/.github/workflows/asan.yml +++ b/.github/workflows/asan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version diff --git a/.github/workflows/cpp-linter.yml b/.github/workflows/cpp-linter.yml index 1e81a1121..32f8a582f 100644 --- a/.github/workflows/cpp-linter.yml +++ b/.github/workflows/cpp-linter.yml @@ -14,7 +14,7 @@ jobs: with: style: file tidy-checks: '' - version: 18 + version: 19 - name: Fail fast?! if: steps.linter.outputs.checks-failed > 0 diff --git a/.github/workflows/lsan.yml b/.github/workflows/lsan.yml index 7679d91d4..6d9755c71 100644 --- a/.github/workflows/lsan.yml +++ b/.github/workflows/lsan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version diff --git a/.github/workflows/msan.yml b/.github/workflows/msan.yml index 968b6481e..00127d398 100644 --- a/.github/workflows/msan.yml +++ b/.github/workflows/msan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version diff --git a/.github/workflows/tsan.yml b/.github/workflows/tsan.yml index 54766d36b..1123abaae 100644 --- a/.github/workflows/tsan.yml +++ b/.github/workflows/tsan.yml @@ -30,7 +30,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - run: clang --version diff --git a/.github/workflows/windows-pkgx.yml b/.github/workflows/windows-pkgx.yml index 2a04b2177..9d37437d8 100644 --- a/.github/workflows/windows-pkgx.yml +++ b/.github/workflows/windows-pkgx.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Clang uses: pkgxdev/setup@v2 with: - +: clang@18 + +: clang@19 - name: Restore artifacts, or setup vcpkg uses: lukka/run-vcpkg@v11