开发者

Crossplatform building Boost with SCons

I tried hard but couldn't find an example of using SCons (or any build system for that matter) to build on both gcc and mvc++ with boost libraries.

Currently my SConstruct looks like

env = Environment()
env.Object(Glob('*.cpp'))
env.Program(target='test', source=Glob('*.o'), LIBS=['boost_filesystem-mt', 'boost_system-mt', 'boost_program_options-mt'])

Which work开发者_运维问答s on Linux but doesn't with Visual C++ which starting with 2010 doesn't let you specify global include directories.


You'll need something like:

import os

env = Environment()
boost_prefix = ""
if is_windows:
  boost_prefix = "path_to_boost"
else:
  boost_prefix = "/usr" # or wherever you installed boost
sources = env.Glob("*.cpp")
env.Append(CPPPATH = [os.path.join(boost_prefix, "include")])
env.Append(LIBPATH = [os.path.join(boost_prefix, "lib")])
app = env.Program(target = "test", source = sources, LIBS = [...])
env.Default(app)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜