-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSConstruct
120 lines (99 loc) · 4.34 KB
/
SConstruct
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import os
import sys
import subprocess
import glob
# Add SBMS directory to PYTHONPATH
sbmsdir = "%s/SBMS" % (os.getcwd())
sys.path.append(sbmsdir)
import sbms
# Get command-line options
SHOWBUILD = ARGUMENTS.get('SHOWBUILD', 0)
OPTIMIZATION = ARGUMENTS.get('OPTIMIZATION', 3)
DEBUG = ARGUMENTS.get('DEBUG', 1)
# Get platform-specific name
osname = os.getenv('BMS_OSNAME', subprocess.Popen(["%s/osrelease.pl" % sbmsdir], stdout=subprocess.PIPE).communicate()[0].strip())
# Get architecture name
arch = ROOT_CFLAGS = subprocess.Popen(["uname"], stdout=subprocess.PIPE).communicate()[0].strip()
# Setup initial environment
installdir = "#%s" %(osname)
ginstalldir = "#../../%s" % (osname)
include = "%s/include" % (installdir)
bin = "%s/bin" % (installdir)
lib = "%s/lib" % (installdir)
plugins = "%s/plugins" % (installdir)
examples = "%s/examples" % (installdir)
env = Environment( ENV = os.environ, # Bring in full environement, including PATH
CPPPATH = [include],
LIBPATH = [lib],
variant_dir = "src/.%s" % (osname))
# These are SBMS-specific variables (i.e. not default scons ones)
env.Replace(INSTALLDIR = installdir,
GINSTALLDIR = ginstalldir,
OSNAME = osname,
INCDIR = include,
BINDIR = bin,
LIBDIR = lib,
PLUGINSDIR = plugins,
ALL_SOURCES = [], # used so we can add generated sources
MISC_OBJS = [], # used so we can add explicit static libraries
SHOWBUILD = SHOWBUILD,
OPTIMIZATION = OPTIMIZATION,
DEBUG = DEBUG,
COMMAND_LINE_TARGETS = COMMAND_LINE_TARGETS)
# Use terse output unless otherwise specified
if SHOWBUILD==0:
env.Replace(CCCOMSTR = "Compiling [$SOURCE]",
CXXCOMSTR = "Compiling [$SOURCE]",
FORTRANPPCOMSTR = "Compiling [$SOURCE]",
FORTRANCOMSTR = "Compiling [$SOURCE]",
SHCCCOMSTR = "Compiling [$SOURCE]",
SHCXXCOMSTR = "Compiling [$SOURCE]",
LINKCOMSTR = "Linking [$TARGET]",
SHLINKCOMSTR = "Linking [$TARGET]",
INSTALLSTR = "Installing [$TARGET]",
ARCOMSTR = "Archiving [$TARGET]",
RANLIBCOMSTR = "Ranlib [$TARGET]")
# Get compiler from environment variables (if set)
env.Replace( CXX = os.getenv('CXX', 'g++'),
CC = os.getenv('CC' , 'gcc'),
FC = os.getenv('FC' , 'gfortran') )
# Add libraries and libraries/include to include search path
env.PrependUnique(CPPPATH = ['#', '#src/libRootSpy', '#src/libRootSpy-client'])
# Standard flags (optimization level and warnings)
env.PrependUnique( CFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall'])
env.PrependUnique( CXXFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall'])
env.PrependUnique(FORTRANFLAGS = ['-O%s' % OPTIMIZATION, '-fPIC', '-Wall'])
# Turn on debug symbols unless user told us not to
if not DEBUG=='0':
env.PrependUnique( CFLAGS = ['-g'])
env.PrependUnique( CXXFLAGS = ['-g'])
env.PrependUnique(FORTRANFLAGS = ['-g'])
# xMsg requires C++14 features. ROOT uses C++11.
# Let ROOT add the -std=c++11 flag and then xMsg
# will add the -std=c++14 flag after it to superceed
# it. No need to further complicate things here.
# Enable some C++11 features available in gcc4.9.2
# env.AppendUnique(CXXFLAGS=['-std=c++11'])
# The following offensive setting is needed to force
# the compiler NOT to include __cxx11 in the namespace
# for std::basic_string<... This seems to be included
# in RootSpy objects, but not in the CODA installed cMsg
# library. Oddly, I compiled a private version of cMsg
# with the -std=c++11 flag and it did NOT add the namespace.
# I fully expect this line will cause me grief at some
# point in the future. (Sorry future Dave!)
#env.AppendUnique(CXXFLAGS=['-D_GLIBCXX_USE_CXX11_ABI=0'])
# Apply any platform/architecture specific settings
sbms.ApplyPlatformSpecificSettings(env, arch)
sbms.ApplyPlatformSpecificSettings(env, osname)
# Include SConscript in src
SConscript('src/SConscript', variant_dir="src/.%s" % (osname), exports='env osname', duplicate=0)
# Make install target
env.Alias('install', installdir)
env.Alias('ginstall', ginstalldir)
# Create setenv if user explicitly specified "install" target
#build_targets = map(str,BUILD_TARGETS)
#if len(build_targets)>0:
# if 'install' in build_targets:
# import sbms_setenv
# sbms_setenv.mk_setenv(env)