2021-05-09 19:10:23 -04:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
2020-12-28 15:22:38 -05:00
|
|
|
project(PrismEngine)
|
2020-08-11 12:07:21 -04:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
|
|
|
|
|
|
|
# enable folders in IDEs that support this feature
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Common.cmake)
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/cmake/AddPlatformExecutable.cmake)
|
|
|
|
include(FetchContent)
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
message("Linux build detected!")
|
|
|
|
|
2021-05-09 20:11:12 -04:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
2020-08-11 12:07:21 -04:00
|
|
|
set(ENABLE_VULKAN TRUE)
|
|
|
|
set(ENABLE_LINUX TRUE)
|
|
|
|
endif()
|
|
|
|
|
2020-08-14 19:56:27 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" AND NOT IOS)
|
|
|
|
message("macOS build detected!")
|
|
|
|
|
2021-09-13 13:47:29 -04:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
|
|
|
set(ENABLE_VULKAN TRUE)
|
2020-08-14 19:56:27 -04:00
|
|
|
set(ENABLE_DARWIN TRUE)
|
|
|
|
set(ENABLE_MACOS TRUE)
|
2022-02-15 11:25:13 -05:00
|
|
|
set(ENABLE_METAL TRUE)
|
2020-08-14 19:56:27 -04:00
|
|
|
|
|
|
|
set(CMAKE_XCODE_GENERATE_SCHEME OFF)
|
|
|
|
endif()
|
|
|
|
|
2020-08-11 12:07:21 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
|
|
|
|
message("iOS build detected!")
|
|
|
|
|
2022-02-12 19:58:51 -05:00
|
|
|
set(ENABLE_VULKAN TRUE)
|
2020-08-11 12:07:21 -04:00
|
|
|
set(ENABLE_DARWIN TRUE)
|
|
|
|
set(ENABLE_IOS TRUE)
|
2022-02-18 14:36:38 -05:00
|
|
|
set(ENABLE_METAL TRUE)
|
2020-08-11 12:07:21 -04:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "tvOS")
|
|
|
|
message("tvOS build detected!")
|
|
|
|
|
2022-02-12 19:58:51 -05:00
|
|
|
set(ENABLE_VULKAN TRUE)
|
2020-08-11 12:07:21 -04:00
|
|
|
set(ENABLE_DARWIN TRUE)
|
|
|
|
set(ENABLE_TVOS TRUE)
|
2022-02-18 14:36:38 -05:00
|
|
|
set(ENABLE_METAL TRUE)
|
2020-08-11 12:07:21 -04:00
|
|
|
endif()
|
|
|
|
|
2020-08-12 22:10:36 -04:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
|
|
message("Windows build detected!")
|
|
|
|
|
2021-04-20 00:23:14 -04:00
|
|
|
find_package(SDL2 REQUIRED)
|
|
|
|
|
2020-08-12 22:10:36 -04:00
|
|
|
set(ENABLE_WINDOWS ON)
|
|
|
|
set(ENABLE_VULKAN ON)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
|
|
|
|
message("UWP build detected!")
|
|
|
|
|
|
|
|
set(ENABLE_UWP TRUE)
|
|
|
|
endif()
|
|
|
|
|
2020-09-21 10:15:28 -04:00
|
|
|
set(CROSS_LIBS
|
|
|
|
spirv-cross-core
|
|
|
|
spirv-cross-glsl
|
|
|
|
spirv-cross-msl
|
|
|
|
glslang
|
|
|
|
SPIRV
|
|
|
|
)
|
2020-08-12 22:10:36 -04:00
|
|
|
|
2020-08-11 12:07:21 -04:00
|
|
|
add_subdirectory(extern)
|
2020-09-22 12:54:08 -04:00
|
|
|
|
|
|
|
# enable lto
|
2021-10-11 14:33:45 -04:00
|
|
|
if (CMAKE_BUILD_TYPE EQUAL "Release")
|
|
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
|
|
endif ()
|
2020-09-22 12:54:08 -04:00
|
|
|
|
2020-08-11 12:07:21 -04:00
|
|
|
add_subdirectory(platforms)
|
|
|
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
|
2020-09-22 16:21:35 -04:00
|
|
|
source_group(Shaders shaders)
|
|
|
|
|
2020-08-11 12:07:21 -04:00
|
|
|
add_subdirectory(engine)
|
2020-12-28 15:45:09 -05:00
|
|
|
add_subdirectory(tools)
|
|
|
|
add_subdirectory(example)
|