Skip to content

Commit de8d1bf

Browse files
committed
freeglut: require GL/glu.h
Freeglut requires GL/glu.h, which isn't always installed. Make sure we check for it, so we can get a meaningful error message early on instead of just failing to compile. Because not all platforms has glu as a dependency, we also need to fall back to searching for the library. This search is copied from Mesa's demos project.
1 parent ba8760d commit de8d1bf

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

releases.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@
931931
"glut"
932932
],
933933
"versions": [
934+
"3.4.0-4",
934935
"3.4.0-3",
935936
"3.4.0-2",
936937
"3.4.0-1"

subprojects/packagefiles/freeglut/meson.build

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,23 @@ freeglut_sources = files(
6767
'src/fg_window.c',
6868
)
6969

70+
dep_glu = dependency('glu', required : false)
71+
# GLU is part of OpenGL.Framework
72+
if not dep_glu.found() and host_machine.system() != 'darwin'
73+
_glu_name = 'GLU'
74+
if host_machine.system() == 'windows'
75+
_glu_name = 'glu32'
76+
endif
77+
dep_glu = cc.find_library(_glu_name, has_headers: 'GL/glu.h')
78+
endif
79+
7080
freeglut_deps = [
7181
cc.find_library(
7282
'm',
7383
required: false,
7484
),
7585
dependency('gl'),
86+
dep_glu,
7687
]
7788

7889
if host_system == 'windows'

0 commit comments

Comments
 (0)