From 0b53b4c879972249e2551606700c1f3fda86b1d7 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Mon, 5 Aug 2024 16:37:33 +0200 Subject: [PATCH 01/13] Add CI --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e83230a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: Build Merian + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: Build ${{ matrix.buildtype }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + buildtype: [debugoptimized, release] + meson_version: ["1.5.1"] + steps: + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.4 + with: + install_runtime: true + cache: true + stripdown: true + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + - name: Install dependencies + run: python -m pip install meson==${{ matrix.meson_version }} ninja + - name: Configure Project + run: meson setup build --buildtype=${{ matrix.buildtype }} + env: + CC: gcc + # - name: Run Tests + # run: meson test -C build -v + # - name: Upload Test Log + # uses: actions/upload-artifact@v4 + # if: failure() + # with: + # name: ${{ matrix.os }}_Meson_Testlog + # path: build/meson-logs/testlog.txt From 9c81fe15ac68c33fbb2a2a19b270deb6adf132a2 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 15:54:09 +0200 Subject: [PATCH 02/13] test --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e83230a..499e20f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,18 +12,18 @@ jobs: buildtype: [debugoptimized, release] meson_version: ["1.5.1"] steps: - - name: Install Vulkan SDK - uses: jakoch/install-vulkan-sdk-action@v1.0.4 - with: - install_runtime: true - cache: true - stripdown: true - name: Checkout code uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.x' + - name: Install Vulkan SDK + uses: jakoch/install-vulkan-sdk-action@v1.0.4 + with: + install_runtime: true + cache: true + stripdown: true - name: Install dependencies run: python -m pip install meson==${{ matrix.meson_version }} ninja - name: Configure Project From 2705974df7111bbc10670ef44d959d1df6373b3f Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 15:58:25 +0200 Subject: [PATCH 03/13] test --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 499e20f..10a38ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,11 +19,11 @@ jobs: with: python-version: '3.x' - name: Install Vulkan SDK - uses: jakoch/install-vulkan-sdk-action@v1.0.4 + uses: humbletim/setup-vulkan-sdk@v1.2.0 with: - install_runtime: true - cache: true - stripdown: true + vulkan-query-version: 1.3.290.0 + vulkan-components: Vulkan-Headers, Vulkan-Loader + vulkan-use-cache: true - name: Install dependencies run: python -m pip install meson==${{ matrix.meson_version }} ninja - name: Configure Project From 8589f872b08dbc9b141d786b75ecd891ee71b6be Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 16:03:06 +0200 Subject: [PATCH 04/13] test --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10a38ff..0483397 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,11 @@ jobs: vulkan-use-cache: true - name: Install dependencies run: python -m pip install meson==${{ matrix.meson_version }} ninja + - name: Install dependencies for Linux + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get -y install \ + xorg-dev - name: Configure Project run: meson setup build --buildtype=${{ matrix.buildtype }} env: From 1543c2328417d30ab518db3ccffedcead0a794f4 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 16:04:51 +0200 Subject: [PATCH 05/13] test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0483397..b9e2a5a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get -y install \ - xorg-dev + libxkbcommon-dev - name: Configure Project run: meson setup build --buildtype=${{ matrix.buildtype }} env: From 6598d91bae43ddc2eab908b79fd89772ee1f13a6 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 19:00:52 +0200 Subject: [PATCH 06/13] test --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9e2a5a..bab0907 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,7 +30,8 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get -y install \ - libxkbcommon-dev + libxkbcommon-dev \ + libxinerama-dev - name: Configure Project run: meson setup build --buildtype=${{ matrix.buildtype }} env: From ef8f03c87b59db15e73b82b05e290c7c46ea571a Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 19:03:47 +0200 Subject: [PATCH 07/13] test --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bab0907..027f35b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: run: | sudo apt-get -y install \ libxkbcommon-dev \ - libxinerama-dev + xorg-dev - name: Configure Project run: meson setup build --buildtype=${{ matrix.buildtype }} env: From cf03291d59c8981d5179632c66fab1bd5bfddd90 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 19:12:32 +0200 Subject: [PATCH 08/13] test --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 027f35b..593b697 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,10 +32,10 @@ jobs: sudo apt-get -y install \ libxkbcommon-dev \ xorg-dev - - name: Configure Project + - name: Setup Project run: meson setup build --buildtype=${{ matrix.buildtype }} - env: - CC: gcc + - name: Compile Project + run: meson compile -C build # - name: Run Tests # run: meson test -C build -v # - name: Upload Test Log From 61ca1fb82662b945ace3db89b0911caae4a079d7 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 19:33:32 +0200 Subject: [PATCH 09/13] fix build? --- src/merian/vk/shader/shader_hotreloader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/merian/vk/shader/shader_hotreloader.cpp b/src/merian/vk/shader/shader_hotreloader.cpp index d20c607..4ffb769 100644 --- a/src/merian/vk/shader/shader_hotreloader.cpp +++ b/src/merian/vk/shader/shader_hotreloader.cpp @@ -1,5 +1,7 @@ #include "merian/vk/shader/shader_hotreloader.hpp" +#include + namespace merian { ShaderModuleHandle @@ -16,7 +18,7 @@ HotReloader::get_shader(const std::filesystem::path& path, std::filesystem::last_write_time(*canonical); if (!shaders.contains(*canonical) || - (clock_cast(std::chrono::system_clock::now() - 200ms) > + (std::chrono::clock_cast(std::chrono::system_clock::now() - 200ms) > last_write_time && last_write_time > shaders[*canonical].last_write_time)) { // wait additional 200ms, else the write to the file might still be in process. From b94d32e267c8a05c58d0945f8387c3c727e7be78 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 20:47:38 +0200 Subject: [PATCH 10/13] fix build? --- src/merian/vk/shader/shader_hotreloader.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/merian/vk/shader/shader_hotreloader.cpp b/src/merian/vk/shader/shader_hotreloader.cpp index 4ffb769..783a158 100644 --- a/src/merian/vk/shader/shader_hotreloader.cpp +++ b/src/merian/vk/shader/shader_hotreloader.cpp @@ -18,8 +18,11 @@ HotReloader::get_shader(const std::filesystem::path& path, std::filesystem::last_write_time(*canonical); if (!shaders.contains(*canonical) || - (std::chrono::clock_cast(std::chrono::system_clock::now() - 200ms) > - last_write_time && + // workaround for this not working in older Ubuntu versions + // (std::chrono::system_clock::now().time_since_epoch() - 200ms > + // last_write_time.time_since_epoch() + ((std::chrono::system_clock::now().time_since_epoch() - 200ms) > + last_write_time.time_since_epoch() && last_write_time > shaders[*canonical].last_write_time)) { // wait additional 200ms, else the write to the file might still be in process. From a855be6403aba676b322f99756dcac58db206523 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 22:10:26 +0200 Subject: [PATCH 11/13] Update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 593b697..65b0722 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,9 @@ jobs: vulkan-use-cache: true - name: Install dependencies run: python -m pip install meson==${{ matrix.meson_version }} ninja + - name: Prepare MSVC + uses: ilammy/msvc-dev-cmd@v1 + if: matrix.os == 'windows-latest' - name: Install dependencies for Linux if: matrix.os == 'ubuntu-latest' run: | From 6a85e6f4a9821e75a420a398f2144794e32c1749 Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 22:31:13 +0200 Subject: [PATCH 12/13] Fix paths on windows for depfile --- scripts/compile_shader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile_shader.py b/scripts/compile_shader.py index d40705e..15fba96 100644 --- a/scripts/compile_shader.py +++ b/scripts/compile_shader.py @@ -130,7 +130,7 @@ def main(): print(f"fixup depfile {depfile_path}") with open(depfile_path, "r") as f: depfile = f.read() - depfile = re.sub("^(.*):", args.implementation_path.name + ":", depfile) + depfile = re.sub("^(.*):(?!\\\\)", args.implementation_path.name + ":", depfile) with open(depfile_path, "w") as f: f.write(depfile) From 67f69fc1f73b0a15f313d4190f063cd894cf89ad Mon Sep 17 00:00:00 2001 From: Lucas Alber Date: Tue, 6 Aug 2024 22:54:42 +0200 Subject: [PATCH 13/13] Fix paths on windows --- scripts/compile_shader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/compile_shader.py b/scripts/compile_shader.py index 15fba96..a4a3363 100644 --- a/scripts/compile_shader.py +++ b/scripts/compile_shader.py @@ -130,7 +130,7 @@ def main(): print(f"fixup depfile {depfile_path}") with open(depfile_path, "r") as f: depfile = f.read() - depfile = re.sub("^(.*):(?!\\\\)", args.implementation_path.name + ":", depfile) + depfile = re.sub("^(.*):(?![\\\\/])", args.implementation_path.name + ":", depfile) with open(depfile_path, "w") as f: f.write(depfile)