forked from dtolnay/cxx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Meson, with handwritten meson.build for deps
- Loading branch information
Showing
32 changed files
with
582 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
demo_bridge = static_library( | ||
'demo_bridge', | ||
implicit_include_directories: false, | ||
include_directories: project_root, | ||
sources: cxxbridge_generator.process( | ||
files('src/main.rs'), | ||
preserve_path_from: meson.project_source_root(), | ||
), | ||
) | ||
|
||
demo_blobstore = static_library( | ||
'demo_blobstore', | ||
implicit_include_directories: false, | ||
include_directories: [demo_bridge.private_dir_include(), project_root], | ||
link_with: demo_bridge, | ||
sources: [files('src/blobstore.cc'), cxx_header], | ||
) | ||
|
||
executable( | ||
'demo', | ||
link_with: [demo_blobstore, cxx_library], | ||
sources: files('src/main.rs'), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
project( | ||
'cxx', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
license_files: ['LICENSE-APACHE', 'LICENSE-MIT'], | ||
meson_version: '>= 1.3.0', | ||
) | ||
|
||
add_languages('rust', native: true) | ||
add_languages('rust', 'cpp', native: false) | ||
|
||
subdir('tools/meson') | ||
subdir('third-party') | ||
|
||
rust = import('rust') | ||
|
||
project_root = include_directories('.') | ||
|
||
cxx_core = static_library( | ||
'cxx_core', | ||
implicit_include_directories: false, | ||
sources: files('src/cxx.cc'), | ||
) | ||
|
||
cxxbridge_macro = rust.proc_macro( | ||
'cxxbridge_macro', | ||
dependencies: [ | ||
third_party['proc-macro2'], | ||
third_party['quote'], | ||
third_party['syn'], | ||
], | ||
sources: files('macro/src/lib.rs'), | ||
) | ||
|
||
cxx_library = static_library( | ||
'cxx', | ||
link_with: [cxx_core, cxxbridge_macro], | ||
rust_args: [ | ||
'--cfg=feature="alloc"', | ||
'--cfg=feature="default"', | ||
'--cfg=feature="std"', | ||
], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
cxxbridge_cmd = executable( | ||
'cxxbridge', | ||
dependencies: [ | ||
third_party['clap'], | ||
third_party['codespan-reporting'], | ||
third_party['proc-macro2'], | ||
third_party['quote'], | ||
third_party['syn'], | ||
], | ||
native: true, | ||
sources: files('gen/cmd/src/main.rs'), | ||
) | ||
|
||
cxxbridge_generator = generator( | ||
cxxbridge_cmd, | ||
arguments: ['@INPUT@', '-o', '@OUTPUT0@', '-o', '@OUTPUT1@'], | ||
output: ['@PLAINNAME@.h', '@PLAINNAME@.cc'], | ||
) | ||
|
||
cxx_header = custom_target( | ||
'cxx_header', | ||
command: ['bash', '-c', 'mkdir -p rust; cp @INPUT@ rust'], | ||
input: files('include/cxx.h'), | ||
output: 'rust', | ||
) | ||
|
||
subdir('demo') | ||
subdir('tests') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* | ||
!/.gitignore | ||
!/packagefiles/ | ||
!/*.wrap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[wrap-file] | ||
directory = anstyle-1.0.9 | ||
source_url = https://static.crates.io/crates/anstyle/1.0.9/download | ||
source_filename = anstyle-1.0.9.tar.gz | ||
source_hash = 8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56 | ||
patch_directory = anstyle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[wrap-file] | ||
directory = clap-4.5.20 | ||
source_url = https://static.crates.io/crates/clap/4.5.20/download | ||
source_filename = clap-4.5.20.tar.gz | ||
source_hash = b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8 | ||
patch_directory = clap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[wrap-file] | ||
directory = clap_builder-4.5.20 | ||
source_url = https://static.crates.io/crates/clap_builder/4.5.20/download | ||
source_filename = clap_builder-4.5.20.tar.gz | ||
source_hash = 19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54 | ||
patch_directory = clap_builder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[wrap-file] | ||
directory = clap_lex-0.7.2 | ||
source_url = https://static.crates.io/crates/clap_lex/0.7.2/download | ||
source_filename = clap_lex-0.7.2.tar.gz | ||
source_hash = 1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97 | ||
patch_directory = clap_lex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[wrap-file] | ||
directory = codespan-reporting-0.11.1 | ||
source_url = https://static.crates.io/crates/codespan-reporting/0.11.1/download | ||
source_filename = codespan-reporting-0.11.1.tar.gz | ||
source_hash = 3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e | ||
patch_directory = codespan-reporting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
project( | ||
'anstyle', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '1.0.9', | ||
) | ||
|
||
lib = static_library( | ||
'anstyle', | ||
native: true, | ||
rust_args: ['--cfg=feature="default"', '--cfg=feature="std"'], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('anstyle', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
project( | ||
'clap', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '4.5.20', | ||
) | ||
|
||
lib = static_library( | ||
'clap', | ||
dependencies: [dependency('clap_builder', version: ['= 4.5.20'])], | ||
native: true, | ||
rust_args: [ | ||
'--cfg=feature="error-context"', | ||
'--cfg=feature="help"', | ||
'--cfg=feature="std"', | ||
'--cfg=feature="usage"', | ||
], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('clap', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
project( | ||
'clap_builder', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '4.5.20', | ||
) | ||
|
||
lib = static_library( | ||
'clap_builder', | ||
dependencies: [ | ||
dependency('anstyle', version: ['>= 1.0.8', '< 2']), | ||
dependency('clap_lex', version: ['>= 0.7.0', '< 0.8']), | ||
], | ||
native: true, | ||
rust_args: [ | ||
'--cfg=feature="error-context"', | ||
'--cfg=feature="help"', | ||
'--cfg=feature="std"', | ||
'--cfg=feature="usage"', | ||
], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('clap_builder', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
project( | ||
'clap_lex', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '0.7.2', | ||
) | ||
|
||
lib = static_library('clap_lex', native: true, sources: files('src/lib.rs')) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('clap_lex', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
project( | ||
'codespan-reporting', | ||
'rust', | ||
default_options: ['rust_std=2018'], | ||
license: 'Apache-2.0', | ||
version: '0.11.1', | ||
) | ||
|
||
lib = static_library( | ||
'codespan_reporting', | ||
dependencies: [ | ||
dependency('termcolor', version: ['>= 1', '< 2']), | ||
dependency('unicode-width', version: ['>= 0.1', '< 0.2']), | ||
], | ||
native: true, | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('codespan-reporting', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
project( | ||
'proc-macro2', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '1.0.89', | ||
) | ||
|
||
build = executable( | ||
'build_script', | ||
native: true, | ||
rust_args: [ | ||
'--cfg=feature="default"', | ||
'--cfg=feature="proc-macro"', | ||
'--cfg=feature="span-locations"', | ||
], | ||
sources: files('build.rs'), | ||
) | ||
|
||
rustc_args = custom_target( | ||
command: [ | ||
find_program('python3'), | ||
'@SOURCE_ROOT@/tools/meson/buildscript_run.py', | ||
'--buildscript', | ||
build, | ||
'--manifest-dir', | ||
'@CURRENT_SOURCE_DIR@', | ||
'--rustc-wrapper', | ||
'@BUILD_ROOT@/tools/meson/rustc_wrapper.sh', | ||
'--out-dir', | ||
'@PRIVATE_DIR@', | ||
'--rustc-args', | ||
'@OUTPUT@', | ||
], | ||
# Hack: any extension other than .rs causes a failure "ERROR: Rust target | ||
# proc_macro2 contains a non-rust source file" below, and forces the use of | ||
# `structured_sources` which would mean listing out every source file in the | ||
# crate, instead of just the crate root lib.rs. | ||
output: 'rustc_args.out.rs', | ||
) | ||
|
||
lib = static_library( | ||
'proc_macro2', | ||
dependencies: [dependency('unicode-ident', version: ['>= 1', '< 2'])], | ||
native: true, | ||
rust_args: [ | ||
'--cfg=feature="default"', | ||
'--cfg=feature="proc-macro"', | ||
'--cfg=feature="span-locations"', | ||
'@' + rustc_args.full_path(), | ||
], | ||
sources: [files('src/lib.rs'), rustc_args], | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('proc-macro2', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
project( | ||
'quote', | ||
'rust', | ||
default_options: ['rust_std=2018'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '1.0.37', | ||
) | ||
|
||
lib = static_library( | ||
'quote', | ||
dependencies: [dependency('proc-macro2', version: ['>= 1.0.80', '< 2'])], | ||
native: true, | ||
rust_args: ['--cfg=feature="default"', '--cfg=feature="proc-macro"'], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('quote', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
project( | ||
'syn', | ||
'rust', | ||
default_options: ['rust_std=2021'], | ||
license: 'MIT OR Apache-2.0', | ||
version: '2.0.85', | ||
) | ||
|
||
lib = static_library( | ||
'syn', | ||
dependencies: [ | ||
dependency('proc-macro2', version: ['>= 1.0.83', '< 2']), | ||
dependency('quote', version: ['>= 1.0.35', '< 2']), | ||
dependency('unicode-ident', version: ['>= 1', '< 2']), | ||
], | ||
native: true, | ||
rust_args: [ | ||
'--cfg=feature="clone-impls"', | ||
'--cfg=feature="default"', | ||
'--cfg=feature="derive"', | ||
'--cfg=feature="full"', | ||
'--cfg=feature="parsing"', | ||
'--cfg=feature="printing"', | ||
'--cfg=feature="proc-macro"', | ||
], | ||
sources: files('src/lib.rs'), | ||
) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('syn', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
project( | ||
'termcolor', | ||
'rust', | ||
default_options: ['rust_std=2018'], | ||
license: 'Unlicense OR MIT', | ||
version: '1.4.1', | ||
) | ||
|
||
lib = static_library('termcolor', native: true, sources: files('src/lib.rs')) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('termcolor', dep) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
project( | ||
'unicode-ident', | ||
'rust', | ||
default_options: ['rust_std=2018'], | ||
license: '(MIT OR Apache-2.0) AND Unicode-DFS-2016', | ||
version: '1.0.13', | ||
) | ||
|
||
lib = static_library('unicode_ident', native: true, sources: files('src/lib.rs')) | ||
|
||
dep = declare_dependency(link_with: lib) | ||
meson.override_dependency('unicode-ident', dep) |
Oops, something went wrong.