Skip to content
Snippets Groups Projects
Commit ec926152 authored by Chichi Lalescu's avatar Chichi Lalescu
Browse files

decide to compile based on actual dependency list

parent 98d5afab
No related branches found
No related tags found
1 merge request!23WIP: Feature/use cmake
Pipeline #36539 passed
......@@ -65,6 +65,15 @@ src_file_list = ['hdf5_tools',
'Lagrange_polys',
'scope_timer']
def get_file_dependency_list(src_file):
p = subprocess.Popen(
['g++', '-Ibfps/cpp', '-MM', 'bfps/cpp/' + src_file + '.cpp'],
stdout = subprocess.PIPE)
out, err = p.communicate()
p.terminate()
deps = str(out, 'ASCII').replace('\\\n', '')
return deps
def get_dependency_list():
ofile = open('dependencies.txt', 'w')
for src_file in src_file_list:
......
......@@ -215,13 +215,10 @@ class CompileLibCommand(distutils.cmd.Command):
if not os.path.isfile('bfps/libbfps.a'):
need_to_compile = True
else:
need_to_compile = False
ofile = 'bfps/libbfps.a'
libtime = datetime.datetime.fromtimestamp(os.path.getctime(ofile))
latest = libtime
for fname in header_list:
latest = max(latest,
datetime.datetime.fromtimestamp(os.path.getctime('bfps/' + fname)))
need_to_compile = (latest > libtime)
eca = extra_compile_args
eca += ['-fPIC']
if self.timing_output:
......@@ -238,9 +235,14 @@ class CompileLibCommand(distutils.cmd.Command):
if not os.path.exists(ofile):
need_to_compile_file = True
else:
need_to_compile_file = (need_to_compile or
(datetime.datetime.fromtimestamp(os.path.getctime(ofile)) <
datetime.datetime.fromtimestamp(os.path.getctime(ifile))))
need_to_compile_file = False
if not need_to_compile:
latest = libtime
dependency_list = get_file_dependency_list(fname)
for depname in dependency_list.split()[1:]:
latest = max(latest,
datetime.datetime.fromtimestamp(os.path.getctime(depname)))
need_to_compile_file = (latest > libtime)
if need_to_compile_file:
command_strings = [compiler, '-c']
command_strings += ['bfps/cpp/' + fname + '.cpp']
......@@ -269,6 +271,15 @@ class CompileLibCommand(distutils.cmd.Command):
protocol = 2)
return None
def get_file_dependency_list(src_file):
p = subprocess.Popen(
['g++', '-Ibfps/cpp', '-MM', 'bfps/cpp/' + src_file + '.cpp'],
stdout = subprocess.PIPE)
out, err = p.communicate()
p.terminate()
deps = str(out, 'ASCII').replace('\\\n', '')
return deps
from setuptools import setup
setup(
......
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