diff options
| author | Cody Northrop <cody@lunarg.com> | 2015-07-08 16:48:37 -0600 |
|---|---|---|
| committer | Cody Northrop <cody@lunarg.com> | 2015-07-08 16:55:52 -0600 |
| commit | 927eeb45cddd60fb53bd65fb09d74ae2602a89b9 (patch) | |
| tree | 648548d0322a3a9c4539fe1e496b0334f9c2346a | |
| parent | 290095a6cd2efc6e719e77baeb57af96b8a94218 (diff) | |
| download | usermoji-927eeb45cddd60fb53bd65fb09d74ae2602a89b9.tar.xz | |
loader: Build fixes for Windows
| -rw-r--r-- | loader/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | loader/loader.c | 6 | ||||
| -rw-r--r-- | 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 <stdio.h> #include <io.h> #include <stdbool.h> +#include <shlwapi.h> #ifdef __cplusplus #include <iostream> #include <string> @@ -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 */ |
