| 1 |
project( |
| 2 |
'proc-macro2', |
| 3 |
'rust', |
| 4 |
version : '1.0.86', |
| 5 |
license : 'MIT OR Apache-2.0', |
| 6 |
meson_version : '>= 1.7.0', |
| 7 |
) |
| 8 |
|
| 9 |
rc = meson.get_compiler('rust') |
| 10 |
|
| 11 |
if rc.version().version_compare('< 1.31') |
| 12 |
error('Minimum rustc supported version is 1.31') |
| 13 |
endif |
| 14 |
|
| 15 |
rust_args = [ |
| 16 |
'--cfg', 'feature="proc-macro"', |
| 17 |
'--cfg', 'feature="default"', |
| 18 |
'--cfg', 'use_proc_macro', |
| 19 |
'--cfg', 'wrap_proc_macro', |
| 20 |
] |
| 21 |
if rc.version().version_compare('< 1.32') |
| 22 |
rust_args += ['--cfg', 'no_libprocmacro_unwind_safe'] |
| 23 |
endif |
| 24 |
if rc.version().version_compare('< 1.39') |
| 25 |
rust_args += ['--cfg', 'no_bind_by_move_pattern_guard'] |
| 26 |
endif |
| 27 |
if rc.version().version_compare('< 1.44') |
| 28 |
rust_args += ['--cfg', 'no_lexerror_display'] |
| 29 |
endif |
| 30 |
if rc.version().version_compare('< 1.45') |
| 31 |
rust_args += ['--cfg', 'no_hygiene'] |
| 32 |
endif |
| 33 |
if rc.version().version_compare('< 1.47') |
| 34 |
rust_args += ['--cfg', 'no_ident_new_raw'] |
| 35 |
endif |
| 36 |
if rc.version().version_compare('< 1.54') |
| 37 |
rust_args += ['--cfg', 'no_literal_from_str'] |
| 38 |
endif |
| 39 |
if rc.version().version_compare('< 1.55') |
| 40 |
rust_args += ['--cfg', 'no_group_open_close'] |
| 41 |
endif |
| 42 |
if rc.version().version_compare('< 1.57') |
| 43 |
rust_args += ['--cfg', 'no_is_available'] |
| 44 |
endif |
| 45 |
if rc.version().version_compare('< 1.66') |
| 46 |
rust_args += ['--cfg', 'no_source_text'] |
| 47 |
endif |
| 48 |
if rc.version().version_compare('< 1.79') |
| 49 |
rust_args += [ |
| 50 |
'--cfg', 'no_literal_byte_character', |
| 51 |
'--cfg', 'no_literal_c_string', |
| 52 |
] |
| 53 |
endif |
| 54 |
|
| 55 |
u_ind = subproject('unicode-ident-1-rs').get_variable('lib') |
| 56 |
|
| 57 |
lib = static_library( |
| 58 |
'proc_macro2', |
| 59 |
'src/lib.rs', |
| 60 |
rust_args : rust_args, |
| 61 |
override_options : ['rust_std=2021', 'build.rust_std=2021', 'warning_level=0'], |
| 62 |
link_with : u_ind, |
| 63 |
rust_abi : 'rust', |
| 64 |
native : true, |
| 65 |
) |