aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlawomir Cygan <slawomir.cygan@intel.com>2018-01-25 13:51:17 +0100
committerLenny Komow <lenny@lunarg.com>2018-02-12 13:23:57 -0700
commit18a1951f0c187d4fb99a05c25fa4bf36100aea58 (patch)
treedd288ccb5e23f8dba61d29121840c01b2ac67678
parent43b42e1ea08a3615510707f94942cbf1efac1957 (diff)
downloadvulkan-validation-layers-18a1951f0c187d4fb99a05c25fa4bf36100aea58.tar.gz
loader: link with OneCore umbrella library
This change makes loader use OneCore umbrella[2] library, common to all Windows 10 devices and required with for Universal Windows drivers[1]. As this change may not be compatible with previous versions of Windows, it's enabled via CMAKE option: -DENABLE_WIN10_ONECORE=1 [2] https://msdn.microsoft.com/en-us/library/windows/desktop/mt654039(v=vs.85).aspx [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/getting-started-with-universal-drivers Change-Id: Ib677face131ab2edb3e8cd2f764fe4e0ca44cecc
-rw-r--r--CMakeLists.txt1
-rw-r--r--loader/CMakeLists.txt15
-rw-r--r--loader/loader.c9
3 files changed, 19 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26808788c..5cf85d487 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,6 +112,7 @@ else()
# is WIN32
option(DISABLE_BUILD_PATH_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with MSVC build type info" OFF)
option(DISABLE_BUILDTGT_DIR_DECORATION "Disable the decoration of the gslang and SPIRV-Tools build path with target info" OFF)
+ option(ENABLE_WIN10_ONECORE "Link the loader with OneCore umbrella libraries" OFF)
# For Windows, since 32-bit and 64-bit items can co-exist, we build each in its own build directory.
# 32-bit target data goes in build32, and 64-bit target data goes into build. So, include/link the
diff --git a/loader/CMakeLists.txt b/loader/CMakeLists.txt
index 6282bac6c..85282d036 100644
--- a/loader/CMakeLists.txt
+++ b/loader/CMakeLists.txt
@@ -149,6 +149,12 @@ if (WIN32)
endif()
endforeach()
+ if (ENABLE_WIN10_ONECORE)
+ # Note When linking your app or driver to OneCore.lib, be sure to remove any links to non-umbrella libs (such as kernel32.lib).
+ set(CMAKE_CXX_STANDARD_LIBRARIES " ") # space is intentional
+ set(CMAKE_C_STANDARD_LIBRARIES ${CMAKE_CXX_STANDARD_LIBRARIES})
+ endif()
+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
# Build dev_ext_trampoline.c with -O2 to allow tail-call optimization.
# Build other C files with normal options
@@ -180,7 +186,14 @@ if (WIN32)
# Suppress conflicting libs warning for debug builds.
set_target_properties(${API_LOWERCASE}-${MAJOR} PROPERTIES LINK_FLAGS_DEBUG /ignore:4098)
set_target_properties(VKstatic.${MAJOR} PROPERTIES OUTPUT_NAME VKstatic.${MAJOR})
- target_link_libraries(${API_LOWERCASE}-${MAJOR} Cfgmgr32)
+
+ if (ENABLE_WIN10_ONECORE)
+ target_link_libraries(${API_LOWERCASE}-${MAJOR} OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB)
+ set_target_properties(${API_LOWERCASE}-${MAJOR} PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
+ else()
+ target_link_libraries(${API_LOWERCASE}-${MAJOR} Cfgmgr32)
+ endif()
+
add_dependencies(${API_LOWERCASE}-${MAJOR} generate_helper_files loader_gen_files loader_asm_gen_files)
if (CMAKE_GENERATOR MATCHES "^Visual Studio.*")
diff --git a/loader/loader.c b/loader/loader.c
index 543b9657b..dcb2ef1ed 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -543,11 +543,11 @@ out:
// *reg_data contains a string list of filenames as pointer.
// When done using the returned string list, the caller should free the pointer.
VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char **reg_data, PDWORD reg_data_size, LPCTSTR value_name) {
- static const wchar_t* softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}";
- static const wchar_t* displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}";
+ static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}";
+ static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}";
const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT;
-
- wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {}
+
+ wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {}
ULONG childGuidSize = sizeof(childGuid);
DEVINST devID = 0, childID = 0;
@@ -579,7 +579,6 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char *
} while (CM_Get_Device_ID_ListW(displayGUID, pDeviceNames, deviceNamesSize, flags) == CR_BUFFER_SMALL);
if (pDeviceNames) {
-
for (wchar_t *deviceName = pDeviceNames; *deviceName; deviceName += wcslen(deviceName) + 1) {
CONFIGRET status = CM_Locate_DevNodeW(&devID, deviceName, CM_LOCATE_DEVNODE_NORMAL);
if (CR_SUCCESS != status) {