简体   繁体   English

如何使用premake从C ++项目复制所有标头

[英]How to copy all headers from a C++ project with premake

I have a C++ project with its source files (.cpp and .h files) in a directory called src and its subdirectories. 我有一个C ++项目,其源文件(.cpp和.h文件)位于一个名为src及其子目录的目录中。 I want, once my project is compiled, to copy all the header files from this source folder into another directory, maintaining the folderstructure of src. 我希望在项目编译后将所有头文件从该源文件夹复制到另一个目录,并保持src的文件夹结构。

I have tried to copy these files with post-build commands: 我尝试使用构建后命令复制这些文件:

postbuildcommands
{
    "{COPY} src/*.h include"
}

and

postbuildcommands
{
    "{COPY} src/**.h include"
}

But these only copy the .h files directly in src and not those in subdirectories. 但是这些仅将.h文件直接复制到src中,而不直接复制到子目录中。 For example, this 例如这个

src
+-- a.h
+-- a.cpp
+-- sub
|   +-- b.h
|   +-- b.cpp

becomes

include
+-- a.h

instead of 代替

include
+-- a.h
+-- sub
|   +-- b.h

Are you using windows linux or mac? 您使用的是Windows Linux还是Mac? Or does it need to be cross platform? 还是需要跨平台?

It looks like the {copy} token doesn't pass the /s flag to xcopy on windows https://github.com/premake/premake-core/wiki/Tokens https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy 看来{copy}令牌没有将/ s标志传递给Windows https://github.com/premake/premake-core/wiki/Tokens https://docs.microsoft.com/zh-CN上的 xcopy / Windows的服务器/管理/窗口的命令/ XCOPY

One possible solution is to find all files or get them from the project somehow and create a postbuild command for each header file which might be a lot slower 一种可能的解决方案是查找所有文件或以某种方式从项目中获取它们,并为每个头文件创建一个postbuild命令,这可能会慢很多

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM