forked from ezEngine/ezEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (76 loc) · 3.1 KB
/
CMakeLists.txt
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
cmake_minimum_required(VERSION 3.20)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not supported. Please choose a different binary directory.")
return()
endif()
include("${CMAKE_CURRENT_SOURCE_DIR}/ezCMakeConfig.cmake")
get_property(EZ_CMAKE_RELPATH GLOBAL PROPERTY EZ_CMAKE_RELPATH)
get_property(EZ_CMAKE_RELPATH_CODE GLOBAL PROPERTY EZ_CMAKE_RELPATH_CODE)
# Required to find cmake modules like 'FindDirectX.cmake'
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/${EZ_CMAKE_RELPATH}")
include("ezUtils")
file(RELATIVE_PATH EZ_SUBMODULE_PREFIX_PATH ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set_property(GLOBAL PROPERTY EZ_SUBMODULE_PREFIX_PATH ${EZ_SUBMODULE_PREFIX_PATH})
if(EZ_SUBMODULE_PREFIX_PATH STREQUAL "")
set(EZ_SUBMODULE_MODE FALSE)
else()
set(EZ_SUBMODULE_MODE TRUE)
endif()
set_property(GLOBAL PROPERTY EZ_SUBMODULE_MODE ${EZ_SUBMODULE_MODE})
# Set a global variable pointing to the root of the EZ source tree
set(EZ_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
set_property(GLOBAL PROPERTY EZ_ROOT ${EZ_ROOT})
ez_build_filter_init()
ez_detect_project_name(DETECTED_NAME)
if(NOT EZ_SUBMODULE_MODE)
ez_detect_languages()
set(EZ_SOLUTION_NAME ${DETECTED_NAME} CACHE STRING "The name of the solution")
project(${EZ_SOLUTION_NAME}
VERSION 1.0
DESCRIPTION "An open-source game engine"
HOMEPAGE_URL "https://ezengine.net"
LANGUAGES ${EZ_LANGUAGES})
endif()
include("ezPlatform")
ez_set_build_types()
ez_check_build_type()
ez_write_configuration_txt()
if(EZ_CUSTOM_TOOLCHAIN_FILE)
message(STATUS "Including EZ_CUSTOM_TOOLCHAIN_FILE: '${EZ_CUSTOM_TOOLCHAIN_FILE}'")
include("${EZ_CUSTOM_TOOLCHAIN_FILE}")
endif()
ez_pull_all_vars()
set(EZ_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Code")
ez_find_qt()
ez_init_projects()
get_property(SELECTED_FILTER_NAME GLOBAL PROPERTY EZ_BUILD_FILTER_SELECTED)
if (NOT ${SELECTED_FILTER_NAME} MATCHES "Everything")
set(CMAKE_SUPPRESS_REGENERATION true)
endif()
add_subdirectory(${EZ_CMAKE_RELPATH_CODE})
add_subdirectory(Data)
ez_add_external_projects_folder("_1")
ez_add_external_projects_folder("_2")
ez_add_external_projects_folder("_3")
if(NOT EZ_SUBMODULE_MODE)
if(TARGET Editor)
# sets the Editor project as the default startup project in Visual Studio
set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" PROPERTY VS_STARTUP_PROJECT Editor)
endif()
endif()
# finalizers may run into problems in split solutions
# however, they aren't needed there, since CI will always build all projects
# and finalizers are typically only needed to set up build dependencies
if (${SELECTED_FILTER_NAME} MATCHES "Everything")
ez_finalize_projects()
endif()
get_property(EXPORT_PROJECTS GLOBAL PROPERTY "EXPORT_PROJECTS")
ez_get_export_location(EZ_EXPORT_LOCATION)
export(TARGETS ${EXPORT_PROJECTS} FILE "${EZ_EXPORT_LOCATION}")
set(EXPORT_INFO "
set(EXPINP_OUTPUT_DIRECTORY_DLL ${EZ_OUTPUT_DIRECTORY_DLL})
set(EXPINP_OUTPUT_DIRECTORY_LIB ${EZ_OUTPUT_DIRECTORY_LIB})
set(EXPINP_BINARY_DIR ${CMAKE_BINARY_DIR})
set(EXPINP_SOURCE_DIR ${CMAKE_SOURCE_DIR})
")
file(WRITE "${EZ_OUTPUT_DIRECTORY_DLL}/ezExportInfo.cmake" ${EXPORT_INFO})