@@ -2692,7 +2692,8 @@ class DEExporter:
26922692 due to numerical errors
26932693
26942694 :ivar compiler:
2695- distutils/setuptools compiler selection to build the Python extension
2695+ Absolute path to the compiler executable to be used to build the Python
2696+ extension, e.g. ``/usr/bin/clang``.
26962697
26972698 :ivar functions:
26982699 carries C++ function signatures and other specifications
@@ -2755,8 +2756,8 @@ def __init__(
27552756 used to avoid problems with state variables that may become
27562757 negative due to numerical errors
27572758
2758- :param compiler: distutils/setuptools compiler selection to build the
2759- python extension
2759+ :param compiler: Absolute path to the compiler executable to be used
2760+ to build the Python extension, e.g. ``/usr/bin/clang``.
27602761
27612762 :param allow_reinit_fixpar_initcond:
27622763 see :class:`amici.de_export.DEExporter`
@@ -2876,8 +2877,8 @@ def _compile_c_code(
28762877 Make model compilation verbose
28772878
28782879 :param compiler:
2879- distutils/setuptools compiler selection to build the python
2880- extension
2880+ Absolute path to the compiler executable to be used to build the Python
2881+ extension, e.g. ``/usr/bin/clang``.
28812882 """
28822883 # setup.py assumes it is run from within the model directory
28832884 module_dir = self .model_path
@@ -2900,8 +2901,10 @@ def _compile_c_code(
29002901 ]
29012902 )
29022903
2904+ env = os .environ .copy ()
29032905 if compiler is not None :
2904- script_args .extend ([f"--compiler={ compiler } " ])
2906+ # CMake will use the compiler specified in the CXX environment variable
2907+ env ["CXX" ] = compiler
29052908
29062909 # distutils.core.run_setup looks nicer, but does not let us check the
29072910 # result easily
@@ -2912,6 +2915,7 @@ def _compile_c_code(
29122915 stdout = subprocess .PIPE ,
29132916 stderr = subprocess .STDOUT ,
29142917 check = True ,
2918+ env = env ,
29152919 )
29162920 except subprocess .CalledProcessError as e :
29172921 print (e .output .decode ("utf-8" ))
0 commit comments