129 lines
3.4 KiB
CMake
129 lines
3.4 KiB
CMake
add_subdirectory(third_party)
|
|
|
|
set(SRC_FILES
|
|
"src/App.cpp"
|
|
"src/Event.cpp"
|
|
|
|
"src/Components/MeshRendererComponent.cpp"
|
|
"src/Components/Rotator.cpp"
|
|
"src/Components/Spinner.cpp"
|
|
"src/Components/OrbitAndSpin.cpp"
|
|
|
|
"src/Graphics/BindlessSetManager.cpp"
|
|
"src/Graphics/Camera.cpp"
|
|
"src/Graphics/GfxDevice.cpp"
|
|
"src/Graphics/ImageCache.cpp"
|
|
"src/Graphics/ImageLoader.cpp"
|
|
"src/Graphics/ImmediateExecuter.cpp"
|
|
"src/Graphics/Init.cpp"
|
|
"src/Graphics/MaterialCache.cpp"
|
|
"src/Graphics/MeshCache.cpp"
|
|
"src/Graphics/Pipeline.cpp"
|
|
"src/Graphics/Renderer.cpp"
|
|
"src/Graphics/Swapchain.cpp"
|
|
"src/Graphics/Util.cpp"
|
|
|
|
"src/Graphics/Resources/GPUImage.cpp"
|
|
"src/Graphics/Resources/NBuffer.cpp"
|
|
"src/Graphics/Resources/Cubemap.cpp"
|
|
|
|
"src/Graphics/Pipelines/MeshPipeline.cpp"
|
|
"src/Graphics/Pipelines/SkyboxPipeline.cpp"
|
|
|
|
"src/Input/InputManager.cpp"
|
|
|
|
"src/ObjectModel/Component.cpp"
|
|
"src/ObjectModel/GameObject.cpp"
|
|
"src/ObjectModel/Object.cpp"
|
|
"src/ObjectModel/Transform.cpp"
|
|
|
|
"src/Scene/Scene.cpp"
|
|
"src/Scene/SceneManager.cpp"
|
|
|
|
|
|
"src/FS/AssetFS.cpp"
|
|
"src/FS/Manifest.cpp"
|
|
)
|
|
|
|
add_library(destrum ${SRC_FILES})
|
|
|
|
add_library(destrum::destrum ALIAS destrum)
|
|
|
|
set_target_properties(destrum PROPERTIES
|
|
CXX_STANDARD 20
|
|
CXX_EXTENSIONS OFF
|
|
)
|
|
|
|
#target_add_extra_warnings(destrum)
|
|
|
|
target_include_directories(destrum PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include")
|
|
|
|
target_link_libraries(destrum
|
|
PUBLIC
|
|
volk::volk_headers
|
|
vk-bootstrap::vk-bootstrap
|
|
GPUOpen::VulkanMemoryAllocator
|
|
|
|
glm::glm
|
|
nlohmann_json::nlohmann_json
|
|
spdlog::spdlog
|
|
stb::image
|
|
tinygltf
|
|
|
|
PRIVATE
|
|
freetype::freetype
|
|
)
|
|
|
|
target_compile_definitions(destrum
|
|
PUBLIC
|
|
VK_NO_PROTOTYPES
|
|
VMA_VULKAN_VERSION=1003000
|
|
# VOLK_DEFAULT_VISIBILITY # FIXME: doesn't work for some reason
|
|
)
|
|
|
|
if (WIN32)
|
|
if (BUILD_SHARED_LIBS)
|
|
target_link_libraries(destrum
|
|
PUBLIC SDL2::SDL2main SDL2::SDL2
|
|
)
|
|
else ()
|
|
target_link_libraries(destrum
|
|
PUBLIC SDL2::SDL2main SDL2::SDL2-static
|
|
)
|
|
endif ()
|
|
endif ()
|
|
|
|
target_compile_definitions(destrum
|
|
PUBLIC
|
|
GLM_FORCE_CTOR_INIT
|
|
GLM_FORCE_XYZW_ONLY
|
|
GLM_FORCE_EXPLICIT_CTOR
|
|
GLM_FORCE_DEPTH_ZERO_TO_ONE
|
|
GLM_ENABLE_EXPERIMENTAL
|
|
)
|
|
|
|
set(ASSETS_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_src")
|
|
set(ASSETS_RUNTIME_DIR "${CMAKE_CURRENT_LIST_DIR}/assets_runtime")
|
|
set(OUTPUT_ENGINE_ASSETS_DIR "${CMAKE_BINARY_DIR}/assets/engine")
|
|
|
|
add_custom_command(TARGET destrum POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E rm -rf "${OUTPUT_ENGINE_ASSETS_DIR}"
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/assets"
|
|
COMMAND ${CMAKE_COMMAND} -E create_symlink "${ASSETS_RUNTIME_DIR}" "${OUTPUT_ENGINE_ASSETS_DIR}"
|
|
VERBATIM
|
|
)
|
|
|
|
add_custom_target(_internal_clean_engine_assets
|
|
COMMAND TheChef
|
|
--input "${ASSETS_SRC_DIR}"
|
|
--output "${ASSETS_RUNTIME_DIR}"
|
|
--clean
|
|
)
|
|
|
|
add_custom_target(_internal_cook_engine_assets ALL
|
|
COMMAND TheChef
|
|
--input "${ASSETS_SRC_DIR}"
|
|
--output "${ASSETS_RUNTIME_DIR}"
|
|
DEPENDS TheChef
|
|
)
|