2

我有以下目录结构:

  • APPDIR/
  • APPDIR/APPHDRS(有 *.h)
  • APPDIR/APPLIBSRCS(有 *.cpp 需要创建一个库,比如 libtest.a)
  • APPDIR/APPMAIN-I $HOME/APPINSTALLDIR(如果 g++ 获得 args和,则具有将编译的 main.cpp -L $HOME/APPINSTALLDIR/LIB

我通过添加来安装标题APPDIR/Jamroot

local headers = [ path.glob-tree $HOME/APPDIR : *.h ] ;

install headers                   
    : $(headers)
    : <location>$HOME/APPINSTALLDIR <install-source-root>$HOME/APPDIR
;

有人可以在 libtest.a 和 main.cpp 的 Jamfile 中帮助我吗?

4

2 回答 2

2

在我的 jamroot.jam 我有如下内容

(我正在将名称更改为您的目录结构,所以我可能会打错字)

#Name this location $(TOP),
path-constant TOP : . ;
#build project
build-project ./appdir/build ;

在我的 ./appdir/build 目录中,我有一个 Jamfile.v2 文件,其中包含

project applib
    : source-location ../applibsrcs
    : default-build  <threading>multi 
    : build-dir $(TOP)/build
    : usage-requirements <include>../apphdrs
    : requirements 
    <include>../apphdrs
;
lib applib : applib.cpp (and the rest of the cpp files)
              ;

#notice the applib is included in the sources
exe appmain : ../appmain/appmain.cpp applib ;

install headers 
    : [ glob ../apphdrs/*.hpp ] 
    : <location>$(TOP)/include  
      <install-source-root>../include 
;

install applib-lib : applib  :  <location>$(TOP)/lib <install-type>LIB ;


install appmain-exe : appmain : <location>$(TOP)/bin ;
于 2010-12-29T10:30:59.860 回答
1

我目前的解决方案:APPDIR/Jamroot.jam:

path-constant PROJECT_ROOT : . ;
path-constant BOOST_INCLUDE_BASE : /apps/boost/include ;
path-constant BOOST_LIB_BASE : /apps/boost/lib ;

local headers = [ path.glob-tree $(PROJECT_ROOT) : *.hpp ] ;


install headers
    : $(headers)
    : <location>$(PROJECT_ROOT)_install <install-source-root>$(PROJECT_ROOT)
    ;

project basetrade
    : requirements <include>$(PROJECT_ROOT)_install
                   <include>$(BOOST_INCLUDE_BASE)
      <variant>release:<cxxflags>-O2
      <variant>debug:<inlining>off
      <variant>debug:<debug-symbols>on
      <variant>debug:<optimization>off
      <variant>debug:<warnings>on
    ;

build-project APPLIBSRCS ;
build-project APPMAIN ;

APPLIBSRCS/Jamfile.jam:

project : usage-requirements <include>$(PROJECT_ROOT)_install ;
lib Utils : [ glob *.cpp ] : <link>static ;
install libUtils
  : Utils
  : <install-type>LIB
    <variant>release:<location>"$(PROJECT_ROOT)_install/lib"
    <variant>debug:<location>"$(PROJECT_ROOT)_install/libdebug"
  : release debug
  ;

APPMAIN/Jamfile.jam:

project : usage-requirements <include>$(PROJECT_ROOT)_install ;
use-project /PLIBSRCS : ../APPLIBSRCS ;

exe tradeexec 
    : main.cpp
      /PLIBSRCS//libUtils 
    :
    : <variant>debug <variant>release 
    ;

install install-bin 
    : tradeexec 
    : <variant>release:<location>"$(PROJECT_ROOT)_install/bin"
      <variant>debug:<location>"$(PROJECT_ROOT)_install/bindebug"
    : release debug
    ;
于 2010-12-30T11:33:56.940 回答