aboutsummaryrefslogtreecommitdiffstats
path: root/usagestatistic.pro
blob: f393ea10861766be0960369a71697446d5dfe70f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
DEFINES += USAGESTATISTIC_LIBRARY

KUSERFEEDBACK_INSTALL_PATH = "$${OUT_PWD}/kuserfeedback"

INCLUDEPATH *= "$$shell_path($${KUSERFEEDBACK_INSTALL_PATH}/include)" "$${PWD}"

CONFIG += c++1z
QMAKE_CXXFLAGS *= -Wall
!msvc:QMAKE_CXXFLAGS *= -Wextra -pedantic

DEFINES += $$shell_quote(USP_AUTH_KEY=\"$$(USP_AUTH_KEY)\")
DEFINES += $$shell_quote(USP_SERVER_URL=\"$$(USP_SERVER_URL)\")

# UsageStatistic files
SOURCES += \
    usagestatisticplugin.cpp \
    datasources/qtclicensesource.cpp \
    datasources/buildcountsource.cpp \
    common/scopedsettingsgroupsetter.cpp \
    datasources/buildsystemsource.cpp \
    datasources/timeusagesourcebase.cpp \
    datasources/modeusagetimesource.cpp \
    datasources/examplesdatasource.cpp \
    datasources/kitsource.cpp \
    datasources/qmldesignerusagetimesource.cpp \
    ui/usagestatisticpage.cpp \
    ui/usagestatisticwidget.cpp \
    ui/outputpane.cpp \
    ui/encouragementwidget.cpp \
    services/datasubmitter.cpp

HEADERS += \
    usagestatisticplugin.h \
    usagestatistic_global.h \
    usagestatisticconstants.h \
    datasources/qtclicensesource.h \
    datasources/buildcountsource.h \
    common/scopedsettingsgroupsetter.h \
    datasources/buildsystemsource.h \
    datasources/timeusagesourcebase.h \
    datasources/modeusagetimesource.h \
    datasources/examplesdatasource.h \
    datasources/kitsource.h \
    datasources/qmldesignerusagetimesource.h \
    ui/usagestatisticpage.h \
    ui/usagestatisticwidget.h \
    ui/outputpane.h \
    ui/encouragementwidget.h \
    services/datasubmitter.h \
    common/utils.h

RESOURCES += \
    usagestatistic.qrc

# Qt Creator linking

## Either set the IDE_SOURCE_TREE when running qmake,
## or set the QTC_SOURCE environment variable, to override the default setting
isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE)

## Either set the IDE_BUILD_TREE when running qmake,
## or set the QTC_BUILD environment variable, to override the default setting
isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD)

## uncomment to build plugin into user config directory
## <localappdata>/plugins/<ideversion>
##    where <localappdata> is e.g.
##    "%LOCALAPPDATA%\QtProject\qtcreator" on Windows Vista and later
##    "$XDG_DATA_HOME/data/QtProject/qtcreator" or "~/.local/share/data/QtProject/qtcreator" on Linux
##    "~/Library/Application Support/QtProject/Qt Creator" on macOS
# USE_USER_DESTDIR = yes

###### If the plugin can be depended upon by other plugins, this code needs to be outsourced to
###### <dirname>_dependencies.pri, where <dirname> is the name of the directory containing the
###### plugin's sources.

QTC_PLUGIN_NAME = UsageStatistic
QTC_LIB_DEPENDS += \
    # nothing here at this time

QTC_PLUGIN_DEPENDS += \
    coreplugin \
    debugger \
    projectexplorer \
    qtsupport

QTC_PLUGIN_RECOMMENDS += \
    # optional plugin dependencies. nothing here at this time

###### End _dependencies.pri contents ######

!build_pass|win32 {
    EXTRA_CMAKE_MODULES_BUILD_PATH   = "$${OUT_PWD}/extra-cmake-modules/build"
    EXTRA_CMAKE_MODULES_SOURCE_PATH  = "$${PWD}/3rdparty/extra-cmake-modules"
    EXTRA_CMAKE_MODULES_INSTALL_PATH = "$${OUT_PWD}/extra-cmake-modules"

    # Configure extra-cmake-modules

    # Create build directory, in case if CMake won't be able do that
    system("$$sprintf($$QMAKE_MKDIR_CMD, $$shell_path($${EXTRA_CMAKE_MODULES_BUILD_PATH}))")

    EXTRA_CMAKE_MODULES_CMAKE_CMD = \
           "$$QMAKE_CD $$system_quote($$shell_path($${EXTRA_CMAKE_MODULES_BUILD_PATH})) && \
            cmake -DCMAKE_INSTALL_PREFIX:PATH=$$system_quote($$shell_path($${EXTRA_CMAKE_MODULES_INSTALL_PATH})) \
            $$system_quote($$shell_path($${EXTRA_CMAKE_MODULES_SOURCE_PATH}))"
    message("$${EXTRA_CMAKE_MODULES_CMAKE_CMD}")
    system("$${EXTRA_CMAKE_MODULES_CMAKE_CMD}")

    # "Build" extra-cmake-modules first time. This step is required to configure KUserFeedback
    EXTRA_CMAKE_MODULES_BUILD_CMD = "cmake --build $$system_quote($$shell_path($${EXTRA_CMAKE_MODULES_BUILD_PATH})) --target install"
    message("$${EXTRA_CMAKE_MODULES_BUILD_CMD}")
    system("$${EXTRA_CMAKE_MODULES_BUILD_CMD}")

    # Configure KUserFeedback
    KUSERFEEDBACK_BUILD_PATH  = "$${OUT_PWD}/kuserfeedback/build"
    KUSERFEEDBACK_SOURCE_PATH = "$${PWD}/3rdparty/kuserfeedback"

    CMAKE_PREFIX_PATHS = "$$shell_path($$[QT_INSTALL_LIBS]/cmake);$$shell_path($${EXTRA_CMAKE_MODULES_INSTALL_PATH}/share/ECM/cmake)"

    BUILD_TYPE = Debug
    CONFIG(release, debug|release): BUILD_TYPE = Release

    KUSERFEEDBACK_DEFINES = \
        -DCMAKE_BUILD_TYPE=$${BUILD_TYPE}

    macos: KUSERFEEDBACK_DEFINES *= -DCMAKE_OSX_DEPLOYMENT_TARGET=$${QMAKE_MACOSX_DEPLOYMENT_TARGET}

    KUSERFEEDBACK_COMPONENTS = \
        -DBUILD_SHARED_LIBS=OFF \
        -DENABLE_SURVEY_TARGET_EXPRESSIONS=OFF \
        -DENABLE_PHP=OFF \
        -DENABLE_PHP_UNIT=OFF \
        -DENABLE_TESTING=OFF \
        -DENABLE_DOCS=OFF \
        -DENABLE_CONSOLE=OFF \
        -DENABLE_CLI=OFF \
        -DBUILD_SHARED_LIBS=OFF

    # Create build directory, in case if CMake won't be able do that
    system("$$sprintf($$QMAKE_MKDIR_CMD, $$shell_path($${KUSERFEEDBACK_BUILD_PATH}))")

    KUSERFEEDBACK_CMAKE_CMD = \
           "$$QMAKE_CD $$system_quote($$shell_path($${KUSERFEEDBACK_BUILD_PATH})) && \
            cmake $${KUSERFEEDBACK_COMPONENTS} \
                  $${KUSERFEEDBACK_DEFINES} \
                  -DCMAKE_INSTALL_PREFIX:PATH=$$system_quote($$shell_path($${KUSERFEEDBACK_INSTALL_PATH})) \
                  -DCMAKE_PREFIX_PATH=$$system_quote($${CMAKE_PREFIX_PATHS}) \
                  -DKDE_INSTALL_LIBDIR=lib \
                  $$system_quote($$shell_path($${KUSERFEEDBACK_SOURCE_PATH}))"
    message("$${KUSERFEEDBACK_CMAKE_CMD}")
    system("$${KUSERFEEDBACK_CMAKE_CMD}")

    buildextracmakemodules.commands = "$${EXTRA_CMAKE_MODULES_BUILD_CMD}"

    buildkuserfeedback.commands = "cmake --build $$system_quote($$shell_path($${KUSERFEEDBACK_BUILD_PATH})) --target install"
    buildkuserfeedback.depends = buildextracmakemodules

    # Force build order. Without this flag Make tries building targets
    # in a random order when -jN specified.
    # All targets themselves (but not the plugin itself) will be built in parallel
    notParallel.target = .NOTPARALLEL

    QMAKE_EXTRA_TARGETS += buildextracmakemodules buildkuserfeedback notParallel
    PRE_TARGETDEPS += buildkuserfeedback
}

include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)

# Put it here to use qtLibraryTargetName function without extra hacks
LIBS *= -L"$$shell_path($${KUSERFEEDBACK_INSTALL_PATH}/lib)" \
            -l$$qtLibraryTargetName(KUserFeedbackCore)       \
            -l$$qtLibraryTargetName(KUserFeedbackWidgets)    \
            -l$$qtLibraryTargetName(KUserFeedbackCommon)

FORMS += \
    ui/usagestatisticwidget.ui \
    ui/encouragementwidget.ui