Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
108 lines (99 loc) · 5.1 KB

File metadata and controls

108 lines (99 loc) · 5.1 KB
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
# -*- python -*-
# Copyright Jim Bosch 2010-2012.
# Distributed under 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)
# Big thanks to Mike Jarvis for help with the configuration prescriptions below.
# Integration of SConsChecks for platform independent building
# by Christoph Lassner.
from __future__ import print_function
import os
import sys
import subprocess
import sysconfig
from SCons.SConf import CheckContext
from SConsChecks import AddLibOptions, GetLibChecks
_libs = ['boost.python',
'python',
'numpy']
_checks = GetLibChecks(_libs)
# Setup command-line options
def setupOptions():
AddOption("--prefix", dest="prefix", type="string", nargs=1, action="store",
metavar="DIR", default="/usr/local", help="installation prefix")
AddOption("--install-headers", dest="install_headers", type="string", nargs=1, action="store",
metavar="DIR", help="location to install header files (overrides --prefix for headers)")
AddOption("--install-lib", dest="install_lib", type="string", nargs=1, action="store",
metavar="DIR", help="location to install libraries (overrides --prefix for libraries)")
AddOption("--with-boost", dest="boost_prefix", type="string", nargs=1, action="store",
metavar="DIR", default=os.environ.get("BOOST_DIR"),
help="prefix for Boost libraries; should have 'include' and 'lib' subdirectories, 'boost' and 'stage\\lib' subdirectories on Windows")
AddOption("--with-boost-include", dest="boost_include", type="string", nargs=1, action="store",
metavar="DIR", help="location of Boost header files")
AddOption("--with-boost-lib", dest="boost_lib", type="string", nargs=1, action="store",
metavar="DIR", help="location of Boost libraries")
AddOption("--rpath", dest="custom_rpath", type="string", action="append",
help="runtime link paths to add to libraries and executables; may be passed more than once")
AddOption("--boost-python-lib", dest="boost_python_lib", type="string", action="store",
help="name of boost_python_lib", default='boost_python')
variables = Variables()
defaultflags = "-O2 -g"
if os.name == 'nt':
defaultflags = "/O2"
variables.Add("CCFLAGS", default=os.environ.get("CCFLAGS", defaultflags), help="compiler flags")
return variables
def makeEnvironment(variables):
shellEnv = {}
for key in ("PATH", "LD_LIBRARY_PATH", "DYLD_LIBRARY_PATH", "PYTHONPATH"):
if key in os.environ:
shellEnv[key] = os.environ[key]
env = Environment(variables=variables, ENV=shellEnv)
if "CCFLAGS" in os.environ:
env.AppendUnique(CCFLAGS = os.environ["CCFLAGS"])
custom_rpath = GetOption("custom_rpath")
if custom_rpath is not None:
env.AppendUnique(RPATH=custom_rpath)
if env['CC'] == 'cl':
# C++ exception handling,
# multithread-supporting, dynamically linked system libraries,
# generate debug information.
env.AppendUnique(CPPFLAGS=['/EHsc', '/MD', '/Zi'])
return env
def setupTargets(env, root="."):
# Determine file extensions.
VERSION = sys.version_info.major
if os.name == 'nt':
EXT_SUFFIX = '.dll'
LIB_SUFFIX = '.lib'
PY_SUFFIX = '.pyd'
else:
EXT_SUFFIX = sysconfig.get_config_var("EXT_SUFFIX")
if VERSION == 2 and EXT_SUFFIX == 'None' or EXT_SUFFIX==None:
EXT_SUFFIX = '.so'
elif VERSION == 3 and EXT_SUFFIX == b'None' or EXT_SUFFIX==None:
EXT_SUFFIX = '.so'
LIB_SUFFIX = EXT_SUFFIX
PY_SUFFIX = EXT_SUFFIX
OBJ_SUFFIX = EXT_SUFFIX.replace ('.so', '.os')
lib = SConscript(os.path.join(root, "libs", "numpy", "src", "SConscript"),
exports=['env', 'EXT_SUFFIX', 'LIB_SUFFIX', 'OBJ_SUFFIX'])
example = SConscript(os.path.join(root, "libs", "numpy", "example", "SConscript"),
exports='env')
test = SConscript(os.path.join(root, "libs", "numpy", "test", "SConscript"),
exports=['env', 'lib', 'EXT_SUFFIX', 'LIB_SUFFIX', 'OBJ_SUFFIX', 'PY_SUFFIX'])
prefix = Dir(GetOption("prefix")).abspath
install_headers = GetOption('install_headers')
install_lib = GetOption('install_lib')
if not install_headers:
install_headers = os.path.join(prefix, "include")
if not install_lib:
install_lib = os.path.join(prefix, "lib")
env.Alias("install", env.Install(install_lib, lib))
for header in ("dtype.hpp", "invoke_matching.hpp", "matrix.hpp",
"ndarray.hpp", "numpy_object_mgr_traits.hpp",
"scalars.hpp", "ufunc.hpp",):
env.Alias("install", env.Install(os.path.join(install_headers, "boost", "numpy"),
os.path.join(root, "boost", "numpy", header)))
env.Alias("install", env.Install(os.path.join(install_headers, "boost"),
os.path.join(root, "boost", "numpy.hpp")))
Return("setupOptions", "makeEnvironment", "setupTargets", "_checks", "_libs")
Morty Proxy This is a proxified and sanitized view of the page, visit original site.