godot/drivers/SCsub
Rémi Verschelde c320a82213 SCons: Add 'split_libmodules' option to workaround linker issue
The new 'split_libmodules=yes' option is useful to work around linker
command line size limitations when linking a huge number of objects.
We're currently over 64k chars when linking libmodules.a on Windows
with MinGW, which triggers issues as seen in #30892.

Even on Linux, we can also reach linker command line size limitations
by adding more custom modules.

We force this option to True for MinGW on Windows, which fixes #30892.

Additional changes to lib splitting:

- Fix linking of the split module libs with interdependent symbols,
  hacking our way into LINKCOM and SHLINKCOM to set the `--start-group`
  and `--end-group` flags.
- Fix Python 3 compatibility in `methods.split_lib()`.
- Drop seemingly obsolete condition for 'msys' on 'posix'.
- Drop the unnecessary 'split_drivers' as the drivers lib is no longer
  too big since we moved all thirdparty builds to modules.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2019-12-11 15:40:28 +01:00

53 lines
1.1 KiB
Python

#!/usr/bin/env python
Import('env')
env.drivers_sources = []
# OS drivers
SConscript('unix/SCsub')
SConscript('windows/SCsub')
# Sounds drivers
SConscript('alsa/SCsub')
SConscript('coreaudio/SCsub')
SConscript('pulseaudio/SCsub')
if (env["platform"] == "windows"):
SConscript("wasapi/SCsub")
if env['xaudio2']:
SConscript("xaudio2/SCsub")
# Midi drivers
SConscript('alsamidi/SCsub')
SConscript('coremidi/SCsub')
SConscript('winmidi/SCsub')
# Graphics drivers
if (env["platform"] != "server"):
SConscript('gles3/SCsub')
SConscript('gles2/SCsub')
SConscript('gl_context/SCsub')
else:
SConscript('dummy/SCsub')
# Core dependencies
SConscript("png/SCsub")
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
if env['tools']:
SConscript("convex_decomp/SCsub")
if env['vsproj']:
import os
path = os.getcwd()
# Change directory so the path resolves correctly in the function call.
os.chdir("..")
env.AddToVSProject(env.drivers_sources)
os.chdir(path)
env.add_source_files(env.drivers_sources, "*.cpp")
lib = env.add_library("drivers", env.drivers_sources)
env.Prepend(LIBS=[lib])