diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 716aa968344db73b02d7d55eaca77180d6e585b1..782710955fe91e642110dfb3e4ed1d23adc6a77f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ variables: RUN: value: "all" - description: "The tests that should run. Possible values: ubuntu, win, mac, all." + description: "The tests that should run. Possible values: ubuntu, win-msvc, win-mingw, mac, all." GIT_DEPTH: 1 stages: @@ -17,7 +17,7 @@ build_ubuntu_gcc: - ubuntu-gcc-cached variables: GIT_SUBMODULE_STRATEGY: recursive - timeout: 10m + timeout: 15m retry: 1 script: - mkdir debug @@ -34,14 +34,14 @@ build_ubuntu_gcc: build_win10_msvc: only: variables: - - $RUN =~ /\bwin.*/i || $RUN =~ /\ball.*/i + - $RUN =~ /\bwin-msvc.*/i || $RUN =~ /\ball.*/i stage: build tags: - win10-msvc-cached variables: GIT_SUBMODULE_STRATEGY: recursive - timeout: 10m - retry: 1 + timeout: 15m + retry: 0 script: - cd 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\' - .\Launch-VsDevShell.ps1 @@ -51,6 +51,23 @@ build_win10_msvc: - cmake -DCMAKE_BUILD_TYPE=Debug .. - cmake --build . +build_win10_mingw: + only: + variables: + - $RUN =~ /\bwin-mingw.*/i || $RUN =~ /\ball.*/i + stage: build + tags: + - win10-mingw-cached + variables: + GIT_SUBMODULE_STRATEGY: recursive + timeout: 15m + retry: 0 + script: + - mkdir debug + - cd debug + - cmake --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\msys64\mingw64\bin\x86_64-w64-mingw32-g++.exe .. -G "Unix Makefiles" + - cmake --build . -j 8 + build_mac_clang: only: variables: @@ -60,7 +77,7 @@ build_mac_clang: - catalina-clang-cached variables: GIT_SUBMODULE_STRATEGY: recursive - timeout: 10m + timeout: 15m retry: 1 script: - mkdir debug diff --git a/config/lib/vma/vma.cpp b/config/lib/vma/vma.cpp index 0928b552c10e23914054c44b8de43df722aa2cf0..307c27f096bd1bae2b1deb2ca5994f132adc92cc 100644 --- a/config/lib/vma/vma.cpp +++ b/config/lib/vma/vma.cpp @@ -3,5 +3,56 @@ #define _DEBUG #endif +#ifndef _MSVC_LANG +#ifdef __MINGW32__ +#include <stdint.h> +#include <stdlib.h> + +class VmaMutex { +public: + VmaMutex() : m_locked(false) {} + + void Lock() { + while (m_locked); + m_locked = true; + } + + void Unlock() { + m_locked = false; + } +private: + bool m_locked; +}; + +#define VMA_MUTEX VmaMutex + +template <typename T> +T* custom_overestimate_malloc(size_t size) { + return new T[size + (sizeof(T) - 1) / sizeof(T)]; +} + +void* custom_aligned_malloc(size_t alignment, size_t size) { + if (alignment > 4) { + return custom_overestimate_malloc<uint64_t>(size); + } else + if (alignment > 2) { + return custom_overestimate_malloc<uint32_t>(size); + } else + if (alignment > 1) { + return custom_overestimate_malloc<uint16_t>(size); + } else { + return custom_overestimate_malloc<uint8_t>(size); + } +} + +void custom_free(void *ptr) { + delete[] reinterpret_cast<uint8_t*>(ptr); +} + +#define VMA_SYSTEM_ALIGNED_MALLOC(size, alignment) (custom_aligned_malloc(alignment, size)) +#define VMA_SYSTEM_FREE(ptr) (custom_free(ptr)) +#endif +#endif + #define VMA_IMPLEMENTATION #include "vk_mem_alloc.hpp" diff --git a/include/vkcv/Event.hpp b/include/vkcv/Event.hpp index 7097e66404d1f580b3802dc17e82083e58ffb9fd..604e3a444dc3bffd2841cb69cd99746d59af523d 100644 --- a/include/vkcv/Event.hpp +++ b/include/vkcv/Event.hpp @@ -1,7 +1,11 @@ #pragma once #include <functional> + +#ifndef __MINGW32__ #include <mutex> +#endif + #include <vector> namespace vkcv { @@ -28,7 +32,10 @@ namespace vkcv { private: std::vector< event_function<T...> > m_functions; uint32_t m_id_counter; + +#ifndef __MINGW32__ std::mutex m_mutex; +#endif public: @@ -76,14 +83,18 @@ namespace vkcv { * locks the event so its function handles won't be called */ void lock() { +#ifndef __MINGW32__ m_mutex.lock(); +#endif } /** * unlocks the event so its function handles can be called after locking */ void unlock() { +#ifndef __MINGW32__ m_mutex.unlock(); +#endif } explicit event(bool locked = false) { diff --git a/modules/camera/config/GLM.cmake b/modules/camera/config/GLM.cmake index efd6444451100b912aa0b5b4a532dc8f448b0b40..f256ccade8c4f44a89744bb7875371324cf2369d 100644 --- a/modules/camera/config/GLM.cmake +++ b/modules/camera/config/GLM.cmake @@ -4,18 +4,20 @@ find_package(glm QUIET) if (glm_FOUND) list(APPEND vkcv_camera_includes ${GLM_INCLUDE_DIRS}) list(APPEND vkcv_camera_libraries glm) - - list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE) - list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED) else() if (EXISTS "${vkcv_camera_lib_path}/glm") add_subdirectory(${vkcv_camera_lib}/glm) - + + list(APPEND vkcv_camera_includes ${vkcv_camera_lib_path}/glm) list(APPEND vkcv_camera_libraries glm) - - list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE) - list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED) else() message(WARNING "GLM is required..! Update the submodules!") endif () endif () + +list(APPEND vkcv_camera_definitions GLM_DEPTH_ZERO_TO_ONE) +list(APPEND vkcv_camera_definitions GLM_FORCE_LEFT_HANDED) + +if ((WIN32) AND (${CMAKE_SIZEOF_VOID_P} MATCHES 4)) + list(APPEND vkcv_camera_definitions GLM_ENABLE_EXPERIMENTAL) +endif()