Cross Platform Building Boost with SCons

I tried, but could not find an example of using SCons (or any other build system, for that matter) to build both gcc and mvC ++ with more powerful 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 works on Linux, but not with Visual C ++, which since 2010 does not allow you to specify global include directories.

+3
source share
1 answer

You will 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)
+3
source

Source: https://habr.com/ru/post/1764959/


All Articles