[C++-sig] Building tutorial example out of the boost tree, on Windows

Gary Oberbrunner garyo at genarts.com
Mon Oct 7 23:44:48 CEST 2013


SCons FTW! :-) 

I built from source and tried it all again with bjam; no luck, same problems. So I figured, how hard can it be, it's just a DLL after all (renamed to .pyd). And sure enough it's not that hard. Here's a SConstruct that builds the tutorial example, wherever it is (does not have to be in the boost tree). I'm sure this could be generalized, but it's good enough for me as is. 

# SConstruct for building boost python tutorial example 

import os 

boost_python_lib = 'boost_python-vc100-gd-1_54' 
boost_top = 'c:/boost' 
python_top = 'c:/python27' 

env=Environment(TARGET_ARCH='x86', 
CCFLAGS=['/MDd', '/DEBUG'], 
CPPPATH=[os.path.join(boost_top,'include/boost-1_54'), 
os.path.join(python_top, 'include')], 
LIBPATH=[os.path.join(boost_top, 'lib/i386'), 
os.path.join(python_top, 'libs')]) 
dll=env.SharedLibrary('hello_ext', 'hello.cpp', 
LIBS=boost_python_lib) 
env.InstallAs('hello_ext.pyd', dll[0]) 
# Copy the boost python lib into this dir so hello_ext will find it at runtime 
env.Install('.', os.path.join(boost_top, 'lib/i386', '%s.dll'%boost_python_lib)) 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20131007/75bd6124/attachment-0001.html>


More information about the Cplusplus-sig mailing list