diff --git a/SConstruct b/SConstruct index 2b614bca5..2977d37b0 100644 --- a/SConstruct +++ b/SConstruct @@ -339,6 +339,12 @@ config_options = [ default 'site-packages' directory. To install to the current user's site-packages directory, use 'python3_prefix=USER'.""", defaults.python_prefix, PathVariable.PathAccept), + PathVariable( + 'python_compiler', + """ Compiler to use while building the Python extension module. By default, + the compiler will be selected by distutils. Applies to both Python 2 + and Python 3.""", + '', PathVariable.PathAccept), EnumVariable( 'matlab_toolbox', """This variable controls whether the Matlab toolbox will be built. If diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index 078723d32..1903eb461 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -110,7 +110,8 @@ libDirs = ('../../build/lib', localenv['sundials_libdir'], localenv['py_cantera_libs'] = repr(localenv['cantera_libs']) localenv['py_libdirs'] = repr([x for x in libDirs if x]) -# Compile the Python module with the same compiler as the rest of Cantera +# Compile the Python module with the same compiler as the rest of Cantera, +# unless otherwise specified localenv['py_extra_compiler_args'] = repr([]) localenv['py_extra_link_args'] = repr([]) if localenv['OS'] == 'Windows': @@ -129,6 +130,8 @@ else: if '-fprofile-arcs' in localenv['CCFLAGS']: localenv['py_extra_compiler_args'] = repr(['-fprofile-arcs', '-ftest-coverage']) localenv['py_extra_link_args'] = repr(['-fprofile-arcs', '-ftest-coverage']) + if env['python_compiler']: + localenv['ENV']['CC'] = env['python_compiler'] if 'LDFLAGS' not in localenv['ENV']: localenv['ENV']['LDFLAGS'] = ''