Skip to content

Commit

Permalink
Add support for modular build structure. (#40)
Browse files Browse the repository at this point in the history
This is part of the effort to make the Boost libraries "modular" for build and consumption. See https://lists.boost.org/Archives/boost/2024/01/255704.php and https://github.com/grafikrobot/boost-b2-modular/blob/b2-modular/README.adoc for more information.

This PR depends on the following other PRs being merged to both develop and master branches of the respective repos:

- boostorg/boost#854
  • Loading branch information
grafikrobot authored Aug 24, 2024
1 parent e37bc99 commit 795773e
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 15 deletions.
26 changes: 26 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 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 ;

constant boost_dependencies :
/boost/config//boost_config
/boost/container_hash//boost_container_hash
/boost/core//boost_core
/boost/throw_exception//boost_throw_exception ;

project /boost/type_index
: common-requirements
<include>include
;

explicit
[ alias boost_type_index : : : : <library>$(boost_dependencies) ]
[ alias all : boost_type_index test ]
;

call-if : boost-library type_index
;

6 changes: 3 additions & 3 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import doxygen ;

doxygen autodoc
:
[ glob ../../../boost/type_index.hpp ]
[ glob ../../../boost/type_index/*.hpp ]
[ glob ../../../boost/type_index/runtime_cast/*.hpp ]
[ glob ../include/boost/type_index.hpp ]
[ glob ../include/boost/type_index/*.hpp ]
[ glob ../include/boost/type_index/runtime_cast/*.hpp ]
:
<doxygen:param>EXTRACT_ALL=NO
<doxygen:param>HIDE_UNDOC_MEMBERS=YES
Expand Down
2 changes: 1 addition & 1 deletion examples/user_defined_typeinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

// BOOST_TYPE_INDEX_USER_TYPEINDEX must be defined *BEFORE* first inclusion of <boost/type_index.hpp>
#define BOOST_TYPE_INDEX_USER_TYPEINDEX <boost/../libs/type_index/examples/user_defined_typeinfo.hpp>
#define BOOST_TYPE_INDEX_USER_TYPEINDEX <user_defined_typeinfo.hpp>
#include <boost/type_index.hpp>
//] [/type_index_my_type_index_worldwide_macro]

Expand Down
25 changes: 14 additions & 11 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#

require-b2 5.0.1 ;
import-search /boost/config/checks ;
import-search /boost/config/checks ;
import config : requires ;
import testing ;
import feature ;
import os ;

import ../../config/checks/config : requires ;

project
: source-location .
: requirements
<library>/boost/type_index//boost_type_index
[ requires cxx11_rvalue_references ]
;

Expand Down Expand Up @@ -46,11 +49,11 @@ lib test_lib_rtti_compat : test_lib_rtti_compat-obj : <link>shared $(nortti) $(c
exe testing_crossmodule_anonymous_no_rtti : testing_crossmodule_anonymous.cpp test_lib_anonymous_nortti : <rtti>off $(norttidefines) ;

test-suite type_index
:
[ run type_index_test.cpp ]
[ run type_index_runtime_cast_test.cpp ]
:
[ run type_index_test.cpp /boost/lexical_cast//boost_lexical_cast ]
[ run type_index_runtime_cast_test.cpp /boost/smart_ptr//boost_smart_ptr ]
[ run type_index_constexpr_test.cpp ]
[ run type_index_test.cpp : : : <rtti>off $(norttidefines) : type_index_test_no_rtti ]
[ run type_index_test.cpp /boost/lexical_cast//boost_lexical_cast : : : <rtti>off $(norttidefines) : type_index_test_no_rtti ]
[ run ctti_print_name.cpp : : : <test-info>always_show_run_output ]
[ run testing_crossmodule.cpp test_lib_rtti ]
[ run testing_crossmodule.cpp test_lib_nortti : : : <rtti>off $(norttidefines) : testing_crossmodule_no_rtti ]
Expand All @@ -65,25 +68,25 @@ test-suite type_index
# Mixing RTTI on and off

# MSVC sometimes overrides the /GR-, without `detect_missmatch` this test may link.
# TODO: Disabled on MSVC. Enable again when there'll be an understanding of how to write this test correctly wor MSVC.
# TODO: Disabled on MSVC. Enable again when there'll be an understanding of how to write this test correctly wor MSVC.
[ link-fail testing_crossmodule.cpp test_lib_rtti : $(nortti) <toolset>msvc:<build>no : link_fail_nortti_rtti ]
[ link-fail testing_crossmodule.cpp test_lib_nortti : <toolset>msvc:<build>no : link_fail_rtti_nortti ]

[ run testing_crossmodule.cpp test_lib_rtti_compat : : : $(nortti) $(compat) : testing_crossmodule_nortti_rtti_compat ]
[ run testing_crossmodule.cpp test_lib_nortti_compat : : : $(compat) : testing_crossmodule_rtti_nortti_compat ]
;
# Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite.

# Assuring that examples compile and run. Adding sources from `examples` directory to the `type_index` test suite.
for local p in [ glob ../examples/*.cpp ]
{
# RTTI on
type_index += [ run $(p) ] ;
type_index += [ run $(p) /boost/unordered//boost_unordered : : : <include>../examples ] ;

# RTTI off
local target_name = $(p[1]:B)_no_rtti ;
if $(target_name) != "table_of_names_no_rtti"
{
type_index += [ run $(p) : : : <rtti>off $(norttidefines) : $(target_name) ] ;
type_index += [ run $(p) /boost/unordered//boost_unordered : : : <include>../examples <rtti>off $(norttidefines) : $(target_name) ] ;
}
}

0 comments on commit 795773e

Please sign in to comment.