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

Add support for modular build structure. #2

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
20 changes: 20 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright René Ferdinand Rivera Morell 2024
# 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)

require-b2 5.2 ;

project /boost/headers
;

explicit
[ alias boost_headers : build//boost_headers ]
[ alias install : build//install ]
[ alias stage : build//stage ]
[ alias all : boost_headers stage ]
;

call-if : boost-library headers
;

54 changes: 46 additions & 8 deletions build/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)

require-b2 5.2 ;

import package ;
import path ;
import sequence ;
import set ;
import ../../../tools/boost_install/boost-install ;
import ../../../tools/boost_install/boost-install-dirs ;
import project ;
import regex ;

import-search /boost/boost_install ;
import boost-install ;
import boost-install-dirs ;

path-constant LIBS_ROOT : ../.. ;

# header-subdir

Expand All @@ -18,13 +26,17 @@ header-subdir ?= "" ;

# first, the 'modular' headers

local modular-headers = $(BOOST_MODULARLAYOUT) ;
local modular-headers
= [ SORT [ MATCH .*libs/(.*)/include/boost : [ glob
$(LIBS_ROOT)/*/include/boost
$(LIBS_ROOT)/numeric/*/include/boost
] ] ] ;

local skip-headers ;

for local lib in $(modular-headers)
{
local header-root = $(BOOST_ROOT)/libs/$(lib)/include ;
local header-root = $(LIBS_ROOT)/$(lib)/include ;
local header-boost = $(header-root)/boost ;

local headers =
Expand All @@ -46,11 +58,17 @@ for local lib in $(modular-headers)

# then, the non-modular headers in boost/, minus the modular ones

local header-root = [ path.make $(BOOST_ROOT) ] ;
local headers ;
local header-root ;

if $(BOOST_ROOT)
{
header-root = [ path.make $(BOOST_ROOT) ] ;

local headers =
[ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ]
[ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ] ;
headers =
[ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ]
[ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ] ;
}

headers = [ set.difference $(headers) : $(header-root)/$(skip-headers) ] ;

Expand All @@ -64,6 +82,26 @@ install install-boost-headers

explicit install-boost-headers ;

# Boost version format: XYYYZZ

if ! [ modules.peek boostcpp : BOOST_VERSION ]
{
local boost-config = [ project.search /boost/config ] ;
ECHO "[INFO] boost-config:" $(boost-config) ;
if $(boost-config)
{
local boost-version-num = [ regex.grep
[ path.native [ path.join $(boost-config) include boost ] ]
: version.hpp : "BOOST_VERSION ([0-9]+)" : 1 ] ;
boost-version-num = [ MATCH "(.*)(...)(..)" : $(boost-version-num[2]) ] ;
boost-version-num =
[ CALC $(boost-version-num[1]) + 0 ]
[ CALC $(boost-version-num[2]) + 0 ]
[ CALC $(boost-version-num[3]) + 0 ] ;
modules.poke boostcpp : BOOST_VERSION : $(boost-version-num:J=.) ;
}
}

#

alias install-headers : install-$(modular-headers)-headers install-boost-headers ;
Expand Down