From 16f69c01d911087b27c48d67978ce7a3b1834514 Mon Sep 17 00:00:00 2001 From: nhatdongdang <144138246+nhatdongdang@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:05:33 +1000 Subject: [PATCH 1/2] Fix iterator bug on macos --- include/mcpp/util.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/mcpp/util.h b/include/mcpp/util.h index 640eb716..4e00ccc4 100644 --- a/include/mcpp/util.h +++ b/include/mcpp/util.h @@ -1,6 +1,8 @@ #pragma once #include "block.h" +#include +#include #include #include @@ -101,6 +103,8 @@ struct Chunk { * access to the elements stored in the chunk. */ struct Iterator { + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; using value_type = BlockType; using pointer = BlockType*; using reference = BlockType&; @@ -256,6 +260,8 @@ struct HeightMap { * operations over the height data stored within a HeightMap. */ struct Iterator { + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; using value_type = int; using pointer = int*; using reference = int&; From 5c46b05da0e5d6e366bcb8b0ca3a6441d3f611cf Mon Sep 17 00:00:00 2001 From: nhatdongdang <144138246+nhatdongdang@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:38:53 +1000 Subject: [PATCH 2/2] Update CI to test library installation --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ test/test_link.cpp | 3 +++ 2 files changed, 24 insertions(+) create mode 100644 test/test_link.cpp diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d925997..d6f0dbdf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,3 +28,24 @@ jobs: - name: Run test suite working-directory: ./build run: make test_suite && ctest -R full -V + install: + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + # Checkout the mcpp repository + - name: Checkout mcpp + uses: actions/checkout@v4 + + - name: Build file + run: cmake . + + - name: Install library + run: make install + + - name: Compile and link + run: g++ -std=c++17 -lmcpp test/test_link.cpp -o test/test_link && test/test_link + + + diff --git a/test/test_link.cpp b/test/test_link.cpp new file mode 100644 index 00000000..8eb7dd95 --- /dev/null +++ b/test/test_link.cpp @@ -0,0 +1,3 @@ +#include + +int main() {} \ No newline at end of file