Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60884560
site_init.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 3, 03:58
Size
2 KB
Mime Type
text/x-python
Expires
Sun, May 5, 03:58 (2 d)
Engine
blob
Format
Raw Data
Handle
17386160
Attached To
rTAMAAS tamaas
site_init.py
View Options
import
SCons
from
SCons.Script
import
*
from
subprocess
import
check_output
# ------------------------------------------------------------------------------
def
pybind11
(
env
):
"""A tool to configure pybind11"""
if
env
.
GetOption
(
'clean'
):
return
# Run code below to get versions from user preference and not scons
versions_script
=
"""
from __future__ import print_function
import distutils.sysconfig as dsys
from numpy.distutils.misc_util import get_numpy_include_dirs as numpy_dirs
print(dsys.get_python_inc())
for d in numpy_dirs():
print(d)"""
includes
=
check_output
([
env
[
'py_exec'
],
"-c"
,
versions_script
],
universal_newlines
=
True
)
.
split
(
'
\n
'
)
includes
+=
[
Dir
(
'#third-party/pybind11/include'
)]
# Extension of shared library for python
extension
=
check_output
([
env
[
'py_exec'
]
+
'-config'
,
"--extension-suffix"
],
universal_newlines
=
True
)
.
split
(
'
\n
'
)[
0
]
env
[
'SHLIBSUFFIX'
]
=
extension
env
.
AppendUnique
(
CPPPATH
=
includes
)
conf
=
Configure
(
env
)
if
not
conf
.
CheckCXXHeader
(
'pybind11/pybind11.h'
):
raise
SCons
.
Errors
.
StopError
(
'Failed to find pybind11 header
\n
'
+
"Run 'git submodule update --init --recursive third-party/pybind11'"
)
env
=
conf
.
Finish
()
# ------------------------------------------------------------------------------
def
gtest
(
env
):
"""A tool to configure GoogleTest"""
if
env
.
GetOption
(
'clean'
):
return
conf
=
Configure
(
env
)
if
not
conf
.
CheckCXXHeader
(
'gtest/gtest.h'
):
raise
SCons
.
Errors
.
StopError
(
'Failed to find GoogleTest header
\n
'
+
"Run 'git submodule update --init --recursive "
+
"third-party/googletest'"
)
env
=
conf
.
Finish
()
# ------------------------------------------------------------------------------
def
gen_print
(
action_string
,
color_string
,
env
):
"""Generic function for creating pretty compile output"""
if
env
[
'verbose'
]:
return
None
def
print_fun
(
command
,
target
,
source
,
env
):
colors
=
env
[
'COLOR_DICT'
]
print
(
"{}[{}] {}{}"
.
format
(
colors
[
color_string
],
action_string
,
colors
[
'end'
],
target
[
0
]))
return
print_fun
Event Timeline
Log In to Comment