2010-09-27 66 views
1

我使用boost.build編譯引用庫的C++代碼,CGNS,但在使用boost.build時遇到了一些困難。 CGNS編譯爲一個庫,包含該平臺的文件夾,例如linux版本的[path]/LINUX。我想在構建中包含庫[path] /LINUX/libcgns.a。我希望這是跨平臺的,以便爲LINUX構建引用LINUX目錄,WIN目錄用於WIN構建(我相信這有平臺條件)。使用Boost.build包含庫

我設法包括庫頭文件,但我該如何去關於庫的條件包括?我的簡單測試Jamroot.jam,其中main.cpp只是CGNS文檔中的一個示例。

exe CGNSTest 
    : src/main.cpp 
    : <include>../Dependencies/cgnslib ; 

另外,我想在CGNS圖書館建設成我的二進制(靜態引用?)

回答

1

使用兩個引用,http://www.highscore.de/cpp/boostbuild/http://www.boost.org/doc/tools/build/doc/userman.pdf,我創造了一些作品,但它可能不會是理想。

lib cgns 
    : # sources 
    : # requirements 
     <name>cgns 
     <target-os>linux:<search>../Dependencies/cgnslib/LINUX 
     <target-os>windows:<search>../Dependencies/cgnslib/WIN32 
    : # default-build 
    : # usage-requirements 
     <include>./../Dependencies/cgnslib ; 
alias static_libraries : cgns : <link>static ; 
exe CGNSTest 
    : src/main.cpp static_libraries 
    : <target-os>windows:<linkflags>/NODEFAULTLIB:MSVCRTD ;