0030682: Configuration, qmake - all warnings are suppressed on macOS target
[occt.git] / adm / qmake / OccCppConfig.pri
CommitLineData
aafe169f 1# This is project defines C++ compilation rules for building an OCCT Toolkit.
2
3exists(custom.auto.pri) { include(custom.auto.pri) }
4exists(custom.pri) { include(custom.pri) }
5
6# Disable some dummy Qt defaults
7QT -= core gui
8CONFIG -= qt app_bundle
9CONFIG -= qml_debug
10CONFIG -= debug_and_release
11
12OccGitRoot = $$_PRO_FILE_PWD_/../../../..
13
14# Define compilation flags
faa0a911 15CONFIG += warn_on
16QMAKE_CFLAGS_WARN_ON = -Wall
17QMAKE_CXXFLAGS_WARN_ON = -Wall
18win32 {
19 QMAKE_CFLAGS_WARN_ON = -W4
aafe169f 20 QMAKE_CXXFLAGS_WARN_ON = -W4
21 QMAKE_CXXFLAGS_EXCEPTIONS_ON = /EHa
22 QMAKE_CXXFLAGS_STL_ON = /EHa
23
24 QMAKE_CXXFLAGS += -fp:precise
25 #QMAKE_CXXFLAGS -= -Zc:throwingNew
26 #QMAKE_CXXFLAGS -= -Zc:rvalueCast
27
28 QMAKE_LFLAGS += -INCREMENTAL:NO
29
30 CONFIG(debug, debug|release) {
31 QMAKE_CXXFLAGS += -Od
32 QMAKE_CXXFLAGS += -Ob1
33 }
34
35 DEFINES -= WIN32
36 DEFINES -= WIN64
37 DEFINES += _CRT_SECURE_NO_WARNINGS
38 DEFINES += _CRT_NONSTDC_NO_DEPRECATE
39 DEFINES += _SCL_SECURE_NO_WARNINGS
faa0a911 40} else {
aafe169f 41 CONFIG += c++11
faa0a911 42 QMAKE_CFLAGS += -fexceptions
43 QMAKE_CXXFLAGS += -fexceptions
aafe169f 44 QMAKE_CXXFLAGS += -fvisibility=default
faa0a911 45 DEFINES += OCC_CONVERT_SIGNALS
46 mac {
47 iphoneos {
48 QMAKE_IOS_DEPLOYMENT_TARGET = 8.0
49 } else {
50 QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
51 }
52 }
53}
54!CONFIG(debug, debug|release) {
55 # disable exceptions in Release builds
56 DEFINES += No_Exception
57 HAVE_RelWithDebInfo {
58 win32 {
59 CONFIG += force_debug_info
60 }
aafe169f 61 }
62}
63
64# Define output folder depending on compiler name
65MY_BITNESS = 32
24ee60ff 66
aafe169f 67equals(QMAKE_TARGET.arch, x86_64) | equals(QMAKE_HOST.arch, x86_64) { MY_BITNESS = 64 }
68equals(ANDROID_TARGET_ARCH, arm64-v8a) { MY_BITNESS = 64 }
24ee60ff 69has64Target = $$find(QMAKE_TARGET.arch, "x64")
70count(has64Target, 1) { MY_BITNESS = 64 }
aafe169f 71
72MY_PLATFORM = platform
73CONFIG(iphonesimulator, iphoneos|iphonesimulator) { MY_PLATFORM = iphonesimulator
74} else:CONFIG(iphoneos, iphoneos|iphonesimulator) { MY_PLATFORM = iphoneos
75} else:android { MY_PLATFORM = android-$$ANDROID_TARGET_ARCH
76} else:win32 { MY_PLATFORM = win$$MY_BITNESS
77} else:mac { MY_PLATFORM = mac
78} else:linux { MY_PLATFORM = lin
79} else:unix { MY_PLATFORM = unix
80} else { warning (Unknown platform. "$$MY_PLATFORM" is used) }
81
82MY_COMPILER = compiler
83MY_VC_VER = 0
84android-g++ {
85 MY_COMPILER = gcc
86} else:clang {
87 MY_COMPILER = clang
88} else:gcc {
89 MY_COMPILER = gcc
90} else:win32-msvc2010 {
91 MY_COMPILER = vc10
92 MY_VC_VER = 10
93} else:win32-msvc2012 {
94 MY_COMPILER = vc11
95 MY_VC_VER = 11
96} else:win32-msvc2013 {
97 MY_COMPILER = vc12
98 MY_VC_VER = 12
99} else:win32-msvc2015 {
100 MY_COMPILER = vc14
101 MY_VC_VER = 14
102} else:win32-msvc2017 {
103 MY_COMPILER = vc14
104 MY_VC_VER = 14
24ee60ff 105} else:win32-msvc {
106 MY_COMPILER = vc14
107 MY_VC_VER = 14
108 aMsvcVer = $$(VisualStudioVersion)
109 equals(aMsvcVer, 14.0){
110 # VS2015, vc140
111 } else:equals(aMsvcVer, 15.0){
112 # VS2015, vc141
113 } else:equals(aMsvcVer, 16.0){
114 # VS2019, vc142
115 } else {
116 warning (Unknown msvc version. "$$MY_COMPILER" is used)
117 }
aafe169f 118} else {
119 warning (Unknown compiler. "$$MY_COMPILER" is used)
120}
121MY_PLATFORM_AND_COMPILER = $$MY_PLATFORM/$$MY_COMPILER
24ee60ff 122#warning (The platform is "$$MY_PLATFORM"; bitness is "$$MY_BITNESS"; compiler is "$$MY_COMPILER")
aafe169f 123
124CONFIG(debug, debug|release) { MY_BUILDTYPE = d }
125
126DESTDIR = $$OccGitRoot/$${MY_PLATFORM_AND_COMPILER}/lib$${MY_BUILDTYPE}
127win32 {
128 DESTDIR = $$OccGitRoot/win$${MY_BITNESS}/vc$${MY_VC_VER}/bin$${MY_BUILDTYPE}
129 aLibDest = $$DESTDIR/../lib$${MY_BUILDTYPE}
130 #DLLDESTDIR = $$DESTDIR/../bin$${MY_BUILDTYPE}
131
132 # dummy target creating lib/libd folder
133 occtkgen_libfolder.input = $$_PRO_FILE_PWD_/../../OcctDummy.in
134 occtkgen_libfolder.output = $$aLibDest/dummy.tmp
135 occtkgen_libfolder.config = verbatim
136 QMAKE_SUBSTITUTES += occtkgen_libfolder
137
138 LIBS += -L$$aLibDest
aafe169f 139 equals(TEMPLATE, lib) {
140 QMAKE_CLEAN += $$DESTDIR/$${TARGET}.dll
141 QMAKE_CLEAN += $$aLibDest/$${TARGET}.lib
142 QMAKE_CLEAN += $$aLibDest/$${TARGET}.exp
143 } else {
144 QMAKE_CLEAN += $$DESTDIR/$${TARGET}.exe
145 }
146 QMAKE_CLEAN += $$DESTDIR/$${TARGET}.pdb
147 QMAKE_LFLAGS += -PDB:"$$DESTDIR/$${TARGET}.pdb"
148 QMAKE_LFLAGS += -IMPLIB:"$$aLibDest/$${TARGET}.lib"
149} else {
150 LIBS += -L$$DESTDIR
151 equals(TEMPLATE, app) {
152 DESTDIR = $$OccGitRoot/$${MY_PLATFORM_AND_COMPILER}/bin$${MY_BUILDTYPE}
153 }
154}
155
156#OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}/$${TARGET}
157OBJECTS_DIR = $$DESTDIR/../obj$${MY_BUILDTYPE}