-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
121 lines (106 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
cmake_minimum_required(VERSION 3.20)
# Disable CYGWIN Legacy Warning
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
# Set where out should go
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY $<1:${CMAKE_SOURCE_DIR}>)
# Set all version configuration
set(VERSION_MAJOR 0)
set(VERSION_MINOR 2)
set(VERSION_PATCH 0)
set(SO_VERSION ${VERSION_MAJOR}.${VERSION_MINOR})
set(FULL_VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
# Project info
project(CurlyEngine VERSION ${FULL_VERSION})
# Project options
option(CURLY_LOCAL_RC "Enable RC File Support for local builds (export icon)" OFF)
option(CURLY_FORCE_GLX_CTX_VERSION OFF)
set(CURLY_GLX_CTX_VERSION_MAJOR 4 CACHE STRING "Specifies Forced GLX Version Major")
set(CURLY_GLX_CTX_VERSION_MINOR 6 CACHE STRING "Specifies Forced GLX Version Minor")
# Set C++20 as the standard
set(CMAKE_CXX_STANDARD 20)
set(CURLY_RUNTIME_LIB_NAME curly-runtime)
set(CURLY_EDITOR_EXEC_NAME curly)
# Set Target Platform
if(WIN32)
set(CURLY_PLATFORM win32)
else()
set(CURLY_PLATFORM linux)
endif()
# Icon
if(CURLY_LOCAL_RC)
set(OPT_RES_OBJ "other/res/curly-rc.o")
else()
set(OPT_RES_OBJ "")
endif()
# Get Source Files
set(CURLY_RUNTIME_SOURCES
src/engine/core/GL/gl.c
src/engine/system/timer.cpp
src/engine/system/${CURLY_PLATFORM}/timerPlatform.cpp
src/engine/graphics/gUtils.cpp
src/engine/graphics/mesh.cpp
src/engine/graphics/model.cpp
src/engine/graphics/shader.cpp
src/engine/math/mUtils.cpp
src/engine/math/vecArithmetic.cpp
src/engine/window/inputHandler.cpp
src/engine/window/renderingWindow.cpp
src/engine/window/${CURLY_PLATFORM}/windowManagerPlatform.cpp
src/engine/window/${CURLY_PLATFORM}/compatUtilsPlatform.cpp
)
set(CURLY_EDITOR_SOURCES
src/editor/window/${CURLY_PLATFORM}/editorWindowManagerPlatform.cpp
src/editor/app.cpp
)
# Set Dynamic Compile Definitions
set(CURLY_BUILD_DEFINITIONS)
if(CURLY_FORCE_GLX_CTX_VERSION)
set(CURLY_BUILD_DEFINITIONS ${CURLY_BUILD_DEFINITIONS}
C__CURLY_FORCE_GLX_CTX_VERSION
C__CURLY_GLX_CTX_VERSION_MAJOR=${CURLY_GLX_CTX_VERSION_MAJOR}
C__CURLY_GLX_CTX_VERSION_MINOR=${CURLY_GLX_CTX_VERSION_MINOR}
)
endif()
# Build library modules
add_library(${CURLY_RUNTIME_LIB_NAME} SHARED ${CURLY_RUNTIME_SOURCES})
set_target_properties(${CURLY_RUNTIME_LIB_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${SO_VERSION}
)
# Set Compile Definitions
target_compile_definitions(${CURLY_RUNTIME_LIB_NAME}
PUBLIC
GLAD_API_CALL_EXPORT
C__CURLY_API_CALL_EXPORT
PRIVATE
__STDC_LIB_EXT1__
GLAD_API_CALL_EXPORT_BUILD
C__CURLY_API_CALL_EXPORT_BUILD
${CURLY_BUILD_DEFINITIONS}
)
# Add Include Directories and Link
target_include_directories(${CURLY_RUNTIME_LIB_NAME} PRIVATE include/engine)
if(WIN32)
target_link_libraries(${CURLY_RUNTIME_LIB_NAME} opengl32)
else()
target_link_libraries(${CURLY_RUNTIME_LIB_NAME} GL X11)
endif()
# Build main runtime module
add_executable(${CURLY_EDITOR_EXEC_NAME} ${CURLY_EDITOR_SOURCES} ${OPT_RES_OBJ})
add_dependencies(${CURLY_EDITOR_EXEC_NAME} ${CURLY_RUNTIME_LIB_NAME})
target_compile_definitions(${CURLY_EDITOR_EXEC_NAME}
PUBLIC
GLAD_API_CALL_EXPORT
C__CURLY_API_CALL_EXPORT
PRIVATE
__STDC_LIB_EXT1__
)
target_include_directories(${CURLY_EDITOR_EXEC_NAME} PRIVATE include)
target_include_directories(${CURLY_EDITOR_EXEC_NAME} PRIVATE include/engine)
target_include_directories(${CURLY_EDITOR_EXEC_NAME} PRIVATE include/editor)
if(WIN32)
target_link_libraries(${CURLY_EDITOR_EXEC_NAME} LINK_PUBLIC ${CURLY_RUNTIME_LIB_NAME} opengl32)
else()
target_link_libraries(${CURLY_EDITOR_EXEC_NAME} LINK_PUBLIC ${CURLY_RUNTIME_LIB_NAME})
endif()