Skip to content

Commit

Permalink
meson: Simplify by using host_machine.subsystem()
Browse files Browse the repository at this point in the history
Available in newer versions of Meson.
  • Loading branch information
oleavr committed Apr 30, 2024
1 parent fe901b7 commit f9d410f
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,8 @@ endif

api_version = '1.0'

host_os = host_machine.system()
if host_os == 'android'
host_os_family = 'linux'
else
host_os_family = host_os
endif
host_os_family = host_machine.system()
host_os = host_machine.subsystem()
if host_machine.cpu_family() == 'arm'
host_arch = 'arm'
host_abi = 'arm'
Expand Down Expand Up @@ -84,30 +80,6 @@ if host_arch == 'arm'
endif

if host_os_family == 'darwin'
apple_os_flavors = [
['macOS', 'OSX'],
['iOS', 'IOS'],
['watchOS', 'WATCH'],
['tvOS', 'TV'],
]
foreach candidate : apple_os_flavors
name = candidate[0]
constant = candidate[1]
if cc.compiles('''
#include <TargetConditionals.h>
#if !TARGET_OS_@0@
# error Nope
#endif
'''.format(constant),
name: f'compiling for @name@')
host_os = name.to_lower()
break
endif
endforeach
if host_os == 'darwin'
error('Unable to detect Apple OS flavor')
endif

have_ptrauth_src = '''
#ifdef __clang__
# if __has_feature (ptrauth_calls)
Expand All @@ -128,10 +100,6 @@ else
have_ptrauth = false
endif

if host_os_family == 'linux' and cc.has_header('android/api-level.h')
host_os = 'android'
endif

if host_os_family == 'windows'
host_executable_format = 'pe'
elif host_os_family == 'darwin'
Expand Down

0 comments on commit f9d410f

Please sign in to comment.