Skip to content

Commit ca87726

Browse files
committed
Add scons variable "tool" for choosing the compiler.
Set tool=intelc to request the Intel C/C++ compiler. Use the default compiler otherwise. Make it easier to choose either the gcc or Intel compiler when both are installed.
1 parent ad640d9 commit ca87726

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: SConstruct

+10-3
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,23 @@ vars.Add(PathVariable('prefix',
6666
vars.Add(EnumVariable('build',
6767
'compiler settings', 'fast',
6868
allowed_values=('debug', 'fast')))
69+
vars.Add(EnumVariable('tool',
70+
'C++ compiler toolkit to be used', 'default',
71+
allowed_values=('default', 'intelc')))
6972
vars.Add(BoolVariable('profile',
7073
'build with profiling information', False))
7174
vars.Add('python',
7275
'Python executable to use for installation.', 'python')
7376
vars.Update(env)
7477
env.Help(MY_SCONS_HELP % vars.GenerateHelpText(env))
7578

76-
# Use Intel C++ compiler when it is available
77-
icpc = env.WhereIs('icpc')
78-
if icpc:
79+
# Use Intel C++ compiler if requested by the user.
80+
icpc = None
81+
if env['tool'] == 'intelc':
82+
icpc = env.WhereIs('icpc')
83+
if not icpc:
84+
print("Cannot find the Intel C/C++ compiler 'icpc'.")
85+
Exit(1)
7986
env.Tool('intelc', topdir=icpc[:icpc.rfind('/bin')])
8087

8188
# Apply CFLAGS, CXXFLAGS, LDFLAGS from the system environment.

0 commit comments

Comments
 (0)