global.pri 5.67 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# /*********************************************************************
# * Copyright (c) 2018, 2019 ITK Engineering GmbH
# * Copyright (c) 2018 in-tech GmbH
# *
# * This program and the accompanying materials are made
# * available under the terms of the Eclipse Public License 2.0
# * which is available at https://www.eclipse.org/legal/epl-2.0/
# *
# * SPDX-License-Identifier: EPL-2.0
# **********************************************************************/

include(defaults.pri)
include(ccache.pri)

!isEmpty(INTERFACE_OVERRIDE_PATH) {
    INCLUDEPATH += $$INTERFACE_OVERRIDE_PATH
    INCLUDEPATH += $$INTERFACE_OVERRIDE_PATH/CoreFramework/OpenPassSlave
}

INCLUDEPATH += $$PWD/openPASS
CONFIG += c++17
Uwe Woessner's avatar
Uwe Woessner committed
22
23
24
25
26
## debug postfix not working in qmake build
DEFINES+=DEBUG_POSTFIX=\\\"\\\"

## common and CoreShare are not built as libraries in the qmake build
DEFINES+=QMAKE_BUILD
27
28
29
30
31
32
33
34
35
36

## activate log time output
DEFINES += LOG_TIME_ENABLED

## simulation libraries destination sub-directory ##
SUBDIR_LIB_SIMS = "/lib"
DEFINES += SUBDIR_LIB_SIM=\\\"/lib\\\"

## gui libraries destination sub-directory ##
SUBDIR_LIB_GUIS = "/bin/gui"
37
SUBDIR_LIB_COMPONENTS = "\components"
38
39

DEFINES += SUBDIR_LIB_GUI=\\\"/bin/gui\\\"
40
DEFINES += SUBDIR_LIB_COMPONENTS=\\\"/components\\\"
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

## Qt plugins sub-directory ##
DEFINES += SUBDIR_LIB_PLUGIN=\\\"/plugin\\\"

## Export configuration ##
#CONFIG += USEOPENPASSSLAVEASLIBRARY
#CONFIG += USEOPENPASSMASTERASLIBRARY

# accumulate list of files for given directories (first parameter)
# according to file name ending (second parameter)
defineReplace(getFiles) {
    variable = $$1
    files = $$eval($$variable)
    result =
    for(file, files) {
        result += $$files($$file/*.$$2)
    }
    return($$result)
}

# prefer bundled libs in OpenPassSlave directory over system libraries
QMAKE_LFLAGS += -Wl,-rpath=\'\$\$ORIGIN\'

win32:DEFINES+=_USE_MATH_DEFINES

######################################################################
# Configuration specific for open pass gui library                   #
# Usage:                                                             #
# set "CONFIG += OPENPASS_LIBRARY_GUI" before including this file    #
######################################################################
OPENPASS_LIBRARY_GUI {
    message("[$$TARGET] Set library configuration")
    TEMPLATE = lib
    CONFIG += shared
    CONFIG -= lib_bundle
    QMAKE_LFLAGS += -L$$system_path($$EXTRA_LIB_PATH)
    QMAKE_CFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    QMAKE_CXXFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    Debug:DESTDIR = $${DESTDIR_GUI}$${SUBDIR_LIB_GUIS}
    Release:DESTDIR = $${DESTDIR_GUI}$${SUBDIR_LIB_GUIS}
    #debug/release predicates are buggy on linux qmake
    unix:DESTDIR=$${DESTDIR_GUI}$${SUBDIR_LIB_GUIS}
    message("[$$TARGET] Build path set to $$DESTDIR")
}

##################################################################
# Configuration specific for open pass simulation libraries      #
# Usage:                                                         #
# set "CONFIG += OPENPASS_LIBRARY" before including this file    #
##################################################################
OPENPASS_LIBRARY {
    message("[$$TARGET] Set library configuration")
    TEMPLATE = lib
    CONFIG += shared
    CONFIG -= lib_bundle
    QMAKE_LFLAGS += -L$$system_path($$EXTRA_LIB_PATH)
    QMAKE_CFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    QMAKE_CXXFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    Debug:DESTDIR = $${DESTDIR_SLAVE}$${SUBDIR_LIB_SIMS}
    Release:DESTDIR = $${DESTDIR_SLAVE}$${SUBDIR_LIB_SIMS}
    #debug/release predicates are buggy on linux qmake
    unix:DESTDIR=$${DESTDIR_SLAVE}$${SUBDIR_LIB_SIMS}
    message("[$$TARGET] Build path set to $$DESTDIR")
}

##################################################################
# Configuration specific for open pass executables               #
# Usage:                                                         #
# set "CONFIG += OPENPASS_EXECUTABLE" before including this file #
##################################################################
OPENPASS_EXECUTABLE {
    message("[$$TARGET] Building executable")
    QT += core xml
    QT -= gui
    TEMPLATE = app
    CONFIG -= app_bundle
    CONFIG += no_include_pwd
    INCLUDEPATH += .
    QMAKE_CFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    QMAKE_CXXFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    Debug:DESTDIR = $${DESTDIR_SLAVE}
    Release:DESTDIR = $${DESTDIR_SLAVE}
    #debug/release predicates are buggy on linux qmake
    unix:DESTDIR=$${DESTDIR_SLAVE}
    QMAKE_PRE_LINK += $$sprintf($$QMAKE_MKDIR_CMD, $$DESTDIR)
}

##################################################################
# Configuration specific for open pass testing projects          #
# Usage:                                                         #
# set "CONFIG += OPENPASS_TESTING" before including this file    #
##################################################################

OPENPASS_TESTING {
    message("[$$TARGET] Building test")

    QT += xml
    TEMPLATE = app
    CONFIG += console
    CONFIG += testcase
    CONFIG -= app_bundle
    CONFIG += COPY_RESOURCES

    QMAKE_CFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    QMAKE_CXXFLAGS += -isystem $$EXTRA_INCLUDE_PATH
    Debug:DESTDIR = $${DIR_DEBUG}
    Release:DESTDIR = $${DIR_RELEASE}
    #debug/release predicates are buggy on linux qmake
    unix:DESTDIR=$${DIR_DEBUG}

    QMAKE_PRE_LINK += $$sprintf($$QMAKE_MKDIR_CMD, $$DESTDIR)

    # reduce gtest warnings
    # CCFLAG += -Wno-zero-as-null-pointer-constant -Wno-padded

    #INCLUDEPATH += ../TestClasses
    LIBS += -lgtest -lgmock

    CONFIG(CODECOVERAGE) {
        message("[$$TARGET] Enabling code coverage generation")
        QMAKE_LFLAGS += -lgcov --coverage
        QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage
    }
}