forked from algorithm-archivists/algorithm-archive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmcs.py
37 lines (27 loc) · 738 Bytes
/
mcs.py
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
from SCons.Builder import Builder
import SCons.Util
class ToolMCSWarning(SCons.Warnings.SConsWarning):
pass
class MCSNotFound(ToolMCSWarning):
pass
SCons.Warnings.enableWarningClass(ToolMCSWarning)
def _detect(env):
try:
return env['mcs']
except KeyError:
pass
mcs = env.WhereIs('mcs')
if mcs:
return mcs
SCons.Warnings.warn(MCSNotFound, 'Could not find mcs executable')
def exists(env):
env.Detect('mcs')
def generate(env):
env['MCS'] = _detect(env)
env['MCSFLAGS'] = []
mcs_builder = Builder(
action='"$MCS" -out:$TARGET $MCSFLAGS $SOURCES',
src_suffix='.cs',
suffix='$PROGSUFFIX',
)
env.Append(BUILDERS={'MCS': mcs_builder})