Skip to content

Commit

Permalink
Use -idirafter when adding Apple framework include paths
Browse files Browse the repository at this point in the history
System headers will continue to "preempt" the framework headers. This
should allow both <GStreamer/gst/gst.h> and <gst/gst.h>
  • Loading branch information
tristan957 authored and nirbheek committed Oct 11, 2023
1 parent 4c9927e commit c0a5da8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/dependencies/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def detect(self, name: str, paths: T.List[str]) -> None:
# https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html
incdir = self._get_framework_include_path(framework_path)
if incdir:
self.compile_args += ['-I' + incdir]
self.compile_args += ['-idirafter' + incdir]
self.is_found = True
return

Expand Down
10 changes: 7 additions & 3 deletions test cases/osx/5 extra frameworks/meson.build
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
project('xcode extra framework test', 'c')

dep_libs = dependency('OpenGL', method : 'extraframework')
assert(dep_libs.type_name() == 'extraframeworks', 'type_name is ' + dep_libs.type_name())
opengl_dep = dependency('OpenGL', method : 'extraframework')
assert(opengl_dep.type_name() == 'extraframeworks', 'type_name is ' + opengl_dep.type_name())

dep_main = dependency('Foundation')
assert(dep_main.type_name() == 'extraframeworks', 'type_name is ' + dep_main.type_name())

stlib = static_library('stat', 'stat.c', install : true, dependencies: dep_libs)
# https://github.com/mesonbuild/meson/issues/10002
ldap_dep = dependency('ldap', method : 'extraframework')
assert(ldap_dep.type_name() == 'extraframeworks', 'type_name is ' + ldap_dep.type_name())

stlib = static_library('stat', 'stat.c', install : true, dependencies: [opengl_dep, ldap_dep])
exe = executable('prog', 'prog.c', install : true, dependencies: dep_main)
3 changes: 3 additions & 0 deletions test cases/osx/5 extra frameworks/stat.c
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
// https://github.com/mesonbuild/meson/issues/10002
#include <ldap.h>

int func(void) { return 933; }

0 comments on commit c0a5da8

Please sign in to comment.