Skip to content

Commit

Permalink
meson: fix macos-touchbar check
Browse files Browse the repository at this point in the history
Apparently, it is possible for touchbar.m to compile on non-macos
machines. Also, the disable switch didn't actually work either. Fix this
by using the require() function and making sure that Cocoa (should be
apple-only) is found in addition to the compile check passing which is
what waf does. Fixes #10847.
  • Loading branch information
Dudemanguy committed Nov 11, 2022
1 parent 8758d96 commit c56d981
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -1530,17 +1530,13 @@ if swift.allowed()
subdir(join_paths('generated', 'osdep'))
endif

macos_touchbar = {
'name': 'macos-touchbar',
'deps': dependency('appleframeworks', modules: 'AppKit',
required: get_option('macos-touchbar')),
'fragment': files(join_paths(fragments, 'touchbar.m')),
}
features += {'macos-touchbar': cc.compiles(macos_touchbar['fragment'], name: 'macos-touchbar check')}
macos_touchbar = get_option('macos-touchbar').require(
cc.compiles(files(join_paths(fragments, 'touchbar.m')), name: 'macos-touchbar check') and features['cocoa'],
error_message: 'Either cocoa could not be found or the macos-touchbar check failed!',
)
features += {'macos-touchbar': macos_touchbar.allowed()}
if features['macos-touchbar']
sources += files('osdep/macosx_touchbar.m')
elif get_option('macos-touchbar').enabled()
error('macos-touchbar enabled but it could not be found!')
endif


Expand Down

0 comments on commit c56d981

Please sign in to comment.