Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TurTLE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TurTLE
TurTLE
Commits
ec926152
Commit
ec926152
authored
6 years ago
by
Chichi Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
decide to compile based on actual dependency list
parent
98d5afab
No related branches found
No related tags found
1 merge request
!23
WIP: Feature/use cmake
Pipeline
#36539
passed
6 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cpp_build.py
+9
-0
9 additions, 0 deletions
cpp_build.py
setup.py
+18
-7
18 additions, 7 deletions
setup.py
with
27 additions
and
7 deletions
cpp_build.py
+
9
−
0
View file @
ec926152
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
18
−
7
View file @
ec926152
...
...
@@ -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
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment