Modular adjustments to building.

This commit is contained in:
Rene Rivera
2023-03-12 23:07:07 -05:00
parent 499d28e34f
commit 41b86ca2e2
5 changed files with 45 additions and 64 deletions

View File

@ -1,38 +1,32 @@
# Copyright René Ferdinand Rivera Morell 2014-2019
# Copyright René Ferdinand Rivera Morell 2014-2023
# Distributed under 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)
#|
This B2 project provides support for using the Predef library externally as
a standalone project or by embedding in your B2 project tree. To use
externally you would need a `use-project` declaration and to use the
project as a dependency where needed:
a standalone project. To use externally you would need a `use-project`
declaration and to use the project as a dependency where needed:
----
use-project /hash-predef : /path/to/hash-predef/root ;
use-project /boost/predef : /path/to/boost_predef/root ;
exe my_thing : main.cpp : <dependency>/hash-predef ;
----
To use in your project tree you would only need to place the Predef tree
in a subdirectory and reference the project location as a dependency where
needed.
----
exe my_thin : main.cpp : <dependency>libs/hash-predef ;
exe my_thing : main.cpp : <dependency>/boost/predef ;
----
|#
import project ;
import modules ;
path-constant BOOST_PREDEF_ROOT : . ;
path-constant BOOST_PREDEF_INCLUDE : include ;
constant PREDEF_DIST : boost ;
path-constant PREDEF_ROOT : . ;
modules.poke : BOOST_BUILD_PATH
: $(PREDEF_ROOT)/tools/check [ modules.peek : BOOST_BUILD_PATH ] ;
project /boost/predef
: usage-requirements
<include>$(BOOST_PREDEF_INCLUDE) ;
: common-requirements
<include>include
;
if [ project.is-jamroot-module $(__name__) ]
{
@ -40,4 +34,11 @@ if [ project.is-jamroot-module $(__name__) ]
$(attributes).set "build-dir" : .bin ;
}
alias libs ;
explicit
[ alias boost_predef ]
[ alias all : boost_predef test//all tools/check ]
;
call-if
: boost-library predef
;

View File

@ -14,7 +14,7 @@ project predefdoc ;
doc-dir = [ MATCH "--doc-dir=(.*)" : [ modules.peek : ARGV ] ] ;
doc-dir ?= . ;
local headers = [ glob-tree-ex $(BOOST_PREDEF_INCLUDE) : *.h ] ;
local headers = [ glob-tree-ex ../include/boost : *.h ] ;
html index : predef.adoc :
:

View File

@ -1,28 +1,18 @@
# Copyright Rene Rivera 2011-2019
# Copyright Rene Rivera 2011-2023
# Distributed under 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 ../tools/check/predef : require check : predef-require predef-check ;
import predef : require check : predef-require predef-check ;
import common ;
import path ;
import regex ;
# This deals with the unfortunate aspect of a Boost monolithic release
# not having the modular include dirs. This is a kludge that just removes
# the direct dependency to the header if it can't find it.
local PREDEF_H = $(BOOST_PREDEF_INCLUDE)/boost/predef.h ;
if ! [ path.exists $(PREDEF_H) ]
{
PREDEF_H = ;
}
project
: requirements
<include>$(BOOST_PREDEF_INCLUDE)
# Add explicit dependency since we don't have header scanner for
# .m and .mm files.
<dependency>$(PREDEF_H)
<dependency>../include/boost/predef.h
;
using testing ;
@ -53,34 +43,13 @@ test-suite predef :
[ compile workaround_strict_config.cpp ]
[ run tested_at.cpp ]
[ compile-fail tested_at_outdated.cpp : <test-info>always_show_run_output ]
[ compile platform_windows.cpp ]
[ compile platform_windows.cpp ]
;
local HEADERS = [ path.glob
$(BOOST_PREDEF_INCLUDE)/predef
$(BOOST_PREDEF_INCLUDE)/predef/architecture
$(BOOST_PREDEF_INCLUDE)/predef/architecture/x86
$(BOOST_PREDEF_INCLUDE)/predef/compiler
$(BOOST_PREDEF_INCLUDE)/predef/hardware
$(BOOST_PREDEF_INCLUDE)/predef/hardware/simd
$(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/arm
$(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/ppc
$(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/x86
$(BOOST_PREDEF_INCLUDE)/predef/hardware/simd/x86_amd
$(BOOST_PREDEF_INCLUDE)/predef/language
$(BOOST_PREDEF_INCLUDE)/predef/library
$(BOOST_PREDEF_INCLUDE)/predef/library/c
$(BOOST_PREDEF_INCLUDE)/predef/library/std
$(BOOST_PREDEF_INCLUDE)/predef/os
$(BOOST_PREDEF_INCLUDE)/predef/os/bsd
$(BOOST_PREDEF_INCLUDE)/predef/other
$(BOOST_PREDEF_INCLUDE)/predef/platform
: *.h
] ;
local single_header_cpp ;
for local h in $(HEADERS)
for local h in [ glob-tree-ex ../include/boost/predef : *.h ]
{
local header_include = [ path.relative $(h) [ path.make $(BOOST_PREDEF_INCLUDE) ] ] ;
local header_include = [ path.relative $(h) ../include ] ;
local header_cpp = [ regex.replace $(header_include:S=.cpp) "/" "_" ] ;
.HEADER($(header_cpp:B:S=)) = $(header_include) ;
make $(header_cpp) : : @gen_single_header_cpp ;
@ -113,5 +82,8 @@ alias full : predef predef-info ;
# Extra's target.
alias extra : predef-headers ;
alias all : predef predef-info predef-headers ;
explicit minimal ;
explicit extra ;
explicit all ;

View File

@ -1,9 +1,17 @@
# Copyright Rene Rivera 2015
# Copyright Rene Rivera 2015-2023
# Distributed under 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)
exe predef_check_as_c : predef_check_as_c.c : <include>../include ;
exe predef_check_as_cpp : predef_check_as_cpp.cpp : <include>../include ;
exe predef_check_as_objc : predef_check_as_objc.m : <include>../include ;
exe predef_check_as_objcpp : predef_check_as_objcpp.mm : <include>../include ;
exe predef_check_as_c : predef_check_as_c.c ;
exe predef_check_as_cpp : predef_check_as_cpp.cpp ;
exe predef_check_as_objc : predef_check_as_objc.m : <conditional>@objc ;
exe predef_check_as_objcpp : predef_check_as_objcpp.mm : <conditional>@objc ;
rule objc ( props * )
{
if ! ( <target-os>darwin in $(props) )
{
return <build>no ;
}
}

View File

@ -88,7 +88,7 @@ local rule check_target ( language key : requirements * )
local source_path
= $(predef_jam:D)/predef_check_cc_as_$(language).$(.$(language).ext) ;
local include_path
= $(predef_jam:D)/../../include $(BOOST_ROOT) ;
= $(predef_jam:D)/../../include ;
obj predef_check_cc_$(key)
: $(source_path)
: <include>$(include_path) $(requirements) ;