Update plugin.pri to make full use of nymea-plugininfocompiler goodness
This commit is contained in:
parent
634e14aeeb
commit
87db9dd4ec
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 2018 Michael Zanetti <michael.zanetti@guh.io>
|
# Copyright (C) 2019 Michael Zanetti <michael.zanetti@nymea.io>
|
||||||
# Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io>
|
# Copyright (C) 2018 Simon Stürz <simon.stuerz@guh.io>
|
||||||
#
|
#
|
||||||
# This file is part of nymea.
|
# This file is part of nymea.
|
||||||
@ -18,10 +18,10 @@
|
|||||||
# <http://www.gnu.org/licenses/>.
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# This project include file is meant to be used by nymea plugins.
|
# This project include file is meant to be used by nymea plugins.
|
||||||
|
|
||||||
# Example project file for a plugin:
|
# Example project file for a plugin:
|
||||||
|
|
||||||
# include(/usr/include/nymea/plugi.pri)
|
# include($$[QT_INSTALL_PREFIX]/include/nymea/plugi.pri)
|
||||||
# TARGET = $$qtLibraryTarget(nymea_devicepluginexample)
|
|
||||||
# SOURCES += devicepluginexample.cpp
|
# SOURCES += devicepluginexample.cpp
|
||||||
# HEADERS += devicepluginexample.h
|
# HEADERS += devicepluginexample.h
|
||||||
|
|
||||||
@ -34,30 +34,26 @@ PKGCONFIG += nymea
|
|||||||
QMAKE_CXXFLAGS *= -Werror -std=c++11 -g
|
QMAKE_CXXFLAGS *= -Werror -std=c++11 -g
|
||||||
QMAKE_LFLAGS *= -std=c++11
|
QMAKE_LFLAGS *= -std=c++11
|
||||||
|
|
||||||
# Check if ccache is enabled
|
JSONFILE=$${_PRO_FILE_PWD_}/deviceplugin"$$TARGET".json
|
||||||
ccache {
|
|
||||||
QMAKE_CXX = ccache g++
|
|
||||||
}
|
|
||||||
|
|
||||||
# Make the device plugin json file visible in the Qt Creator
|
# Make the device plugin json file visible in the Qt Creator
|
||||||
OTHER_FILES+=deviceplugin"$$TARGET".json
|
OTHER_FILES += $$JSONFILE
|
||||||
|
|
||||||
# NOTE: if the code includes "plugininfo.h", it would fail if we only give it a compiler for $$OUT_PWD/plugininfo.h
|
# Compile the plugininfo.h file
|
||||||
# Let's add a dummy target with the plugininfo.h file without any path to allow the developer to just include it like that.
|
plugininfo.input = JSONFILE
|
||||||
|
plugininfo.output = plugininfo.h
|
||||||
|
plugininfo.commands = nymea-plugininfocompiler ${QMAKE_FILE_NAME} --output ${QMAKE_FILE_OUT}
|
||||||
|
plugininfo.dependency_type = TYPE_C
|
||||||
|
plugininfo.CONFIG += no_link combine
|
||||||
|
QMAKE_EXTRA_COMPILERS += plugininfo
|
||||||
|
|
||||||
# Create plugininfo file
|
# Compile the extern-plugininfo.h file
|
||||||
plugininfo.target = $$OUT_PWD/plugininfo.h
|
extern_plugininfo.input = JSONFILE
|
||||||
extern-plugininfo.target = $$OUT_PWD/extern-plugininfo.h
|
extern_plugininfo.output = extern-plugininfo.h
|
||||||
plugininfo_dummy.target = plugininfo.h
|
extern_plugininfo.commands = nymea-plugininfocompiler ${QMAKE_FILE_NAME} --extern ${QMAKE_FILE_OUT}
|
||||||
extern-plugininfo_dummy.target = extern-plugininfo.h
|
extern_plugininfo.dependency_type = TYPE_C
|
||||||
plugininfo.depends = FORCE
|
extern_plugininfo.CONFIG += no_link combine
|
||||||
plugininfo.commands = nymea-plugininfocompiler \
|
QMAKE_EXTRA_COMPILERS += extern_plugininfo
|
||||||
$${_PRO_FILE_PWD_}/deviceplugin"$$TARGET".json \
|
|
||||||
--output $$OUT_PWD/plugininfo.h \
|
|
||||||
--extern $$OUT_PWD/extern-plugininfo.h
|
|
||||||
plugininfo_dummy.commands = $$plugininfo.commands
|
|
||||||
extern-plugininfo.depends = plugininfo
|
|
||||||
QMAKE_EXTRA_TARGETS += plugininfo plugininfo_dummy extern-plugininfo extern-plugininfo_dummy
|
|
||||||
|
|
||||||
# Clean up autogenerated plugin info files
|
# Clean up autogenerated plugin info files
|
||||||
plugininfo_clean.commands = rm -fv $$OUT_PWD/plugininfo.h $$OUT_PWD/extern-plugininfo.h
|
plugininfo_clean.commands = rm -fv $$OUT_PWD/plugininfo.h $$OUT_PWD/extern-plugininfo.h
|
||||||
@ -80,10 +76,7 @@ QMAKE_EXTRA_TARGETS += lrelease
|
|||||||
translations.path = /usr/share/nymea/translations
|
translations.path = /usr/share/nymea/translations
|
||||||
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
|
translations.files = $$[QT_SOURCE_TREE]/translations/*.qm
|
||||||
|
|
||||||
HEADERS += $$OUT_PWD/plugininfo.h \
|
# Redefine target to make output file suite the plugin filename schema
|
||||||
$$OUT_PWD/extern-plugininfo.h
|
|
||||||
DEPENDPATH += $$OUT_PWD
|
|
||||||
|
|
||||||
TARGET = $$qtLibraryTarget(nymea_deviceplugin"$$TARGET")
|
TARGET = $$qtLibraryTarget(nymea_deviceplugin"$$TARGET")
|
||||||
|
|
||||||
# Install plugin
|
# Install plugin
|
||||||
|
|||||||
Reference in New Issue
Block a user