forked from duaneking/BansheeEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
105 lines (82 loc) · 3.61 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
102
103
104
105
cmake_minimum_required (VERSION 3.12.0)
project (Banshee3D)
set (BSF_DIRECTORY ${PROJECT_SOURCE_DIR}/Source/bsf)
set (BSF_SOURCE_DIR ${BSF_DIRECTORY}/Source)
set (APP_ROOT_DIR ${PROJECT_SOURCE_DIR})
set (BS_IS_BANSHEE3D 1)
# Grab BSF
find_path(SUBMODULE_SOURCES "Source/Foundation/bsfEngine/BsApplication.h" "Source/bsf/")
if(NOT SUBMODULE_SOURCES)
execute_process(COMMAND git submodule update
--init
-- Source/bsf
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
else()
execute_process(COMMAND git submodule update
-- Source/bsf
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()
mark_as_advanced(SUBMODULE_SOURCES)
include(${BSF_SOURCE_DIR}/CMake/Properties.cmake)
include(${BSF_SOURCE_DIR}/CMake/FindPackageOrBuild.cmake)
include(${BSF_SOURCE_DIR}/CMake/HelperMethods.cmake)
add_subdirectory(${BSF_SOURCE_DIR})
set (BS_PREBUILT_DEPENDENCIES_VERSION 24)
set (BS_SRC_DEPENDENCIES_VERSION 15)
set (BS_BUILTIN_ASSETS_VERSION 12)
# Options
set(GENERATE_SCRIPT_BINDINGS OFF CACHE BOOL "If true, script binding files will be generated. Script bindings are required for the project to build properly, however they take a while to generate. If you are sure the script bindings are up to date, you can turn off their generation (temporarily) to speed up the build.")
# Ensure dependencies are up to date
## Check prebuilt dependencies that are downloaded in a .zip
check_and_update_binary_deps(Banshee ${PROJECT_SOURCE_DIR}/Dependencies/ ${BS_PREBUILT_DEPENDENCIES_VERSION})
## Check data dependencies
check_and_update_builtin_assets(Banshee ${PROJECT_SOURCE_DIR}/Data/Raw Raw ${BS_BUILTIN_ASSETS_VERSION} NO)
## Import built-in assets
if(${BUILD_ASSETS})
run_import_tool(Banshee ${PROJECT_SOURCE_DIR} "--editor")
endif()
## Fetch built-in assets
set(BANSHEE_COMPILED_ASSETS_VERSION_FILE ${PROJECT_SOURCE_DIR}/Data/.reqversion)
file (STRINGS ${BANSHEE_COMPILED_ASSETS_VERSION_FILE} BANSHEE_COMPILED_ASSETS_VERSION)
check_and_update_builtin_assets(BansheeCompiled ${PROJECT_SOURCE_DIR}/Data Data ${BANSHEE_COMPILED_ASSETS_VERSION} NO)
# Generate script bindings
include(${BSF_SOURCE_DIR}/CMake/GenerateScriptBindings.cmake)
# Sub-directories
add_subdirectory(Source/EditorCore)
## Script interop
add_subdirectory(${BSF_SOURCE_DIR}/Plugins/bsfMono)
add_subdirectory(Source/Scripting/SBansheeEngine)
add_subdirectory(Source/Scripting/SBansheeEditor)
## Executables
add_subdirectory(Source/Banshee3D)
add_subdirectory(Source/Game)
## Managed projects
set(CS_ENGINE_PROJ ${PROJECT_SOURCE_DIR}/Source/Scripting/MBansheeEngine/MBansheeEngine.csproj)
set(CS_EDITOR_PROJ ${PROJECT_SOURCE_DIR}/Source/Scripting/MBansheeEditor/MBansheeEditor.csproj)
if(MSVC)
include_external_msproject(MBansheeEngine ${CS_ENGINE_PROJ})
include_external_msproject(MBansheeEditor ${CS_EDITOR_PROJ})
set_target_properties(MBansheeEngine PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE OptimizedDebug
)
set_target_properties(MBansheeEditor PROPERTIES
MAP_IMPORTED_CONFIG_RELEASE OptimizedDebug
)
set_property(TARGET MBansheeEngine PROPERTY FOLDER Script)
set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
add_dependencies(Banshee3D MBansheeEngine MBansheeEditor)
add_dependencies(Game MBansheeEngine)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT Banshee3D)
else()
find_package(mcs)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
set(CS_PROJ_CONFIG Debug)
else()
set(CS_PROJ_CONFIG Release)
endif()
add_custom_target(BuildManaged
COMMAND xbuild /p:Configuration=${CS_PROJ_CONFIG} ${CS_EDITOR_PROJ}
COMMENT "Building managed assemblies")
add_dependencies(Banshee3D BuildManaged)
add_dependencies(Game BuildManaged)
endif()