summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/SCsub2
-rw-r--r--platform/windows/detect.py15
2 files changed, 13 insertions, 4 deletions
diff --git a/platform/windows/SCsub b/platform/windows/SCsub
index fd041e096e..d3c160f052 100644
--- a/platform/windows/SCsub
+++ b/platform/windows/SCsub
@@ -30,7 +30,7 @@ common_win.append(obj)
binary = env.Program('#bin/godot', ['godot_win.cpp'] + common_win, PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
-if (env['vsproj']) == "yes":
+if env['vsproj']:
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 65eb51a2f3..031b397988 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -49,6 +49,7 @@ def can_build():
def get_opts():
+ from SCons.Variables import BoolVariable, EnumVariable
mingw32 = ""
mingw64 = ""
@@ -64,7 +65,8 @@ def get_opts():
return [
('mingw_prefix_32', 'MinGW prefix (Win32)', mingw32),
('mingw_prefix_64', 'MinGW prefix (Win64)', mingw64),
- ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
+ BoolVariable('use_lto', 'Use link time optimization (when using MingW)', False),
+ EnumVariable('debug_symbols', 'Add debug symbols to release version', 'yes', ('yes', 'no', 'full')),
]
@@ -256,11 +258,18 @@ def configure(env):
env["CC"] = mingw_prefix + "gcc"
env['AS'] = mingw_prefix + "as"
env['CXX'] = mingw_prefix + "g++"
- env['AR'] = mingw_prefix + "ar"
- env['RANLIB'] = mingw_prefix + "ranlib"
+ env['AR'] = mingw_prefix + "gcc-ar"
+ env['RANLIB'] = mingw_prefix + "gcc-ranlib"
env['LD'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
+ if env['use_lto']:
+ env.Append(CCFLAGS=['-flto'])
+ if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
+ env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])
+ else:
+ env.Append(LINKFLAGS=['-flto'])
+
## Compile flags
env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])