Skip to content
Snippets Groups Projects
Commit 2d45bc23 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Correctly fiddle around with paths when not building from perftool

parent b51b1bbf
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,18 @@ import subprocess
def get_cmake_cache_entry(entry):
for line in open(os.path.join(get_option("project_basedir"), "CMakeCache.txt"), "r"):
match = re.match("{}:[INTERNAL|FILEPATH|BOOL|STRING|PATH|UNINITIALIZED]+=(.*)".format(entry), line)
match = re.match("{}:[INTERNAL|FILEPATH|BOOL|STRING|PATH|UNINITIALIZED|STATIC]+=(.*)".format(entry), line)
if match:
return match.groups()[0]
def get_perftool_dir():
if get_cmake_cache_entry("CMAKE_PROJECT_NAME") == "dune-perftool":
return get_option("project_basedir")
else:
return get_cmake_cache_entry("dune-perftool_DIR")
def compiler_invocation(name, filename):
# Determine the CMake Generator in use
gen = get_cmake_cache_entry("CMAKE_GENERATOR")
......@@ -30,7 +37,7 @@ def compiler_invocation(name, filename):
compile_flags = [compiler]
# Parse compiler flags
for line in open(os.path.join(get_option("project_basedir"), "python", "CMakeFiles", "_autotune_target.dir", "flags.make"), "r"):
for line in open(os.path.join(get_perftool_dir(), "python", "CMakeFiles", "_autotune_target.dir", "flags.make"), "r"):
match = re.match("([^=]*)=(.*)", line)
if match:
compile_flags.extend(match.groups()[1].split())
......@@ -39,14 +46,14 @@ def compiler_invocation(name, filename):
compile_flags.append(filename)
# Parse linker flags
for line in open(os.path.join(get_option("project_basedir"), "python", "CMakeFiles", "_autotune_target.dir", "link.txt"), "r"):
for line in open(os.path.join(get_perftool_dir(), "python", "CMakeFiles", "_autotune_target.dir", "link.txt"), "r"):
match = re.match(".*_autotune_target (.*)", line)
if match:
for flag in match.groups()[0].split():
if flag.startswith("-") or os.path.isabs(flag):
compile_flags.append(flag)
else:
compile_flags.append(os.path.join(get_option("project_basedir"), "python", flag))
compile_flags.append(os.path.join(get_perftool_dir(), "python", flag))
# Set an output name
compile_flags.append("-o")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment