2016. 1. 8. 13:49

boost 컴파일 옵션

설치방법


1. 사용하려는 Visual Studio 의 도구명령 프롬프트(CMD같은거)를 연다.


2. Boost 라이브러리를 압축해제한 경로로 이동한다.


3. bootstarp.bat(또는 sh)를 실행하여 bjam 파일을 만든다.

   여기서 cl.exe 파일을 못찻는다는 오류가 나면 도구명령 프롬프트로 연게 아니니 다시 한번 확인하거나.

   cl.exe 가 있는 경로(보통 "Visual Studio 설치경로\bin")를 path 에추가 해도 된다.


4. bjam 으로 필요한 dll,lib 파일을 생성하면 된다.

   아래는 생성옵션 정리


-toolset=msvc-10.0

: Visual Studio 2010(msvc-10.0), 2012 (msvc-11.0), 2013(msvc-12.0) 을 이용해 컴파일함을 알려준다. 다른 버전을 사용할 경우에는 그에 맞는 버전을 지정하면 된다.


-architecture=x86

: 아키텍쳐를 지정한다. x86이나, x64라면 디폴트 값으로 x86으로 지정되고 IA64의 경우에는 –architecture=ia64


address-model=64

: 주소 모델을 지정한다. x64로 빌드할것이므로 64 를 지정한다. 지정안한다면 32가 디폴트 값으로 사용된다.


link=static

: 어떤 형태로 빌드할 것인지 나타낸다. static(lib), shared(dll) 두가지 옵션이 있다. link=static,shared 로 둘다 지정도 가능


runtime-link=static,shared

: 사용하는 C – Runtime Library 를 어떻게 연결할 것인지를 나타낸다. 나는 둘 다 지정했다.


variant=release

: 빌드된 라이브러리가 릴리즈용인지, 디버그 용인지를 나타낸다. variant=release,debug 와 같이 지정도 가능.


–without=mpi


–without=python


: 부스트 라이브러리는 사용을 위해 또 다른 라이브러리가 이미 설치 되 있어야 하는 경우도 있다. MPI 가 그 경우.

나는 MPI와 파이썬을 사용하지 않으므로 둘 다 빌드하지 않겠다는 옵션을 주었다.


–stagedir=stage64_lib_release

: 빌드된 라이브러리들이 위치 할 폴더. %BOOSTROOT% \ %STAGEDIR% 에 생성된다.


stage

: Stage 옵션. 헤더파일을 제외하고 라이브러리만 생성한다.


-j 2


: 쓰레드를 이용해 동시에 몇개의 작업을 할 것인가, 이경우는 두개의 작업을 동시에 하겠다고 옵션을 주었다.


-------------------------------------------------------------------

생성된 파일명의 의미


boost

: 이 파일이 link=shared 옵션으로 생성된 DLL 파일임을 나타낸다. LIB 파일이라면 libboost 로 시작한다.


libboost

: 이 파일이 link=static 옵션으로 생성된 LIB 파일임을 나타낸다.


data_time

: 라이브러리 이름을 나타낸다


vc100

: 컴파일하는데 사용된 툴과 버전을 나타낸다. vc 10.0 버전을 사용하였다.


mt

: 이 멀티 쓰레드용 부스트 라이브러리임을 나타낸다.


s

: runtime-link=static 옵션으로 C - Runtime Library 가 static 으로 링크 되었음을 알려준다.


g

: variant:debug 옵션으로 C - Runtime Library 가 디버그 버전으로 링크 되었음을 알려준다.


d

: variant:debug 옵션으로 이 부스트 라이브러리가 디버거 버전으로 컴파일 되었음을 알려준다.


1_46_1

: 부스트 라이브러리의 버전을 알려줌




libboost_mt 

: 멀티 쓰레드용 릴리즈 버전, C Runtime Library 는 shared 방식으로 링크됨. 비주얼 스튜디오 /MT 옵션용 라이브러리


libboost_mt_gd

: 멀티 쓰레드용 디버그 버전, C Runtime Library 는 shared 방식으로 링크됨. 비주얼 스튜디오 /MTd 옵션용 라이브러리


libboost_mt_s

: 멀티 쓰레드용 릴리즈 버전, C Runtime Library 는 static 방식으로 링크됨. 비주얼 스튜디오 /MD 옵션용 라이브러리


libboost_mt_sgd

: 멀티 쓰레드용 디버그 버전, C Runtime Library 는 static 방식으로 링크됨. 비주얼 스튜디오 /MDd 옵션용 라이브러리


-------------------------------------------------------------------

일반 용도 : (/MD 옵션)

mkdir build\amd64\v110

bjam --toolset=msvc-11.0 architecture=x86 address-model=64 link=static runtime-link=static variant=release,debug --without=mpi --without=python --stagedir=build/amd64/v110 stage -j 2

mkdir build\x86\v110

bjam --toolset=msvc-11.0 architecture=x86 address-model=32 link=static runtime-link=static variant=release,debug --without=mpi --without=python --stagedir=build/x86/v110 stage -j 2


mkdir build\amd64\v100

bjam --toolset=msvc-10.0 architecture=x86 address-model=64 link=static runtime-link=static variant=release,debug --without=mpi --without=python --stagedir=build/amd64/v100 stage -j 2

mkdir build\x86\v100

bjam --toolset=msvc-10.0 architecture=x86 address-model=32 link=static runtime-link=static variant=release,debug --without=mpi --without=python --stagedir=build/x86/v100 stage -j 2


Matlab 용도 : (/MT 옵션을 사용해야한다?)

mkdir build_mt\amd64\v100

bjam --toolset=msvc-10.0 architecture=x86 address-model=64 link=static runtime-link=shared variant=release,debug --without=mpi --without=python --stagedir=build_mt/amd64/v100 stage -j 2

mkdir build_mt\x86\v100

bjam --toolset=msvc-10.0 architecture=x86 address-model=32 link=static runtime-link=shared variant=release,debug --without=mpi --without=python --stagedir=build_mt/x86/v100 stage -j 2




toolset 설정 시 아래와 같은 오류가 발생할 경우.

error: msvc initialization: parameter 'version' inconsistent

error: no value was specified in earlier initialization

error: an explicit value is specified now


project-config.jam 파일을 열어서 아래 부분을 사용할 toolset 버전으로 변경해준다.

using msvc;  -> using msvc : 11.0;