From 6e7a3f684445a2131c242b19325e86ba3a1cecb5 Mon Sep 17 00:00:00 2001
From: Cristian Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Sat, 13 Aug 2016 15:44:49 +0200
Subject: [PATCH] add control of compiler during setup

---
 machine_settings_py.py | 1 +
 setup.py               | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/machine_settings_py.py b/machine_settings_py.py
index 22123e39..787f1d5a 100644
--- a/machine_settings_py.py
+++ b/machine_settings_py.py
@@ -37,6 +37,7 @@ import os
 
 hostname = os.getenv('HOSTNAME')
 
+compiler = 'g++'
 extra_compile_args = ['-Wall', '-O2', '-g', '-mtune=native', '-ffast-math', '-std=c++11']
 extra_libraries = ['hdf5']
 include_dirs = []
diff --git a/setup.py b/setup.py
index c9bbc9c1..4e6de683 100644
--- a/setup.py
+++ b/setup.py
@@ -52,7 +52,7 @@ if not os.path.exists(os.path.join(bfpsfolder, 'host_information.py')):
     shutil.copyfile('./machine_settings_py.py', os.path.join(bfpsfolder, 'machine_settings.py'))
 sys.path.insert(0, bfpsfolder)
 # import stuff required for compilation of static library
-from machine_settings import include_dirs, library_dirs, extra_compile_args, extra_libraries
+from machine_settings import compiler, include_dirs, library_dirs, extra_compile_args, extra_libraries
 
 
 ### package versioning
@@ -147,6 +147,8 @@ def compile_bfps_library():
     if not os.path.isdir('obj'):
         os.makedirs('obj')
         need_to_compile = True
+    if not os.path.isfile('bfps/libbfps.a'):
+        need_to_compile = True
     else:
         ofile = 'bfps/libbfps.a'
         libtime = datetime.datetime.fromtimestamp(os.path.getctime(ofile))
@@ -165,7 +167,7 @@ def compile_bfps_library():
                                     (datetime.datetime.fromtimestamp(os.path.getctime(ofile)) <
                                      datetime.datetime.fromtimestamp(os.path.getctime(ifile))))
         if need_to_compile_file:
-            command_strings = ['g++', '-c']
+            command_strings = [compiler, '-c']
             command_strings += ['bfps/cpp/' + fname + '.cpp']
             command_strings += ['-o', 'obj/' + fname + '.o']
             command_strings += extra_compile_args
-- 
GitLab