From b223577e78789d7b6ab21dea8a4596ab95c9a55c Mon Sep 17 00:00:00 2001 From: zccrs Date: Wed, 3 Jan 2018 18:36:51 +0800 Subject: [PATCH] feat: add the "DtkWidgets" header file Change-Id: Ib49a7a37c8cd10f6dbec39a602e8206e49c45591 --- .gitignore | 2 ++ src/src.pro | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f33351fbf..b540f7d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ build*/ # executeable files *.qm + +src/DtkWidgets diff --git a/src/src.pro b/src/src.pro index 943010565..011893845 100644 --- a/src/src.pro +++ b/src/src.pro @@ -38,7 +38,7 @@ win* { HEADERS += dtkwidget_global.h includes.path = $${DTK_INCLUDEPATH}/DWidget -includes.files += $$PWD/dtkwidget_global.h +includes.files += $$PWD/dtkwidget_global.h $$PWD/DtkWidgets include($$PWD/util/util.pri) include($$PWD/widgets/widgets.pri) @@ -72,3 +72,36 @@ translations.files = $$PWD/../translations/*.qm INSTALLS += translations cmake_config +# create DtkWidgets file +defineTest(containIncludeFiles) { + header = $$absolute_path($$ARGS) + header_dir = $$quote($$dirname(header)) + + for (file, includes.files) { + file_ap = $$absolute_path($$file) + file_dir = $$quote($$dirname(file_ap)) + + isEqual(file_dir, $$header_dir):return(true) + } + + return(false) +} + +defineTest(updateDtkWidgetsFile) { + dtkwidgets_include_files = $$HEADERS + dtkwidgets_file_content = $$quote($${LITERAL_HASH}ifndef DTK_WIDGETS_MODULE_H) + dtkwidgets_file_content += $$quote($${LITERAL_HASH}defined DTK_WIDGETS_MODULE_H) + + for(header, dtkwidgets_include_files) { + containIncludeFiles($$header) { + dtkwidgets_file_content += $$quote($${LITERAL_HASH}include \"$$basename(header)\") + } + } + + dtkwidgets_file_content += $$quote($${LITERAL_HASH}endif) + !write_file($$PWD/DtkWidgets, dtkwidgets_file_content, exe):return(false) + + return(true) +} + +!updateDtkWidgetsFile():warning(Cannot create "DtkWidgets" header file)