This repository has been archived by the owner on Feb 26, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
CMakeLists.txt
164 lines (151 loc) · 3.88 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
cmake_minimum_required(VERSION 3.16.3)
option(PSXF_STDMEM "Use standard libc memory allocators instead of the fast custom one" OFF)
set(PSXF_GL "MODERN" CACHE STRING "Which version of OpenGL to use: 'MODERN' for OpenGL Core 3.2, 'LEGACY' for OpenGL 2.1, and 'ES' for OpenGL ES 2.0")
option(PSXF_NETWORK "Enable networking" OFF)
project(funkin LANGUAGES C)
add_executable(funkin
"src/main.c"
"src/main.h"
"src/mem.h"
"src/mutil.c"
"src/mutil.h"
"src/random.c"
"src/random.h"
"src/archive.c"
"src/archive.h"
"src/font.c"
"src/font.h"
"src/trans.c"
"src/trans.h"
"src/loadscr.c"
"src/loadscr.h"
"src/menu.c"
"src/menu.h"
"src/stage.c"
"src/stage.h"
"src/pc/psx.c"
"src/psx.h"
"src/pc/io.c"
"src/io.h"
"src/pc/gfx.c"
"src/gfx.h"
"src/pc/audio.c"
"src/audio.h"
"src/pc/pad.c"
"src/pad.h"
"src/pc/timer.c"
"src/timer.h"
"src/pc/movie.c"
"src/movie.h"
"src/pc/dr_mp3.h"
"src/pc/miniaudio.h"
"src/stage/dummy.c"
"src/stage/dummy.h"
"src/stage/week1.c"
"src/stage/week1.h"
"src/stage/week2.c"
"src/stage/week2.h"
"src/stage/week3.c"
"src/stage/week3.h"
"src/stage/week4.c"
"src/stage/week4.h"
"src/stage/week5.c"
"src/stage/week5.h"
"src/stage/week6.c"
"src/stage/week6.h"
"src/stage/week7.c"
"src/stage/week7.h"
"src/animation.c"
"src/animation.h"
"src/character.c"
"src/character.h"
"src/character/bf.c"
"src/character/bf.h"
"src/character/bfweeb.c"
"src/character/bfweeb.h"
"src/character/speaker.c"
"src/character/speaker.h"
"src/character/dad.c"
"src/character/dad.h"
"src/character/spook.c"
"src/character/spook.h"
"src/character/pico.c"
"src/character/pico.h"
"src/character/mom.c"
"src/character/mom.h"
"src/character/xmasbf.c"
"src/character/xmasbf.h"
"src/character/xmasp.c"
"src/character/xmasp.h"
"src/character/senpai.c"
"src/character/senpai.h"
"src/character/senpaim.c"
"src/character/senpaim.h"
"src/character/spirit.c"
"src/character/spirit.h"
"src/character/tank.c"
"src/character/tank.h"
"src/character/gf.c"
"src/character/gf.h"
"src/character/gfweeb.c"
"src/character/gfweeb.h"
"src/character/clucky.c"
"src/character/clucky.h"
"src/object.c"
"src/object.h"
"src/object/combo.c"
"src/object/combo.h"
"src/object/splash.c"
"src/object/splash.h"
)
if (PSXF_GL STREQUAL "ES")
# Enable OpenGL ES 2.0 code
target_compile_definitions(funkin PRIVATE PSXF_GL=PSXF_GL_ES)
# Link OpenGL ES 2.0 library
target_link_libraries(funkin PRIVATE GLESv2)
# Raspberry Pi Broadcom GLESv2 driver.
# Would be nice to test someday, but it doesn't work during X sessions,
# and this port cannot be ran from the terminal (yet).
# For now, we'll just have to settle with the open-source Mesa driver.
#target_link_libraries(funkin PRIVATE "/opt/vc/lib/libbrcmGLESv2.so")
else()
if(PSXF_GL STREQUAL "LEGACY")
target_compile_definitions(funkin PRIVATE PSXF_GL=PSXF_GL_LEGACY)
elseif(PSXF_GL STREQUAL "MODERN")
target_compile_definitions(funkin PRIVATE PSXF_GL=PSXF_GL_MODERN)
else()
message(FATAL_ERROR "Invalid PSXF_GL specified")
endif()
# Include the 'glad' OpenGL loader
target_sources(funkin PRIVATE
"src/pc/glad/glad.c"
"src/pc/glad/glad.h"
)
endif()
# Make it so the code knows it's targetting PC
target_compile_definitions(funkin PRIVATE PSXF_PC)
# Use standard memory allocators if requested to
#if(PSXF_STDMEM)
target_compile_definitions(funkin PRIVATE PSXF_STDMEM)
#endif()
# Use networking if requested to
if(PSXF_NETWORK)
target_compile_definitions(funkin PRIVATE PSXF_NETWORK)
target_sources(funkin PRIVATE
"src/pc/network.c"
"src/network.h"
)
endif()
# Link GLFW3
find_package(glfw3 REQUIRED)
target_link_libraries(funkin PRIVATE glfw)
# miniaudio requires libm, libpthread, and libdl
find_library(LIBM m)
if(LIBM)
target_link_libraries(funkin PRIVATE ${LIBM})
endif()
find_library(LIBPTHREAD pthread)
if(LIBPTHREAD)
target_link_libraries(funkin PRIVATE ${LIBPTHREAD})
endif()
target_link_libraries(funkin PRIVATE ${CMAKE_DL_LIBS})