Move Builder and BuildEnv in specific module.

Introduce also a "NeutralEnv", a build environment independent of the
targeted platform. All `Source` now build using the neutralEnv.

Most of toolchains are also using neutralEnv except android_ndk who is
specific to a platform.

As toolchain are neutral, platform specific environment variables are now
set by the platformInfo directly instead of the toolchain.
This commit is contained in:
Matthieu Gautier
2018-05-22 16:36:54 +02:00
parent ac83dec674
commit b950feb893
15 changed files with 649 additions and 589 deletions

View File

@ -4,15 +4,17 @@ from .base import PlatformInfo
class Win32PlatformInfo(PlatformInfo):
def __init__(self, name, static):
super().__init__(name, 'win32', static, ['mingw32_toolchain'], ['fedora', 'debian'])
self.extra_libs = ['-lwinmm', '-lws2_32', '-lshlwapi', '-lrpcrt4', '-lmsvcr90', '-liphlpapi']
def get_cross_config(self, host):
root_paths = {
'fedora': '/usr/i686-w64-mingw32/sys-root/mingw',
'debian': '/usr/i686-w64-mingw32'
}
self.root_path = root_paths[host]
return {
'root_path': root_paths[host],
'extra_libs': ['-lwinmm', '-lws2_32', '-lshlwapi', '-lrpcrt4', '-lmsvcr90', '-liphlpapi'],
'root_path': self.root_path,
'extra_libs': self.extra_libs,
'extra_cflags': ['-DWIN32'],
'host_machine': {
'system': 'Windows',
@ -24,6 +26,12 @@ class Win32PlatformInfo(PlatformInfo):
}
}
def get_bin_dir(self):
return [pj(self.root_path, 'bin')]
def set_env(self, env):
env['PKG_CONFIG_LIBDIR'] = pj(self.root_path, 'lib', 'pkgconfig')
env['LIBS'] = " ".join(self.extra_libs) + " " +env['LIBS']
Win32PlatformInfo('win32_dyn', False)
Win32PlatformInfo('win32_static', True)