Skip to content

Commit

Permalink
osdep/mac/meson.build: dynamically add features to swift build flags
Browse files Browse the repository at this point in the history
similar to how our config.h is created the feature flags added to the
swift build should be generated from our features array, instead of
manually adding those when needed.

this prevents errors when forgetting to add any needed flags or remove
obsolete ones.
  • Loading branch information
Akemi committed Dec 24, 2024
1 parent cf01fdd commit e8ecc7d
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions osdep/mac/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,11 @@ if get_option('optimization') != '0'
swift_flags += '-O'
endif

if macos_10_15_4_features.allowed()
swift_flags += ['-D', 'HAVE_MACOS_10_15_4_FEATURES']
endif

if macos_11_features.allowed()
swift_flags += ['-D', 'HAVE_MACOS_11_FEATURES']
endif

if macos_12_features.allowed()
swift_flags += ['-D', 'HAVE_MACOS_12_FEATURES']
endif

if macos_cocoa_cb.allowed()
swift_flags += ['-D', 'HAVE_MACOS_COCOA_CB']
endif

if macos_touchbar.allowed()
swift_flags += ['-D', 'HAVE_MACOS_TOUCHBAR']
endif

if macos_media_player.allowed()
swift_flags += ['-D', 'HAVE_MACOS_MEDIA_PLAYER']
endif
foreach feature, allowed: features
if allowed
swift_flags += ['-D', 'HAVE_@0@'.format(feature.underscorify().to_upper())]
endif
endforeach

extra_flags = get_option('swift-flags').split()
swift_flags += extra_flags
Expand Down

0 comments on commit e8ecc7d

Please sign in to comment.