-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
144 lines (121 loc) · 4.15 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
cmake_minimum_required(VERSION 3.7)
#----PROJECT VARIABLES----#
project(Vivid)
set(CMAKE_CXX_STANDARD 17)
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
set(DEBUG true)
set(BUILD true)
else ()
set(DEBUG false)
set(BUILD false)
endif ()
set(VERSION_MAJOR 0)
set(VERSION_MINOR 1)
#-------------------------#
# Find the platform of the compiling system
if (WIN32)
if (NOT DEBUG)
SET(EXE_ARGUMENT ${EXE_ARGUMENT} WIN32)
endif ()
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PLATFORM WIN64)
else ()
set(PLATFORM WIN32)
endif ()
endif (WIN32)
# Create the configuration file for the C++ code
configure_file(
${PROJECT_SOURCE_DIR}/config.h.in
${PROJECT_SOURCE_DIR}/src/vivid/util/config.h
)
# Set the correct output folder
if (DEBUG)
set(RELEASE_FOLDER bin/debug)
else (DEBUG)
set(RELEASE_FOLDER bin/release_${PLATFORM}/${VERSION_MAJOR}.${VERSION_MINOR})
endif (DEBUG)
# Delete any existing bin files
file(REMOVE_RECURSE ${RELEASE_FOLDER})
# Setting output folder to the bin folder
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/${RELEASE_FOLDER}")
# Copy the platform-dependent dlls and libraries
if (PLATFORM MATCHES "WIN64")
file(GLOB DEP_FILES dependencies/win64/*)
file(COPY ${DEP_FILES} DESTINATION "${PROJECT_SOURCE_DIR}/${RELEASE_FOLDER}")
endif ()
# Copying resource files to the correct bin folder
file(GLOB RES_FILES res/*)
file(COPY ${RES_FILES} DESTINATION "${PROJECT_SOURCE_DIR}/${RELEASE_FOLDER}")
# Adds a copy of the source code for reference in release builds
if (NOT DEBUG)
file(COPY src DESTINATION "${PROJECT_SOURCE_DIR}/${RELEASE_FOLDER}")
endif (NOT DEBUG)
# Include OpenGL (Would be a shame to forget doing this...)
find_package(OpenGL REQUIRED)
# Adds a few definitions because the libraries need it
add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
)
# Compile library dependencies
add_subdirectory(dependencies/libs)
# Include header files
include_directories(dependencies/include)
# Pack all the necessary libraries in one convenient variable
set(
ALL_LIBS
${OPENGL_LIBRARY}
glfw
GLEW_1130
VividImage
)
# Adds all the source files (CLion automatically does this when creating a file)
set(
SOURCE_FILES
src/vivid/util/config.h
src/main.cpp
src/vivid/graphics/shader.h
src/vivid/graphics/shader.cpp
src/vivid/graphics/window.h
src/vivid/graphics/window.cpp
src/vivid/core.h
src/vivid/util/timer.h
src/vivid/input/input.cpp
src/vivid/input/input.h
src/vivid/graphics/renderer2D.h
src/vivid/graphics/quad.h
src/vivid/graphics/batchrenderer2D.cpp
src/vivid/graphics/batchrenderer2D.h
src/vivid/graphics/buffers/buffer.cpp
src/vivid/graphics/buffers/buffer.h
src/vivid/graphics/buffers/indexbuffer.cpp
src/vivid/graphics/buffers/indexbuffer.h
src/vivid/graphics/buffers/vertexarray.cpp
src/vivid/graphics/buffers/vertexarray.h
src/vivid/graphics/buffers/buffers.h
src/vivid/scenegraph/sprite.h
src/vivid/scenegraph/sprite.cpp
src/vivid/graphics/texture.cpp
src/vivid/graphics/texture.h
src/vivid/scenegraph/gameobject.cpp
src/vivid/scenegraph/gameobject.h
src/vivid/scenegraph/camera.cpp
src/vivid/scenegraph/camera.h
src/vivid/scenegraph/layer.cpp
src/vivid/scenegraph/layer.h
src/vivid/scenegraph/transform.cpp
src/vivid/scenegraph/transform.h
src/vivid/util/maths.cpp
src/vivid/util/maths.h
src/vivid/util/resource.cpp
src/vivid/util/resource.h src/vivid/scenegraph/scene.cpp src/vivid/scenegraph/scene.h src/vivid/events/event.h src/vivid/events/windowEvent.h src/vivid/events/keyEvent.h src/vivid/events/mouseEvent.h src/vivid/vivid.cpp src/vivid/vivid.h
src/vivid/graphics/font.h src/vivid/graphics/font.cpp src/vivid/scenegraph/textureatlas.cpp src/vivid/scenegraph/textureatlas.h src/vivid/scenegraph/Text.cpp src/vivid/scenegraph/Text.h)
add_compile_definitions(VIVID_BUILD=true)
install(DIRECTORY src/ DESTINATION include/myproj FILES_MATCHING PATTERN "*.h")
#file(COPY ${HEADER_FILES} DESTINATION "${PROJECT_SOURCE_DIR}/test")
add_executable(${PROJECT_NAME} ${EXE_ARGUMENT} ${SOURCE_FILES})
target_include_directories(${PROJECT_NAME} PRIVATE src)
target_link_libraries(${PROJECT_NAME} ${ALL_LIBS})