1

I have a resource folder that needs to be copied to the build directory in a project using Meson build. I was using a custom_target like this:

  demo_res = custom_target('demo-res',
    input: ['demo/res/materials.yml'],
    output: ['res'],
    command: ['cp', '-r', meson.source_root() + '/demo/res', './'],
    install: false,
    build_by_default: true
  )

But, when testing a Windows build, it turns out the 'cp' command can't be called through a script in PowerShell and isn't available at all in cmd. I attempted to use 'copy', but for some reason this can not be called from meson as a command.

I'm aware of fs.copyfile, but that's only for single files and doesn't copy directories.

Is there some sort of cross-platform method, preferably internal to Meson, to copy a full directory full of multiple files to the build directory?

Kagetsuki
  • 309
  • 2
  • 18
  • 1
    Why don't you use `install_subdir`? – Elvis Oric Jul 28 '23 at 15:45
  • Because this is for testing in the build directory, not for installation. As far as I know every method with the install_ prefix is only run when actually running an install procedure? Also, as for actual installation, what I'm trying to copy are actually resource files specifically for testing that I don't want to actually have installed during an install procedure. – Kagetsuki Jul 30 '23 at 01:39

0 Answers0