Debian Codegraph @

test cases/osx/4 framework/meson.build

raw
1 # Primitive test for adding frameworks in XCode
2 # When opening the xcodeproj, the Folder "Frameworks" should contain two frameworks (OpenGL.framework and Foundation.framework)
3 # "Target Membership" of ...
4 # - OpenGL.framework should be only to prog@exe
5 # - Foundation.framework should be only to stat@sta
6 # "Build Phase" / "Link Binary with Libraries" for the target
7 # - "prog@exe" should be only "Foundation.framework"
8 # - "stat@sta" should be only "OpenGL.framework"
9 # see "xcode-frameworks.png" for an example
10
11 project('xcode framework test', 'objc', default_options : ['libdir=libtest'])
12
13 dep_main = dependency('appleframeworks', modules : ['Foundation'])
14
15 if meson.is_cross_build()
16 # This is only available in iOS, not macOS. Just test finding it.
17 uikit_dep = dependency('appleframeworks', modules: 'UIKit')
18 else
19 dep_libs = dependency('appleframeworks', modules : ['OpenGL'], required : false)
20 if not dep_libs.found()
21 error('OpenGL framework not found')
22 endif
23 assert(dep_libs.type_name() == 'appleframeworks', 'type_name is wrong')
24 # Only add the C compiler now, to ensure all lookups above were done with the ObjC one.
25 add_languages('c')
26 stlib = static_library('stat', 'stat.c', install : true, dependencies: dep_libs)
27 exe = executable('prog', 'prog.c', install : true, dependencies: dep_main)
28 uikit_dep = dependency('appleframeworks', modules: 'UIKit', required: false)
29 if uikit_dep.found()
30 error('UIKit found on macOS even though it should not be there.')
31 endif
32 endif