1project( 2 'syn', 3 'rust', 4 version : '2.0.15', 5 license :'MIT OR Apache-2.0', 6) 7 8rc = meson.get_compiler('rust') 9 10 11rust_args = [ 12 '--cfg', 'feature="default"', 13 '--cfg', 'feature="derive"', 14 '--cfg', 'feature="parsing"', 15 '--cfg', 'feature="printing"', 16 '--cfg', 'feature="clone-impls"', 17 '--cfg', 'feature="proc-macro"', 18 '--cfg', 'feature="quote"', 19] 20if rc.version().version_compare('< 1.36') 21 rust_args += ['--cfg', 'syn_omit_await_from_token_macro'] 22endif 23if rc.version().version_compare('< 1.39') 24 rust_args += ['--cfg', 'syn_no_const_vec_new'] 25endif 26if rc.version().version_compare('< 1.40') 27 rust_args += ['--cfg', 'syn_no_non_exhaustive'] 28endif 29if rc.version().version_compare('< 1.56') 30 rust_args += ['--cfg', 'syn_no_negative_literal_parse'] 31endif 32 33u_ind = subproject('unicode-ident').get_variable('lib') 34quote = subproject('quote').get_variable('lib') 35pm2 = subproject('proc-macro2').get_variable('lib') 36 37 38lib = static_library( 39 'syn', 40 'src/lib.rs', 41 rust_args : rust_args, 42 override_options : ['rust_std=2021', 'build.rust_std=2021'], 43 link_with : [u_ind, quote, pm2], 44 rust_abi : 'rust', 45 native : true, 46) 47 48dep_syn = declare_dependency( 49 link_with : [lib, u_ind, quote, pm2], 50) 51