forked from pgmodeler/pgmodeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgmodeler.pri
243 lines (210 loc) · 8.79 KB
/
pgmodeler.pri
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# This file contains the main variables settings to build pgModeler on all supported platforms.
#
# Thanks to Lisandro Damián Nicanor Pérez Meyer, pgModeler is able to be package in most of
# Linux distros.
#
# Original version by: Lisandro Damián Nicanor Pérez Meyer <[email protected]>
# Original code: https://github.com/perezmeyer/pgmodeler/tree/shared_libs
#
# Refactored version by: Raphal Araújo e Silva <[email protected]>
# Refactored code: https://github.com/pgmodeler/pgmodeler
# General Qt settings
QT += core widgets printsupport network svg
CONFIG += ordered qt stl rtti exceptions warn_on c++14
TEMPLATE = subdirs
MOC_DIR = moc
OBJECTS_DIR = obj
UI_DIR = src
# Setting up the flag passed to compiler to indicate a snapshot build
defined(SNAPSHOT_BUILD, var): DEFINES+=SNAPSHOT_BUILD
# Setting up the flag passed to compiler to build the demo version
defined(DEMO_VERSION, var): DEFINES+=DEMO_VERSION
# Setting up the flag passed to compiler to disable all code related to update checking
defined(NO_UPDATE_CHECK, var): DEFINES+=NO_UPDATE_CHECK
# Properly defining build number constant
unix {
BUILDNUM=$$system("date '+%Y%m%d'")
DEFINES+=BUILDNUM=\\\"$${BUILDNUM}\\\"
} else {
BUILDNUM=$$system('getbuildnum.bat')
DEFINES+=BUILDNUM=\\\"$${BUILDNUM}\\\"
}
# Below, the user can specify where all generated file can be placed
# through a set of variables, being them:
#
# PREFIX -> the root directory where the files will be placed
# BINDIR -> where executables accessible by the user resides
# PRIVATEBINDIR -> where executables not directly accessible by the user resides
# PRIVATELIBDIR -> where libraries not directly shared through the system resides
# PLUGINSDIR -> where third party plugins are installed
# SHAREDIR -> where shared files and resources should be placed
# CONFDIR -> where the pgModeler's configuration folder (conf) resides
# DOCDIR -> where documentation related files are placed
# LANGDIR -> where the UI translation folder (lang) resides
# SAMPLESDIR -> where the sample models folder (samples) resides
# SCHEMASDIR -> where the object's schemas folder (schema) resides
#
# The values of each variable changes between supported platforms and are describe as follow
# Linux custom variables settings
linux {
CONFIG += x11
# If the AppImage generation option is set
defined(APPIMAGE_BUILD, var):{
!defined(PREFIX, var): PREFIX = /usr/local/pgmodeler-appimage
BINDIR = $$PREFIX
PRIVATEBINDIR = $$PREFIX
PRIVATELIBDIR = $$PREFIX/lib
PLUGINSDIR = $$PREFIX/lib/pgmodeler/plugins
SHAREDIR = $$PREFIX
CONFDIR = $$SHAREDIR/conf
DOCDIR = $$SHAREDIR
LANGDIR = $$SHAREDIR/lang
SAMPLESDIR = $$SHAREDIR/samples
SCHEMASDIR = $$SHAREDIR/schemas
}
!defined(APPIMAGE_BUILD, var):{
# Default configuration for package pgModeler.
# The default prefix is /usr/local
!defined(PREFIX, var): PREFIX = /usr/local
!defined(BINDIR, var): BINDIR = $$PREFIX/bin
!defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$PREFIX/bin
!defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX/lib/pgmodeler
!defined(PLUGINSDIR, var): PLUGINSDIR = $$PREFIX/lib/pgmodeler/plugins
!defined(SHAREDIR, var): SHAREDIR = $$PREFIX/share/pgmodeler
!defined(CONFDIR, var): CONFDIR = $$SHAREDIR/conf
!defined(DOCDIR, var): DOCDIR = $$SHAREDIR
!defined(LANGDIR, var): LANGDIR = $$SHAREDIR/lang
!defined(SAMPLESDIR, var): SAMPLESDIR = $$SHAREDIR/samples
!defined(SCHEMASDIR, var): SCHEMASDIR = $$SHAREDIR/schemas
}
# Specifies where to find the libraries at runtime
RELATIVE_PRIVATELIBDIR = $$relative_path($$PRIVATELIBDIR, $$BINDIR)
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\' -Wl,-rpath,\'\$$ORIGIN/$$RELATIVE_PRIVATELIBDIR\'"
# Forcing the display of some warnings
CONFIG(debug, debug|release): QMAKE_CXXFLAGS += "-Wall -Wextra -Wuninitialized"
}
# Windows custom variables settings
windows {
CONFIG += windows
# The default prefix is ./build
!defined(PREFIX, var): PREFIX = $$PWD/build
!defined(BINDIR, var): BINDIR = $$PREFIX
!defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$PREFIX
!defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX
!defined(PLUGINSDIR, var): PLUGINSDIR = $$PREFIX/plugins
!defined(SHAREDIR, var): SHAREDIR = $$PREFIX
!defined(CONFDIR, var): CONFDIR = $$PREFIX/conf
!defined(DOCDIR, var): DOCDIR = $$PREFIX
!defined(LANGDIR, var): LANGDIR = $$PREFIX/lang
!defined(SAMPLESDIR, var): SAMPLESDIR = $$PREFIX/samples
!defined(SCHEMASDIR, var): SCHEMASDIR = $$PREFIX/schemas
}
# MacOS X custom variables settings
macx {
CONFIG -= app_bundle
# The default prefix is ./build/pgmodeler.app/Contents
!defined(PREFIX, var): PREFIX = /Applications/pgModeler.app/Contents
!defined(BINDIR, var): BINDIR = $$PREFIX/MacOS
!defined(PRIVATEBINDIR, var): PRIVATEBINDIR = $$BINDIR
!defined(PRIVATELIBDIR, var): PRIVATELIBDIR = $$PREFIX/Frameworks
!defined(PLUGINSDIR, var): PLUGINSDIR = $$BINDIR/plugins
!defined(SHAREDIR, var): SHAREDIR = $$BINDIR
!defined(CONFDIR, var): CONFDIR = $$BINDIR/conf
!defined(DOCDIR, var): DOCDIR = $$BINDIR
!defined(LANGDIR, var): LANGDIR = $$BINDIR/lang
!defined(SAMPLESDIR, var): SAMPLESDIR = $$BINDIR/samples
!defined(SCHEMASDIR, var): SCHEMASDIR = $$BINDIR/schemas
# Specifies where to find the libraries at runtime
QMAKE_RPATHDIR += @executable_path/../Frameworks
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@loader_path/../Frameworks/
}
# Creating constants based upon the custom paths so the GlobalAttributes
# namespace can correctly configure the paths inside the code
DEFINES += BINDIR=\\\"$${BINDIR}\\\" \
PLUGINSDIR=\\\"$${PLUGINSDIR}\\\" \
PRIVATEBINDIR=\\\"$${PRIVATEBINDIR}\\\" \
CONFDIR=\\\"$${CONFDIR}\\\" \
DOCDIR=\\\"$${DOCDIR}\\\" \
LANGDIR=\\\"$${LANGDIR}\\\" \
SAMPLESDIR=\\\"$${SAMPLESDIR}\\\" \
SCHEMASDIR=\\\"$${SCHEMASDIR}\\\"
# pgModeler depends on libpq and libxml2 this way to variables
# are define so the compiler can find the libs at link time.
#
# PGSQL_LIB -> Full path to libpq.(so | dll | dylib)
# PGSQL_INC -> Root path where PgSQL includes can be found
#
# XML_LIB -> Full path to libxml2.(so | dll | dylib)
# XML_INC -> Root path where XML2 includes can be found
unix:!macx {
CONFIG += link_pkgconfig
PKGCONFIG = libpq libxml-2.0
PGSQL_LIB = -lpq
XML_LIB = -lxml2
}
macx {
!defined(PGSQL_LIB, var): PGSQL_LIB = /Library/PostgreSQL/12/lib/libpq.dylib
!defined(PGSQL_INC, var): PGSQL_INC = /Library/PostgreSQL/12/include
!defined(XML_INC, var): XML_INC = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
!defined(XML_LIB, var): XML_LIB = /usr/lib/libxml2.dylib
INCLUDEPATH += $$PGSQL_INC $$XML_INC
}
windows {
!defined(PGSQL_LIB, var): PGSQL_LIB = C:/msys64/mingw64/bin/libpq.dll
!defined(PGSQL_INC, var): PGSQL_INC = C:/msys64/mingw64/include
!defined(XML_INC, var): XML_INC = C:/msys64/mingw64/include/libxml2
!defined(XML_LIB, var): XML_LIB = C:/msys64/mingw64/bin/libxml2-2.dll
# Workaround to solve bug of timespec struct on MingW + PostgreSQL < 9.4
QMAKE_CXXFLAGS+="-DHAVE_STRUCT_TIMESPEC"
INCLUDEPATH += "$$PGSQL_INC" "$$XML_INC"
}
macx | windows {
!exists($$PGSQL_LIB) {
PKG_ERROR = "PostgreSQL libraries"
VARIABLE = "PGSQL_LIB"
VALUE = $$PGSQL_LIB
}
!exists($$PGSQL_INC/libpq-fe.h) {
PKG_ERROR = "PostgreSQL headers"
VARIABLE = "PGSQL_INC"
VALUE = $$PGSQL_INC
}
!exists($$XML_LIB) {
PKG_ERROR = "XML2 libraries"
VARIABLE = "XML_LIB"
VALUE = $$XML_LIB
}
!exists($$XML_INC) {
PKG_ERROR = "XML2 headers"
VARIABLE = "XML_INC"
VALUE = $$XML_INC
}
!isEmpty(PKG_ERROR) {
warning("$$PKG_ERROR were not found at \"$$VALUE\"!")
warning("Please correct the value of $$VARIABLE and try again!")
error("pgModeler compilation aborted.")
}
}
# Define a custom function to print build details
defineTest(printBuildDetails) {
LB=$$escape_expand(\n)
log($$LB)
log("** pgModeler build details ** $$LB $$LB")
log(" PREFIX = $$PREFIX $$LB")
log(" BINDIR = $$BINDIR $$LB")
log(" PRIVATEBINDIR = $$PRIVATEBINDIR $$LB")
log(" PRIVATELIBDIR = $$PRIVATELIBDIR $$LB")
log(" PLUGINSDIR = $$PLUGINSDIR $$LB")
log(" SHAREDIR = $$SHAREDIR $$LB")
log(" CONFDIR = $$CONFDIR $$LB")
log(" DOCDIR = $$DOCDIR $$LB")
log(" LANGDIR = $$LANGDIR $$LB")
log(" SAMPLESDIR = $$SAMPLESDIR $$LB")
log(" SCHEMASDIR = $$SCHEMASDIR $$LB $$LB")
log("* To change a variable value run qmake again setting the desired value e.g.: $$LB")
log(" > qmake PREFIX+=/usr/local -r pgmodeler.pro $$LB $$LB")
log("* Proceed with build process by running: $$LB")
log(" > make && make install $$LB")
log($$LB)
return(true)
}