Files

95 lines
2.7 KiB
CMake

# 1. Vulkan - shaderc, spirv-reflect
add_library(vulkan INTERFACE)
find_package(Vulkan REQUIRED COMPONENTS shaderc_combined)
# Adding SPIRV-Reflect to vulkan interface
target_sources(vulkan INTERFACE
${Vulkan_INCLUDE_DIRS}/SPIRV-Reflect/spirv_reflect.c
)
target_include_directories(vulkan INTERFACE
${Vulkan_INCLUDE_DIRS}/SPIRV-Reflect
)
target_link_libraries(vulkan INTERFACE
Vulkan::Vulkan
Vulkan::shaderc_combined
)
# 2. VMA (header-only, ships with the Vulkan SDK)
add_library(vma INTERFACE)
target_include_directories(vma INTERFACE ${Vulkan_INCLUDE_DIRS}/vma)
target_link_libraries(vma INTERFACE vulkan)
# 3. GLFW (static)
option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
option(GLFW_INSTALL "Generate installation target" OFF)
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
set(GLFW_VULKAN_STATIC ON CACHE BOOL "Link Vulkan statically with GLFW" FORCE)
add_subdirectory(glfw)
# 4. GLM (static)
add_library(glm INTERFACE)
target_include_directories(glm INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/glm)
# EnTT (single header)
add_library(entt INTERFACE)
target_include_directories(entt INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/entt)
# stb_image (static)
add_library(stb_image STATIC
${CMAKE_CURRENT_SOURCE_DIR}/stb_image/stb_image.cpp
)
target_include_directories(stb_image PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/stb_image)
# Tracy profiler client (static). Configure with -DTRACY_ENABLE=OFF to compile
# all profiling macros out.
option(TRACY_ENABLE "Enable Tracy profiling" ON)
option(TRACY_ON_DEMAND "Only collect data while the viewer is connected" ON)
add_subdirectory(tracy)
# 5. IMGUI (static)
set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui)
add_library(imgui STATIC
${IMGUI_DIR}/imgui.cpp
${IMGUI_DIR}/imgui_draw.cpp
${IMGUI_DIR}/imgui_demo.cpp # remove this
${IMGUI_DIR}/imgui_tables.cpp
${IMGUI_DIR}/imgui_widgets.cpp
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp
)
target_include_directories(imgui PUBLIC
${IMGUI_DIR}
${IMGUI_DIR}/backends
${Vulkan_INCLUDE_DIRS}
)
target_link_libraries(imgui PRIVATE
glfw
vulkan
)
if(UNIX AND NOT APPLE)
target_compile_options(imgui PRIVATE -fPIC)
endif()
# ImGuizmo: only the transform gizmo. The repo's own CMakeLists also builds
# its other widgets, and doesn't link imgui when used as a subdirectory.
add_library(imguizmo STATIC
${CMAKE_CURRENT_SOURCE_DIR}/ImGuizmo/src/ImGuizmo.cpp
)
target_include_directories(imguizmo PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/ImGuizmo/src
)
target_link_libraries(imguizmo PUBLIC
imgui
)