Skip to content

Commit 8edbdf3

Browse files
author
mercier.nicolas
committed
initial import
git-svn-id: https://bugengine.googlecode.com/svn/trunk@1 f3700e90-1ba7-11de-b56b-c9554f25afe1
0 parents  commit 8edbdf3

File tree

808 files changed

+152472
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

808 files changed

+152472
-0
lines changed

mak/__init__.py

Whitespace-only changes.

mak/host/nt/wscript

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# set win32 specific options
2+
# detect tools : msvc, mingw
3+
4+
5+
import _winreg
6+
import os
7+
import re
8+
import Tools.msvc
9+
import Utils
10+
from Logs import warn
11+
12+
13+
tools = [ 'gcc', 'msvc']
14+
projects = [('vs2005', 'Visual Studio 2005'), ('vs2008', 'Visual Studio 2008'), ('vs2005e', 'Visual Studio 2005 Express'), ('vs2008e', 'Visual Studio 2008 Express')]
15+
16+
17+
# gets a list of all the Platform SDKs installed (msvc not needed)
18+
def get_available_platform_sdk(conf = None, selected=[]):
19+
pass
20+
21+
22+
# adds MSVC vars to environment
23+
def add_msvc_to_env(conf, version, target, tname):
24+
name = 'msvc-win32-%s-%s' %(target,version)
25+
Utils.pprint('NORMAL', 'configure for tool %s' % name)
26+
newenv = conf.set_env_name(name, conf.env.copy())
27+
newenv.set_variant(name)
28+
tool,platform,arch,version = name.split('-')
29+
newenv['PLATFORM'] = platform
30+
newenv['ARCHITECTURE'] = tname
31+
newenv['MSVC_VERSIONS'] = version
32+
newenv['MSVC_TARGETS'] = target
33+
conf.setenv(name)
34+
conf.check_tool('msvc')
35+
conf.sub_config(os.path.join('..', '..', 'target', 'win32'))
36+
conf.sub_config(os.path.join('..', '..', 'target', tname))
37+
conf.setenv('default')
38+
conf.env['BUILD_VARIANTS'].append(name)
39+
40+
# gets a list of all the MSVC complete suites installed
41+
def get_available_msvc( conf):
42+
allversions = conf.get_msvc_versions()
43+
for (version,targets) in allversions:
44+
for (target, (tname, paths)) in targets:
45+
add_msvc_to_env(conf, version, target, tname)
46+
47+
# adds GCC vars to environment
48+
gccPlatforms = {
49+
'mingw32' : [('win32','x86')],
50+
'x86_64-pc-mingw32' : [('win32','amd64')],
51+
'powerpc-gekko': [('wii','powerpc')],
52+
'psp': [('psp','mips')],
53+
'arm-eabi': [('nds', 'arm')]
54+
}
55+
56+
def add_gcc_to_env(conf, version, toolchaindir, gcc_target):
57+
import subprocess
58+
try: supportedPlatforms = gccPlatforms[gcc_target]
59+
except KeyError: supportedPlatforms = []
60+
for platform,arch in supportedPlatforms:
61+
name = 'gcc-'+platform + '-' + arch + '-' + version
62+
Utils.pprint('NORMAL', 'configure for tool %s' % name)
63+
newenv = conf.set_env_name(name, conf.env.copy())
64+
newenv.set_variant(name)
65+
tool,platform,arch,version = name.split('-')
66+
newenv['PLATFORM'] = platform
67+
newenv['ARCHITECTURE'] = arch
68+
newenv['GCC_VERSION'] = version
69+
newenv['GCC_TARGET'] = gcc_target
70+
conf.setenv(name)
71+
conf.env['PATH'] = [os.path.abspath(os.path.join(toolchaindir, 'bin')),
72+
os.path.abspath(os.path.join(toolchaindir, gcc_target, 'bin'))]
73+
74+
conf.env['CC'] = conf.find_program('%s-gcc-%s' %(gcc_target, version), path_list = conf.env['PATH'], var='CC')
75+
conf.env['CPP'] = conf.find_program('%s-cpp' %gcc_target, path_list = conf.env['PATH'], var='CPP')
76+
conf.env['CXX'] = conf.find_program('%s-g++' %gcc_target, path_list = conf.env['PATH'], var='CXX')
77+
conf.env['AS'] = conf.find_program('%s-as' %gcc_target, path_list = conf.env['PATH'], var='AS')
78+
conf.env['AR'] = conf.find_program('%s-ar' %gcc_target, path_list = conf.env['PATH'], var='AR')
79+
conf.env['RANLIB'] = conf.find_program('%s-ranlib' %gcc_target, path_list = conf.env['PATH'], var='RANLIB')
80+
conf.check_tool('gcc')
81+
conf.check_tool('gxx')
82+
conf.check_tool('gas')
83+
if platform=='win32':
84+
conf.env['WINRC'] = conf.find_program('%s-windres' %gcc_target, path_list = conf.env['PATH'], var='WINRC')
85+
conf.check_tool('winres')
86+
conf.sub_config(os.path.join('..', '..', 'target', platform))
87+
conf.sub_config(os.path.join('..', '..', 'target', arch))
88+
conf.setenv('default')
89+
conf.env['BUILD_VARIANTS'].append(name)
90+
91+
# gets a list of the GCC toolchains installed
92+
def get_available_gcc(conf):
93+
toolchaindir = '../..'
94+
if os.path.isdir(os.path.join(toolchaindir,'lib','gcc')):
95+
for target in os.listdir(os.path.join(toolchaindir, 'lib', 'gcc')):
96+
if target in ['.svn', '.cvs']:
97+
continue
98+
for version in os.listdir(os.path.join(toolchaindir, 'lib', 'gcc', target)):
99+
if version in ['.svn', '.cvs']:
100+
continue
101+
name = add_gcc_to_env(conf, version, os.path.join(toolchaindir), target)
102+
103+
104+
def set_options(opt):
105+
Utils.pprint('NORMAL', 'Host system is Win32')
106+
for p,pname in projects:
107+
opt.add_option( '--%s'%p,
108+
action='store_true',
109+
default=False,
110+
dest=p,
111+
help='generate solutions for %s'%pname)
112+
113+
def configure(conf):
114+
import Options
115+
conf.env['PROJECTS'] = projects
116+
117+
conf.check_tool('msvc_projects', tooldir='mak/tools')
118+
119+
conf.env['BUILD_VARIANTS'] = []
120+
get_available_gcc(conf)
121+
get_available_platform_sdk(conf)
122+
get_available_msvc(conf)
123+
124+
if len(conf.env['BUILD_VARIANTS']) == 0:
125+
raise SystemExit("no match found : make sure you selected a valid toolchain")

0 commit comments

Comments
 (0)