2021-03-31 12:18:16 +02:00
|
|
|
cmake_minimum_required(VERSION 3.19)
|
2020-02-05 20:58:58 +01:00
|
|
|
|
2021-03-31 12:18:16 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2020-02-25 00:44:40 +01:00
|
|
|
|
2020-02-05 20:58:58 +01:00
|
|
|
# Handle superbuild first
|
|
|
|
|
option (USE_SUPERBUILD "Whether or not a superbuild should be invoked" ON)
|
|
|
|
|
|
2020-02-25 00:44:40 +01:00
|
|
|
set(ENGINE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src/Engine)
|
|
|
|
|
set(EXTERNAL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/external)
|
2020-06-02 11:46:18 +02:00
|
|
|
set(ASSIMP_ROOT ${EXTERNAL_ROOT}/assimp)
|
2020-02-25 00:44:40 +01:00
|
|
|
set(BOOST_ROOT ${EXTERNAL_ROOT}/boost)
|
2020-06-02 11:46:18 +02:00
|
|
|
set(SLANG_ROOT ${EXTERNAL_ROOT}/slang)
|
2020-02-25 00:44:40 +01:00
|
|
|
set(GLM_ROOT ${EXTERNAL_ROOT}/glm)
|
|
|
|
|
set(GLFW_ROOT ${EXTERNAL_ROOT}/glfw)
|
2020-05-05 01:51:13 +02:00
|
|
|
set(JSON_ROOT ${EXTERNAL_ROOT}/json)
|
2021-08-21 18:02:53 +02:00
|
|
|
set(KTX_ROOT ${EXTERNAL_ROOT}/ktx)
|
2020-06-02 11:46:18 +02:00
|
|
|
set(STB_ROOT ${EXTERNAL_ROOT}/stb)
|
2020-10-03 11:00:10 +02:00
|
|
|
set(SPIRV_ROOT ${EXTERNAL_ROOT}/SPIRV-Cross)
|
2021-06-04 18:27:49 +02:00
|
|
|
set(NSAM_ROOT ${EXTERNAL_ROOT}/aftermath)
|
2020-06-02 11:46:18 +02:00
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/)
|
2020-02-25 00:44:40 +01:00
|
|
|
|
2021-04-01 16:40:14 +02:00
|
|
|
set(Boost_USE_STATIC_LIBS OFF)
|
2020-03-25 11:55:50 +01:00
|
|
|
|
2020-10-03 11:00:10 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
|
|
|
|
|
#Workaround for vs, because it places artifacts into an additional subfolder
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug)
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/bin/Release)
|
|
|
|
|
|
2020-02-05 20:58:58 +01:00
|
|
|
if (USE_SUPERBUILD)
|
|
|
|
|
project (SUPERBUILD NONE)
|
|
|
|
|
# execute the superbuild (this script will be invoked again without the
|
|
|
|
|
# USE_SUPERBUILD option this time)
|
|
|
|
|
include (cmake/SuperBuild.cmake)
|
|
|
|
|
return() # stop processing this file further
|
|
|
|
|
else()
|
|
|
|
|
project (Seele)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-06-02 11:46:18 +02:00
|
|
|
|
2020-02-05 20:58:58 +01:00
|
|
|
find_package(Vulkan REQUIRED)
|
|
|
|
|
find_package(Boost REQUIRED COMPONENTS serialization)
|
2020-06-02 11:46:18 +02:00
|
|
|
find_package(Threads REQUIRED)
|
2021-04-01 16:40:14 +02:00
|
|
|
find_package(Assimp REQUIRED)
|
2020-06-02 11:46:18 +02:00
|
|
|
find_package(JSON REQUIRED)
|
|
|
|
|
find_package(GLFW REQUIRED)
|
2020-10-14 01:49:43 +02:00
|
|
|
find_package(GLM REQUIRED)
|
2021-08-21 18:02:53 +02:00
|
|
|
find_package(KTX REQUIRED)
|
2021-08-22 23:07:38 +02:00
|
|
|
find_package(STB REQUIRED)
|
2021-04-01 16:40:14 +02:00
|
|
|
find_package(SLANG REQUIRED)
|
2021-06-04 18:27:49 +02:00
|
|
|
find_package(Aftermath REQUIRED)
|
2020-02-05 20:58:58 +01:00
|
|
|
|
|
|
|
|
include_directories(${GLM_INCLUDE_DIRS})
|
2021-08-21 18:02:53 +02:00
|
|
|
include_directories(${KTX_INCLUDE_DIRS})
|
2020-06-02 11:46:18 +02:00
|
|
|
include_directories(${STB_INCLUDE_DIRS})
|
2020-02-05 20:58:58 +01:00
|
|
|
include_directories(${Vulkan_INCLUDE_DIR})
|
|
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
2020-06-02 11:46:18 +02:00
|
|
|
include_directories(${GLFW_INCLUDE_DIRS})
|
2020-02-25 00:44:40 +01:00
|
|
|
include_directories(${SLANG_INCLUDE_DIRS})
|
2020-06-02 11:46:18 +02:00
|
|
|
include_directories(${ASSIMP_INCLUDE_DIRS})
|
|
|
|
|
include_directories(${JSON_INCLUDE_DIRS})
|
2021-06-04 18:27:49 +02:00
|
|
|
include_directories(${NSAM_INCLUDE_DIRS})
|
2020-06-02 11:46:18 +02:00
|
|
|
include_directories(${ENGINE_ROOT})
|
2020-02-25 00:44:40 +01:00
|
|
|
include_directories(src/Engine)
|
|
|
|
|
add_definitions(${Vulkan_DEFINITIONS})
|
|
|
|
|
add_definitions(${Boost_DEFINITIONS})
|
2020-03-02 19:07:49 +01:00
|
|
|
add_compile_definitions(GLFW_WINDOWS)
|
2020-03-17 02:41:33 +01:00
|
|
|
if(WIN32)
|
|
|
|
|
add_compile_definitions(USE_EXTENSIONS)
|
|
|
|
|
endif()
|
2020-10-14 01:49:43 +02:00
|
|
|
if(CMAKE_DEBUG_POSTFIX)
|
|
|
|
|
add_compile_definitions(ENABLE_VALIDATION)
|
|
|
|
|
endif()
|
2020-02-25 00:44:40 +01:00
|
|
|
add_executable(SeeleEngine "")
|
2020-02-05 20:58:58 +01:00
|
|
|
target_link_libraries(SeeleEngine ${Vulkan_LIBRARY})
|
2020-06-02 11:46:18 +02:00
|
|
|
target_link_libraries(SeeleEngine ${Boost_LIBRARIES})
|
|
|
|
|
target_link_libraries(SeeleEngine ${GLFW_LIBRARIES})
|
2020-10-14 01:49:43 +02:00
|
|
|
target_link_libraries(SeeleEngine ${SLANG_LIBRARIES})
|
2020-06-02 11:46:18 +02:00
|
|
|
target_link_libraries(SeeleEngine ${ASSIMP_LIBRARIES})
|
2021-06-04 18:27:49 +02:00
|
|
|
target_link_libraries(SeeleEngine ${NSAM_LIBRARIES})
|
2021-08-22 23:07:38 +02:00
|
|
|
target_link_libraries(SeeleEngine ${KTX_LIBRARIES})
|
2021-10-13 15:20:30 +02:00
|
|
|
if(UNIX)
|
|
|
|
|
target_link_libraries(SeeleEngine Threads::Threads)
|
|
|
|
|
target_link_libraries(SeeleEngine dl)
|
|
|
|
|
endif()
|
2021-04-01 16:40:14 +02:00
|
|
|
target_precompile_headers(SeeleEngine
|
|
|
|
|
PRIVATE
|
|
|
|
|
<assert.h>
|
|
|
|
|
<atomic>
|
|
|
|
|
<condition_variable>
|
|
|
|
|
<coroutine>
|
|
|
|
|
<cstring>
|
|
|
|
|
<filesystem>
|
|
|
|
|
<functional>
|
|
|
|
|
<fstream>
|
|
|
|
|
<iostream>
|
|
|
|
|
<memory>
|
|
|
|
|
<mutex>
|
|
|
|
|
<string>
|
|
|
|
|
<thread>
|
|
|
|
|
<boost/serialization/serialization.hpp>
|
|
|
|
|
<boost/crc.hpp>)
|
2020-06-02 11:46:18 +02:00
|
|
|
|
2020-05-05 01:51:13 +02:00
|
|
|
add_subdirectory(src/)
|
2020-02-25 00:44:40 +01:00
|
|
|
|
2020-04-12 15:47:19 +02:00
|
|
|
if(MSVC)
|
2020-06-02 11:46:18 +02:00
|
|
|
set(_CRT_SECURE_NO_WARNINGS)
|
2020-08-11 22:38:19 +02:00
|
|
|
# target_compile_options(SeeleEngine PRIVATE /DEBUG:FASTLINK /Zi)
|
2020-04-12 15:47:19 +02:00
|
|
|
else()
|
2021-04-01 16:40:14 +02:00
|
|
|
target_compile_options(SeeleEngine PRIVATE -Wall -Wextra -Wno-delete-incomplete -pedantic -fcoroutines)
|
2020-04-12 15:47:19 +02:00
|
|
|
endif()
|
|
|
|
|
|
2020-06-02 11:46:18 +02:00
|
|
|
add_executable(Seele_unit_tests "")
|
2020-02-25 00:44:40 +01:00
|
|
|
add_subdirectory(test/)
|
|
|
|
|
|
2020-06-02 11:46:18 +02:00
|
|
|
add_custom_target(copy-runtime-files ALL
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $<TARGET_FILE_DIR:SeeleEngine>
|
2021-06-04 18:27:49 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>
|
2020-10-14 01:49:43 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_GLSLANG} $<TARGET_FILE_DIR:SeeleEngine>
|
2020-06-02 11:46:18 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GLFW_BINARY} $<TARGET_FILE_DIR:SeeleEngine>
|
2020-10-30 18:45:35 +01:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ASSIMP_BINARY} $<TARGET_FILE_DIR:SeeleEngine>
|
2021-06-04 18:27:49 +02:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NSAM_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>
|
2020-06-02 11:46:18 +02:00
|
|
|
DEPENDS SeeleEngine)
|