Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
hysop
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
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
particle_methods
hysop
Commits
4c4a148e
Commit
4c4a148e
authored
5 years ago
by
Jean-Baptiste Keck
Browse files
Options
Downloads
Patches
Plain Diff
build option fix for cpp and fortran
parent
b4db021e
No related branches found
No related tags found
1 merge request
!16
MPI operators
Pipeline
#29419
canceled
5 years ago
Stage: env
Stage: configure
Stage: build
Stage: install
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py.in
+18
-22
18 additions, 22 deletions
setup.py.in
with
18 additions
and
22 deletions
setup.py.in
100755 → 100644
+
18
−
22
View file @
4c4a148e
...
...
@@ -24,22 +24,18 @@ if enable_cpp:
swig_executable
=
find_executable
(
"
@SWIG_EXECUTABLE@
"
)
def
parseCMakeVar
(
var
):
def
parseCMakeVar
(
var
,
sep
=
'
;
'
):
"""
Post-process cmake list-like variables.
Example::
a = parseCMakeVar(
"
var1;var2;var3;
"
)
a = parseCMakeVar(
"
var1;var2 ; var3;
"
)
# --> a = [
'
var
'
,
'
var2
'
,
'
var3
'
]
"""
if
var
!=
""
:
res
=
list
(
set
(
var
.
split
(
'
;
'
)))
# list/set stuff to avoid duplicates
# remove empty strings to avoid '-I -I' things leading to bugs
if
res
.
count
(
''
):
res
.
remove
(
''
)
return
res
# split and remove empty strings
res
=
list
(
var
.
split
(
sep
))
return
list
(
filter
(
len
,
map
(
str
.
strip
,
res
)))
else
:
return
[]
...
...
@@ -57,7 +53,7 @@ def parseCMakeDefines(var):
defines
=
parseCMakeVar
(
var
)
if
len
(
defines
)
==
0
:
return
None
# regex to match compiler defines like -DMACRO_NAME or
# -DMACRO_NAME = MACRO_VALUE
p
=
re
.
compile
(
'
\s*(?:-D)?\s*(\w+)(?:\s*=\s*(\w+))?\s*
'
)
...
...
@@ -126,7 +122,7 @@ def create_fortran_extension(name, pyf_file=None, src_dirs=None, sources=None,
for
sdir
in
src_dirs
:
sources
+=
glob
.
glob
(
os
.
path
.
join
(
sdir
,
'
*.f95
'
))
sources
+=
glob
.
glob
(
os
.
path
.
join
(
sdir
,
'
*.f90
'
))
# Reorder source list with fortran modules
# dependencies. It seems that this is not taken into
# account in f2py or distutils.
...
...
@@ -136,9 +132,10 @@ def create_fortran_extension(name, pyf_file=None, src_dirs=None, sources=None,
# --- set f2py options ---
f2py_options
=
[
'
--no-lower
'
,
'
--no-wrap-functions
'
]
options
=
[]
options
.
append
((
'
F2PY_REPORT_ON_ARRAY_COPY
'
,
'
1
'
))
if
debug_mode
and
(
os
.
uname
()[
0
]
==
'
Linux
'
):
options
.
append
((
'
F2PY_REPORT_ATEXIT
'
,
'
1
'
))
if
debug_mode
==
1
:
options
.
append
((
'
F2PY_REPORT_ON_ARRAY_COPY
'
,
'
1
'
))
if
os
.
uname
()[
0
]
==
'
Linux
'
:
options
.
append
((
'
F2PY_REPORT_ATEXIT
'
,
'
1
'
))
# --- set include dir ---
inc_dir
=
parseCMakeVar
(
"
@FORTRAN_INCLUDE_DIRS@
"
)
...
...
@@ -146,13 +143,12 @@ def create_fortran_extension(name, pyf_file=None, src_dirs=None, sources=None,
inc_dir
+=
parseCMakeVar
(
'
@CMAKE_Fortran_MODULE_DIRECTORY@
'
)
# --- set compilation flags ---
fortran_flags
=
[
'
@Fortran_FLAGS@
'
]
fortran_flags
=
list
(
set
([
_
for
_
in
fortran_flags
[
0
].
split
(
'
'
)
if
_
!=
''
]))
fortran_flags
=
parseCMakeVar
(
'
@Fortran_FLAGS@
'
,
sep
=
'
'
)
# we trust cmake for external libraries and
# add them to linker, without using libraries option
extra_link_args
=
hysop_link_libraries
ext_fort
=
Extension
(
name
=
name
,
sources
=
sources
,
f2py_options
=
f2py_options
,
...
...
@@ -223,8 +219,8 @@ def create_swig_extension(name, inc_dirs, src_dirs=None, sources=None):
libraries
=
parseCMakeVar
(
"
@CXX_EXT_LIBS@
"
)
library_dirs
=
parseCMakeVar
(
"
@CXX_EXT_LIB_DIRS@
"
)
extra_compile_args
=
parseCMakeVar
(
"
@CXX_FLAGS@
"
)
extra_link_args
=
parseCMakeVar
(
"
@CXX_LINKER_FLAGS@
"
)
extra_compile_args
=
parseCMakeVar
(
"
@CXX_FLAGS@
"
,
sep
=
'
'
)
extra_link_args
=
parseCMakeVar
(
"
@CXX_LINKER_FLAGS@
"
,
sep
=
'
'
)
define_macros
=
parseCMakeDefines
(
"
@CXX_EXTRA_DEFINES@
"
)
swig_ext
=
Extension
(
name
,
sources
=
sources
,
language
=
'
c++
'
,
swig_opts
=
swig_opts
,
...
...
@@ -309,7 +305,7 @@ if enable_fortran is "ON":
num_dirs
=
[]
for
sd
in
subdirs
:
num_dirs
.
append
(
os
.
path
.
join
(
fortran_root
,
sd
))
hysop_libdir
=
[
ld
.
strip
()
for
ld
in
hysop_libdir
]
# hysop_libdir = ' '.join([ '-L{}'.format(ld) if ld[1]!='L' else hysop_libdir])
num_dirs
.
append
(
'
@GENERATED_FORTRAN_FILES_DIR@
'
)
...
...
@@ -367,8 +363,8 @@ config = Configuration(
description
=
descr
,
author
=
authors
,
author_email
=
'
hysop-members@lists.forge.imag.fr
'
,
url
=
'
https://
gricad-gitlab.univ-grenoble-alpes.fr/particle_method
s/hysop
'
,
license
=
'
Apache Licence, Version 2.0
(
A
PLv
2
)
'
,
url
=
'
https://
forge.imag.fr/project
s/hysop
/
'
,
license
=
'
GNU General Public License
(
G
PLv
3
)
'
,
package_dir
=
{
''
:
'
@CMAKE_SOURCE_DIR@
'
},
ext_modules
=
ext_modules
,
packages
=
packages
,
...
...
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