Skip to content

Commit

Permalink
feat: add the "dtkwidget_global.h" header file
Browse files Browse the repository at this point in the history
Change-Id: I307046c3dab4961fe6e80c8e5bc67d8cd6358d51
  • Loading branch information
zccrs committed Jan 4, 2018
1 parent a1a02cb commit de47120
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ build*/
*.qm

src/DtkWidgets
src/dtkwidget_config.h
1 change: 1 addition & 0 deletions src/dtkwidget_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#pragma once

#include <dtkcore_global.h>
#include <dtkwidget_config.h>

#include <QtCore/QMetaMethod>

Expand Down
26 changes: 23 additions & 3 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ win* {
HEADERS += dtkwidget_global.h

includes.path = $${DTK_INCLUDEPATH}/DWidget
includes.files += $$PWD/dtkwidget_global.h $$PWD/DtkWidgets
includes.files += \
$$PWD/dtkwidget_global.h\
$$PWD/DtkWidgets\
$$PWD/dtkwidget_config.h

include($$PWD/util/util.pri)
include($$PWD/widgets/widgets.pri)
Expand Down Expand Up @@ -90,7 +93,7 @@ defineTest(containIncludeFiles) {
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)
dtkwidgets_file_content += $$quote($${LITERAL_HASH}define DTK_WIDGETS_MODULE_H)

for(header, dtkwidgets_include_files) {
containIncludeFiles($$header) {
Expand All @@ -99,9 +102,26 @@ defineTest(updateDtkWidgetsFile) {
}

dtkwidgets_file_content += $$quote($${LITERAL_HASH}endif)
!write_file($$PWD/DtkWidgets, dtkwidgets_file_content, exe):return(false)
!write_file($$PWD/DtkWidgets, dtkwidgets_file_content):return(false)

return(true)
}

!updateDtkWidgetsFile():warning(Cannot create "DtkWidgets" header file)

# create dtkwidget_config.h file
defineTest(updateDtkWidgetConfigFile) {
for(file, includes.files) {
file = $$quote($$basename(file))

!isEqual(file, DtkWidgets):contains(file, D[A-Za-z0-9_]+) {
dtkwidget_config_content += $$quote($${LITERAL_HASH}define DTKWIDGET_CLASS_$$file)
}
}

!write_file($$PWD/dtkwidget_config.h, dtkwidget_config_content):return(false)

return(true)
}

!updateDtkWidgetConfigFile():warning(Cannot create "dtkwidget_config.h" header file)

0 comments on commit de47120

Please sign in to comment.