From 3066c73c093dace63d49ddc9aec7783715c3e96a Mon Sep 17 00:00:00 2001 From: Stefan Seefeld Date: Wed, 15 Feb 2017 15:36:01 -0500 Subject: [PATCH] Fix Windows builds. --- SConstruct | 1 + appveyor.yml | 4 +++- src/SConscript | 14 +++++++++++--- test/SConscript | 9 +++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 3f3dbfd4..6edd7cd4 100644 --- a/SConstruct +++ b/SConstruct @@ -39,6 +39,7 @@ arch = ARGUMENTS.get('arch', platform.machine()) env_vars = {} if 'CXX' in os.environ: env_vars['CXX'] = os.environ['CXX'] if 'CXXFLAGS' in os.environ: env_vars['CXXFLAGS'] = os.environ['CXXFLAGS'].split() +env_vars['ENV'] = os.environ #{'PATH': os.environ['PATH'], 'TMP' : os.environ['TMP']} env = Environment(toolpath=['config/tools'], tools=['default', 'libs', 'tests', 'doc', 'sphinx4scons'], variables=vars, diff --git a/appveyor.yml b/appveyor.yml index 4dbaffd7..bc11c5b8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -69,13 +69,15 @@ install: # pip will build them from source using the MSVC compiler matching the # target Python version and architecture - easy_install scons + - easy_install sphinx + - pip install numpy #- "%CMD_IN_ENV% pip install -r dev-requirements.txt" build_script: # Build the compiled extension #- "%CMD_IN_ENV% python setup.py build" - scons config arch=%ARCH% --boost-include=%BOOST_PREFIX% - - scons arch=%ARCH% + - scons arch=%ARCH% --verbose test_script: # Run the project tests diff --git a/src/SConscript b/src/SConscript index 6d81a9dc..49ab73b8 100644 --- a/src/SConscript +++ b/src/SConscript @@ -10,9 +10,11 @@ Import('env') env.AppendUnique(CPPDEFINES = ["${LINK_DYNAMIC and 'BOOST_PYTHON_DYN_LINK=1' or ''}"]) -env.AppendUnique(CPPDEFINES = ['BOOST_PYTHON_SOURCE']) -env.BoostLibrary( +env1 = env.Clone() +env1.AppendUnique(CPPDEFINES = ['BOOST_PYTHON_SOURCE']) + +env1.BoostLibrary( 'python', ['numeric.cpp', 'list.cpp', @@ -44,7 +46,13 @@ env.BoostLibrary( 'object/function_doc_signature.cpp']) if env['NUMPY']: - env.BoostLibrary( + env2 = env.Clone() + env2.Append(CPPPATH=env['NUMPY_CPPPATH']) + build_dir = env.Dir('$BOOST_CURRENT_VARIANT_DIR/src') + env2.AppendUnique(CPPDEFINES = ['BOOST_NUMPY_SOURCE'], + LIBPATH = [build_dir], + LIBS='boost_python' + env["BOOST_SUFFIX"]) + env2.BoostLibrary( 'numpy', ['numpy/dtype.cpp', 'numpy/matrix.cpp', diff --git a/test/SConscript b/test/SConscript index ee41547f..3a0fcf06 100644 --- a/test/SConscript +++ b/test/SConscript @@ -8,9 +8,18 @@ # http://www.boost.org/LICENSE_1_0.txt) import platform +import sys Import('env') +if sys.platform == 'win32': + # HACK: This works around a bug in SCons. + # subprocess.check_output will complain unless all environment + # variables are strings. + system_root = env['ENV']['SystemRoot'] + env['ENV']['SystemRoot'] = str(system_root) + + # libs needed for embedding ELIBS=env['LIBS'] + env['PYTHONLIBS']