Repository navigation
|
Hello, I am trying to create a directory inside the build directory from Meson. I searched into the documentation and on internet but I didn't find a way to do that (I may have missed the answer though!). What I want to do is to create the directory before an To give a bit more context, where I work we have some old Makefile scripts and I am looking to replace them with something more convenient / modern. (I experimented with CMake, and while it now works well it was fairly painful due to its complexity and bad language design). Is there a way to cleanly solve this problem with meson? From my understanding the biggest problem is the lack of Edit: replaced double quotes with Markdown quotes |
Replies: 3 comments 2 replies
|
There's no mkdir function. Build subdirectories mirror the source tree, so For a directory with no source counterpart, make it at configure time: run_command('mkdir', '-p', meson.current_build_dir() / 'generated', check: true)or have the |
|
You do not need to model this as a dependency of The most Meson-native portable approach is to mirror the directory in the source tree:
subdir('asm')
asm_dir = join_paths(meson.current_build_dir(), 'asm')
exe = executable(
'my-program',
sources,
c_args: ['--asm-directory=' + asm_dir],
)Processing A configure-time If the assembly files themselves need to be tracked as build outputs, that is a different problem: declare the individual files as outputs of a |
|
Thanks a lot! It worked well. |
You do not need to model this as a dependency of
executable()if the directory only has to exist before compilation. It is configuration-time structure, not a generated build artifact.The most Meson-native portable approach is to mirror the directory in the source tree:
asm/meson.buildcan be empty. In the rootmeson.build:Processing
subdir('asm')creates the corresponding directory below the build directory during Meson configuration, so it exists before Ninja starts compili…