diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..9c20d92287c3340a8100cbafbc8224d1e040f5fd --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "bpl-subset"] + path = bpl-subset + url = http://git.tiker.net/trees/bpl-subset.git diff --git a/MANIFEST.in b/MANIFEST.in index d7c816a739c9a92f1cec6aea53e9c2295089e96a..fdfc08c172a47ca390782f9c8c963f0bdab95b3e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -12,3 +12,5 @@ include configure.py include Makefile.in include aksetup_helper.py include README_SETUP.txt + +recursive-include bpl-subset diff --git a/aksetup_helper.py b/aksetup_helper.py index ff3645870da045c404a697e1382f40dd791a61e9..feefb81effbd812322658b7ef28af56dcd0329b3 100644 --- a/aksetup_helper.py +++ b/aksetup_helper.py @@ -479,6 +479,48 @@ class BoostLibraries(Libraries): help="Library names for Boost C++ %s library (without lib or .so)" % humanize(lib_base_name)) +def set_up_shipped_boost_if_requested(conf): + """Set up the package to use a shipped version of Boost. + + Return a list of extra C files to build. + """ + if conf["USE_SHIPPED_BOOST"]: + from os.path import exists + if not exists("bpl-subset/bpl_subset/boost/version.hpp"): + raise RuntimeError("The shipped Boost library was not found.") + conf["BOOST_INC_DIR"] = ["bpl-subset/bpl_subset"] + conf["BOOST_LIB_DIR"] = [] + conf["BOOST_PYTHON_LIBNAME"] = [] + + from glob import glob + source_files = (glob("bpl-subset/bpl_subset/libs/*/*/*/*.cpp") + + glob("bpl-subset/bpl_subset/libs/*/*/*.cpp") + + glob("bpl-subset/bpl_subset/libs/*/*.cpp")) + + print len(source_files) + source_files = [f for f in source_files + if not f.startswith("bpl-subset/bpl_subset/libs/thread/src")] + print len(source_files) + + import sys + if sys.platform == "nt": + print glob( + "bpl-subset/bpl_subset/libs/thread/src/win32/*.cpp") + source_files += glob( + "bpl-subset/bpl_subset/libs/thread/src/win32/*.cpp") + else: + print glob( + "bpl-subset/bpl_subset/libs/thread/src/pthread/*.cpp") + source_files += glob( + "bpl-subset/bpl_subset/libs/thread/src/pthread/*.cpp") + + return (source_files, + {"BOOST_MULTI_INDEX_DISABLE_SERIALIZATION": 1} + ) + else: + return [], {} + + def make_boost_base_options(): return [ IncludeDir("BOOST", []), diff --git a/bpl-subset b/bpl-subset new file mode 160000 index 0000000000000000000000000000000000000000..eb21ae675a7e5d9b7ca19303ce1bd2bf95444118 --- /dev/null +++ b/bpl-subset @@ -0,0 +1 @@ +Subproject commit eb21ae675a7e5d9b7ca19303ce1bd2bf95444118 diff --git a/setup.py b/setup.py index 0088d0bdb7362f91be9d05a2e16aaf5f33bcb0a7..1cbec7925ddad27f9e9bccc120e9eecd1323c2e7 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,8 @@ def get_config_schema(): return ConfigSchema(make_boost_base_options() + [ BoostLibraries("python"), + Switch("USE_SHIPPED_BOOST", True, "Use included Boost library"), + Switch("CL_TRACE", False, "Enable OpenCL API tracing"), Switch("CL_ENABLE_GL", False, "Enable OpenCL<->OpenGL interoperability"), @@ -40,18 +42,18 @@ def get_config_schema(): def main(): import glob - from aksetup_helper import hack_distutils, get_config, setup, \ - NumpyExtension + from aksetup_helper import (hack_distutils, get_config, setup, + NumpyExtension, set_up_shipped_boost_if_requested) hack_distutils() conf = get_config(get_config_schema()) + EXTRA_OBJECTS, EXTRA_DEFINES = set_up_shipped_boost_if_requested(conf) LIBRARY_DIRS = conf["BOOST_LIB_DIR"] LIBRARIES = conf["BOOST_PYTHON_LIBNAME"] from os.path import dirname, join, normpath - EXTRA_DEFINES = { } EXTRA_INCLUDE_DIRS = [] EXTRA_LIBRARY_DIRS = [] EXTRA_LIBRARIES = [] @@ -137,7 +139,7 @@ def main(): NumpyExtension("_cl", [ "src/wrapper/wrap_cl.cpp", - ], + ]+EXTRA_OBJECTS, include_dirs=INCLUDE_DIRS + EXTRA_INCLUDE_DIRS, library_dirs=LIBRARY_DIRS + conf["CL_LIB_DIR"], libraries=LIBRARIES + conf["CL_LIBNAME"],