Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subprojects ignore shared_module's build_by_default : false option when install : true and build regardless #13498

Open
lf- opened this issue Jul 31, 2024 · 0 comments

Comments

@lf-
Copy link
Contributor

lf- commented Jul 31, 2024

Describe the bug
If you set build_by_default : false in a subproject, one would expect the target to not be built by default. I later discovered this is because install : true, which is not documented to be related to whether it will be be built by default.

The use case that is leading to wanting this is that this is a clang-tidy plugin that I would like to build only on demand when you actually run the clang-tidy custom target, and it is in a subproject because I would like to be able to also pass it in externally to easily use Nix build caching. Actually it would be even more ideal if the subproject were not even configured if the dependent target is not demanded, since there is no reason to need it to be, but I would also accept skipping the build.

To Reproduce

https://git.jade.fyi/jade/meson-repro-20240731

or, reproduce the below file structure:

meson/repro » tree .
.
├── meson.build
└── subprojects
    └── subproj
        ├── lib.c
        └── meson.build

3 directories, 3 files

meson/repro » cat meson.build
project('repro')
subproject('subproj')
meson/repro » cat subprojects/subproj/meson.build
project('lix-clang-tidy', ['c'])

sources = files('lib.c')
module = shared_module('lix-clang-tidy', sources, install : true, build_by_default : false)

meson/repro » cat subprojects/subproj/lib.c

Repro:

meson/repro » meson setup build
....

meson/repro » rg 'build all' build/build.ninja
115:build all: phony meson-test-prereq meson-benchmark-prereq subprojects/subproj/liblix-clang-tidy.so

Observe that liblix-clang-tidy.so is incorrectly included in all in spite of being explicitly set to not be built by default.

Expected behavior

I expect the subproject target to not be built by default if it is not set to be built by default.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? Nope
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.): Arch Linux
  • what Python version are you using e.g. 3.8.0: 3.12.4
  • what meson --version: 1.5.1
  • what ninja --version if it's a Ninja build: don't even have to run ninja to find this problem, but 1.12.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant