-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
80 lines (58 loc) · 2.48 KB
/
CMakeLists.txt
File metadata and controls
80 lines (58 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
cmake_minimum_required(VERSION 3.25)
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER gcc)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_CXX_FLAGS "-std=c++17 -O3")
add_compile_options(-O0)
find_package(Vulkan REQUIRED)
if (DEFINED VULKAN_SDK_PATH)
set(Vulkan_INCLUDE_DIRS "${VULKAN_SDK_PATH}/Include")
set(Vulkan_LIBRARIES "${VULKAN_SDK_PATH}/Lib")
set(Vulkan_FOUND "True")
else()
find_package(Vulkan REQUIRED)
message(STATUS "Found Vulkan: $ENV{VULKAN_SDK}")
endif()
if (NOT Vulkan_FOUND)
message(FATAL_ERROR "Could not find Vulkan library!")
else()
message(STATUS "Using Vulkan lib at: ${Vulkan_LIBRARIES}")
endif()
add_subdirectory(libs/glfw)
add_subdirectory(libs/glm)
add_subdirectory(libs/VulkanMemoryAllocator)
project(VK-Renderer CXX C)
add_executable(VK-Renderer
${CMAKE_SOURCE_DIR}/src/main.cpp
${CMAKE_SOURCE_DIR}/src/api/app-context/vk_instance.cpp
${CMAKE_SOURCE_DIR}/src/api/app-context/vk_device.cpp
${CMAKE_SOURCE_DIR}/src/api/app-context/vk_swapchain.cpp
${CMAKE_SOURCE_DIR}/src/api/app-context/vk_window.cpp
${CMAKE_SOURCE_DIR}/src/api/descriptors/vk_descriptor_set.cpp
${CMAKE_SOURCE_DIR}/src/api/descriptors/vk_descriptor_set_layout.cpp
${CMAKE_SOURCE_DIR}/src/api/commands/vk_command_pool.cpp
${CMAKE_SOURCE_DIR}/src/api/commands/vk_command_buffer.cpp
${CMAKE_SOURCE_DIR}/src/api/graphics-pipeline/vk_shader_module.cpp
${CMAKE_SOURCE_DIR}/src/api/graphics-pipeline/vk_renderpass.cpp
${CMAKE_SOURCE_DIR}/src/api/graphics-pipeline/vk_graphics_pipeline.cpp
${CMAKE_SOURCE_DIR}/src/api/memory/vk_buffer.cpp
${CMAKE_SOURCE_DIR}/src/api/memory/vk_vma_allocator.cpp
${CMAKE_SOURCE_DIR}/src/renderer/vk_renderer.cpp
)
target_include_directories(VK-Renderer PRIVATE
${CMAKE_SOURCE_DIR}/libs/glfw/include
${CMAKE_SOURCE_DIR}/libs/glm/glm
${CMAKE_SOURCE_DIR}/libs/glm/glm/detail
${CMAKE_SOURCE_DIR}/libs/glm/glm/ext
${CMAKE_SOURCE_DIR}/libs/glm/glm/gtc
${CMAKE_SOURCE_DIR}/libs/glm/glm/gtx
${CMAKE_SOURCE_DIR}/libs/glm/glm/simd
${CMAKE_SOURCE_DIR}/libs/VulkanMemoryAllocator/include
${Vulkan_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/libs
${CMAKE_SOURCE_DIR}/src
)
add_compile_options(-Wno-dev)
target_link_libraries(VK-Renderer PUBLIC Vulkan::Vulkan glfw glm VulkanMemoryAllocator stdc++)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
set_property(TARGET VK-Renderer PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")