Basically i would like to be able to have a mix between the functions install_subdir and install_headers.
I want to copy all header files from my project source directory over to some other directory and still maintain the subdirectory structure.
Source
MyProject
|-- folder1
| |-- file11.h
| |-- file11.cpp
| |-- file12.h
| `-- file12.cpp
`-- folder2
`-- file21.h
Destination
MyProject
|-- folder1
| |-- file11.h
| |-- file12.h
`-- folder2
`-- file21.h
What I tried was copying the source directory and exclude all cpp files and to just use the intended install_headers()
function but both didn't work out.
I added comments to things I did and why. Maybe somebody knows what's up:
project('MyProject', 'cpp')
test_src = [ 'src/MyProject/folder1/file11.cpp'
'src/MyProject/folder1/file12.cpp']
# Passing files seems to be preferred but exclude_files only takes list of strings
# test_src = files([ 'src/MyProject/folder1/file11.cpp'
# 'src/MyProject/folder1/file12.cpp'])
test_hdr = files([ 'src/MyProject/folder1/file11.h',
'src/MyProject/folder1/file12.h',
'src/MyProject/folder2/file21.h'])
base_dir = meson.current_source_dir()
static_library('MyProject', name_prefix: '', name_suffix : 'lib',
sources: test_src,
install: true,
install_dir: base_dir + '/build/lib')
# Produces flat hierarchy
install_headers(test_hdr, install_dir: base_dir + '/build/include')
# Also copies all cpp files into destination folder
install_subdir('src/MyProject', install_dir: base_dir + '/build/include', exclude_files: '*.cpp')
# Same result as wildcard exclusion
install_subdir('src/MyProject', install_dir: base_dir + '/build/include', exclude_files: test_src)
Does anyone have a solution to this?
I have a full list of my sources and headers if that is necessary for any method.
I am currently copying the files via shell commands, but including this into the install/build process would be preferred.
// EDIT:
I am using meson-build on windows.