Skip to content

Commit

Permalink
Merge pull request #264 from grafikrobot/modular
Browse files Browse the repository at this point in the history
Add support for modular build structure.
  • Loading branch information
olk authored Aug 28, 2024
2 parents 13e9cde + c79fa61 commit 463cffe
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 63 deletions.
60 changes: 60 additions & 0 deletions boost-context-features.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Copyright René Ferdinand Rivera Morell 2023-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)

import feature ;
import os ;

feature.feature segmented-stacks : on : optional propagated composite ;
feature.compose <segmented-stacks>on : <define>BOOST_USE_SEGMENTED_STACKS ;

feature.feature htm : tsx : optional propagated composite ;
feature.compose <htm>tsx : <define>BOOST_USE_TSX ;

feature.feature valgrind : on : optional propagated composite ;
feature.compose <valgrind>on : <define>BOOST_USE_VALGRIND ;

local rule default_binary_format ( )
{
local tmp = elf ;
if [ os.name ] = "NT" { tmp = pe ; }
else if [ os.name ] = "CYGWIN" { tmp = pe ; }
else if [ os.name ] = "AIX" { tmp = xcoff ; }
else if [ os.name ] = "MACOSX" { tmp = mach-o ; }
return $(tmp) ;
}

feature.feature binary-format
: elf
mach-o
pe
xcoff
: propagated
;
feature.set-default binary-format : [ default_binary_format ] ;

local rule default_abi ( )
{
local tmp = sysv ;
if [ os.name ] = "NT" { tmp = ms ; }
else if [ os.name ] = "CYGWIN" { tmp = ms ; }
else if [ os.platform ] in "ARM" "ARM64" { tmp = aapcs ; }
else if [ os.platform ] = "MIPS32" { tmp = o32 ; }
else if [ os.platform ] = "MIPS64" { tmp = n64 ; }
return $(tmp) ;
}

feature.feature abi
: aapcs
eabi
ms
n32
n64
o32
o64
sysv
x32
: propagated
;
feature.set-default abi : [ default_abi ] ;
39 changes: 39 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright René Ferdinand Rivera Morell 2023-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 ;

import-search /boost/predef/tools/check ;

import predef ;
import boost-context-features ;

constant boost_dependencies :
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/mp11//boost_mp11
/boost/pool//boost_pool
/boost/predef//boost_predef
/boost/smart_ptr//boost_smart_ptr ;

project /boost/context
: common-requirements
<include>include
: requirements
# Auto-detect toolset default address-model and architecture.
[ predef.address-model ]
[ predef.architecture ]
;

explicit
[ alias boost_context : build//boost_context ]
[ alias all : boost_context test ]
;

call-if : boost-library context
: install boost_context
;

71 changes: 9 additions & 62 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,18 @@
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

import-search /boost/config/checks ;

import common ;
import feature ;
import indirect ;
import modules ;
import os ;
import toolset ;
import ../../config/checks/config : requires ;

feature.feature segmented-stacks : on : optional propagated composite ;
feature.compose <segmented-stacks>on : <define>BOOST_USE_SEGMENTED_STACKS ;

feature.feature htm : tsx : optional propagated composite ;
feature.compose <htm>tsx : <define>BOOST_USE_TSX ;

feature.feature valgrind : on : optional propagated composite ;
feature.compose <valgrind>on : <define>BOOST_USE_VALGRIND ;
import config : requires ;
import feature ;

project boost/context
project
: common-requirements <library>$(boost_dependencies)
: requirements
<target-os>windows:<define>_WIN32_WINNT=0x0601
<target-os>linux,<toolset>gcc,<segmented-stacks>on:<cxxflags>-fsplit-stack
Expand All @@ -48,59 +42,13 @@ project boost/context
<toolset>msvc,<address-model>32:<asmflags>/safeseh
: usage-requirements
<link>shared:<define>BOOST_CONTEXT_DYN_LINK=1
<define>BOOST_CONTEXT_NO_LIB=1
<optimization>speed:<define>BOOST_DISABLE_ASSERTS
<variant>release:<define>BOOST_DISABLE_ASSERTS
: source-location ../src
;


local rule default_binary_format ( )
{
local tmp = elf ;
if [ os.name ] = "NT" { tmp = pe ; }
else if [ os.name ] = "CYGWIN" { tmp = pe ; }
else if [ os.name ] = "AIX" { tmp = xcoff ; }
else if [ os.name ] = "MACOSX" { tmp = mach-o ; }
return $(tmp) ;
}

feature.feature binary-format
: elf
mach-o
pe
xcoff
: propagated
;
feature.set-default binary-format : [ default_binary_format ] ;


local rule default_abi ( )
{
local tmp = sysv ;
if [ os.name ] = "NT" { tmp = ms ; }
else if [ os.name ] = "CYGWIN" { tmp = ms ; }
else if [ os.platform ] = "ARM" { tmp = aapcs ; }
else if [ os.platform ] = "ARM64" { tmp = aapcs ; }
else if [ os.platform ] = "MIPS32" { tmp = o32 ; }
else if [ os.platform ] = "MIPS64" { tmp = n64 ; }
return $(tmp) ;
}

feature.feature abi
: aapcs
eabi
ms
n32
n64
o32
o64
sysv
x32
: propagated
;
feature.set-default abi : [ default_abi ] ;


feature.feature context-impl
: fcontext
ucontext
Expand All @@ -112,6 +60,7 @@ feature.set-default context-impl : fcontext ;
feature.compose <context-impl>ucontext : <define>BOOST_USE_UCONTEXT ;
feature.compose <context-impl>winfib : <define>BOOST_USE_WINFIB ;


# ARM
# ARM/AAPCS/ELF
alias asm_sources
Expand Down Expand Up @@ -860,7 +809,7 @@ alias asm_sources
<binary-format>pe
<toolset>msvc
;

# Embarcadero on Windows, bcc64, uses the sysv-elf format for 64-bits
# This is configured in the embarcadero toolset as using bcc64 with the
# command line option '-x assembler-with-cpp'.
Expand Down Expand Up @@ -997,5 +946,3 @@ lib boost_context
: impl_sources
stack_traits_sources
;

boost-install boost_context ;
6 changes: 5 additions & 1 deletion test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import modules ;
import os ;
import testing ;
import toolset ;
import ../../config/checks/config : requires ;
import-search /boost/config/checks ;
import config : requires ;
using flags ;

project boost/context/test
: requirements
<library>/boost/array//boost_array
<library>/boost/lexical_cast//boost_lexical_cast
<library>/boost/context//boost_context
<library>/boost/variant//boost_variant
<target-os>linux,<toolset>gcc,<segmented-stacks>on:<cxxflags>-fsplit-stack
<target-os>linux,<toolset>gcc,<segmented-stacks>on:<cxxflags>-DBOOST_USE_SEGMENTED_STACKS
<toolset>clang,<segmented-stacks>on:<cxxflags>-fsplit-stack
Expand Down

0 comments on commit 463cffe

Please sign in to comment.