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
f0d1a3a7
Commit
f0d1a3a7
authored
9 years ago
by
Cristian Lalescu
Browse files
Options
Downloads
Patches
Plain Diff
working at compilation thing
parent
aa42386a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+37
-12
37 additions, 12 deletions
setup.py
with
37 additions
and
12 deletions
setup.py
+
37
−
12
View file @
f0d1a3a7
...
...
@@ -31,6 +31,7 @@ import pickle
AUTHOR
=
'
Cristian C Lalescu
'
AUTHOR_EMAIL
=
'
Cristian.Lalescu@ds.mpg.de
'
import
os
import
datetime
import
subprocess
from
subprocess
import
CalledProcessError
...
...
@@ -61,8 +62,8 @@ src_file_list = ['field_descriptor',
header_list
=
[
'
cpp/base.hpp
'
]
+
[
'
cpp/
'
+
fname
+
'
.hpp
'
for
fname
in
src_file_list
]
# not sure we need the MANIFEST.in file, but I might as well
#with open('MANIFEST.in', 'w') as manifest_in_file:
with
open
(
'
MANIFEST.in
'
,
'
w
'
)
as
manifest_in_file
:
manifest_in_file
.
write
(
'
include libbfps.a
\n
'
)
# for fname in ['bfps/cpp/' + fname + '.cpp' for fname in src_file_list] + header_list:
# manifest_in_file.write('include {0}\n'.format(fname))
...
...
@@ -83,22 +84,46 @@ pickle.dump(
open
(
'
bfps/install_info.pickle
'
,
'
wb
'
),
protocol
=
2
)
from
setuptools
import
setup
,
Extension
libbfps
=
Extension
(
'
libbfps
'
,
sources
=
[
'
bfps/cpp/
'
+
fname
+
'
.cpp
'
for
fname
in
src_file_list
],
include_dirs
=
include_dirs
,
libraries
=
libraries
,
extra_compile_args
=
extra_compile_args
,
library_dirs
=
library_dirs
)
from
distutils.command.install
import
install
as
DistutilsInstall
class
CustomInstall
(
DistutilsInstall
):
def
run
(
self
):
# compile bfps library
for
fname
in
src_file_list
:
ifile
=
'
bfps/cpp/
'
+
fname
+
'
.cpp
'
ofile
=
'
obj/
'
+
fname
+
'
.o
'
if
not
os
.
path
.
exists
(
ofile
):
need_to_compile
=
True
else
:
need_to_compile
=
(
datetime
.
datetime
.
fromtimestamp
(
os
.
path
.
getctime
(
ofile
))
<
datetime
.
datetime
.
fromtimestamp
(
os
.
path
.
getctime
(
ifile
)))
if
need_to_compile
:
command_strings
=
[
'
g++
'
,
'
-c
'
]
command_strings
+=
[
'
bfps/cpp/
'
+
fname
+
'
.cpp
'
]
command_strings
+=
[
'
-o
'
,
'
obj/
'
+
fname
+
'
.o
'
]
command_strings
+=
extra_compile_args
command_strings
+=
[
'
-I
'
+
idir
for
idir
in
include_dirs
]
command_strings
.
append
(
'
-Ibfps/cpp/
'
)
print
(
'
'
.
join
(
command_strings
))
subprocess
.
call
(
command_strings
)
command_strings
=
[
'
ar
'
,
'
rvs
'
,
'
libbfps.a
'
]
command_strings
+=
[
'
obj/
'
+
fname
+
'
.o
'
for
fname
in
src_file_list
]
#command_strings += ['-l' + libname for libname in libraries]
#command_strings += ['-L' + ldir for ldir in library_dirs]
#command_strings += ['-o', 'libbfps.a']
print
(
'
'
.
join
(
command_strings
))
subprocess
.
call
(
command_strings
)
DistutilsInstall
.
run
(
self
)
from
setuptools
import
setup
setup
(
name
=
'
bfps
'
,
packages
=
[
'
bfps
'
],
install_requires
=
[
'
numpy>=1.8
'
,
'
h5py>=2.2.1
'
],
ext_modules
=
[
libbfps
]
,
cmdclass
=
{
'
install
'
:
CustomInstall
}
,
package_data
=
{
'
bfps
'
:
header_list
+
[
'
../machine_settings.py
'
,
'
libbfps.a
'
,
'
install_info.pickle
'
]},
########################################################################
# useless stuff folows
...
...
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