Skip to content

Commit 8bd7e28

Browse files
committed
Adding LTO
1 parent b544b42 commit 8bd7e28

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

AMBuildScript

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if builder.cxx.target.platform == 'linux':
5656
'-std=c++17',
5757
]
5858
# Linux linker flags
59-
builder.cxx.linkflags += ['-m32', '-ldl', '-lm']
59+
builder.cxx.linkflags += ['-m32', '-ldl', '-lm', '-flto']
6060
elif builder.cxx.target.platform == 'windows':
6161
# Windows defines
6262
builder.cxx.defines += [
@@ -101,11 +101,13 @@ if builder.options.optimize:
101101
if builder.cxx.target.platform == 'linux':
102102
# Linux optimization flags
103103
builder.cxx.cflags += ['-O3']
104+
# Linux optimization link flags #TODO
105+
#builder.cxx.linkflags += ['-flto']
104106
elif builder.cxx.target.platform == 'windows':
105107
# Windows optimization flags - /Ob3 needs to be after /Ox, enables aggressive function inling -caxanga334
106-
builder.cxx.cflags += ['/Ox', '/Zo', '/Ob3', '/GF']
108+
builder.cxx.cflags += ['/Ox', '/Zo', '/Ob3', '/GL']
107109
# Windows optimization link flags
108-
builder.cxx.linkflags += ['/OPT:ICF', '/OPT:REF']
110+
builder.cxx.linkflags += ['/OPT:ICF', '/OPT:REF', '/LTCG']
109111
# This needs to be after our optimization flags which could otherwise disable it.
110112
builder.cxx.cflags += ['/Oy-']
111113

@@ -115,7 +117,7 @@ if builder.options.debug:
115117
builder.cxx.defines += ['DEBUG', '_DEBUG']
116118
if builder.cxx.target.platform == 'linux':
117119
# Linux debug flags
118-
builder.cxx.cflags += ['-g3', '-Og', '-ggdb3']
120+
builder.cxx.cflags += ['-g3', '-O0']
119121
elif builder.cxx.target.platform == 'windows':
120122
# Windows debug flags
121123
builder.cxx.cflags += ['/Od', '/RTC1', '/MTd']

common/const.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
****/
1515
#ifndef CONST_H
1616
#define CONST_H
17+
18+
#include <cstdint>
19+
1720
//
1821
// Constants shared by the engine and dlls
1922
// This header file included by engine files and DLL files.

0 commit comments

Comments
 (0)