FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
libdiffpy/src/SConscript at develop · cfarrow/libdiffpy · GitHub
cfarrow
libdiffpy
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
libdiffpy
/
src
/
SConscript
Copy path
More file actions
More file actions
Latest commit
History
History
History
116 lines (89 loc) · 3.68 KB
Breadcrumbs
libdiffpy
/
src
/
SConscript
Copy path
File metadata and controls
116 lines (89 loc) · 3.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import
os
Import
(
'env'
)
# Build environment configuration --------------------------------------------
# The directory of this SConscript should be searched first for any headers.
env
.
PrependUnique
(
CPPPATH
=
Dir
(
'.'
))
# Insert LIBRARY_PATH explicitly because some compilers
# ignore it in the system environment.
env
.
PrependUnique
(
LIBPATH
=
env
[
'ENV'
].
get
(
'LIBRARY_PATH'
,
''
).
split
(
':'
))
# Use Intel C++ compiler when it is available
icpc
=
env
.
WhereIs
(
'icpc'
)
if
icpc
:
env
.
Tool
(
'intelc'
,
topdir
=
icpc
[:
icpc
.
rfind
(
'/bin'
)])
# Declare external libraries.
env
.
ParseConfig
(
"python-config --includes"
)
env
.
ParseConfig
(
"python-config --ldflags"
)
env
.
ParseConfig
(
"gsl-config --cflags --libs"
)
fast_linkflags
=
[
'-s'
]
# Platform specific intricacies.
if
env
[
'PLATFORM'
]
==
'darwin'
:
fixmacflags
=
lambda
x
: (
str
(
x
)
not
in
(
'-u'
,
'_PyMac_Error'
))
env
.
Replace
(
CCFLAGS
=
filter
(
fixmacflags
,
env
[
'CCFLAGS'
]))
env
.
Replace
(
LIBS
=
filter
(
fixmacflags
,
env
[
'LIBS'
]))
fast_linkflags
[:]
=
[]
# configure version specific options.
if
not
(
GetOption
(
'clean'
)
or
env
.
GetOption
(
'help'
)):
SConscript
(
'SConscript.configure'
)
# Compiler specific options
if
icpc
:
# options for Intel C++ compiler on hpc dev-intel07
env
.
PrependUnique
(
CCFLAGS
=
[
'-w1'
,
'-fp-model'
,
'precise'
])
env
.
PrependUnique
(
LIBS
=
[
'imf'
])
fast_optimflags
=
[
'-fast'
,
'-no-ipo'
]
else
:
# g++ options
env
.
PrependUnique
(
CCFLAGS
=
[
'-Wall'
])
fast_optimflags
=
[
'-ffast-math'
]
# Configure build variants
if
env
[
'build'
]
==
'debug'
:
env
.
Append
(
CCFLAGS
=
'-g'
)
elif
env
[
'build'
]
==
'fast'
:
env
.
AppendUnique
(
CCFLAGS
=
[
'-O3'
]
+
fast_optimflags
)
env
.
AppendUnique
(
CPPDEFINES
=
{
'NDEBUG'
:
None
})
env
.
AppendUnique
(
LINKFLAGS
=
fast_linkflags
)
if
env
[
'profile'
]:
env
.
AppendUnique
(
CCFLAGS
=
'-pg'
)
env
.
AppendUnique
(
LINKFLAGS
=
'-pg'
)
# Define lists for storing library source and include files.
env
[
'lib_includes'
]
=
[]
env
[
'lib_sources'
]
=
[]
env
[
'lib_datafiles'
]
=
[]
# Subsidiary SConscripts -----------------------------------------------------
# Load the version script first to resolve the majorminor tuple
SConscript
(
'diffpy/SConscript.version'
)
# Path where datafiles should be installed
env
[
'runtimepath'
]
=
os
.
path
.
join
(
env
[
'datadir'
],
'diffpy/libdiffpy%i%i'
%
env
[
'majorminor'
])
SConscript
(
'runtime/SConscript'
)
# Load all other sconscripts that update lib_includes and lib_sources
SConscript
(
'diffpy/SConscript'
)
# Top Level Targets ----------------------------------------------------------
# lib -- shared library object
libdiffpy
=
env
.
SharedLibrary
(
'diffpy'
,
env
[
'lib_sources'
])
Export
(
'libdiffpy'
)
Alias
(
'lib'
,
libdiffpy
)
# Define targets related to testing. Do so only when testing is requested.
# This enables library build on machines without cxxtest.
if
set
((
'test'
,
'alltests'
)).
intersection
(
COMMAND_LINE_TARGETS
):
SConscript
(
'tests/SConscript'
)
# Installation targets.
prefix
=
env
[
'prefix'
]
# install-lib
libinstall
=
Install
(
env
[
'libdir'
],
libdiffpy
)
if
env
[
'PLATFORM'
]
==
'darwin'
:
env
.
AddPostAction
(
libinstall
,
'install_name_tool -id $TARGET.abspath $TARGET'
)
Alias
(
'install-lib'
,
libinstall
)
# install-includes
ninc
=
len
(
Dir
(
'.'
).
path
)
+
1
inc_target_path
=
lambda
f
:
os
.
path
.
join
(
env
[
'includedir'
],
f
.
path
[
ninc
:])
include_targets
=
map
(
inc_target_path
,
env
[
'lib_includes'
])
Alias
(
'install-include'
,
InstallAs
(
include_targets
,
env
[
'lib_includes'
]))
# install-data
nrt
=
len
(
Dir
(
'runtime'
).
path
)
+
1
data_target_path
=
lambda
f
:
os
.
path
.
join
(
env
[
'runtimepath'
],
f
.
path
[
nrt
:])
data_targets
=
map
(
data_target_path
,
env
[
'lib_datafiles'
])
Alias
(
'install-data'
,
InstallAs
(
data_targets
,
env
[
'lib_datafiles'
]))
# install
Alias
(
'install'
, [
'install-include'
,
'install-lib'
,
'install-data'
])
# vim: ft=python
Back
|
FazBrowse Home
|
New Git URL