-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
130 lines (109 loc) · 3.98 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
cmake_minimum_required(VERSION 3.0)
#------------------------------------------------------------------------------
# Project variables
project(
rematrix
VERSION 0.1.1
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS off)
#------------------------------------------------------------------------------
# Find packages
find_package(X11 REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
#------------------------------------------------------------------------------
# Targets
add_executable(
rematrix
buffer.cpp
main.cpp
options.cpp
frame_buffer.cpp
program.cpp
render_context.cpp
resources.cpp
shader.cpp
texture.cpp
vertex_array.cpp
)
add_dependencies(
rematrix
resources_inc
)
target_include_directories(
rematrix
PRIVATE
${PROJECT_BINARY_DIR}
)
target_link_libraries(
rematrix
PRIVATE
GLEW::GLEW
OpenGL::GL
X11::X11
)
install(TARGETS rematrix DESTINATION bin)
#------------------------------------------------------------------------------
# Targets
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font_image_size.inc
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont image_size ${PROJECT_BINARY_DIR}/font.png > ${PROJECT_BINARY_DIR}/font_image_size.inc
DEPENDS ${PROJECT_BINARY_DIR}/font.png ${PROJECT_SOURCE_DIR}/data/procfont
VERBATIM
)
foreach(SHADER vertex frag)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/${SHADER}_src.inc
COMMAND sh -c "echo 'R\"('; cat ${PROJECT_SOURCE_DIR}/data/${SHADER}.glsl; echo ')\"'" > ${PROJECT_BINARY_DIR}/${SHADER}_src.inc
DEPENDS ${PROJECT_SOURCE_DIR}/data/${SHADER}.glsl
VERBATIM
)
endforeach()
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font.inc
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont make_cpp_inc < ${PROJECT_BINARY_DIR}/font.fnt > ${PROJECT_BINARY_DIR}/font.inc
DEPENDS ${PROJECT_BINARY_DIR}/font.fnt ${PROJECT_SOURCE_DIR}/data/procfont
VERBATIM
)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font_image_data.inc
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont dump_image_inc ${PROJECT_BINARY_DIR}/font.png > ${PROJECT_BINARY_DIR}/font_image_data.inc
DEPENDS ${PROJECT_BINARY_DIR}/font.png ${PROJECT_SOURCE_DIR}/data/procfont
VERBATIM
)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font2.png
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont transpose_glyphs ${PROJECT_SOURCE_DIR}/data/font2.png ${PROJECT_BINARY_DIR}/font2.png < ${PROJECT_SOURCE_DIR}/data/font2.fnt
DEPENDS ${PROJECT_SOURCE_DIR}/data/procfont ${PROJECT_SOURCE_DIR}/data/font2.fnt ${PROJECT_SOURCE_DIR}/data/font2.png
VERBATIM
)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font2.fnt
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont transpose_descr < ${PROJECT_SOURCE_DIR}/data/font2.fnt > ${PROJECT_BINARY_DIR}/font2.fnt
DEPENDS ${PROJECT_SOURCE_DIR}/data/procfont ${PROJECT_SOURCE_DIR}/data/font2.fnt
VERBATIM
)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font.png
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont combine_glyphs ${PROJECT_SOURCE_DIR}/data/font1.png ${PROJECT_BINARY_DIR}/font2.png ${PROJECT_BINARY_DIR}/font.png
DEPENDS ${PROJECT_BINARY_DIR}/font2.png ${PROJECT_SOURCE_DIR}/data/procfont ${PROJECT_SOURCE_DIR}/data/font1.png
VERBATIM
)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/font.fnt
COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/data/procfont combine_descrs ${PROJECT_SOURCE_DIR}/data/font1.fnt ${PROJECT_BINARY_DIR}/font2.fnt > ${PROJECT_BINARY_DIR}/font.fnt
DEPENDS ${PROJECT_BINARY_DIR}/font2.fnt ${PROJECT_SOURCE_DIR}/data/procfont ${PROJECT_SOURCE_DIR}/data/font1.fnt
VERBATIM
)
add_custom_target(
resources_inc
DEPENDS
${PROJECT_BINARY_DIR}/font.inc
${PROJECT_BINARY_DIR}/font_image_data.inc
${PROJECT_BINARY_DIR}/font_image_size.inc
${PROJECT_BINARY_DIR}/frag_src.inc
${PROJECT_BINARY_DIR}/vertex_src.inc
)