mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 12:20:10 +01:00
subprojects: rustix: enable windows + macos build support
This is a matter of adding the right dependencies and using them. Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
This commit is contained in:
parent
7aec401b62
commit
b6094567a7
1 changed files with 26 additions and 6 deletions
|
|
@ -2,7 +2,7 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
project(
|
||||
'rustix',
|
||||
'rustix-1-rs',
|
||||
'rust',
|
||||
version : '1.1.2',
|
||||
license : 'Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT',
|
||||
|
|
@ -13,12 +13,14 @@ libc = subproject('libc-0.2-rs').get_variable('lib')
|
|||
bitflags = subproject('bitflags-2-rs').get_variable('lib')
|
||||
|
||||
rustix_args = []
|
||||
os_deps = []
|
||||
|
||||
if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
||||
rustix_args += [
|
||||
'--cfg', 'linux_like',
|
||||
'--cfg', 'linux_kernel',
|
||||
'--cfg', 'libc',
|
||||
'--cfg', 'feature="use-libc"',
|
||||
'--cfg', 'linux_like',
|
||||
'--cfg', 'linux_kernel',
|
||||
'--cfg', 'feature="std"',
|
||||
'--cfg', 'feature="alloc"',
|
||||
'--cfg', 'feature="event"',
|
||||
|
|
@ -27,18 +29,36 @@ if host_machine.system() == 'linux' or host_machine.system() == 'android'
|
|||
'--cfg', 'feature="net"',
|
||||
'--cfg', 'feature="param"',
|
||||
'--cfg', 'feature="pipe"',
|
||||
]
|
||||
]
|
||||
elif host_machine.system() == 'darwin' or host_machine.system() == 'macos'
|
||||
rustix_args += [
|
||||
'--cfg', 'apple',
|
||||
'--cfg', 'bsd',
|
||||
'--cfg', 'libc',
|
||||
'--cfg', 'feature="use-libc"',
|
||||
'--cfg', 'feature="std"',
|
||||
'--cfg', 'feature="alloc"',
|
||||
'--cfg', 'feature="fs"',
|
||||
'--cfg', 'feature="net"',
|
||||
'--cfg', 'feature="pipe"',
|
||||
]
|
||||
elif host_machine.system() == 'windows'
|
||||
rustix_args += [
|
||||
'--cfg', 'libc',
|
||||
'--cfg', 'feature="use-libc"',
|
||||
]
|
||||
os_deps += subproject('windows-sys-0.6-rs').get_variable('lib')
|
||||
endif
|
||||
|
||||
lib = static_library(
|
||||
'rustix',
|
||||
'src/lib.rs',
|
||||
override_options : ['rust_std=2021', 'build.rust_std=2021'],
|
||||
link_with : [errno, libc, bitflags],
|
||||
link_with : [errno, libc, bitflags] + os_deps,
|
||||
rust_abi : 'rust',
|
||||
rust_args: rustix_args,
|
||||
)
|
||||
|
||||
dep_rustix = declare_dependency(
|
||||
link_with : [lib, errno, libc, bitflags]
|
||||
link_with : [lib, errno, libc, bitflags] + os_deps,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue