-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
127 lines (108 loc) · 3.48 KB
/
CMakeLists.txt
File metadata and controls
127 lines (108 loc) · 3.48 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
cmake_minimum_required(VERSION 3.16)
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
project(RayneEngine)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(FetchContent)
FetchContent_Declare(
SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 2.6.x
)
FetchContent_MakeAvailable(SFML)
FetchContent_Declare(
nlohmann_json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
FetchContent_MakeAvailable(nlohmann_json)
FetchContent_Declare(
sol2
GIT_REPOSITORY https://github.com/ThePhD/sol2.git
GIT_TAG main
)
FetchContent_MakeAvailable(sol2)
FetchContent_Declare(
lua_source
GIT_REPOSITORY https://github.com/lua/lua.git
GIT_TAG v5.4.6
)
FetchContent_GetProperties(lua_source)
if(NOT lua_source_POPULATED)
FetchContent_Populate(lua_source)
file(GLOB LUA_SOURCES "${lua_source_SOURCE_DIR}/*.c")
list(REMOVE_ITEM LUA_SOURCES
"${lua_source_SOURCE_DIR}/lua.c"
"${lua_source_SOURCE_DIR}/luac.c"
"${lua_source_SOURCE_DIR}/onelua.c"
)
add_library(lua_lib STATIC ${LUA_SOURCES}
)
if(UNIX)
target_link_libraries(lua_lib PUBLIC dl)
endif()
target_include_directories(lua_lib PUBLIC ${lua_source_SOURCE_DIR})
target_compile_options(lua_lib PRIVATE $<$<CONFIG:Release>:/O2>)
endif()
# --- Engine Executable ---
add_executable(RayneEngine
src/main.cpp
src/Core/Application/Application.cpp
src/Core/Scenes/SceneManager.cpp
src/Core/Primitives/Primitive.h
src/Core/Primitives/RectanglePrimitive.h
src/Core/Primitives/CirclePrimitive.h
src/Core/Primitives/TrianglePrimitive.h
src/Core/Primitives/PrimitiveManager.h
src/Core/Math/MathR.h
src/Core/Math/Vector.h
src/Core/Scripting/ScriptComponent.cpp
src/Core/Scripting/ScriptComponent.h
src/Core/Scripting/LuaState.cpp
src/Core/Scripting/LuaState.h
src/Core/Math/MathR.cpp
src/Core/ECS/Entity.h
src/Core/ECS/Pool.h
src/Core/ECS/Registry.h
src/Core/ECS/Components.h
src/Core/ECS/View.h
src/Core/Scenes/EditorScene.cpp
src/Core/Scenes/EditorScene.h
src/Core/Scenes/GameScene.cpp
src/Core/Scenes/GameScene.h
src/Core/Input/InputManager.cpp
src/Core/Input/InputManager.h
src/Core/Scripting/EventManager.cpp
src/Core/Scripting/EventManager.h
src/Core/Scenes/ContentBrowser.cpp
src/Core/Scenes/ContentBrowser.h
)
# --- Link Libraries ---
target_link_libraries(RayneEngine
PRIVATE
sfml-system
sfml-window
sfml-graphics
sfml-audio
sol2::sol2
lua_lib
nlohmann_json::nlohmann_json
)
# --- Copy assets ---
add_custom_command(TARGET RayneEngine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/assets
$<TARGET_FILE_DIR:RayneEngine>/assets
)
add_custom_command(TARGET RayneEngine POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:sfml-system>
$<TARGET_FILE:sfml-window>
$<TARGET_FILE:sfml-graphics>
$<TARGET_FILE:sfml-audio>
$<TARGET_FILE_DIR:RayneEngine>
)
# --- Working Directory ---
set_target_properties(RayneEngine PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
)
target_compile_definitions(RayneEngine PRIVATE ASSET_PATH="${CMAKE_SOURCE_DIR}/assets/")