| 1 | # Example usage: |
| 2 | # mkdir build |
| 3 | # cd build |
| 4 | # cmake -g "Visual Studio 14 2015" .. |
| 5 | |
| 6 | cmake_minimum_required(VERSION 2.8) |
| 7 | project(imgui_example_glfw_vulkan C CXX) |
| 8 | |
| 9 | if(NOT CMAKE_BUILD_TYPE) |
| 10 | set(CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE) |
| 11 | endif() |
| 12 | |
| 13 | set(CMAKE_CXX_STANDARD 11) |
| 14 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES") |
| 15 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES") |
| 16 | |
| 17 | # GLFW |
| 18 | if(NOT GLFW_DIR) |
| 19 | set(GLFW_DIR ../../../glfw) # Set this to point to an up-to-date GLFW repo |
| 20 | endif() |
| 21 | option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) |
| 22 | option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) |
| 23 | option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF) |
| 24 | option(GLFW_INSTALL "Generate installation target" OFF) |
| 25 | option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF) |
| 26 | add_subdirectory(${GLFW_DIR} binary_dir EXCLUDE_FROM_ALL) |
| 27 | include_directories(${GLFW_DIR}/include) |
| 28 | |
| 29 | # Dear ImGui |
| 30 | set(IMGUI_DIR ../../) |
| 31 | include_directories(${IMGUI_DIR} ${IMGUI_DIR}/backends ..) |
| 32 | |
| 33 | # Libraries |
| 34 | find_package(Vulkan REQUIRED) |
| 35 | #find_library(VULKAN_LIBRARY |
| 36 | #NAMES vulkan vulkan-1) |
| 37 | #set(LIBRARIES "glfw;${VULKAN_LIBRARY}") |
| 38 | set(LIBRARIES "glfw;Vulkan::Vulkan") |
| 39 | |
| 40 | # Use vulkan headers from glfw: |
| 41 | include_directories(${GLFW_DIR}/deps) |
| 42 | |
| 43 | file(GLOB sources *.cpp) |
| 44 | |
| 45 | add_executable(example_glfw_vulkan ${sources} ${IMGUI_DIR}/backends/imgui_impl_glfw.cpp ${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp ${IMGUI_DIR}/imgui.cpp ${IMGUI_DIR}/imgui_draw.cpp ${IMGUI_DIR}/imgui_demo.cpp ${IMGUI_DIR}/imgui_tables.cpp ${IMGUI_DIR}/imgui_widgets.cpp) |
| 46 | target_link_libraries(example_glfw_vulkan ${LIBRARIES}) |
| 47 | |