Skip to content

Commit

Permalink
Merge pull request #787 from grafikrobot/modular
Browse files Browse the repository at this point in the history
Add support for modular build structure.
  • Loading branch information
djowel authored Aug 22, 2024
2 parents 52c8d66 + 1bbea78 commit 154e6b9
Show file tree
Hide file tree
Showing 17 changed files with 133 additions and 82 deletions.
58 changes: 50 additions & 8 deletions Jamfile → build.jam
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#==============================================================================
# Copyright (c) 2021 Nikita Kniazev
#
# Use, modification and distribution is subject to 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)
#==============================================================================
# Copyright René Ferdinand Rivera Morell 2023-2024
# Copyright (c) 2021 Nikita Kniazev
# 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 feature ;

Expand All @@ -14,7 +14,40 @@ if ! [ feature.valid known-warnings ] {

local 9.0-14.0 = 9.0 10.0 11.0 12.0 14.0 ;

project spirit
constant boost_dependencies :
/boost/array//boost_array
/boost/assert//boost_assert
/boost/config//boost_config
/boost/core//boost_core
/boost/endian//boost_endian
/boost/function//boost_function
/boost/function_types//boost_function_types
/boost/fusion//boost_fusion
/boost/integer//boost_integer
/boost/io//boost_io
/boost/iterator//boost_iterator
/boost/move//boost_move
/boost/mpl//boost_mpl
/boost/optional//boost_optional
/boost/phoenix//boost_phoenix
/boost/pool//boost_pool
/boost/preprocessor//boost_preprocessor
/boost/proto//boost_proto
/boost/range//boost_range
/boost/regex//boost_regex
/boost/smart_ptr//boost_smart_ptr
/boost/static_assert//boost_static_assert
/boost/thread//boost_thread
/boost/throw_exception//boost_throw_exception
/boost/type_traits//boost_type_traits
/boost/typeof//boost_typeof
/boost/unordered//boost_unordered
/boost/utility//boost_utility
/boost/variant//boost_variant ;

project /boost/spirit
: common-requirements
<include>include
: requirements
# Warnings that we have not managed to fix yet
<known-warnings>hide,<toolset>msvc:<cxxflags>-wd4244 # conversion from 'T' to 'U', possible loss of data
Expand All @@ -34,3 +67,12 @@ project spirit
<known-warnings>hide,<toolset>msvc-$(9.0-14.0):<cxxflags>-wd4512 # assignment operator could not be generated
<known-warnings>hide,<toolset>msvc-$(9.0-14.0):<cxxflags>-wd4714 # function 'x' marked as __forceinline not inlined
;

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

call-if : boost-library spirit
;

5 changes: 3 additions & 2 deletions classic/test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================

import-search /boost/config/checks ;
import config : requires ;

###############################################################################
Expand Down Expand Up @@ -41,7 +42,7 @@ explicit pch pch-dbg ;
rule spirit-run ( sources + : args * : input-files * : requirements * : name ? : default-build * )
{
name ?= $(sources[1]:D=:S=) ;
return
return
[ run $(sources) : $(args) : $(input-files) : $(requirements)
<pch>on-spirit:<source>pch : $(name)
: $(default-build) ]
Expand Down Expand Up @@ -210,6 +211,6 @@ local multi-threading = <library>boost_thread
[ compile typeof_support/typeof_symbols.cpp ]
[ compile typeof_support/typeof_tree.cpp ]
[ compile typeof_support/typeof_utility.cpp ]
;
;


4 changes: 3 additions & 1 deletion example/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

# build all examples

local examples = [ glob-tree [jJ]amfile [jJ]amfile.v2 ] ;
project : requirements <library>/boost/spirit//boost_spirit ;

local examples = [ glob-tree "[jJ]amfile" "[jJ]amfile.v2" ] ;

for local ex in $(examples) {
local dir = $(ex:P) ;
Expand Down
6 changes: 3 additions & 3 deletions example/karma/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ project spirit-karma-example
:
;

exe actions_example : actions.cpp ;
exe actions_example : actions.cpp /boost/lambda//boost_lambda ;
exe auto_facilities : auto_facilities.cpp ;
exe basic_facilities : basic_facilities.cpp /boost//date_time ;
exe basic_facilities : basic_facilities.cpp /boost/date_time//boost_date_time /boost/tokenizer//boost_tokenizer ;
exe karma_calc2_ast_dump : calc2_ast_dump.cpp ;
exe karma_calc2_ast_rpn : calc2_ast_rpn.cpp ;
exe karma_calc2_ast_vm : calc2_ast_vm.cpp ;
Expand All @@ -31,7 +31,7 @@ exe mini_xml_karma : mini_xml_karma.cpp ;
exe printf_style_double_format : printf_style_double_format.cpp ;
exe quick_start1 : quick_start1.cpp ;
exe karma_reference : reference.cpp ;
exe karma_reorder_struct : reorder_struct.cpp ;
exe karma_reorder_struct : reorder_struct.cpp /boost/assign//boost_assign ;
exe karma_escaped_string : escaped_string.cpp ;
exe simple_columns_directive : simple_columns_directive.cpp ;
exe quoted_strings : quoted_strings.cpp ;
Expand Down
2 changes: 1 addition & 1 deletion example/lex/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ exe print_number_tokenids : print_number_tokenids.cpp ;
exe word_count : word_count.cpp ;
exe word_count_functor : word_count_functor.cpp ;
exe word_count_lexer : word_count_lexer.cpp ;
exe word_count_functor_flex : word_count_functor_flex.cpp ;
exe word_count_functor_flex : word_count_functor_flex.cpp /boost/timer//boost_timer ;
exe strip_comments : strip_comments.cpp ;
exe strip_comments_lexer : strip_comments_lexer.cpp ;
exe custom_token_attribute : custom_token_attribute.cpp ;
Expand Down
12 changes: 6 additions & 6 deletions example/qi/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ project spirit-qi-example
:
;

exe actions_ : actions.cpp ;
exe actions_ : actions.cpp /boost/lambda//boost_lambda ;
exe sum : sum.cpp ;
exe complex_number : complex_number.cpp ;
exe employee : employee.cpp ;
exe roman : roman.cpp ;
exe reference : reference.cpp ;
exe mini_xml1 : mini_xml1.cpp ;
exe mini_xml2 : mini_xml2.cpp ;
exe mini_xml3 : mini_xml3.cpp ;
exe mini_xml1 : mini_xml1.cpp /boost/foreach//boost_foreach ;
exe mini_xml2 : mini_xml2.cpp /boost/foreach//boost_foreach ;
exe mini_xml3 : mini_xml3.cpp /boost/foreach//boost_foreach ;
exe num_list1 : num_list1.cpp ;
exe num_list2 : num_list2.cpp ;
exe num_list3 : num_list3.cpp ;
exe num_list4 : num_list4.cpp ;
exe reorder_struct : reorder_struct.cpp ;
exe reorder_struct : reorder_struct.cpp /boost/foreach//boost_foreach ;
exe parse_date : parse_date.cpp ;
exe expect : expect.cpp ;
exe expect : expect.cpp /boost/foreach//boost_foreach ;

exe key_value_sequence : key_value_sequence.cpp ;
exe key_value_sequence_ordered : key_value_sequence_ordered.cpp ;
Expand Down
31 changes: 18 additions & 13 deletions example/qi/compiler_tutorial/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,60 @@ project spirit-qi-compiler_tutorial

import modules ;

exe calc1 : calc1.cpp ;
exe calc2 : calc2.cpp ;
exe calc3 : calc3.cpp ;
exe calc4 : calc4.cpp ;
exe calc5 : calc5.cpp ;
exe calc6 : calc6.cpp ;

exe calc7 :
exe calc1_exe : calc1.cpp ;
exe calc2_exe : calc2.cpp ;
exe calc3_exe : calc3.cpp ;
exe calc4_exe : calc4.cpp /boost/foreach//boost_foreach ;
exe calc5_exe : calc5.cpp /boost/foreach//boost_foreach ;
exe calc6_exe : calc6.cpp /boost/foreach//boost_foreach ;

exe calc7_exe :
calc7/vm.cpp
calc7/compiler.cpp
calc7/expression.cpp
calc7/statement.cpp
calc7/main.cpp
/boost/foreach//boost_foreach
;

exe calc8 :
exe calc8_exe :
calc8/vm.cpp
calc8/compiler.cpp
calc8/expression.cpp
calc8/statement.cpp
calc8/main.cpp
/boost/foreach//boost_foreach
;

exe mini_c :
exe mini_c_exe :
mini_c/vm.cpp
mini_c/compiler.cpp
mini_c/expression.cpp
mini_c/statement.cpp
mini_c/function.cpp
mini_c/main.cpp
/boost/foreach//boost_foreach
;

exe conjure1 :
exe conjure1_exe :
conjure1/vm.cpp
conjure1/compiler.cpp
conjure1/expression.cpp
conjure1/statement.cpp
conjure1/function.cpp
conjure1/main.cpp
/boost/foreach//boost_foreach
;

exe conjure2 :
exe conjure2_exe :
conjure2/compiler.cpp
conjure2/expression.cpp
conjure2/function.cpp
conjure2/lexer.cpp
conjure2/main.cpp
conjure2/statement.cpp
conjure2/vm.cpp
/boost/foreach//boost_foreach
;

#==============================================================================
Expand Down Expand Up @@ -117,7 +122,7 @@ if $(LLVM_PATH)
build_exe_1 $(target-name) : $(sources) : <variant>release ;
}

build_exe conjure3 :
build_exe conjure3_exe :
conjure3/compiler.cpp
conjure3/expression.cpp
conjure3/function.cpp
Expand Down
5 changes: 3 additions & 2 deletions example/x3/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# 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-search /boost/config/checks ;
import config : requires ;

project spirit-x3-example
Expand Down Expand Up @@ -47,7 +48,7 @@ exe x3_calc7 :
;

exe x3_calc8 :
/boost//filesystem
/boost/filesystem//boost_filesystem
calc/calc8/vm.cpp
calc/calc8/compiler.cpp
calc/calc8/expression.cpp
Expand All @@ -56,7 +57,7 @@ exe x3_calc8 :
;

exe x3_calc9 :
/boost//filesystem
/boost/filesystem//boost_filesystem
calc/calc9/vm.cpp
calc/calc9/compiler.cpp
calc/calc9/expression.cpp
Expand Down
1 change: 0 additions & 1 deletion example/x3/rexpr/rexpr_full/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
project spirit-x3-example-rexpr
: requirements
<c++-template-depth>512
<use>/boost//headers
<define>BOOST_SPIRIT_X3_NO_FILESYSTEM
<include>.
;
Expand Down
4 changes: 2 additions & 2 deletions example/x3/rexpr/rexpr_full/test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import testing ;
project
: requirements
<source>..//rexpr
<source>/boost//regex
<source>/boost//filesystem
<library>/boost/regex//boost_regex
<library>/boost/filesystem//boost_filesystem
<c++-template-depth>300
;

Expand Down
36 changes: 17 additions & 19 deletions repository/test/test_headers/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,19 @@ import print ;
import sequence ;
import feature ;

project boost/spirit/repository/test/test_headers
: requirements
<include>$(BOOST_ROOT)
<include>../../../../..
project boost/spirit/repository/test/test_headers
: requirements
<c++-template-depth>300
;

headers =
[
path.glob-tree ../../../../../boost/spirit/repository/include : *.hpp
headers =
[
path.glob-tree ../../../include/boost/spirit/repository/include : *.hpp
] ;

main_headers =
[
path.glob-tree ../../../../../boost/spirit/include : *.hpp : classic* phoenix1*
main_headers =
[
path.glob-tree ../../../include/boost/spirit/include : *.hpp : classic* phoenix1*
] ;

for local file in $(headers)
Expand All @@ -40,7 +38,7 @@ for local file in $(headers)
<define>BOOST_SPIRIT_HEADER_NAME=$(file)
<dependency>$(file)
: # test name
[ regex.replace [ path.relative-to ../../../../../boost/spirit/repository $(file) ] "/" "_" ]
[ regex.replace [ path.relative-to ../../../include/boost/spirit/repository $(file) ] "/" "_" ]
;
}

Expand All @@ -63,19 +61,19 @@ rule generate-include-all ( target : sources * : properties * )

}

make auto_all1.cpp
make auto_all1.cpp
: $(headers) $(main_headers)
: @generate-include-all
: @generate-include-all
;

make auto_all2.cpp
make auto_all2.cpp
: $(headers) $(main_headers)
: @generate-include-all
: <generate-include-all-order>reverse
: @generate-include-all
: <generate-include-all-order>reverse
;

# this ought to catch non-inlined functions and other duplicate definitions
link auto_all1.cpp auto_all2.cpp main.cpp
: <include>.
: auto_all_headers
link auto_all1.cpp auto_all2.cpp main.cpp
: <include>.
: auto_all_headers
;
2 changes: 2 additions & 0 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# http://www.boost.org/LICENSE_1_0.txt)
#==============================================================================

project : requirements <library>/boost/spirit//boost_spirit ;

build-project karma ;
build-project lex ;
build-project qi ;
Expand Down
Loading

0 comments on commit 154e6b9

Please sign in to comment.