Boost logo

Boost Users :

From: KSpam (keesling_spam_at_[hidden])
Date: 2007-05-24 11:11:13


Chris,

There is another option that I have seen on the mailing lists, and it is the
option that I use. I just plumb the Boost source files directly into my
build system. Often this approach is preferred, as you can guarantee that
the Boost source files are being compiled with a compatible set of flags as
the code that depends on it (compatibility is notoriously difficult on
Windows). Furthermore, it releases you from distributing Boost binaries with
your source. This immediately gives you a more portable application.

In my case, I use CMake as a build tool, and my applications compile on both
Windows and Linux (32 and 64 bit) without having to distribute any binaries.
I use this technique for the filesystem, iostreams, unit_test_framework,
thread, regex, signals, and program_options libraries. For the most part,
compiling Boost source files does not require any "trickery". If you are
compiling on Windows, you probably want to define the following flags:
BOOST_ALL_NO_LIB
_SCL_SECURE_NO_WARNINGS
WIN32_LEAN_AND_MEAN

BOOST_ALL_NO_LIB disables the automatic linking of Boost binary libraries.
This allows you to name the library according to your own convention and link
it in manually. This is most likely a must in your case.

_SCL_SECURE_NO_WARNINGS will remove some compilation warnings regarding
non-ANSI "secure" functions on Windows. This is optional.

WIN32_LEAN_AND_MEAN is probably not necessary for program_options. I have
found that it is a necessity for using ASIO, and it is probably not a bad
flag to use anyway. This is optional.

The bcp tool will pull out the required headers as well as the required source
files for program_options. You will want to compile all of the *.cpp files
located in libs/program_options/src.

I hope that this helps.

Justin

P.S. My CMake scripts are designed to automatically download and unzip the
Boost distribution package. In my case, I do not need to include any Boost
sources with my application because the build system takes care of it.

On Thursday 24 May 2007 02:52, Vladimir Prus wrote:
> Chris Thachuk wrote:
> > Hello all,
> >
> > I'm a first time user of boost libraries and I'm finding them
> > extremely useful. I will be incorporating their use into a number of
> > open source research projects. I've searched the archives on how to
> > distribute the boost source with my code. It seems the bcp tool is
> > the way to go for this, however, I'm confused on how to use it for my
> > purpose.
> >
> > I would like to keep the code as portable as possible without users
> > needing to install additional libraries on their own. Since most of
> > the boost libraries are all contained in header files, it seems easy
> > to distribute. However, I always getting linking errors unless I
> > link against a pre-built library for Boost.Program_options.
> >
> > Is it necessary for this library to be built first, then linked against?
>
> Yes.
>
> > How could I use the 'bcp' tool to grab the needed Boost dependencies
> > for my project?
>
> I don't have a pointer handy; but I think bcp docs say that.
>
> > Can I use a standard make file as the users wouldn't have bjam
> > installed?
>
> No. You can either distribute prebuilt binaries, or you can include
> both bjam and boost.build in your project, and have a shell
> script to build bjam and then build necessary boost library.
>
> - Volodya


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net