开发者

Can I add Boost source+header files to my own (Open Source) project? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_运维技巧

This question does not appear to be about programming within the scope defined in the help center.

Closed 7 years ago.

Improve this question

Is it allowed by the Boost License to just add the source code of the stuff I need to my project (accompanied by the license of course?). I couldn't find any "descriptive" confirmation. I would have seperate Include/boost and Source/boost directories for easy access.

PS: Seeing as boost::filesystem is going into C++0x TR2, and lambda, regex and whatnot are already in c++0x TR1, I don't see any reason to be juggling with C functions like realpath, getcwd and the like. They don't work well anyways...

UPDATE: I'm adding the required files "one-by-one" folder by folder, but the amount is gigantic. Maybe it's better to include the full boost dist....


Yes you can do that. The license is very liberal. The only condition is that if you redistribute your software in source form you need to include a complete copy of the license.


There is a utility that comes with boost called bcp, that can scan your source and extract any boost header files that are used from the boost source. I've setup a script that does this extraction into our source tree, so that we can package the source that we need along with our code. It will also copy the boost source files for a couple of boost libraries that we use that are no header only, which are then compiled directly into our applications. This makes it easy to rerun the script whenever there is a new version of boost released.

For reference, here is what we use #!/bin/sh BOOST_SRC=.../boost_1_43_0 DEST_DIR=../src/boost TOOLSET= if ( test uname = "Darwin") then TOOLSET="--toolset=darwin" fi

# make bcp if necessary
if ( ! test -x $BOOST_SRC/dist/bin/bcp ) then
    if ( test -x $BOOST_SRC/tools/jam/*/bin.*/bjam ) then
        BJAM=$BOOST_SRC/tools/jam/*/bin.*/bjam
    else
        echo "### Building bjam"
        pushd $BOOST_SRC/tools/jam
        ./build_dist.sh
        popd
        if ( test -x $BOOST_SRC/tools/jam/*/bin.*/bjam ) then
            BJAM=$BOOST_SRC/tools/jam/*/bin.*/bjam
        fi

    fi
    echo "BJAM: $BJAM"
    pushd $BOOST_SRC/tools/bcp
    echo "### Building bcp"
    echo "$BJAM $TOOLSET"
    $BJAM $TOOLSET
    if [ $? == "0" ]; then
        exit 1;
    fi
    popd
fi

if ( ! test -x $BOOST_SRC/dist/bin/bcp) then
    echo "### Couldn't find bpc"
    exit 1;
fi

mkdir -p $DEST_DIR

echo "### Copying boost source"
MAKEFILEAM=$DEST_DIR/libs/Makefile.am
rm $MAKEFILEAM

# copy source libraries
mkdir -p $DEST_DIR/libs/signals/src
cp $BOOST_SRC/libs/signals/src/* $DEST_DIR/libs/signals/src/.
echo -n "boost_sources += " >> $MAKEFILEAM
for f in `ls $DEST_DIR/libs/signals/src | fgrep .cpp`; do
    echo -n "boost/libs/signals/src/$f " >> $MAKEFILEAM
done
echo >> $MAKEFILEAM

echo "### Extracting boost includes"
$BOOST_SRC/dist/bin/bcp --scan --boost=$BOOST_SRC ../src/*/*.[Ch]  $DEST_DIR
if [ $? != "0" ]; then
    echo "### bcp failed"
    rm -rf $DEST_DIR
    exit 1;
fi


i would recommend linking to boost externally instead of include the source directly into your projects. beside the huge spiderweb dependency issue, linking them externally mean you can always refer to latest stable build (assume u checkout from the repository) without explicitly overwrite each old source in your project.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜