diff --git a/.github/workflows/win64.yml b/.github/workflows/win64.yml new file mode 100644 index 0000000..2a963bb --- /dev/null +++ b/.github/workflows/win64.yml @@ -0,0 +1,26 @@ +name: build-win64 + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v3 + + - name: Setup Ninja + uses: ashutoshvarma/setup-ninja@master + with: + # ninja version to download. Default: 1.10.0 + version: 1.10.0 + + - name: configure + run: cmake --preset windows-ninja-msvc + - name: make + run: cmake --build build/windows-ninja-msvc diff --git a/source/DeviceWrapper.h b/source/DeviceWrapper.h index 4770691..7c56f24 100644 --- a/source/DeviceWrapper.h +++ b/source/DeviceWrapper.h @@ -1,5 +1,13 @@ #pragma once +#if defined(Linux) +#include +#elif defined(_WIN32) +#include +#else +#error "No OS specified" +#endif + #include #include #include @@ -7,7 +15,6 @@ #include "Object.h" #include "ProgramManager.h" #include -#include #include "CpuTimer.h" class ProgramManager; @@ -66,10 +73,17 @@ class PipelineCreationAPIDispatcher : public gfx::IPipelineCreationAPIDispatcher void** outPipelineState ) { - void* vulkanLibraryHandle = nullptr; const char* dynamicLibraryName = "Unknown"; + +#if defined(Linux) dynamicLibraryName = "libvulkan.so.1"; - vulkanLibraryHandle = dlopen(dynamicLibraryName, RTLD_NOW); + void* vulkanLibraryHandle = dlopen(dynamicLibraryName, RTLD_NOW); +#elif defined(_WIN32) + dynamicLibraryName = "vulkan-1.dll"; + HMODULE vulkanLibraryHandle = ::LoadLibraryA(dynamicLibraryName); +#else +#error "No OS specified" +#endif gfx::IDevice::InteropHandles outHandles; device->getNativeDeviceHandles(&outHandles); @@ -81,7 +95,15 @@ class PipelineCreationAPIDispatcher : public gfx::IPipelineCreationAPIDispatcher vkDevice = (VkDevice)outHandles.handles[2].handleValue; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = nullptr; + +#if defined(Linux) vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)dlsym(vulkanLibraryHandle, "vkGetInstanceProcAddr"); +#elif defined(_WIN32) + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)::GetProcAddress(vulkanLibraryHandle, "vkGetInstanceProcAddr"); +#else +#error "No OS specified" +#endif + if (!vkGetInstanceProcAddr) { assert(!"Fail to get instance proc address");