From 747e2e4502360bfff57c844caf8ea835487a2261 Mon Sep 17 00:00:00 2001 From: Norbert Nopper Date: Thu, 8 Sep 2016 09:31:36 +0200 Subject: [PATCH] Fix, that display only build under Linux works --- CMakeLists.txt | 8 +++++++- demos/CMakeLists.txt | 54 ++++++++++++++++++++++++++++++---------------------- vk-layer-generate.py | 4 ++++ 3 files changed, 42 insertions(+), 24 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 602f01f..4ed5092 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") add_definitions(-DVK_USE_PLATFORM_MIR_KHR) set(DisplayServer Mir) endif() + + if (NOT BUILD_WSI_XCB_SUPPORT AND NOT BUILD_WSI_XLIB_SUPPORT AND NOT BUILD_WSI_WAYLAND_SUPPORT AND NOT BUILD_WSI_MIR_SUPPORT) + set(DisplayServer Display) + endif() else() message(FATAL_ERROR "Unsupported Platform!") endif() @@ -74,7 +78,9 @@ if(WIN32) endif() if(NOT WIN32) - find_package(XCB REQUIRED) + if (BUILD_WSI_XCB_SUPPORT) + find_package(XCB REQUIRED) + endif() set (BUILDTGT_DIR build) set (BINDATA_DIR Bin) set (LIBSOURCE_DIR Lib) diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 26e86fb..e61065f 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -67,23 +67,24 @@ if(WIN32) file(COPY tri.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos) file(COPY vulkaninfo.vcxproj.user DESTINATION ${CMAKE_BINARY_DIR}/demos) else() - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/tri-vert.spv - COMMAND ${GLSLANG_VALIDATOR} -s -V -o tri-vert.spv ${PROJECT_SOURCE_DIR}/demos/tri.vert - DEPENDS tri.vert ${GLSLANG_VALIDATOR} - ) - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/tri-frag.spv - COMMAND ${GLSLANG_VALIDATOR} -s -V -o tri-frag.spv ${PROJECT_SOURCE_DIR}/demos/tri.frag - DEPENDS tri.frag ${GLSLANG_VALIDATOR} - ) - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-vert.spv - COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-vert.spv ${PROJECT_SOURCE_DIR}/demos/cube.vert - DEPENDS cube.vert ${GLSLANG_VALIDATOR} - ) - - add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-frag.spv - COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-frag.spv ${PROJECT_SOURCE_DIR}/demos/cube.frag - DEPENDS cube.frag ${GLSLANG_VALIDATOR} - ) + if (${CMAKE_SYSTEM_PROCESSOR} EQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/tri-vert.spv + COMMAND ${GLSLANG_VALIDATOR} -s -V -o tri-vert.spv ${PROJECT_SOURCE_DIR}/demos/tri.vert + DEPENDS tri.vert ${GLSLANG_VALIDATOR} + ) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/tri-frag.spv + COMMAND ${GLSLANG_VALIDATOR} -s -V -o tri-frag.spv ${PROJECT_SOURCE_DIR}/demos/tri.frag + DEPENDS tri.frag ${GLSLANG_VALIDATOR} + ) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-vert.spv + COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-vert.spv ${PROJECT_SOURCE_DIR}/demos/cube.vert + DEPENDS cube.vert ${GLSLANG_VALIDATOR} + ) + add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/demos/cube-frag.spv + COMMAND ${GLSLANG_VALIDATOR} -s -V -o cube-frag.spv ${PROJECT_SOURCE_DIR}/demos/cube.frag + DEPENDS cube.frag ${GLSLANG_VALIDATOR} + ) + endif() endif() if(NOT WIN32) @@ -116,15 +117,21 @@ add_executable(vulkaninfo vulkaninfo.c) target_link_libraries(vulkaninfo ${LIBRARIES}) if(UNIX) - add_executable(tri tri.c ${CMAKE_BINARY_DIR}/demos/tri-vert.spv ${CMAKE_BINARY_DIR}/demos/tri-frag.spv) + if (${CMAKE_SYSTEM_PROCESSOR} EQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + add_executable(tri tri.c ${CMAKE_BINARY_DIR}/demos/tri-vert.spv ${CMAKE_BINARY_DIR}/demos/tri-frag.spv) + endif() else() add_executable(tri WIN32 tri.c ${CMAKE_BINARY_DIR}/demos/tri-vert.spv ${CMAKE_BINARY_DIR}/demos/tri-frag.spv) endif() -target_link_libraries(tri ${LIBRARIES}) +if (${CMAKE_SYSTEM_PROCESSOR} EQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + target_link_libraries(tri ${LIBRARIES}) +endif() if(NOT WIN32) - add_executable(cube cube.c ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv) - target_link_libraries(cube ${LIBRARIES}) + if (${CMAKE_SYSTEM_PROCESSOR} EQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + add_executable(cube cube.c ${CMAKE_BINARY_DIR}/demos/cube-vert.spv ${CMAKE_BINARY_DIR}/demos/cube-frag.spv) + target_link_libraries(cube ${LIBRARIES}) + endif() else() if (CMAKE_CL_64) set (LIB_DIR "Win64") @@ -136,5 +143,6 @@ else() target_link_libraries(cube ${LIBRARIES} ) endif() -add_subdirectory(smoke) - +if (${CMAKE_SYSTEM_PROCESSOR} EQUAL ${CMAKE_HOST_SYSTEM_PROCESSOR}) + add_subdirectory(smoke) +endif() diff --git a/vk-layer-generate.py b/vk-layer-generate.py index 5301e26..015826f 100755 --- a/vk-layer-generate.py +++ b/vk-layer-generate.py @@ -1028,6 +1028,9 @@ class UniqueObjectsSubcommand(Subcommand): ('xlib_enabled', ['vkCreateXlibSurfaceKHR']), ('wayland_enabled', ['vkCreateWaylandSurfaceKHR']), ('mir_enabled', ['vkCreateMirSurfaceKHR'])] + elif self.wsi == 'Display': + instance_extensions=[('wsi_enabled', surface_wsi_instance_exts), + ('display_enabled', display_wsi_instance_exts)] else: print('Error: Undefined DisplayServer') instance_extensions=[] @@ -1049,6 +1052,7 @@ def main(): "Xlib", "Wayland", "Mir", + "Display", } subcommands = { -- 2.7.4