-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
95 lines (72 loc) · 2.5 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
cmake_minimum_required(VERSION 3.3)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT "Runtime" )
project(Ming3D)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
set(BUILD_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
set(EXTERNAL_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ExternalLibraries" CACHE PATH "External library directory")
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(BUILD_ROOT "${CMAKE_SOURCE_DIR}/build")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/build")
set(ROOT_DIR "${CMAKE_SOURCE_DIR}")
# Cache variables
set(MING3D_BUILD_SAMPLES ON CACHE BOOL "Build sample project")
set(MING3D_DEBUG_STATS OFF CACHE BOOL "Enable debug stats")
set(MING3D_BUILD_EDITOR ON CACHE BOOL "Build editor project")
if(WIN32)
# Graphics API
set(MING3D_RENDERING_API "D3D11" CACHE STRING "Rendering API")
set_property(CACHE MING3D_RENDERING_API PROPERTY STRINGS D3D11 OpenGL)
else()
# Graphics API
set(MING3D_RENDERING_API "OpenGL" CACHE STRING "Rendering API")
set_property(CACHE MING3D_RENDERING_API PROPERTY STRINGS OpenGL)
endif()
# Physics API
set(MING3D_PHYSICS_API "PhysX" CACHE STRING "Physics API")
set_property(CACHE MING3D_PHYSICS_API PROPERTY STRINGS PhysX Null)
# Set rendering API
if(MING3D_RENDERING_API STREQUAL "OpenGL")
add_definitions(-DMING3D_OPENGL)
else()
add_definitions(-DMING3D_D3D11)
endif()
# Set physics API
if(MING3D_PHYSICS_API STREQUAL "PhysX")
add_definitions(-DMING3D_PHYSX)
endif()
if(MING3D_DEBUG_STATS)
add_definitions(-DMING3D_DEBUG_STATS_ENABLED)
endif()
IF(WIN32)
add_definitions(-DUNICODE)
endif()
# Copy conan.cmake
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/CMake/conan.cmake" DESTINATION "${CMAKE_BINARY_DIR}")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
if(WIN32)
set(CONANFILE_PATH conanfile-win.txt)
else()
set(CONANFILE_PATH conanfile.txt)
endif()
conan_cmake_run(CONANFILE ${CONANFILE_PATH} BASIC_SETUP CMAKE_TARGETS BUILD missing)
# project
add_subdirectory(Core)
add_subdirectory(Runtime)
add_subdirectory(Networking)
add_subdirectory(Rendering)
add_subdirectory(Engine)
add_subdirectory(Viewer)
if(MING3D_BUILD_EDITOR)
add_subdirectory(Editor)
endif()
if(MING3D_BUILD_SAMPLES)
add_subdirectory(Samples)
endif()