Skip to content

Commit

Permalink
Add Wayland WSI support
Browse files Browse the repository at this point in the history
  • Loading branch information
tomek-brcm committed Feb 2, 2017
1 parent eb57780 commit 570d9bc
Show file tree
Hide file tree
Showing 7 changed files with 551 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Expand Up @@ -13,6 +13,7 @@ include_directories(external/assimp)
include_directories(base)

OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)

# Use FindVulkan module added with CMAKE 3.7
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
Expand Down Expand Up @@ -43,6 +44,13 @@ ELSE(WIN32)
IF(USE_D2D_WSI)
MESSAGE("Using direct to display extension...")
add_definitions(-D_DIRECT2DISPLAY)
ELSEIF(USE_WAYLAND_WSI)
find_package(Wayland REQUIRED)
if (NOT WAYLAND_FOUND)
message(FATAL_ERROR "Wayland development package not found")
endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_WAYLAND_KHR")
include_directories(${WAYLAND_INCLUDE_DIR})
ELSE(USE_D2D_WSI)
find_package(XCB REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_USE_PLATFORM_XCB_KHR")
Expand Down Expand Up @@ -77,7 +85,7 @@ function(buildExample EXAMPLE_NAME)
target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WINLIBS})
else(WIN32)
add_executable(${EXAMPLE_NAME} ${EXAMPLE_NAME}/${EXAMPLE_NAME}.cpp ${SOURCE})
target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(${EXAMPLE_NAME} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif(WIN32)
endfunction(buildExample)

Expand Down
7 changes: 7 additions & 0 deletions base/keycodes.hpp
Expand Up @@ -51,6 +51,13 @@
#define KEY_N 0xE
#define KEY_O 0xF
#define KEY_T 0x10
#elif defined(VK_USE_PLATFORM_WAYLAND_KHR)
#include <linux/input.h>

// todo: hack for bloom example
#define KEY_KPADD KEY_KPPLUS
#define KEY_KPSUB KEY_KPMINUS

#elif defined(__linux__)
#define KEY_ESCAPE 0x9
#define KEY_F1 0x43
Expand Down

0 comments on commit 570d9bc

Please sign in to comment.