Skip to content

Meson: fix meson_lib missing deps, meson_exe layout & install verbosity#19918

Merged
franramirez688 merged 3 commits into
conan-io:develop2from
perseoGI:pgi/meson/tweaks
Apr 28, 2026
Merged

Meson: fix meson_lib missing deps, meson_exe layout & install verbosity#19918
franramirez688 merged 3 commits into
conan-io:develop2from
perseoGI:pgi/meson/tweaks

Conversation

@perseoGI

@perseoGI perseoGI commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Changelog: Fix: Fix meson_lib missing deps, meson_exe layout & install verbosity.
Docs: omit

@perseoGI perseoGI changed the title Meson: fix cmake_lib missing deps, cmake_exe layout & install verbosity Meson: fix meson_lib missing deps, meson_exe layout & install verbosity Apr 28, 2026

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, maybe at least some integration test that checks the new {{as_name(require)}} = dependency('{{as_name(require)}}', required: true) logic?

Because the layout() would be at least tested not to break by functional tests


def layout(self):
self.folders.build = "build"
basic_layout(self)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the folder to be build-debug and build-release, is it intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Without a basic_layout, all generators and meson cache/files were being created in the root, constantly dirtying it

@perseoGI

Copy link
Copy Markdown
Contributor Author

maybe at least some integration test that checks the new {{as_name(require)}} = dependency('{{as_name(require)}}', required: true) logic?

Okay, I can do it, but it is just a copy from meson_exe

@memsharded

Copy link
Copy Markdown
Member

Okay, I can do it, but it is just a copy from meson_exe

No, better do not add new functional tests for this, I was thinking of a fast integration one, because I thought there were already some integration tests for this, but there isn't, so probably not worth it.

@perseoGI

Copy link
Copy Markdown
Contributor Author

Yes, that is what I was wondering. I did not see any test which were testing a meson_lib/meson_exe using -d requires.
There is one that calls to meson_lib -d requires... but it overwrites the meson.build file.

Comment thread conan/internal/api/new/meson_lib.py
@perseoGI

Copy link
Copy Markdown
Contributor Author
$ conan new meson_lib -d name="liba" -d version=1.0 -o liba
File saved: conanfile.py
File saved: meson.build
File saved: src/liba.cpp
File saved: src/liba.h
File saved: test_package/conanfile.py
File saved: test_package/meson.build
File saved: test_package/src/example.cpp
$ conan new meson_lib -d name="libb" -d version=1.0 -d requires=liba/1.0 -o libb
File saved: conanfile.py
File saved: meson.build
File saved: src/libb.cpp
File saved: src/libb.h
File saved: test_package/conanfile.py
File saved: test_package/meson.build
File saved: test_package/src/example.cpp
$ conan new meson_exe -d name="consumer" -d version=1.0 -d requires="libb/1.0" -o consumer
File saved: conanfile.py
File saved: meson.build
File saved: src/consumer.cpp
File saved: src/consumer.h
File saved: src/main.cpp
File saved: test_package/conanfile.py
$ conan export liba
======== Exporting recipe to the cache ========
liba/1.0: [HOOK - hook_check_license.py] pre_export(): ERROR: Recipe does not define its 'license'
liba/1.0: Exporting package recipe: /private/tmp/test-meson/liba/conanfile.py
liba/1.0: Copied 1 '.py' file: conanfile.py
liba/1.0: Copied 1 '.build' file: meson.build
liba/1.0: Copied 1 '.cpp' file: liba.cpp
liba/1.0: Copied 1 '.h' file: liba.h
liba/1.0: Exported to cache folder: /Users/perseo/.conan2/p/liba205c217cdf534/e
liba/1.0: Exported: liba/1.0#e2502cc21bb608f19b26cbef4b3e5569 (2026-04-28 12:05:51 UTC)
$ conan export libb
======== Exporting recipe to the cache ========
libb/1.0: [HOOK - hook_check_license.py] pre_export(): ERROR: Recipe does not define its 'license'
libb/1.0: Exporting package recipe: /private/tmp/test-meson/libb/conanfile.py
libb/1.0: Copied 1 '.py' file: conanfile.py
libb/1.0: Copied 1 '.build' file: meson.build
libb/1.0: Copied 1 '.h' file: libb.h
libb/1.0: Copied 1 '.cpp' file: libb.cpp
libb/1.0: Exported to cache folder: /Users/perseo/.conan2/p/libb7130bba477819/e
libb/1.0: Exported: libb/1.0#6dc6006c19f32ba4b9a46354981ab826 (2026-04-28 12:05:53 UTC)
$  conan build consumer -b missing`
======== Input profiles ========
Profile host:
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=17
os=Macos
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.files.download:verify=False
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=true

Profile build:
[settings]
arch=armv8
build_type=Release
compiler=apple-clang
compiler.cppstd=gnu17
compiler.libcxx=libc++
compiler.version=17
os=Macos
[conf]
tools.cmake.cmaketoolchain:generator=Ninja
tools.files.download:verify=False
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=true


======== Computing dependency graph ========
Graph root
    conanfile.py (consumer/1.0): /private/tmp/test-meson/consumer/conanfile.py
Requirements
    liba/1.0#378a4c049721861c90ce396e89623174 - Cache
    libb/1.0#d98b62b7193fb300cf39d4f345d4ef5f - Cache

======== Computing necessary packages ========
...

A new experimental approach for binary compatibility detection is available.
    Enable it by setting the core.graph:compatibility_mode=optimized conf
    and get improved performance when querying multiple compatible binaries in remotes.

Requirements
    liba/1.0#378a4c049721861c90ce396e89623174:461f120128f0af7aba967bf3e9e4aaa5892a82b3 - Build
    libb/1.0#d98b62b7193fb300cf39d4f345d4ef5f:7e3b7daf201fd6ce2f56a667116263e5e8cad43d - Build

======== Installing packages ========

-------- Installing package liba/1.0 (1 of 2) --------
liba/1.0: Building from source
liba/1.0: Package liba/1.0:461f120128f0af7aba967bf3e9e4aaa5892a82b3
liba/1.0: settings: os=Macos arch=armv8 compiler=apple-clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=17 build_type=Release
liba/1.0: options: fPIC=True shared=False
liba/1.0: Copying sources to build folder
liba/1.0: Building your package in /Users/perseo/.conan2/p/b/liba0dbe843d46819/b
liba/1.0: Calling generate()
liba/1.0: Generators folder: /Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release/conan
liba/1.0: MesonToolchain generated: conan_meson_native.ini
liba/1.0: Generating aggregated env files
liba/1.0: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
liba/1.0: Calling build()
liba/1.0: Meson configure cmd: meson setup --native-file "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release/conan/conan_meson_native.ini" "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release" "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b" --prefix=/
liba/1.0: RUN: meson setup --native-file "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release/conan/conan_meson_native.ini" "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release" "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b" --prefix=/
The Meson build system
Version: 1.10.1
Source dir: /Users/perseo/.conan2/p/b/liba0dbe843d46819/b
Build dir: /Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release
Build type: native build
Project name: liba
Project version: undefined
C++ compiler for the host machine: clang++ (clang 17.0.0 "Apple clang version 17.0.0 (clang-1700.6.4.2)")
C++ linker for the host machine: clang++ ld64 1230.1
Host machine cpu family: aarch64
Host machine cpu: aarch64
Build targets in project: 1

liba  undefined

  User defined options
    Native files: /Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release/conan/conan_meson_native.ini
    prefix      : /

Found ninja-1.13.2 at /opt/homebrew/bin/ninja

liba/1.0: Meson build cmd: meson compile -C "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release" -j14
liba/1.0: RUN: meson compile -C "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release" -j14
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /opt/homebrew/bin/ninja -j 14
[2/2] Linking static target libliba.a

liba/1.0: Package '461f120128f0af7aba967bf3e9e4aaa5892a82b3' built
liba/1.0: Build folder /Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release
liba/1.0: Generating the package
liba/1.0: Packaging in folder /Users/perseo/.conan2/p/b/liba0dbe843d46819/p
liba/1.0: Calling package()
liba/1.0: RUN: meson install -C "/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release" --destdir "/Users/perseo/.conan2/p/b/liba0dbe843d46819/p"
ninja: Entering directory `/Users/perseo/.conan2/p/b/liba0dbe843d46819/b/build-release'
ninja: no work to do.
Installing libliba.a to /Users/perseo/.conan2/p/b/liba0dbe843d46819/p/lib
Installing /Users/perseo/.conan2/p/b/liba0dbe843d46819/b/src/liba.h to /Users/perseo/.conan2/p/b/liba0dbe843d46819/p/include

liba/1.0: [HOOK - hook_macos_check_sdk.py] post_package(): WARN: File lib/libliba.a does not have the expected macOS min OS, expected 13.0 but found 26.0
liba/1.0: [HOOK - hook_macos_check_sdk.py] post_package(): WARN: File lib/libliba.a does not have the expected macOS base SDK, expected 26.0 but found 26.2
liba/1.0: [HOOK - hook_ms_runtime_files.py] post_package(): Skipping liba from checking MS files: Not msvc.
liba/1.0: [HOOK - hook_package_license.py] post_package(): WARN: No 'licenses' folder found in package folder
liba/1.0: package(): Packaged 1 '.h' file: liba.h
liba/1.0: package(): Packaged 1 '.a' file: libliba.a
liba/1.0: Created package revision 682ff772355c45a939add0c9c7f5d5e8
liba/1.0: Package '461f120128f0af7aba967bf3e9e4aaa5892a82b3' created
liba/1.0: Full package reference: liba/1.0#378a4c049721861c90ce396e89623174:461f120128f0af7aba967bf3e9e4aaa5892a82b3#682ff772355c45a939add0c9c7f5d5e8
liba/1.0: Package folder /Users/perseo/.conan2/p/b/liba0dbe843d46819/p

-------- Installing package libb/1.0 (2 of 2) --------
libb/1.0: Building from source
libb/1.0: Package libb/1.0:7e3b7daf201fd6ce2f56a667116263e5e8cad43d
libb/1.0: settings: os=Macos arch=armv8 compiler=apple-clang compiler.cppstd=gnu17 compiler.libcxx=libc++ compiler.version=17 build_type=Release
libb/1.0: options: fPIC=True shared=False
libb/1.0: requires: liba/1.0.Z
libb/1.0: Copying sources to build folder
libb/1.0: Building your package in /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b
libb/1.0: Calling generate()
libb/1.0: Generators folder: /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release/conan
libb/1.0: MesonToolchain generated: conan_meson_native.ini
libb/1.0: Generating aggregated env files
libb/1.0: Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']
libb/1.0: Calling build()
libb/1.0: Meson configure cmd: meson setup --native-file "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release/conan/conan_meson_native.ini" "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release" "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b" --prefix=/
libb/1.0: RUN: meson setup --native-file "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release/conan/conan_meson_native.ini" "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release" "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b" --prefix=/
The Meson build system
Version: 1.10.1
Source dir: /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b
Build dir: /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release
Build type: native build
Project name: libb
Project version: undefined
C++ compiler for the host machine: clang++ (clang 17.0.0 "Apple clang version 17.0.0 (clang-1700.6.4.2)")
C++ linker for the host machine: clang++ ld64 1230.1
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.5.1
Run-time dependency liba found: YES 1.0
Build targets in project: 1

libb  undefined

  User defined options
    Native files: /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release/conan/conan_meson_native.ini
    prefix      : /

Found ninja-1.13.2 at /opt/homebrew/bin/ninja

libb/1.0: Meson build cmd: meson compile -C "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release" -j14
libb/1.0: RUN: meson compile -C "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release" -j14
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /opt/homebrew/bin/ninja -j 14
[2/2] Linking static target liblibb.a

libb/1.0: Package '7e3b7daf201fd6ce2f56a667116263e5e8cad43d' built
libb/1.0: Build folder /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release
libb/1.0: Generating the package
libb/1.0: Packaging in folder /Users/perseo/.conan2/p/b/libb41757fef5b4f3/p
libb/1.0: Calling package()
libb/1.0: RUN: meson install -C "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release" --destdir "/Users/perseo/.conan2/p/b/libb41757fef5b4f3/p"
ninja: Entering directory `/Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/build-release'
ninja: no work to do.
Installing liblibb.a to /Users/perseo/.conan2/p/b/libb41757fef5b4f3/p/lib
Installing /Users/perseo/.conan2/p/b/libb41757fef5b4f3/b/src/libb.h to /Users/perseo/.conan2/p/b/libb41757fef5b4f3/p/include

libb/1.0: [HOOK - hook_macos_check_sdk.py] post_package(): WARN: File lib/liblibb.a does not have the expected macOS min OS, expected 13.0 but found 26.0
libb/1.0: [HOOK - hook_macos_check_sdk.py] post_package(): WARN: File lib/liblibb.a does not have the expected macOS base SDK, expected 26.0 but found 26.2
libb/1.0: [HOOK - hook_ms_runtime_files.py] post_package(): Skipping libb from checking MS files: Not msvc.
libb/1.0: [HOOK - hook_package_license.py] post_package(): WARN: No 'licenses' folder found in package folder
libb/1.0: package(): Packaged 1 '.h' file: libb.h
libb/1.0: package(): Packaged 1 '.a' file: liblibb.a
libb/1.0: Created package revision da8a3c70e7017f7c4ea80ffad220b4f3
libb/1.0: Package '7e3b7daf201fd6ce2f56a667116263e5e8cad43d' created
libb/1.0: Full package reference: libb/1.0#d98b62b7193fb300cf39d4f345d4ef5f:7e3b7daf201fd6ce2f56a667116263e5e8cad43d#da8a3c70e7017f7c4ea80ffad220b4f3
libb/1.0: Package folder /Users/perseo/.conan2/p/b/libb41757fef5b4f3/p

======== Finalizing install (deploy, generators) ========
conanfile.py (consumer/1.0): Calling generate()
conanfile.py (consumer/1.0): Generators folder: /private/tmp/test-meson/consumer/build-release/conan
conanfile.py (consumer/1.0): MesonToolchain generated: conan_meson_native.ini
conanfile.py (consumer/1.0): Generating aggregated env files
conanfile.py (consumer/1.0): Generated aggregated env files: ['conanbuild.sh', 'conanrun.sh']

======== Calling build() ========
conanfile.py (consumer/1.0): Calling build()
conanfile.py (consumer/1.0): Meson configure cmd: meson setup --native-file "/private/tmp/test-meson/consumer/build-release/conan/conan_meson_native.ini" "/private/tmp/test-meson/consumer/build-release" "/private/tmp/test-meson/consumer" --prefix=/
conanfile.py (consumer/1.0): RUN: meson setup --native-file "/private/tmp/test-meson/consumer/build-release/conan/conan_meson_native.ini" "/private/tmp/test-meson/consumer/build-release" "/private/tmp/test-meson/consumer" --prefix=/
The Meson build system
Version: 1.10.1
Source dir: /private/tmp/test-meson/consumer
Build dir: /private/tmp/test-meson/consumer/build-release
Build type: native build
Project name: consumer
Project version: undefined
C++ compiler for the host machine: clang++ (clang 17.0.0 "Apple clang version 17.0.0 (clang-1700.6.4.2)")
C++ linker for the host machine: clang++ ld64 1230.1
Host machine cpu family: aarch64
Host machine cpu: aarch64
Found pkg-config: YES (/opt/homebrew/bin/pkg-config) 2.5.1
Run-time dependency libb found: YES 1.0
Build targets in project: 1

consumer  undefined

  User defined options
    Native files: /private/tmp/test-meson/consumer/build-release/conan/conan_meson_native.ini
    prefix      : /

Found ninja-1.13.2 at /opt/homebrew/bin/ninja

conanfile.py (consumer/1.0): Meson build cmd: meson compile -C "/private/tmp/test-meson/consumer/build-release" -j14
conanfile.py (consumer/1.0): RUN: meson compile -C "/private/tmp/test-meson/consumer/build-release" -j14
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /opt/homebrew/bin/ninja -j 14
[3/3] Linking target consumer
./consumer/build-release/consumer
liba/1.0: Hello World Release!
  liba/1.0: __aarch64__ defined
  liba/1.0: __cplusplus201703
  liba/1.0: __GNUC__4
  liba/1.0: __GNUC_MINOR__2
  liba/1.0: __clang_major__17
  liba/1.0: __apple_build_version__17000604
libb/1.0: Hello World Release!
  libb/1.0: __aarch64__ defined
  libb/1.0: __cplusplus201703
  libb/1.0: __GNUC__4
  libb/1.0: __GNUC_MINOR__2
  libb/1.0: __clang_major__17
  libb/1.0: __apple_build_version__17000604
consumer/1.0: Hello World Release!
  consumer/1.0: __aarch64__ defined
  consumer/1.0: __cplusplus201703
  consumer/1.0: __GNUC__4
  consumer/1.0: __GNUC_MINOR__2
  consumer/1.0: __clang_major__17
  consumer/1.0: __apple_build_version__17000604
consumer/1.0 test_package

@franramirez688 franramirez688 merged commit c5d447f into conan-io:develop2 Apr 28, 2026
17 checks passed
@czoido czoido added this to the 2.29.0 milestone Apr 28, 2026
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

Successfully merging this pull request may close these issues.

4 participants