-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathconfig.m4
More file actions
180 lines (154 loc) 路 5.16 KB
/
Copy pathconfig.m4
File metadata and controls
180 lines (154 loc) 路 5.16 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
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
dnl $Id$
dnl config.m4 for extension glfw
PHP_ARG_ENABLE(glfw, whether to enable glfw support,
[ --enable-glfw Enable glfw support])
PHP_ARG_WITH([glfw-dir],
[dir of glfw],
[AS_HELP_STRING([[--with-glfw-dir[=DIR]]],
[Path to the glfw library directory])], [no], [no])
AC_MSG_CHECKING([for os target])
AC_CANONICAL_HOST
build_linux=no
build_mac=no
case "${host_os}" in
linux*)
build_linux=yes
;;
darwin*)
build_mac=yes
;;
*)
AC_MSG_ERROR(["OS $host_os is not supported"])
;;
esac
if test "$build_mac" = "yes"; then
AC_MSG_RESULT([building for MacOS])
else
AC_MSG_RESULT([building for Linux])
fi
check_for_glfw3() {
for i in /usr/local /usr /opt /opt/homebrew /opt/local; do
if test -r "$i/include/GLFW/glfw3.h"; then
GLFW_DIR=$i
return 0
fi
done
return 1
}
if test "$PHP_GLFW" != "no"; then
AC_MSG_CHECKING([for glfw installation])
if test "x$PHP_GLFW_DIR" != "xno"; then
if test -r "$PHP_GLFW_DIR/include/GLFW/glfw3.h"; then
GLFW_DIR=$PHP_GLFW_DIR
else
check_for_glfw3
fi
else
check_for_glfw3
fi
if test "x$GLFW_DIR" = "x"; then
AC_MSG_RESULT([GLFW lib not found, trying to build])
#聽Build glfw
cd vendor/glfw
# cmake . -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=./ && make install
cmake . -DGLFW_BUILD_TESTS=OFF -DGLFW_BUILD_EXAMPLES=OFF -DGLFW_BUILD_DOCS=OFF -DBUILD_SHARED_LIBS=ON && sudo make install
if test "$build_linux" = "yes"; then
sudo ldconfig
fi
cd ./../../
check_for_glfw3
fi
if test "x$GLFW_DIR" = "x"; then
AC_MSG_ERROR([GLFW lib could not be located or build])
fi
AC_MSG_RESULT([found in $GLFW_DIR ($PHP_LIBDIR)])
# GLFW lib common sources
GLFWLIB_SRC_FILES=""
GLFWPLATTFORMARGS=""
if test "$build_mac" = "yes"; then
AC_DEFINE(_GLFW_COCOA, 1, [Cocoa support])
GLFWPLATTFORMARGS="-D_GLFW_COCOA"
# GLFWLIB_SRC_FILES="$GLFWLIB_SRC_FILES \
# vendor/glfw/src/cocoa_init.m \
# vendor/glfw/src/cocoa_joystick.m \
# vendor/glfw/src/cocoa_monitor.m \
# vendor/glfw/src/cocoa_window.m \
# vendor/glfw/src/cocoa_time.c \
# vendor/glfw/src/posix_thread.c \
# vendor/glfw/src/nsgl_context.m \
# vendor/glfw/src/egl_context.c \
# vendor/glfw/src/osmesa_context.c"
else
AC_DEFINE(_GLFW_X11, 1, [X11 support])
GLFWPLATTFORMARGS="-D_GLFW_X11"
# GLFWLIB_SRC_FILES="vendor/glfw/src/context.c \
# vendor/glfw/src/init.c \
# vendor/glfw/src/input.c \
# vendor/glfw/src/monitor.c \
# vendor/glfw/src/vulkan.c \
# vendor/glfw/src/window.c"
# GLFWLIB_SRC_FILES="$GLFWLIB_SRC_FILES \
# vendor/glfw/src/x11_init.c \
# vendor/glfw/src/x11_monitor.c \
# vendor/glfw/src/x11_window.c \x
# vendor/glfw/src/xkb_unicode.c \
# vendor/glfw/src/posix_time.c \
# vendor/glfw/src/posix_thread.c \
# vendor/glfw/src/glx_context.c \
# vendor/glfw/src/egl_context.c \
# vendor/glfw/src/osmesa_context.c \
# vendor/glfw/src/null_joystick.c"
# PHP_ADD_BUILD_DIR($ext_builddir/vendor/glfw/src)
fi
PHPGLFW_SRC_FILES="phpglfw.c \
phpglfw_constants.c \
phpglfw_functions.c \
phpglfw_math.c \
phpglfw_buffer.c \
phpglfw_texture.c \
phpglfw_objparser.c \
phpglfw_voxparser.c \
phpglfw_svgparser.c \
src/ogt_vox_c_wrapper.cpp \
phpglfw_vg.c \
phpglfw_audio.c \
phpglfw_drawcall_assembler.c \
vendor/fastobj/fast_obj.c \
vendor/glad/src/glad.c \
vendor/nanovg/src/nanovg.c"
# we already use stb libs in phpglfw so we need to stop nanovg from implementing them
GLFWPLATTFORMARGS="-DNVG_NO_STB=1 $GLFWPLATTFORMARGS"
# the generated arginfo file has unicode issues because we have classes like "\\UInt"
#聽im just going to supress those warnings for now, please don't judge me
GLFWPLATTFORMARGS="-Wno-unicode $GLFWPLATTFORMARGS"
PHP_ADD_LIBRARY_WITH_PATH(glfw, [$GLFW_DIR/lib], GLFW_SHARED_LIBADD)
AC_DEFINE(HAVE_GLFW, 1, [Whether you have glfw])
PHP_SUBST(GLFW_SHARED_LIBADD)
PHP_REQUIRE_CXX()
PHP_NEW_EXTENSION(glfw, $PHPGLFW_SRC_FILES $GLFWLIB_SRC_FILES, $ext_shared, , $GLFWPLATTFORMARGS -Wall)
PHP_ADD_INCLUDE([$ext_srcdir])
PHP_ADD_INCLUDE([$ext_srcdir/include])
PHP_ADD_INCLUDE([$ext_srcdir/src])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/glad/include])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/cvector])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/stb])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/fastobj])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/nanosvg/src])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/nanovg/src])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/miniaudio])
PHP_ADD_INCLUDE([$ext_srcdir/vendor/opengametools/src])
PHP_ADD_INCLUDE([$GLFW_DIR/include])
PHP_INSTALL_HEADERS([ext/glfw], [*.h \
include/*.h \
vendor/glad/include/glad/*.h \
vendor/glad/include/KHR/*.h \
vendor/cvector/*.h \
vendor/stb/*.h \
vendor/fastobj/*.h \
vendor/nanosvg/src/*.h \
vendor/nanovg/src/*.h \
vendor/miniaudio/*.h \
vendor/opengametools/src/*.h \
vendor/glfw/include/GLFW/*.h])
PHP_ADD_BUILD_DIR($ext_builddir/src)
fi