boost 빌드


--32bit

b2 --toolset=msvc-10.0 link=static runtime-link=static,shared variant=release,debug threading=multi stage install -j4




-MT/MTd 빌드 준비

SConstruct 파일 수정

        for b in boostLibs:

            #l = "boost_" + b

            #if not conf.CheckLib([ l + boostCompiler + "-mt" + boostVersion,

             #                      l + boostCompiler + boostVersion ], language='C++' ):

            l = "libboost_" + b

            if not conf.CheckLib([ l + "-vc100-mt-s-1_55",

                                   l +  "-vc100-mt-sgd-1_55"], language='C++' ):


명령 실행

scons --32 --full --dd --static --cpppath=D:\boost_1_55_0 --libpath=D:\boost_1_55_0\stage\lib --extrapath=D:\boost_1_55_0\stage\lib --use-system-boost mongoclient

Checking for C++ library libboost_thread-vc100-mt-s-1_55... yes

Checking for C++ library libboost_filesystem-vc100-mt-s-1_55... yes

Checking for C++ library libboost_program_options-vc100-mt-s-1_55... yes

Checking for C++ library libboost_system-vc100-mt-s-1_55... yes



-MT 빌드

scons --32 --full --release --static --cpppath=D:\boost_1_55_0 --libpath=D:\boost_1_55_0\stage\lib --extrapath=D:\boost_1_55_0\stage\lib --use-system-boost mongoclient

-MTd 빌드

scons --32 --full --d --static --cpppath=D:\boost_1_55_0 --libpath=D:\boost_1_55_0\stage\lib --use-system-boost mongoclient



-MD/MDd 빌드 준비

    if release:

        # /O2:  optimize for speed (as opposed to size)

        # /Oy-: disable frame pointer optimization (overrides /O2, only affects 32-bit)

        # /MT:  use the multithreaded, static version of the run-time library (LIBCMT.lib)

        #env.Append( CCFLAGS= ["/O2", "/Oy-", "/MT"] )

env.Append( CCFLAGS= ["/O2", "/Oy-", "/MD"] )


        ...생략...

    else:

        # /RTC1: - Enable Stack Frame Run-Time Error Checking; Reports when a variable is used without having been initialized

        #        (implies /Od: no optimizations)

        # /MTd: Defines _DEBUG, _MT, and causes your application to use the

        #       debug multithread version of the run-time library (LIBCMTD.lib)

        #env.Append( CCFLAGS=["/RTC1", "/Od", "/MTd"] )

env.Append( CCFLAGS=["/RTC1", "/Od", "/MDd"] )


-MD 빌드

scons --32 --full --release --static --cpppath=D:\boost_1_55_0 --libpath=D:\boost_1_55_0\stage\lib --extrapath=D:\boost_1_55_0\stage\lib --use-system-boost mongoclient

-MDd 빌드

scons --32 --full --d --static --cpppath=D:\boost_1_55_0 --libpath=D:\boost_1_55_0\stage\lib --use-system-boost mongoclient




-사용


#include <WinSock2.h>

#pragma comment(lib, "ws2_32.lib")

#pragma comment(lib, "DbgHelp.lib")


#pragma warning(disable : 4996)

#include "mongo/client/dbclient.h"


#if defined(_MT) && defined(_DLL)

#if defined(_DEBUG)

#pragma comment(lib, "mongoclient_vc100_mdd.lib")

#else

#pragma comment(lib, "mongoclient_vc100_md.lib")

#endif

#else

#if defined(_DEBUG)

#pragma comment(lib, "mongoclient_vc100_mtd.lib")

#else

#pragma comment(lib, "mongoclient_vc100_mt.lib")

#endif

#endif

#pragma warning(default: 4996)