How to change include path using bjam

╄→尐↘猪︶ㄣ 提交于 2019-12-04 19:23:38

In my jamroot.jam I have something like follows

(I am changing the names to your directory structure so I may make a typo)

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

In my ./appdir/build directory I have a Jamfile.v2 file containing

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 ;

My current solution : 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
    ;
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!