Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force features to override library detections and make separate rules for each feature check #203

Merged
merged 4 commits into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 76 additions & 16 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require-b2 5.0.1 ;
import-search /boost/config/checks ;
import boost-stacktrace-features ;
import config : requires ;
import configure ;
import property ;

constant boost_dependencies_private :
Expand Down Expand Up @@ -63,9 +64,9 @@ explicit WinDbg ;
mp-run-simple has_windbg_cached.cpp : : : <library>Dbgeng <library>ole32 : WinDbgCached ;
explicit WinDbgCached ;

rule build-stacktrace-feature ( name : props * )
rule build-stacktrace-noop ( props * )
{
local enabled = [ property.select <boost.stacktrace.$(name)> : $(props) ] ;
local enabled = [ property.select <boost.stacktrace.noop> : $(props) ] ;
switch $(enabled:G=)
{
case "on" : return ;
Expand All @@ -79,14 +80,28 @@ lib boost_stacktrace_noop
: # requirements
<warnings>all
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
# Enable build when explicitly requested
<conditional>@$(build-stacktrace-feature noop)
<conditional>@build-stacktrace-noop
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
<define>BOOST_STACKTRACE_NO_LIB=1
;

rule build-stacktrace-backtrace ( props * )
{
local enabled = [ property.select <boost.stacktrace.backtrace> : $(props) ] ;
switch $(enabled:G=)
{
case "on" : return ;
case "off" : return <build>no ;
}

if ! [ configure.builds libbacktrace : $(props) : "boost.stacktrace.backtrace" ]
{
return <build>no ;
}
}

lib boost_stacktrace_backtrace
: # sources
../src/backtrace.cpp
Expand All @@ -95,8 +110,7 @@ lib boost_stacktrace_backtrace
<target-os>linux:<library>dl
<library>backtrace
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
[ check-target-builds libbacktrace : : <build>no ]
<conditional>@$(build-stacktrace-feature backtrace)
<conditional>@build-stacktrace-backtrace
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
Expand All @@ -114,6 +128,12 @@ rule build-stacktrace-addr2line ( props * )

# Disable by default on Windows when not using Cygwin
if <target-os>windows in $(props) && ! ( <target-os>cygwin in $(props) )
{
configure.log-library-search-result "boost.stacktrace.addr2line" : "no" ;
return <build>no ;
}

if ! [ configure.builds addr2line : $(props) : "boost.stacktrace.addr2line" ]
{
return <build>no ;
}
Expand All @@ -126,53 +146,94 @@ lib boost_stacktrace_addr2line
<warnings>all
<target-os>linux:<library>dl
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
[ check-target-builds addr2line : : <build>no ]
<conditional>@build-stacktrace-addr2line
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
<define>BOOST_STACKTRACE_NO_LIB=1
;

rule build-stacktrace-basic ( props * )
{
local enabled = [ property.select <boost.stacktrace.basic> : $(props) ] ;
switch $(enabled:G=)
{
case "on" : return ;
case "off" : return <build>no ;
}

if [ configure.builds WinDbg : $(props) : "boost.stacktrace.basic" ]
{
return <build>no ;
}
}

lib boost_stacktrace_basic
: # sources
../src/basic.cpp
: # requirements
<warnings>all
<target-os>linux:<library>dl
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
[ check-target-builds WinDbg : <build>no ]
<conditional>@$(build-stacktrace-feature basic)
<conditional>@build-stacktrace-basic
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
<define>BOOST_STACKTRACE_NO_LIB=1
;

rule build-stacktrace-windbg ( props * )
{
local enabled = [ property.select <boost.stacktrace.windbg> : $(props) ] ;
switch $(enabled:G=)
{
case "on" : return ;
case "off" : return <build>no ;
}

if ! [ configure.builds WinDbg : $(props) : "boost.stacktrace.windbg" ]
{
return <build>no ;
}
}

lib boost_stacktrace_windbg
: # sources
../src/windbg.cpp
: # requirements
<warnings>all
<library>Dbgeng <library>ole32
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
[ check-target-builds WinDbg : : <build>no ]
<conditional>@$(build-stacktrace-feature windbg)
<conditional>@build-stacktrace-windbg
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
<define>BOOST_STACKTRACE_NO_LIB=1
;

rule build-stacktrace-windbg-cached ( props * )
{
local enabled = [ property.select <boost.stacktrace.windbg_cached> : $(props) ] ;
switch $(enabled:G=)
{
case "on" : return ;
case "off" : return <build>no ;
}

if ! [ configure.builds WinDbgCached : $(props) : "boost.stacktrace.windbg_cached" ]
{
return <build>no ;
}
}

lib boost_stacktrace_windbg_cached
: # sources
../src/windbg_cached.cpp
: # requirements
<warnings>all
<library>Dbgeng <library>ole32
<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
[ check-target-builds WinDbgCached : : <build>no ]
<conditional>@$(build-stacktrace-feature windbg-cached)
<conditional>@build-stacktrace-windbg-cached
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
Expand All @@ -191,8 +252,10 @@ rule build-stacktrace-from-exception ( props * )
local arch = [ property.select <architecture> : $(props) ] ;
if $(arch) && ( $(arch:G=) != x86 )
{
configure.log-library-search-result "boost.stacktrace.from_exception" : "no" ;
return <build>no ;
}
configure.log-library-search-result "boost.stacktrace.from_exception" : "yes" ;
}

lib boost_stacktrace_from_exception
Expand All @@ -204,9 +267,6 @@ lib boost_stacktrace_from_exception

# Enable build when explicitly requested, or by default, when on x86
<conditional>@build-stacktrace-from-exception

# Require usable libbacktrace on other platforms
# [ check-target-builds libbacktrace : : <build>no ]
: # default build
: # usage-requirements
#<link>shared:<define>BOOST_STACKTRACE_DYN_LINK=1
Expand Down
Loading