如上所述完成:https://stackoverflow.com/a/7810877/630169但是make告诉我:
make:“安装”没什么可做的。
没有复制到构建目录。专业文件包含以下行:
wav_files.path = %{buildDir}
wav_files.files += %{sourceDir}/hurray.wav
INSTALLS += wav_files
答案 0 :(得分:3)
这是我用于复制其他运行时文件以构建路径和安装目标的方法:
在这里定义你的文件。
## === define copy files for installation and build ===
copytarget.path = /path/to/installation
copytarget.files += $$files(example/filename*)
## wildcard for filename1 filename2 filename3 ...
message("found files for copytarget: "$$copytarget.files)
你必须添加一个qmake编译器:
## === os specific dir separator ===
win32: copytarget.files ~= s,/,\\,g
## === copy compiler for makefile ===
DirSep = /
win32: DirSep = \\
for(f,copytarget.files) tmp += $$PWD$$DirSep$${f} ## make absolute paths
copycompiler.input = tmp
isEmpty(DESTDIR):DESTDIR=.
copycompiler.output = $$DESTDIR$$DirSep${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
copycompiler.commands = $(COPY_FILE) ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
copycompiler.CONFIG = no_link no_clean
## other CONFIG options are: depends explicit_dependencies target_predeps
copycompiler.variable_out = QMAKE_DISTCLEAN
QMAKE_EXTRA_COMPILERS += copycompiler
单独的makefile目标:
## == makefile copy target ===
copyfiles.recurse_target = compiler_copycompiler_make_all
copyfiles.depends = $$copyfiles.recurse_target
copyfiles.CONFIG += recursive
在源构建步骤之后附加目标:
QMAKE_EXTRA_TARGETS += copyfiles
POST_TARGETDEPS += copyfiles ## copy files after source compilation
包含运行时文件以安装目标
INSTALLS += copytarget