From 927eeb45cddd60fb53bd65fb09d74ae2602a89b9 Mon Sep 17 00:00:00 2001 From: Cody Northrop Date: Wed, 8 Jul 2015 16:48:37 -0600 Subject: loader: Build fixes for Windows --- loader/CMakeLists.txt | 2 +- loader/loader.c | 6 +++++- loader/vk_loader_platform.h | 7 +++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt index 4b7ebc29..51030c3e 100644 --- a/loader/CMakeLists.txt +++ b/loader/CMakeLists.txt @@ -33,7 +33,7 @@ if (WIN32) set_target_properties(vulkan PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/vulkan.def") add_library(VKstatic STATIC ${LOADER_SRCS} dirent_on_windows.c) set_target_properties(VKstatic PROPERTIES OUTPUT_NAME VKstatic) - target_link_libraries(vulkan) + target_link_libraries(vulkan shlwapi) endif() if (NOT WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES -Wpointer-arith") diff --git a/loader/loader.c b/loader/loader.c index 9f8cfc92..9c725024 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -127,7 +127,11 @@ void* loader_aligned_heap_alloc( if (!instance && instance->alloc_callbacks.pfnAlloc) { return instance->alloc_callbacks.pfnAlloc(instance->alloc_callbacks.pUserData, size, alignment, alloc_type); } - return aligned_alloc(size, alignment); +#if defined(_WIN32) + return _aligned_malloc(alignment, size); +#else + return aligned_alloc(alignment, size); +#endif } void loader_heap_free( diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index 427cfea3..f7d3896d 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -31,6 +31,8 @@ #ifndef LOADER_PLATFORM_H #define LOADER_PLATFORM_H +#include "vk_platform.h" + #if defined(__linux__) /* Linux-specific common code: */ @@ -172,6 +174,7 @@ static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return #include #include #include +#include #ifdef __cplusplus #include #include @@ -210,7 +213,7 @@ static bool loader_platform_file_exists(const char *path) return true; } -static bool loader_is_path_absolute(const char *path) +static bool loader_platform_is_path_absolute(const char *path) { return !PathIsRelative(path); } @@ -415,7 +418,7 @@ char *loader_get_registry_string(const HKEY hive, #define DeleteCriticalSection PLEASE USE THE loader_platform_thread_delete_mutex() FUNCTION #define loader_stack_alloc(size) _alloca(size) -static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return _aligned_alloc(alignment, size); } +static inline void *loader_aligned_alloc(size_t alignment, size_t size) { return _aligned_malloc(alignment, size); } #endif // defined(_WIN32) #endif /* LOADER_PLATFORM_H_TEMP */ -- cgit v1.2.3