-
Notifications
You must be signed in to change notification settings - Fork 3
/
SConstruct-config
88 lines (64 loc) · 2.29 KB
/
SConstruct-config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import platform
import os, sys
from subprocess import *
Import('env')
if 'debug' in BUILD_TARGETS:
env.Replace(DEBUG = 'TRUE')
if 'dtc' in BUILD_TARGETS:
env.Replace(CODE_THREADING_TYPE = 'DTC')
if 'itc' in BUILD_TARGETS:
env.Replace(CODE_THREADING_TYPE = 'ITC')
if platform.system().startswith("CYGWIN_NT"):
env.Replace(HSYS = 'nt')
if platform.system() == 'Windows':
env.Replace(HSYS = 'nt')
if platform.system() == 'Linux':
env.Replace(HSYS = 'linux')
env.SetDefault(TSYS = env['HSYS'])
if 'win32' in BUILD_TARGETS:
env.Replace(TSYS = 'nt')
if 'linux' in BUILD_TARGETS:
env.Replace(TSYS = 'linux')
if env['TSYS'] == 'nt':
env.Replace(TERMINIT = 'WINCONSOLE-INIT')
if env['TSYS'] == 'linux':
env.Replace(TERMINIT = 'ANSITERM-INIT')
if env['HSYS'] == 'linux' and env['TSYS'] == 'nt':
env.SetDefault(BUILD_LAUNCHER = 'WINEDEBUG=-all wine32')
if 'term' in BUILD_TARGETS or 'test-stdin' in BUILD_TARGETS or not 'DISPLAY' in env['ENV']:
env.SetDefault(RUN_LAUNCHER = 'WINEDEBUG=-all wine32')
else:
env.SetDefault(RUN_LAUNCHER = 'WINEDEBUG=-all wineconsole')
if 'term' in BUILD_TARGETS or 'test-stdin' in BUILD_TARGETS:
env.Replace(TERMINIT = 'ANSITERM-INIT')
if 'BUILD_TAG' in env['ENV']:
env.Replace(GIT_DESC = env['ENV']['BUILD_TAG'])
def getGitDesc():
return Popen('git describe --tags --always --abbrev=8 --dirty=-wip', stdout=PIPE, shell=True).stdout.read().strip().decode("utf-8", errors="ignore")
conf = Configure(env)
if conf.CheckProg('git'):
env.Replace(GIT_DESC = getGitDesc())
env = conf.Finish()
env.SetDefault(GIT_DESC = 'HEAD')
env.SetDefault(DIST_FILE_NAME = 'ikforth-dist-${GIT_DESC}')
env.SetDefault(DEBUG = 'FALSE')
env.SetDefault(CODE_THREADING_TYPE = 'DTC')
env.SetDefault(WINCONST_BUILD_LAUNCHER = 'WINEDEBUG=-all wine32')
def execname(env, basename):
if env['TSYS'] == 'nt':
return basename + '.exe'
if env['TSYS'] == 'linux':
return basename + '.elf'
env.AddMethod(execname)
def pre_process(env, source):
env = env.Clone()
env.Replace(OBJSUFFIX = '.E')
env.AppendUnique(CCFLAGS = ['-E', '-dM'])
return env.Object(source)
env.AddMethod(pre_process, 'PreProcess')
env.Alias('term')
env.Alias('debug')
env.Alias('dtc')
env.Alias('itc')
env.Alias('win32')
env.Alias('linux')