diff --git a/python/dune/generator/cmakebuilder.py b/python/dune/generator/cmakebuilder.py index 93f01984a4aa743a4ce3841082f80c991dbf6888..6da264de7e3022f23dbe7471b6d11fe5edfea623 100644 --- a/python/dune/generator/cmakebuilder.py +++ b/python/dune/generator/cmakebuilder.py @@ -457,6 +457,9 @@ class MakefileBuilder(Builder): generatedDir = os.path.join(dunepy_dir,'python','dune','generated') buildScriptName = os.path.join(dunepy_dir,'python','dune','generated','buildScript.sh') + # compiler launcher, if set + launcher = None + # check whether ninja is available with cmake or not useNinja = False # to be revised in later versions if useNinja: @@ -474,7 +477,12 @@ class MakefileBuilder(Builder): # call base class dunepy_from_template (re-initialize) force = Builder.generate_dunepy_from_template(dunepy_dir, force=True) - Builder.callCMake(["cmake"] + defaultCMakeFlags() + ["."], + cmake_flags = defaultCMakeFlags() + for flag in cmake_flags: + if flag.find('CMAKE_CXX_COMPILER_LAUNCHER') > 0: + launcher = flag.split("=")[1] + + Builder.callCMake(["cmake"] + cmake_flags + ["."], cwd=dunepy_dir, infoTxt="Configuring dune-py with CMake (make)", active=True, # print details anyway @@ -545,6 +553,7 @@ class MakefileBuilder(Builder): # write compiler commands with open(commandSourceName) as commandFile: compilerCmd = json.load(commandFile)[0]["command"] + # replace target file compilerCmd = compilerCmd.replace('extractCompiler', '$1') # this line is extracted from build.make usedBuildMake = False @@ -564,6 +573,9 @@ class MakefileBuilder(Builder): # forward errors so that compilation failure will be caught buildScript.write('set -e\n') + # if launcher was provided, add it before compiler + if launcher is not None: + buildScript.write(str(launcher) + " ") buildScript.write(compilerCmd) buildScript.write('\n') # write linker commands @@ -601,6 +613,9 @@ class MakefileBuilder(Builder): replace(' python/dune/generated/',' ') # better to move the script to the root of dune-py then this can be kept compilerCmd = compilerCmd.split(' ',1) compilerCmd = compilerCmd[0] + " " + compilerCmd[1] + # if launcher was provided, add it before compiler + if launcher is not None: + buildScript.write(str(launcher) + " ") buildScript.write(compilerCmd+"\n") # this needs fixing: Issue is that at the linker line beginns with ': && ' linkerCmd = out[1].replace('extractCompiler','$1').\ diff --git a/python/dune/generator/template/CMakeLists.txt.template b/python/dune/generator/template/CMakeLists.txt.template index 03bb8f39f9de9596f516a3600a1f37077e6c418f..dc3bd614c6b1922363565fe889d123a33989a008 100644 --- a/python/dune/generator/template/CMakeLists.txt.template +++ b/python/dune/generator/template/CMakeLists.txt.template @@ -18,8 +18,8 @@ message("---- LOCK") file(LOCK ${lock}) message("---- ACQUIRED") -set(ALLOW_CXXFLAGS_OVERWRITE ON) -set(ALLOW_CXXFLAGS_OVERWRITE_FORCE ON) +#set(ALLOW_CXXFLAGS_OVERWRITE ON) +#set(ALLOW_CXXFLAGS_OVERWRITE_FORCE ON) set(DUNE_ENABLE_PYTHONBINDINGS ON) set(CMAKE_PREFIX_PATH {{ install_prefix }}) diff --git a/python/dune/packagemetadata.py b/python/dune/packagemetadata.py index e5edc1f7cb69efbd193b2992db0116fa92586808..4af6b60566784e41ddd62ec21b396f08938ede00 100644 --- a/python/dune/packagemetadata.py +++ b/python/dune/packagemetadata.py @@ -330,7 +330,7 @@ def defaultCMakeFlags(): ('CMAKE_CXX_FLAGS', '-O3 -DNDEBUG'), # same as release ('CMAKE_INSTALL_RPATH_USE_LINK_PATH', 'TRUE'), ('DUNE_ENABLE_PYTHONBINDINGS', 'TRUE'), - ('ALLOW_CXXFLAGS_OVERWRITE', 'ON'), + #('ALLOW_CXXFLAGS_OVERWRITE', 'ON'), ('CMAKE_DISABLE_FIND_PACKAGE_LATEX', 'TRUE'), ('CMAKE_DISABLE_FIND_PACKAGE_Doxygen', 'TRUE'), ('INKSCAPE', 'FALSE'),