Skip to content

Commit

Permalink
Merge pull request #215 from grafikrobot/modular
Browse files Browse the repository at this point in the history
Add support for modular build structure.
  • Loading branch information
jzmaddock authored Aug 19, 2024
2 parents cb55913 + 1144c1d commit dca0bdc
Show file tree
Hide file tree
Showing 9 changed files with 1,679 additions and 68 deletions.
30 changes: 30 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# 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/assert//boost_assert
/boost/concept_check//boost_concept_check
/boost/config//boost_config
/boost/predef//boost_predef
/boost/static_assert//boost_static_assert
/boost/throw_exception//boost_throw_exception
/boost/type_traits//boost_type_traits ;

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

explicit
[ alias boost_regex : build//boost_regex ]
[ alias all : boost_regex example test ]
;

call-if : boost-library regex
: install boost_regex
;

45 changes: 25 additions & 20 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# copyright John Maddock 2003
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# 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 modules ;
import testing ;
import errors ;

constant boost_dependencies_private :
/boost/core//boost_core
;

project : requirements
# default to all warnings on:
<warnings>all
: common-requirements <library>$(boost_dependencies)
: requirements <library>$(boost_dependencies_private)
;

local disable-icu = [ MATCH (--disable-icu) : [ modules.peek : ARGV ] ] ;

rule path_options ( properties * )
{
local result ;
if <address-model>64 in $(properties) && <toolset>msvc in $(properties)
if <address-model>64 in $(properties) && <toolset>msvc in $(properties)
{
result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ;
result = <search>$(ICU_PATH)/bin64 <search>$(ICU_PATH)/lib64 ;
}
else
{
result = <search>$(ICU_PATH)/bin <search>$(ICU_PATH)/lib ;
result = <search>$(ICU_PATH)/bin <search>$(ICU_PATH)/lib ;
}
return $(result) ;
}
Expand All @@ -34,24 +40,24 @@ rule path_options ( properties * )
if ! $(disable-icu)
{
if [ modules.peek : ICU_LINK ]
{
{
errors.user-error : "The ICU_LINK option is no longer supported by the Boost.Regex build - please refer to the documentation for equivalent options" ;
}

if [ modules.peek : ICU_PATH ]
{
{
ICU_PATH = [ modules.peek : ICU_PATH ] ;
}
if [ modules.peek : ICU_ICUUC_NAME ]
{
{
ICU_ICUUC_NAME = [ modules.peek : ICU_ICUUC_NAME ] ;
}
if [ modules.peek : ICU_ICUDT_NAME ]
{
{
ICU_ICUDT_NAME = [ modules.peek : ICU_ICUDT_NAME ] ;
}
if [ modules.peek : ICU_ICUIN_NAME ]
{
{
ICU_ICUIN_NAME = [ modules.peek : ICU_ICUIN_NAME ] ;
}

Expand Down Expand Up @@ -102,16 +108,16 @@ if ! $(disable-icu)
lib icuin : : <name>this_is_an_invalid_library_name ;
}

ICU_OPTS =
<include>$(ICU_PATH)/include
ICU_OPTS =
<include>$(ICU_PATH)/include
<runtime-link>shared:<library>icuuc/<link>shared
<runtime-link>shared:<library>icudt/<link>shared
<runtime-link>shared:<library>icuin/<link>shared
<runtime-link>static:<library>icuuc
<runtime-link>static:<library>icudt
<runtime-link>static:<library>icuin
<target-os>windows,<toolset>clang:<linkflags>"advapi32.lib"
<define>BOOST_HAS_ICU=1
<define>BOOST_HAS_ICU=1
<runtime-link>static:<define>U_STATIC_IMPLEMENTATION=1
;

Expand Down Expand Up @@ -144,16 +150,15 @@ explicit has_icu ;

alias icu_options : : : : [ check-target-builds has_icu : $(ICU_OPTS) : ] ;

SOURCES =
SOURCES =
posix_api.cpp
wide_posix_api.cpp
;

lib boost_regex : ../src/$(SOURCES) icu_options
:
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
<toolset>gcc-cygwin:<link>static
:
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
<toolset>gcc-cygwin:<link>static
: :
<define>BOOST_REGEX_NO_LIB=1
;

boost-install boost_regex ;

49 changes: 26 additions & 23 deletions example/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# copyright John Maddock 2003
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# 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.

project
: requirements
<threading>multi
: requirements
<library>/boost/regex//boost_regex
<library>/boost/timer//boost_timer
<threading>multi
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
# There are unidentified linker problems on these platforms:
<toolset>mipspro-7.4:<link>static
<toolset>sun-5.9:<link>static
<toolset>msvc:<warnings>all
<toolset>gcc:<warnings>all
<toolset>gcc:<cxxflags>-Wextra
<toolset>gcc:<warnings>extra
<define>U_USING_ICU_NAMESPACE=0
#<toolset>gcc-mw:<link>static
#<toolset>gcc-mingw:<link>static
<toolset>gcc-cygwin:<link>static
<define>BOOST_TIMER_ENABLE_DEPRECATED
;

rule regex-test-run ( sources + : input * : name * )
{
return [
return [
run
# sources
$(sources)
# dependencies
../build//boost_regex
/boost/regex//boost_regex
: # additional args
$(input)
: # test-files
Expand All @@ -37,32 +39,33 @@ rule regex-test-run ( sources + : input * : name * )
] ;
}

path-constant HERE : . ;

test-suite regex-examples :

[ regex-test-run timer/regex_timer.cpp : $(BOOST_ROOT)/libs/regex/example/timer/input_script.txt ]
[ regex-test-run grep/grep.cpp ../../program_options/build//boost_program_options/<link>static : -n -b $(BOOST_ROOT)/boost/regex.hpp $(BOOST_ROOT)/boost/type_traits.hpp : test_grep ]
[ regex-test-run timer/regex_timer.cpp /boost/smart_ptr//boost_smart_ptr : $(HERE)/timer/input_script.txt ]
[ regex-test-run grep/grep.cpp /boost/program_options//boost_program_options/<link>static : -n -b $(HERE)/../include/boost/regex.hpp : test_grep ]
[ regex-test-run snippets/credit_card_example.cpp ]
[ regex-test-run snippets/mfc_example.cpp ]
[ regex-test-run snippets/icu_example.cpp ]
[ regex-test-run snippets/partial_regex_grep.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
[ regex-test-run snippets/partial_regex_iterate.cpp : $(BOOST_ROOT)/libs/regex/index.htm ]
[ regex-test-run snippets/partial_regex_grep.cpp : $(HERE)/../index.htm ]
[ regex-test-run snippets/partial_regex_iterate.cpp : $(HERE)/../index.htm ]
[ regex-test-run snippets/partial_regex_match.cpp : 1234-5678-8765-4 ]
[ regex-test-run snippets/regex_grep_example_1.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_2.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_3.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_4.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_1.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_2.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_3.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_grep_example_4.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_match_example.cpp : -auto ]
[ regex-test-run snippets/regex_merge_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_merge_example.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_replace_example.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_search_example.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ regex-test-run snippets/regex_split_example_1.cpp : -auto ]
[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
[ regex-test-run snippets/regex_split_example_2.cpp : $(HERE)/../doc/html/index.html ]
[ regex-test-run snippets/regex_token_iterator_eg_1.cpp : -auto ]
[ regex-test-run snippets/regex_token_iterator_eg_2.cpp : $(BOOST_ROOT)/libs/regex/doc/html/index.html ]
[ regex-test-run snippets/regex_iterator_example.cpp : $(BOOST_ROOT)/boost/regex/v5/regex_token_iterator.hpp ]
[ regex-test-run snippets/regex_token_iterator_eg_2.cpp : $(HERE)/../doc/html/index.html ]
[ regex-test-run snippets/regex_iterator_example.cpp : $(HERE)/../include/boost/regex/v5/regex_iterator.hpp ]
[ run snippets/captures_example.cpp
../test/captures//boost_regex_extra
: : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 ]

;

40 changes: 22 additions & 18 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# copyright John Maddock 2003
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# 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.

project
: requirements
<threading>multi
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
<toolset>msvc-7.1:<define>TEST_MFC=1
: requirements
<library>/boost/regex//boost_regex
<library>/boost/detail//boost_detail
<threading>multi
<link>shared:<define>BOOST_REGEX_DYN_LINK=1
<toolset>msvc-7.1:<define>TEST_MFC=1
<toolset>msvc-7.0:<define>TEST_MFC=1
# There are unidentified linker problems on these platforms:
<toolset>mipspro-7.4:<link>static
Expand All @@ -20,21 +22,23 @@ project
#<toolset>gcc-mingw:<link>static
#<toolset>gcc-cygwin:<link>static
<toolset>sun:<link>static
<include>../src
<include>.
;

#
# rule for simple regex test programs:
#
rule regex-test ( name : sources + : requirements * : input-files * )
{
return [ run $(sources) ../build//boost_regex
return [ run $(sources) /boost/regex//boost_regex
:
: $(input-files)
: $(requirements)
: $(name) ] ;
}

R_SOURCE =
R_SOURCE =
basic_tests.cpp
main.cpp
wmain.cpp
Expand Down Expand Up @@ -69,15 +73,15 @@ run regress/$(R_SOURCE) ../build//boost_regex ../build//icu_options
: regex_regress ;

run regress/$(R_SOURCE) ../build//boost_regex
../../thread/build//boost_thread ../build//icu_options
/boost/thread//boost_thread ../build//icu_options
: # command line
: # input files
: # requirements
<define>TEST_THREADS
: regex_regress_threaded ;

run regress/$(R_SOURCE) ../build//boost_regex
../../thread/build//boost_thread ../build//icu_options
/boost/thread//boost_thread ../build//icu_options
: # command line
: # input files
: # requirements
Expand All @@ -97,28 +101,28 @@ run unicode/unicode_iterator_test.cpp : : : release <define>TEST_UTF16 : unicode
run unicode/unicode_casefold_test.cpp ../build//boost_regex ../build//icu_options ;
run object_cache/object_cache_test.cpp ;
run config_info/regex_config_info.cpp ../build//boost_regex/<link>static : : : <test-info>always_show_run_output ;
run config_info/regex_config_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : regex_dll_config_info ;
run config_info/regex_config_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : regex_dll_config_info ;
run collate_info/collate_info.cpp ../build//boost_regex : : : <test-info>always_show_run_output : test_collate_info ;
link concepts/concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
link concepts/concept_check.cpp /boost/range//boost_range : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
link concepts/concept_check.cpp : <define>BOOST_REGEX_STANDALONE <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_concept_check ;
link concepts/icu_concept_check.cpp : <define>BOOST_REGEX_STANDALONE <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
link concepts/icu_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy : standalone_icu_concept_check ;
link concepts/range_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy ;
run concepts/test_bug_11988.cpp ;
run captures/captures_test.cpp ../build//icu_options : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 <define>BOOST_REGEX_NO_LIB=1 : captures_test ;
link concepts/range_concept_check.cpp : <toolset>gcc:<cxxflags>-Wno-deprecated-copy <library>/boost/range//boost_range ;
run concepts/test_bug_11988.cpp ;
run captures/captures_test.cpp ../build//icu_options /boost/array//boost_array : : : <threading>multi <define>BOOST_REGEX_MATCH_EXTRA=1 <define>BOOST_REGEX_NO_LIB=1 : captures_test ;
run regress/$(R_SOURCE) ./noeh_test//boost_regex_noeh ../build//icu_options : : : <define>BOOST_NO_EXCEPTIONS=1 <exception-handling>off <link>static <runtime-link>shared : regex_regress_noeh ;
compile test_consolidated.cpp ;

build-project ../example ;

# `quick` target (for CI)
run quick.cpp ../build//boost_regex ;
compile test_warnings.cpp
compile test_warnings.cpp
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on ;

compile test_warnings.cpp
compile test_warnings.cpp
: <toolset>msvc:<warnings>all <toolset>msvc:<warnings-as-errors>on
<toolset>gcc:<warnings>all <toolset>gcc:<warnings-as-errors>on
<toolset>clang:<warnings>all <toolset>clang:<warnings-as-errors>on
Expand All @@ -130,4 +134,4 @@ compile test_windows_defs_2.cpp ;
compile test_windows_defs_3.cpp ;
compile test_windows_defs_4.cpp ;

run issue153.cpp : : : <toolset>msvc:<linkflags>-STACK:2097152 ;
run issue153.cpp : : : "<toolset>msvc:<linkflags>-STACK:2097152" ;
2 changes: 1 addition & 1 deletion test/cmake_install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ target_link_libraries(quick Boost::regex Boost::core)
enable_testing()
add_test(quick quick)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
2 changes: 1 addition & 1 deletion test/cmake_subdir_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ target_link_libraries(quick Boost::regex Boost::core)
enable_testing()
add_test(quick quick)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
Loading

0 comments on commit dca0bdc

Please sign in to comment.