Merge pull request #352 from jku/install
Support installing demos, support out-of-tree builds
This commit is contained in:
commit
a3b8534e5f
2 changed files with 16 additions and 1 deletions
|
|
@ -16,6 +16,8 @@ include_directories(base)
|
||||||
OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
|
OPTION(USE_D2D_WSI "Build the project using Direct to Display swapchain" OFF)
|
||||||
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
|
OPTION(USE_WAYLAND_WSI "Build the project using Wayland swapchain" OFF)
|
||||||
|
|
||||||
|
set(RESOURCE_INSTALL_DIR "" CACHE PATH "Path to install resources to (leave empty for running uninstalled)")
|
||||||
|
|
||||||
# Use FindVulkan module added with CMAKE 3.7
|
# Use FindVulkan module added with CMAKE 3.7
|
||||||
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
|
if (NOT CMAKE_VERSION VERSION_LESS 3.7.0)
|
||||||
message(STATUS "Using module to find Vulkan")
|
message(STATUS "Using module to find Vulkan")
|
||||||
|
|
@ -108,6 +110,10 @@ function(buildExample EXAMPLE_NAME)
|
||||||
add_executable(${EXAMPLE_NAME} ${MAIN_CPP} ${SOURCE} ${SHADERS})
|
add_executable(${EXAMPLE_NAME} ${MAIN_CPP} ${SOURCE} ${SHADERS})
|
||||||
target_link_libraries(${EXAMPLE_NAME} base )
|
target_link_libraries(${EXAMPLE_NAME} base )
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
|
if(RESOURCE_INSTALL_DIR)
|
||||||
|
install(TARGETS ${EXAMPLE_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
endif()
|
||||||
endfunction(buildExample)
|
endfunction(buildExample)
|
||||||
|
|
||||||
# Build all examples
|
# Build all examples
|
||||||
|
|
@ -117,6 +123,13 @@ function(buildExamples)
|
||||||
endforeach(EXAMPLE)
|
endforeach(EXAMPLE)
|
||||||
endfunction(buildExamples)
|
endfunction(buildExamples)
|
||||||
|
|
||||||
|
if(RESOURCE_INSTALL_DIR)
|
||||||
|
add_definitions(-DVK_EXAMPLE_DATA_DIR=\"${RESOURCE_INSTALL_DIR}/\")
|
||||||
|
install(DIRECTORY data/ DESTINATION ${RESOURCE_INSTALL_DIR}/)
|
||||||
|
else()
|
||||||
|
add_definitions(-DVK_EXAMPLE_DATA_DIR=\"${CMAKE_SOURCE_DIR}/data/\")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Compiler specific stuff
|
# Compiler specific stuff
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||||
|
|
@ -128,7 +141,7 @@ ELSE(WIN32)
|
||||||
link_libraries(${XCB_LIBRARIES} ${Vulkan_LIBRARY} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
link_libraries(${XCB_LIBRARIES} ${Vulkan_LIBRARY} ${Vulkan_LIBRARY} ${ASSIMP_LIBRARIES} ${WAYLAND_CLIENT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin/")
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
|
||||||
|
|
||||||
add_subdirectory(base)
|
add_subdirectory(base)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,8 @@ const std::string VulkanExampleBase::getAssetPath()
|
||||||
{
|
{
|
||||||
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
|
||||||
return "";
|
return "";
|
||||||
|
#elif defined(VK_EXAMPLE_DATA_DIR)
|
||||||
|
return VK_EXAMPLE_DATA_DIR;
|
||||||
#else
|
#else
|
||||||
return "./../data/";
|
return "./../data/";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue