Fix, that display only build under Linux works
authorNorbert Nopper <norbert@nopper.tv>
Thu, 8 Sep 2016 07:31:36 +0000 (09:31 +0200)
committerKarl Schultz <karl@lunarg.com>
Mon, 12 Sep 2016 17:55:47 +0000 (11:55 -0600)
CMakeLists.txt
demos/CMakeLists.txt
tests/CMakeLists.txt
vk-layer-generate.py

index 602f01f..4ed5092 100644 (file)
@@ -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)
index 26e86fb..e61065f 100644 (file)
@@ -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()
index 7b9de1d..c314f81 100644 (file)
@@ -12,7 +12,9 @@ if (WIN32)
    endif()
 else()
     include (FindPkgConfig)
-    find_package(XCB REQUIRED)
+    if (BUILD_WSI_XCB_SUPPORT)
+        find_package(XCB REQUIRED)
+    endif()
 endif()
 
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
@@ -82,7 +84,11 @@ set_target_properties(vk_layer_validation_tests
    PROPERTIES
    COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
 if(NOT WIN32)
-   target_link_libraries(vk_layer_validation_tests ${LIBVK} ${XCB_LIBRARIES} ${X11_LIBRARIES} gtest gtest_main VkLayer_utils ${GLSLANG_LIBRARIES})
+    if (BUILD_WSI_XCB_SUPPORT AND BUILD_WSI_XLIB_SUPPORT)
+        target_link_libraries(vk_layer_validation_tests ${LIBVK} ${XCB_LIBRARIES} ${X11_LIBRARIES} gtest gtest_main VkLayer_utils ${GLSLANG_LIBRARIES})
+    else()
+        target_link_libraries(vk_layer_validation_tests ${LIBVK} gtest gtest_main VkLayer_utils ${GLSLANG_LIBRARIES})
+    endif()
 endif()
 if(WIN32)
    target_link_libraries(vk_layer_validation_tests ${LIBVK} gtest gtest_main VkLayer_utils ${GLSLANG_LIBRARIES})
index 5301e26..015826f 100755 (executable)
@@ -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 = {