Skip to content

Commit feb3c01

Browse files
authored
Merge pull request libbitcoin#1776 from evoskuil/master
Move boost config into source except WITH_ICU for *nix.
2 parents 1b8230b + 7ee5898 commit feb3c01

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

builds/cmake/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,12 @@ set( with-tests "yes" CACHE BOOL "Compile with unit tests." )
148148
#------------------------------------------------------------------------------
149149
set( with-examples "yes" CACHE BOOL "Compile with examples." )
150150

151-
# Implement -Dwith-icu and define BOOST_HAS_ICU and output ${icu}.
151+
# Implement -Dwith-icu and define WITH_ICU and output ${icu}.
152152
#------------------------------------------------------------------------------
153153
set( with-icu "no" CACHE BOOL "Compile with International Components for Unicode." )
154154

155155
if (with-icu)
156-
add_definitions( -DBOOST_HAS_ICU )
156+
add_definitions( -DWITH_ICU )
157157
endif()
158158

159159
if (with-icu)

builds/msvc/vs2022/libbitcoin-system.import.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,9 @@
4646
<ItemDefinitionGroup>
4747
<ClCompile>
4848
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\libbitcoin-system\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
49-
<!-- WITH_ICU always defined in Visual Studio builds. -->
5049
<!-- NOMINMAX enables use of std::min/max without conflict. -->
5150
<!-- WIN32_LEAN_AND_MEAN avoids inclusion of certain headers, winsock.h conflicts with boost and protocol use of winsock2.h. -->
52-
<PreprocessorDefinitions>WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0602;%(PreprocessorDefinitions)</PreprocessorDefinitions>
53-
<!-- Disable auto-linking for all boost-json and its dependency boost-container so they can be header only. -->
54-
<PreprocessorDefinitions>BOOST_JSON_NO_LIB;BOOST_CONTAINER_NO_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
51+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0602;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5552
<PreprocessorDefinitions Condition="'$(Linkage-libbitcoin-system)' == 'static' Or '$(Linkage-libbitcoin-system)' == 'ltcg'">BC_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5653
<PreprocessorDefinitions Condition="$(Configuration.IndexOf('Debug')) != -1">_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
5754
<!-- Enable use of CPU intrinsics. -->

builds/msvc/vs2022/libbitcoin-system/libbitcoin-system.props

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@
1919
<ClCompile>
2020
<AdditionalIncludeDirectories>$(RepoRoot)include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
2121
<EnablePREfast>false</EnablePREfast>
22-
<!-- WITH_ICU always defined in Visual Studio builds. -->
2322
<!-- NOMINMAX enables use of std::min/max without conflict. -->
2423
<!-- WIN32_LEAN_AND_MEAN avoids inclusion of certain headers, winsock.h conflicts with boost and protocol use of winsock2.h. -->
25-
<PreprocessorDefinitions>WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
26-
<!-- Disable auto-linking for all boost-json and its dependency boost-container so they can be header only. -->
27-
<PreprocessorDefinitions>BOOST_JSON_NO_LIB;BOOST_CONTAINER_NO_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
24+
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
2825
<PreprocessorDefinitions Condition="'$(ConfigurationType)' == 'DynamicLibrary'">BC_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
2926
<PreprocessorDefinitions Condition="'$(ConfigurationType)' == 'StaticLibrary'">BC_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
3027
<PreprocessorDefinitions Condition="$(Configuration.IndexOf('Debug')) != -1">_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ AC_ARG_WITH([examples],
109109
AC_MSG_RESULT([$with_examples])
110110
AM_CONDITIONAL([WITH_EXAMPLES], [test x$with_examples != xno])
111111

112-
# Implement --with-icu and define BOOST_HAS_ICU and output ${icu}.
112+
# Implement --with-icu and define WITH_ICU and output ${icu}.
113113
#------------------------------------------------------------------------------
114114
AC_MSG_CHECKING([--with-icu option])
115115
AC_ARG_WITH([icu],
@@ -118,7 +118,7 @@ AC_ARG_WITH([icu],
118118
[with_icu=$withval],
119119
[with_icu=no])
120120
AC_MSG_RESULT([$with_icu])
121-
AS_CASE([${with_icu}], [yes], AC_DEFINE([BOOST_HAS_ICU]))
121+
AS_CASE([${with_icu}], [yes], AC_DEFINE([WITH_ICU]))
122122
AS_CASE([${with_icu}], [yes], AC_SUBST([icu], [-DWITH_ICU]))
123123

124124
# Implement --enable-avx2.

include/bitcoin/system/boost.hpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,40 @@
1919
#ifndef LIBBITCOIN_SYSTEM_BOOST_HPP
2020
#define LIBBITCOIN_SYSTEM_BOOST_HPP
2121

22+
///////////////////////////////////////////////////////////////////////////////
23+
// Include boost only here, so these definitions take hold within boost.
24+
// Dependent projects must include <bitcoin/system.hpp> before any boost.
25+
///////////////////////////////////////////////////////////////////////////////
26+
2227
#include <utility>
2328

2429
// Apply any warning suppressions to boost.
25-
// Any boost includes within headers will not benefit from suppression, as the
26-
// warnings are included by define.hpp which follows boost includes.
2730
#include <bitcoin/system/warnings.hpp>
2831

29-
// Include boost only from here, so this exclusion works.
32+
// Headers only containers.
33+
#define BOOST_CONTAINER_NO_LIB
34+
3035
// Avoid namespace conflict between boost::placeholders and std::placeholders.
3136
// This arises when including <functional>, which declares std::placeholders.
3237
// www.boost.org/doc/libs/1_78_0/boost/bind.hpp
33-
// Include boost only from here, so placeholders exclusion works.
3438
#define BOOST_BIND_NO_PLACEHOLDERS
3539
#include <boost/bind.hpp>
3640

41+
// Include boost only from here, so this definition works.
42+
#if defined(HAVE_ICU)
43+
#define BOOST_HAS_ICU
44+
#endif
45+
#include <boost/locale.hpp>
46+
47+
// address::from_string
48+
////#define BOOST_ASIO_NO_DEPRECATED
3749
#include <boost/asio.hpp>
3850
#include <boost/format.hpp>
3951
#include <boost/iostreams/stream.hpp>
52+
53+
// Headers only json.
54+
#define BOOST_JSON_NO_LIB
4055
#include <boost/json.hpp>
41-
#include <boost/locale.hpp>
4256
#include <boost/multiprecision/cpp_int.hpp>
4357
#include <boost/program_options.hpp>
4458
#include <boost/url.hpp>

0 commit comments

Comments
 (0)