-
-
Notifications
You must be signed in to change notification settings - Fork 489
/
common.project
214 lines (175 loc) · 6.06 KB
/
common.project
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
# perl highlighting
LIBC = shared
#MAPFILES = 1
CONSOLE = 1
!if !defined(OPTIMIZE) # allow overriding of OPTIMIZE in parent project
OPTIMIZE = size
!endif
PDB = 2 # keep enabled, executable is almost the same, except embedded link to pdb file
!if !defined(OLDCRT) # allow overriding of OLDCRT in parent project
OLDCRT = 0 # set to 0 (or comment the line) to use "native" compiler's CRT
# Changed 29.05.2021: Oodle static libraries requires more modern CRT which is not available in MSVCRT.dll
!endif
!if defined(TRACY)
OLDCRT = 0 # tracy requires some new C++ features which aren't available with msvcrt.dll
!endif
#------------------------------------------------
# Compiler-specific options
#------------------------------------------------
STDDEFS = # common defines
WARNINGS = # warnings for our source code (i.e. excluding thirs-parties), empty by default
USE_SYSTEM_LIBS = 0
CPP_STD = c++14 # allow modern C++ features
#!! todo: add standard option for that
#!! todo: the standard has been changed for clang on macOS, check for "CPP_STD" below!
!if "$COMPILER" eq "VisualC"
!if !defined(CPP_EXCEPT)
CPP_EXCEPT = 0 # used with WIN32_USE_SEH in Core.h
!endif
WINXP = 1 # we're not using any modern Win32 features, so allow to worn at WinXP
OPTIONS = -GS- -GR-
# WARNINGS += -W4 # maximal warning level for Visual C++
WDKCRT = $R/../Libs/msvcrt
!if "$OLDCRT" eq "1" && -e "$WDKCRT/msvcrt.project"
STDDEFS += OLDCRT # used in code to distinguish which functions are available
STDDEFS += _NO_CRT_STDIO_INLINE # UCRT (VS 2015+): without that, all printf functions will use some "common" function
!include $WDKCRT/msvcrt.project
!if "$VC_VER" >= 2015 # support for OLDCRT with modern compilers
OPTIONS += -fp:fast
OPTIONS += -Zc:threadSafeInit- # disable calls to C++11 thread-safe static object initializers
STDDEFS += _ACRTIMP_ALT= # remove dllimport from some CRT functions (there're just a few)
!endif
!endif
LINKFLAGS += -largeaddressaware # allow 32-bit build to use more than 2Gb or RAM
OPTIONS += -std:$CPP_STD
!endif
!if "$COMPILER" eq "GnuC"
# linux/cygwin + GCC
STDLIBS = m stdc++ # libm for math.h functions
!if "$PLATFORM" ne "cygwin"
STDLIBS += dl # dlopen() and friends
STDLIBS += pthread
!endif
!if "$PLATFORM" ne "osx"
STDLIBS += GL
!else
CPP_STD = c++2a # https://github.com/gildor2/UEViewer/issues/183#issuecomment-846745134
!endif
LIBC = shared
OPTIONS = -msse2 # enable SSE instructions
OPTIONS += -fno-strict-aliasing # required for our uint_cast()-based FP hacks (check!! taken from my Quake2)
OPTIONS += -fno-stack-protector # this will remove GLIBC_2.4 dependency
OPTIONS += {
# enable some warnings
# -Wsuggest-override # enforce use of 'override' keyword for virtual methods
-Wunused-value # warning about expression which is occasionally typed in code and not used anywhare
}
CPP_OPTIONS += -std=$CPP_STD
CPP_OPTIONS += -Wno-invalid-offsetof
USE_SYSTEM_LIBS = 1
!endif
# GCC debug build
!if ("$COMPILER" eq "GnuC") && 0
#!! should disable "-s" option from linker command
OPTIONS += -g3 -fno-omit-frame-pointer -funwind-tables -fstack-protector -fno-optimize-sibling-calls
LINKFLAGS += -rdynamic
!endif
DEFINES = $STDDEFS
#OPTIONS += -analyze
#------------------------------------------------
# Third-party libraries
#------------------------------------------------
LIBINCLUDES = $R/libs/include $R/libs
OBJDIR = $R/obj/libs-$PLATFORM
!if ("$OLDCRT" eq "1") && ("$COMPILER" eq "VisualC")
OBJDIR = $R/obj/libs-$PLATFORM-msvcrt
!endif
push(INCLUDES)
push(OPTIMIZE)
INCLUDES = $R/libs/nvtt
LIBINCLUDES += $R/libs/nvtt
OPTIMIZE = speed
sources(NV_LIBS) = {
# $R/libs/nvtt/nvcore/*.cpp
$R/libs/nvtt/nvimage/*.cpp
# $R/libs/nvtt/nvmath/*.cpp
# $R/libs/nvtt/nvtt/bc6h/*.cpp
# $R/libs/nvtt/nvtt/bc7/*.cpp
}
pop(OPTIMIZE)
pop(INCLUDES)
# defines for smaller zlib
push(DEFINES)
push(INCLUDES)
DEFINES = $STDDEFS DYNAMIC_CRC_TABLE BUILDFIXED NO_GZIP
INCLUDES = $R/libs/include
# compression libraries
sources(COMP_LIBS) = {
# ... lzo for compressed UE3 packages
$R/libs/lzo/lzo_init.c
$R/libs/lzo/lzo1x_d2.c
# ... lzx for compressed XBox360 UE3 packages
$R/libs/mspack/lzxd.c
# ... lz4 for Gears of War 4
$R/libs/lz4/lz4.c
}
!if "$USE_SYSTEM_LIBS" eq "0"
# ... zlib for compressed UE3/UE4 packages
# zlib.h location: used from zlib source code and from UModel code.
# Default location for Linux is <zlib.h>
LIBINCLUDES += $R/libs/zlib # for using zlib in source code
INCLUDES += $R/libs/zlib # for building zlib itself
sources(COMP_LIBS) = {
$R/libs/zlib/*.c
}
# ... PNG for compressed source textures
LIBINCLUDES += $R/libs/libpng
DEFINES = $STDDEFS PNG_USER_CONFIG
sources(IMG_LIBS) = {
$R/libs/libpng/*.c
}
!else
STDLIBS += z png
!if !-e "/usr/include/png.h"
# Probably "png.h" include will fail, add "libpng" subdirectory to include paths
LIBINCLUDES += /usr/include/libpng
!endif
!endif
pop(INCLUDES)
pop(DEFINES)
# SDL2
!include $R/libs/SDL2/SDL2.project
# oodle SDK support
!include $R/libs/oodle/oodle.project
sources(MOBILE_LIBS) = {
$R/libs/PowerVR/*.cpp
$R/libs/astc/*.cpp
}
LIBINCLUDES += $R/libs/PowerVR
LIBINCLUDES += $R/libs/detex
sources(IMG_LIBS) = {
$R/libs/detex/*.cpp
}
LIBINCLUDES += $R/libs/rijndael
sources(UE4_LIBS) = {
$R/libs/rijndael/*.c
}
#------------------------------------------------
# Project-specific options
#------------------------------------------------
OBJDIR = $R/obj/$PRJ-$PLATFORM
INCLUDES += . $R/Core $R/Unreal $LIBINCLUDES
OPTIONS += $WARNINGS
!if defined(DEBUG)
DEFINES += MAX_DEBUG
OBJDIR = $OBJDIR-debug
OPTIMIZE = none
!endif
!if defined(TRACY)
DEFINES += TRACY_ENABLE
OBJDIR = $OBJDIR-profile
STDLIBS += advapi32.lib
sources(MAIN) = {
libs/tracy/TracyClient.cpp
}
!endif