diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..65b0722 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +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: 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: humbletim/setup-vulkan-sdk@v1.2.0 + with: + 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: Prepare MSVC + uses: ilammy/msvc-dev-cmd@v1 + if: matrix.os == 'windows-latest' + - name: Install dependencies for Linux + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get -y install \ + libxkbcommon-dev \ + xorg-dev + - name: Setup Project + run: meson setup build --buildtype=${{ matrix.buildtype }} + - name: Compile Project + run: meson compile -C build + # - 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 diff --git a/scripts/compile_shader.py b/scripts/compile_shader.py index d40705e..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) diff --git a/src/merian/vk/shader/shader_hotreloader.cpp b/src/merian/vk/shader/shader_hotreloader.cpp index d20c607..783a158 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,8 +18,11 @@ 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) > - 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.