-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJamfile.v2
304 lines (268 loc) · 8.08 KB
/
Jamfile.v2
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# Copyright (C) 2005, 2006 The Trustees of Indiana University.
# Use, modification and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Authors: Douglas Gregor
# Andrew Lumsdaine
# This file builds the Python bindings for the Boost Graph Library.
import modules ;
import package ;
import path ;
import python ;
import stage ;
import os ;
if [ python.configured ]
{
BOOST_ROOT = [ modules.peek : BOOST_ROOT ] ;
project bgl-python
: requirements <include>. <include>$(BOOST_ROOT)
: usage-requirements <include>. <include>$(BOOST_ROOT)
: build-dir bin.v2
: default-build release
: source-location src
;
# Pull in the Boost.Python library
use-project /boost/python : $(BOOST_ROOT)/libs/python/build ;
# Pull in the Boost.Graph library
use-project /boost/graph : $(BOOST_ROOT)/libs/graph/build ;
# Pull in the expat library
use-project /bgl-python/expat : ./vendor/expat-2.0.0 ;
# Python source files that are part of the BGL-Python package.
BOOST_GRAPH_PYTHON_SOURCES =
astar_visitor
bfs_visitor
dijkstra_visitor
dfs_visitor
docstring
__init__
show
bellman_ford_visitor
;
# Small support utilities.
python-extension _support
: # Sources
support.cpp
: # Requirements
<library>/boost/python//boost_python
;
EXTRA_SRCS = ;
EXTRA_REQUIREMENTS = <define>XML_STATIC ;
if $(IETL_INCLUDE) {
# Use the Iterative Eigensolver Template Library
EXTRA_SRCS = sparse_spectrum.cpp ;
EXTRA_REQUIREMENTS = <include>$(IETL_INCLUDE)
<define>INCLUDE_SPARSE_SPECTRUM ;
}
else {
EXTRA_SRCS = ;
EXTRA_REQUIREMENTS = ;
}
if [ os.name ] = MACOSX {
# Use vecLib on Mac OS X for the spectral embedding layouts
EXTRA_SRCS += spectrum.cpp
spectral_embedding_3d_layout.cpp
spectral_embedding_layout.cpp ;
EXTRA_REQUIREMENTS +=
<framework>/System/Library/Frameworks/vecLib.framework/vecLib
<define>INCLUDE_SPECTRUM ;
}
else if $(LAPACK_PATH) {
# If a path to LAPACK is provided, use it to build the spectral
# embedding layout code.
EXTRA_SRCS += spectrum.cpp
spectral_embedding_3d_layout.cpp
spectral_embedding_layout.cpp ;
EXTRA_REQUIREMENTS += <find-library>libclapack
<library-path>$(LAPACK_PATH)
<define>INCLUDE_SPECTRUM ;
}
# The actual Python extension module
python-extension _graph
: # Sources
module.cpp
exception.cpp
# Graph types
basic_graph.cpp
graphdocs.cpp
properties.cpp
directed_properties.cpp
# Algorithms
astar_search.cpp
bellman_ford_shortest_paths.cpp
betweenness_centrality.cpp
biconnected_components.cpp
breadth_first_search.cpp
circle_layout.cpp
connected_components.cpp
cuthill_mckee_ordering.cpp
dag_shortest_paths.cpp
depth_first_search.cpp
dijkstra_shortest_paths.cpp
fruchterman_reingold.cpp
isomorphism.cpp
kamada_kawai_spring_layout.cpp
king_ordering.cpp
kruskal_min_spanning_tree.cpp
minimum_degree_ordering.cpp
page_rank.cpp
prim_minimum_spanning_tree.cpp
sequential_vertex_coloring.cpp
sloan_ordering.cpp
strong_components.cpp
topological_sort.cpp
transitive_closure.cpp
# Graph generators
generators.cpp
# Graph I/O
graphviz.cpp
graphml.cpp
pickle.cpp
# Everything else
$(EXTRA_SRCS)
: # Requirements
<library>/boost/python//boost_python
<library>/boost/graph//boost_graph
<library>/bgl-python/expat//expat
$(EXTRA_REQUIREMENTS)
;
# Strip any end-of-line characters off the given string and return the
# result.
local rule strip-eol ( string )
{
local match = [ MATCH "^(([A-Za-z0-9~`\.!@#$%^&*()_+={};:'\",.<>/?\\| -]|[|])*
).*$" : $(string) ] ;
if $(match)
{
return $(match[1]) ;
}
else
{
return $(string) ;
}
}
if install in [ modules.peek : ARGV ]
{
exec-prefix = [ MATCH "^--exec-prefix=(.*)" : [ modules.peek : ARGV ] ] ;
home = [ MATCH "^--home=(.*)" : [ modules.peek : ARGV ] ] ;
libdir = [ MATCH "^--libdir=(.*)" : [ modules.peek : ARGV ] ] ;
pythonlibdir = [ MATCH "^--pythonlibdir=(.*)" : [ modules.peek : ARGV ] ] ;
if $(home)
{
# Only one of --home or --exec-prefix can be provided
if $(exec-prefix)
{
ECHO "ERROR: Cannot specify both --home and --exec-prefix" ;
ECHO " --home is for home-directory installations" ;
ECHO " --exec-prefix is for system-wide installations" ;
EXIT -1 ;
}
# Install libraries in $(home)/lib
if ! $(libdir)
{
libdir = $(home)/lib ;
}
# Install Python module in $(home)/lib/python
if ! $(pythonlibdir)
{
pythonlibdir = $(home)/lib/python ;
}
}
else
{
# If no --home or --exec-prefix given. Ask Python
if ! $(exec-prefix)
{
local PYTHON = [ python.get-python-interpreter ] ;
exec-prefix
= [ strip-eol [ SHELL "$(PYTHON:G=) -c \"import sys; print sys.exec_prefix\"" ] ] ;
}
# Non-pure Python modules go into the exec-prefix's site-packages
if ! $(pythonlibdir)
{
local PYTHON_VERSION = [ python.get-python-version ] ;
pythonlibdir = $(exec-prefix)/lib/python$(PYTHON_VERSION)/site-packages ;
}
# Libraries go into $(exec-prefix)/lib on Unix
# /usr/local/lib on Mac.
if ! $(libdir)
{
if [ os.name ] = MACOSX
{
# We do this because we need the libraries to be found in
# DYLB_FALLBACK_LIBRARY_PATH, which includes /usr/local/lib. Ugh.
libdir = /usr/local/lib ;
}
else
{
libdir = $(exec-prefix)/lib ;
}
}
}
HOME = [ modules.peek : HOME ] ;
if $(HOME)
{
# Replace any occurrences of "~" in libdir with $(HOME)
local tilde = [ MATCH "^(.*)~(.*)$" : $(libdir) ] ;
while $(tilde)
{
libdir = $(tilde[1])$(HOME)$(tilde[2]) ;
tilde = [ MATCH "^(.*)~(.*)$" : $(libdir) ] ;
}
# Replace any occurrences of "~" in pythonlibdir with $(HOME)
tilde = [ MATCH "^(.*)~(.*)$" : $(pythonlibdir) ] ;
while $(tilde)
{
pythonlibdir = $(tilde[1])$(HOME)$(tilde[2]) ;
tilde = [ MATCH "^(.*)~(.*)$" : $(pythonlibdir) ] ;
}
}
# Tell the user what we're planning to do
if ! $(gBGL_PYTHON_INSTALL_MSG)
{
gBGL_PYTHON_INSTALL_MSG = yes ;
ECHO "Installing BGL support libraries in $(libdir)..." ;
}
# Tell the user what we're planning to do
if ! $(gBGL_PYTHON_PYTHON_INSTALL_MSG)
{
gBGL_PYTHON_PYTHON_INSTALL_MSG = yes ;
ECHO "Installing BGL Python module in $(pythonlibdir)..." ;
}
local BGL_PYTHON_ROOT = [ PWD ] ;
# Add a stage target that copies the __init.py__ for the boost module.
stages += [
install install-init
: $(BGL_PYTHON_ROOT)/python/boost/__init__.py
: <location>$(pythonlibdir)/boost
] ;
# Add a stage target that copies the Python extension module
stages += [
install install-bgl-python
: /bgl-python//_support
/bgl-python//_graph
: <location>$(pythonlibdir)/boost/graph
<install-type>PYTHON_EXTENSION
] ;
# Add a stage target that copies the Python sources
stages += [
install install-python-sources
: $(BGL_PYTHON_ROOT)/python/boost/graph/$(BOOST_GRAPH_PYTHON_SOURCES).py
: <location>$(pythonlibdir)/boost/graph
] ;
# Add a stage target to copy the Boost.Python library,
# Boost.Graph library, and expat library
stages += [
install install-boost-python
: /boost/python//boost_python
/boost/graph//boost_graph
/bgl-python/expat//expat
: <location>$(libdir)
<install-type>LIB
] ;
alias install : $(stages) ;
}
}
else
{
ECHO "ERROR: Python not configured: cannot build BGL-Python bindings" ;
}