# copyright John Maddock 2006 # Use, modification and distribution are subject to the # Boost Software License, Version 1.0. (See accompanying file # LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) import type ; type.register AUTOLINK_LIB ; import generators ; import "class" : new ; # This generator creates library using standard generators, # and then add usage requirements with the # path of the created library. class autolink-generator : generator { import generators ; import "class" ; import property-set ; import path ; rule run ( project name ? : property-set : sources + ) { local result = [ generators.construct $(project) $(name) : LIB : $(property-set) : $(sources) ] ; local targets ; local usage-requirements ; if [ class.is-a $(result[1]) : property-set ] { usage-requirements = $(result[1]) ; targets = $(result[2-]) ; } else { usage-requirements = [ property-set.empty ] ; targets = $(result) ; } local extra ; local paths ; local pwd = [ path.pwd ] ; for local t in $(targets) { if [ type.is-derived [ $(t).type ] LIB ] { paths += [ path.root [ path.make [ $(t).path ] ] $(pwd) ] ; } } extra += $(paths:G=) ; if $(extra) { extra = [ sequence.unique $(extra) ] ; usage-requirements = [ $(usage-requirements).add-raw $(extra) ] ; } return $(usage-requirements) $(targets) ; } } generators.register [ new autolink-generator $(__name__).autolink : : AUTOLINK_LIB ] ; project : requirements -multi false ; autolink-lib link_test : ../link_test.cpp : shared:BOOST_DYN_LINK=1 : ; explicit link_test ; run ../main.cpp link_test : : : msvc-8.0:no msvc-9.0:no msvc-10.0:no msvc-11.0:no msvc-12.0:no static static single debug : link_test_ssd ; run ../main.cpp link_test : : : msvc-8.0:no msvc-9.0:no msvc-10.0:no msvc-11.0:no msvc-12.0:no static static single release : link_test_ssr ; run ../main.cpp link_test : : : static static multi debug : link_test_smd ; run ../main.cpp link_test : : : static static multi release : link_test_smr ; run ../main.cpp link_test : : : static shared multi debug : link_test_dmd ; run ../main.cpp link_test : : : static shared multi release : link_test_dmr ; run ../main.cpp link_test : : : static shared single debug : link_test_dsd ; run ../main.cpp link_test : : : static shared single release : link_test_dsr ; run ../main.cpp link_test : : : BOOST_DYN_LINK=1 shared shared multi debug : link_test_dll_dmd ; run ../main.cpp link_test : : : BOOST_DYN_LINK=1 shared shared multi release : link_test_dll_dmr ; run ../main.cpp link_test : : : BOOST_DYN_LINK=1 shared shared single debug : link_test_dll_dsd ; run ../main.cpp link_test : : : BOOST_DYN_LINK=1 shared shared single release : link_test_dll_dsr ;