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. #2905

Merged
merged 29 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f311975
Use beast exclusive valgrind feature.
grafikrobot Feb 29, 2024
3838865
Make the library modular usable.
grafikrobot Mar 11, 2024
6e29e5d
Sync from upstream.
grafikrobot Mar 16, 2024
8d7f8a3
Sync from upstream.
grafikrobot Mar 23, 2024
2216f7d
Switch to library requirements instead of source. As source puts extr…
grafikrobot Mar 30, 2024
48f5687
Sync from upstream.
grafikrobot Apr 10, 2024
c54078b
Add Beast root dir for includes. As some tests refer to files relativ…
grafikrobot Apr 26, 2024
13c8a30
Replace relative docca refs with project based.
grafikrobot Apr 27, 2024
c60fcb7
Avoid mtuliple openssl configurations.
grafikrobot May 4, 2024
a270ae0
Always declare openssl. If it's empty and duplicate it will be ignored.
grafikrobot May 4, 2024
84be4f2
Add missing import-search for cconfig/predef checks.
grafikrobot May 5, 2024
9095950
Add requires-b2 check to top-level build file.
grafikrobot May 5, 2024
1bc51a3
Sync from upstream.
grafikrobot May 11, 2024
9f90276
Sync from upstream.
grafikrobot May 12, 2024
db9bd83
Sync from upstream.
grafikrobot May 16, 2024
c8e47c2
Sync from upstream.
grafikrobot May 20, 2024
721e793
Sync from upstream.
grafikrobot May 30, 2024
47e5fa0
Sync from upstream.
grafikrobot Jun 2, 2024
1b54986
Sync from upstream.
grafikrobot Jun 11, 2024
1ae38cd
Bump B2 require to 5.2
grafikrobot Jun 14, 2024
b6ebda3
Sync from upstream.
grafikrobot Jul 12, 2024
11c8e83
Sync from upstream.
grafikrobot Jul 18, 2024
e81bad5
Update copyright dates.
grafikrobot Jul 21, 2024
d37e52f
Move inter-lib dependencies to a project variable and into the build …
grafikrobot Jul 24, 2024
3bc6e2e
Update build deps.
grafikrobot Jul 30, 2024
cbd06c4
Sync from upstream.
grafikrobot Aug 9, 2024
ec909c9
Update build deps.
grafikrobot Aug 12, 2024
415693a
Sync from upstream.
grafikrobot Aug 22, 2024
15a19f6
The http/client/body example uses the source header from json instead…
grafikrobot Aug 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 0 additions & 136 deletions Jamfile

This file was deleted.

74 changes: 74 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# 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 feature ;

constant boost_dependencies :
/boost/asio//boost_asio
/boost/assert//boost_assert
/boost/bind//boost_bind
/boost/config//boost_config
/boost/container//boost_container
/boost/container_hash//boost_container_hash
/boost/core//boost_core
/boost/endian//boost_endian
/boost/intrusive//boost_intrusive
/boost/logic//boost_logic
/boost/mp11//boost_mp11
/boost/optional//boost_optional
/boost/preprocessor//boost_preprocessor
/boost/smart_ptr//boost_smart_ptr
/boost/static_assert//boost_static_assert
/boost/static_string//boost_static_string
/boost/system//boost_system
/boost/throw_exception//boost_throw_exception
/boost/type_index//boost_type_index
/boost/type_traits//boost_type_traits
/boost/winapi//boost_winapi ;

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

explicit
[ alias boost_beast : build//boost_beast ]
[ alias boost_beast_asio : build//boost_beast_asio ]
[ alias boost_beast_asio_ssl : build//boost_beast_asio_ssl ]
[ alias all : boost_beast boost_beast_asio boost_beast_asio_ssl example test ]
# Old-style targets. Remove once the rest of Beast changes.
[ alias lib-beast : boost_beast ]
[ alias lib-asio : boost_beast_asio ]
[ alias lib-asio-ssl : boost_beast_asio_ssl ]
;

call-if : boost-library beast
: install boost_beast boost_beast_asio boost_beast_asio_ssl
;

feature.feature boost.beast.allow-deprecated : on off : propagated ;
feature.feature boost.beast.separate-compilation : on off : propagated ;
feature.feature boost.beast.valgrind : on off : optional propagated ;

variant beast_coverage
: debug
: <cxxflags>"-msse4.2 --coverage"
<linkflags>"--coverage"
;

variant beast_valgrind
: release
: <boost.beast.valgrind>on
;

variant beast_ubasan
: release
: <cxxflags>"-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize-recover=address,undefined -fsanitize-blacklist=libs/beast/tools/blacklist.supp"
<linkflags>"-fsanitize=address,undefined"
<define>BOOST_USE_ASAN=1
;

99 changes: 99 additions & 0 deletions build/Jamfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# 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 ac ;
import-search /boost/config/checks ;
import config : requires ;
import os ;
import path ;

local openssl-root ;
if [ os.on-windows ]
{
openssl-root ?= [ os.environ OPENSSL_ROOT ] ;
if ! $(openssl-root) && [ path.glob "C:/OpenSSL" : lib include ]
{
openssl-root = "C:/OpenSSL" ;
}
}
grafikrobot marked this conversation as resolved.
Show resolved Hide resolved
using openssl : : <search>$(openssl-root)/lib <include>$(openssl-root)/include ;

project
: source-location ../test
: common-requirements
<library>$(boost_dependencies)
[ requires
cxx11_constexpr
cxx11_decltype
cxx11_hdr_tuple
cxx11_template_aliases
cxx11_variadic_templates
]
<define>BOOST_ALL_NO_LIB=1
<define>BOOST_ASIO_SEPARATE_COMPILATION
<define>BOOST_ASIO_NO_DEPRECATED=1
<define>BOOST_ASIO_DISABLE_BOOST_ARRAY=1
<define>BOOST_ASIO_DISABLE_BOOST_BIND=1
<define>BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1
<define>BOOST_ASIO_DISABLE_BOOST_REGEX=1
<define>BOOST_COROUTINES_NO_DEPRECATION_WARNING=1
<toolset>msvc:<cxxflags>"/bigobj"
<toolset>msvc-14.1:<cxxflags>"/permissive-"
<toolset>msvc-14.2:<cxxflags>"/permissive-"
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS=1
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS=1
<toolset>msvc:<define>_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING
<toolset>msvc:<define>_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING
<toolset>msvc,<variant>release:<cxxflags>"/Ob2 /Oi /Ot"
<target-os>linux:<define>_XOPEN_SOURCE=600
<target-os>linux:<define>_GNU_SOURCE=1
<target-os>solaris:<define>_XOPEN_SOURCE=500
<target-os>solaris:<define>__EXTENSIONS__
<target-os>solaris:<library>socket
<target-os>solaris:<library>nsl
<target-os>windows:<define>_WIN32_WINNT=0x0601
<target-os>windows,<toolset>gcc:<library>ws2_32
<target-os>windows,<toolset>gcc:<library>mswsock
<target-os>windows,<toolset>gcc-cygwin:<define>__USE_W32_SOCKETS
<target-os>hpux,<toolset>gcc:<define>_XOPEN_SOURCE_EXTENDED
<target-os>hpux:<library>ipv6
<target-os>qnxnto:<library>socket
<target-os>haiku:<library>network
<boost.beast.valgrind>on:<define>BOOST_USE_VALGRIND
<boost.beast.allow-deprecated>on:<define>BOOST_BEAST_ALLOW_DEPRECATED
<boost.beast.separate-compilation>on:<define>BOOST_BEAST_SEPARATE_COMPILATION
;

explicit
[ searched-lib socket ] # SOLARIS, QNXNTO
[ searched-lib nsl ] # SOLARIS
[ searched-lib ws2_32 : : <target-os>windows ] # NT
[ searched-lib mswsock : : <target-os>windows ] # NT
[ searched-lib ipv6 ] # HPUX
[ searched-lib network ] # HAIKU
;

lib boost_beast_asio
: lib_asio.cpp
: requirements
<link>static
;

lib boost_beast_asio_ssl
: lib_asio_ssl.cpp
: requirements
<link>static
[ ac.check-library /openssl//ssl : <library>/openssl//ssl/<link>shared : <build>no ]
[ ac.check-library /openssl//crypto : <library>/openssl//crypto/<link>shared : <build>no ]
: usage-requirements
[ ac.check-library /openssl//ssl : <library>/openssl//ssl/<link>shared : <build>no ]
[ ac.check-library /openssl//crypto : <library>/openssl//crypto/<link>shared : <build>no ]
;

lib boost_beast
: lib_beast.cpp
: requirements
<link>static
;
3 changes: 2 additions & 1 deletion doc/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ project beast/doc ;

import boostbook ;
import type ;
import ../../../tools/docca/docca.jam ;
import-search /boost/docca ;
import docca ;


if ! [ type.registered IPP ]
Expand Down
4 changes: 3 additions & 1 deletion example/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
#

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

project /boost/beast/example
: requirements
Expand All @@ -22,6 +23,7 @@ project /boost/beast/example
]
<library>/boost/beast//lib-asio/<link>static
<boost.beast.separate-compilation>on:<library>/boost/beast//lib-beast/<link>static
<include>..
;

build-project advanced ;
Expand Down
1 change: 1 addition & 0 deletions example/advanced/server-flex-awaitable/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import ac ;
project
: requirements
[ ac.check-library /boost/beast//lib-asio-ssl : <library>/boost/beast//lib-asio-ssl/<link>static : <build>no ]
<library>/boost/scope//boost_scope
;

exe advanced-server-flex-awaitable :
Expand Down
1 change: 1 addition & 0 deletions example/http/client/body/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ exe json_client : json_client.cpp
:
<variant>coverage:<build>no
<variant>ubasan:<build>no
<use>/boost/json//boost_json
Copy link
Collaborator

@ashtum ashtum Sep 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still passes -DBOOST_JSON_DYN_LINK=1:

 cl /Zm800 -nologo "json_client.cpp" -c -Fo"..\..\..\..\..\..\bin.v2\libs\beast\example\http\client\body\msvc-14.3\debug\x86_64\threading-multi\json_client.obj"     -TP /wd4675 /EHs /GR /Zc:throwingNew /Z7 /Od /Ob0 /W3 /MDd /Zc:forScope /Zc:wchar_t /Zc:inline /favor:blend /bigobj -DBOOST_ALL_NO_LIB=1 -DBOOST_ASIO_DISABLE_BOOST_ARRAY=1 -DBOOST_ASIO_DISABLE_BOOST_BIND=1 -DBOOST_ASIO_DISABLE_BOOST_DATE_TIME=1 -DBOOST_ASIO_DISABLE_BOOST_REGEX=1 -DBOOST_ASIO_NO_DEPRECATED=1 -DBOOST_ASIO_SEPARATE_COMPILATION -DBOOST_BEAST_ALLOW_DEPRECATED -DBOOST_BEAST_SEPARATE_COMPILATION -DBOOST_COBALT_USE_STD_PMR=1 -DBOOST_CONTAINER_DYN_LINK=1 -DBOOST_CONTAINER_NO_LIB=1 -DBOOST_COROUTINES_NO_DEPRECATION_WARNING=1 -DBOOST_JSON_DYN_LINK=1 -D_CRT_SECURE_NO_WARNINGS=1 -D_SCL_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS=1 -D_SILENCE_CXX17_ADAPTOR_TYPEDEFS_DEPRECATION_WARNING -D_SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING -D_WIN32_WINNT=0x0601 "-I..\..\..\..\..\.." "-I..\..\..\..\..\..\libs\beast" "-IC:\Users\win\Desktop\boost\libs\assert\include" "-IC:\Users\win\Desktop\boost\libs\container\include" "-IC:\Users\win\Desktop\boost\libs\intrusive\include" "-IC:\Users\win\Desktop\boost\libs\move\include"

And the same link errrors:

C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(31): warning C4273: 'empty_': inconsistent dll linkage
C:\Users\win\Desktop\boost\boost/json/array.hpp(96): note: see previous definition of 'empty_'
C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(31): error C2491: 'boost::json::array::empty_': definition of dllimport static data member not allowed
C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(36): warning C4273: 'boost::json::array::table::allocate': inconsistent dll linkage
C:\Users\win\Desktop\boost\boost/json/impl/array.hpp(42): note: see previous definition of 'boost::json::array::table::allocate'
C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(60): warning C4273: 'boost::json::array::table::deallocate': inconsistent dll linkage
C:\Users\win\Desktop\boost\boost/json/impl/array.hpp(49): note: see previous definition of 'boost::json::array::table::deallocate'
C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(76): warning C4273: 'boost::json::array::revert_insert::revert_insert': inconsistent dll linkage
C:\Users\win\Desktop\boost\boost/json/impl/array.hpp(93): note: see previous definition of 'boost::json::array::revert_insert::revert_insert'
C:\Users\win\Desktop\boost\boost/json/impl/array.ipp(128): warning C4273: 'boost::json::array::revert_insert::~revert_insert': inconsistent dll linkage
C:\Users\win\Desktop\boost\boost/json/impl/array.hpp(100): note: see previous definition of 'boost::json::array::revert_insert::~revert_insert'

;
26 changes: 13 additions & 13 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,8 @@
#

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

lib lib-test
: lib_test.cpp
: requirements
<link>static
$(defines)
: usage-requirements
<include>./extras/include
$(defines)
;
import-search /boost/config/checks ;
import config : requires ;

project /boost/beast/test
: requirements
Expand All @@ -34,12 +25,21 @@ project /boost/beast/test
<target-os>darwin:<define>Z_HAVE_UNISTD_H=1
<library>/boost/beast//lib-asio/<link>static
<boost.beast.separate-compilation>on:<library>/boost/beast//lib-beast/<link>static
<library>/boost/filesystem//boost_filesystem
<library>/boost/context//boost_context
<library>/boost/filesystem//boost_filesystem/<link>static
<library>/boost/context//boost_context/<link>static
<address-sanitizer>norecover:<context-impl>ucontext
<address-sanitizer>norecover:<define>BOOST_USE_ASAN=1
<include>..
;

lib lib-test
: lib_test.cpp
: requirements
<link>static
: usage-requirements
<include>extras/include
;

lib lib-zlib :
extern/zlib-1.2.12/adler32.c
extern/zlib-1.2.12/compress.c
Expand Down
Loading
Loading