|
11 | 11 | from spin import util
|
12 | 12 |
|
13 | 13 |
|
| 14 | +# The numpy-vendored version of Meson. Put the directory that the executable |
| 15 | +# `meson` is in at the front of the PATH. |
| 16 | +curdir = pathlib.Path(__file__).parent.resolve() |
| 17 | +meson_executable_dir = str(curdir.parent / 'vendored-meson' / 'entrypoint') |
| 18 | +os.environ['PATH'] = meson_executable_dir + os.pathsep + os.environ['PATH'] |
| 19 | + |
| 20 | +# Check that the meson git submodule is present |
| 21 | +meson_import_dir = curdir.parent / 'vendored-meson' / 'meson' / 'mesonbuild' |
| 22 | +if not meson_import_dir.exists(): |
| 23 | + raise RuntimeError( |
| 24 | + 'The `vendored-meson/meson` git submodule does not exist! ' + |
| 25 | + 'Run `git submodule update --init` to fix this problem.' |
| 26 | + ) |
| 27 | + |
| 28 | + |
| 29 | +@click.command() |
| 30 | +@click.option( |
| 31 | + "-j", "--jobs", |
| 32 | + help="Number of parallel tasks to launch", |
| 33 | + type=int |
| 34 | +) |
| 35 | +@click.option( |
| 36 | + "--clean", is_flag=True, |
| 37 | + help="Clean build directory before build" |
| 38 | +) |
| 39 | +@click.option( |
| 40 | + "-v", "--verbose", is_flag=True, |
| 41 | + help="Print all build output, even installation" |
| 42 | +) |
| 43 | +@click.argument("meson_args", nargs=-1) |
| 44 | +@click.pass_context |
| 45 | +def build(ctx, meson_args, jobs=None, clean=False, verbose=False): |
| 46 | + """🔧 Build package with Meson/ninja and install |
| 47 | +
|
| 48 | + MESON_ARGS are passed through e.g.: |
| 49 | +
|
| 50 | + spin build -- -Dpkg_config_path=/lib64/pkgconfig |
| 51 | +
|
| 52 | + The package is installed to build-install |
| 53 | +
|
| 54 | + By default builds for release, to be able to use a debugger set CFLAGS |
| 55 | + appropriately. For example, for linux use |
| 56 | +
|
| 57 | + CFLAGS="-O0 -g" spin build |
| 58 | + """ |
| 59 | + ctx.forward(meson.build) |
| 60 | + |
| 61 | + |
14 | 62 | @click.command()
|
15 | 63 | @click.argument("sphinx_target", default="html")
|
16 | 64 | @click.option(
|
|
32 | 80 | )
|
33 | 81 | @click.option(
|
34 | 82 | "--install-deps/--no-install-deps",
|
35 |
| - default=True, |
| 83 | + default=False, |
36 | 84 | help="Install dependencies before building"
|
37 | 85 | )
|
38 | 86 | @click.pass_context
|
|
0 commit comments