-
Notifications
You must be signed in to change notification settings - Fork 792
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding boost as a submodule rather than requiring it to be provided e…
…xternally. The boost libs are now statically linked to the nano targets so dynamic linking related functionality has been removed. Adding several target link references that were missing but not apparent when using the unified boost install directories Linking to boost stacktrace basic as this is the main functionality we use. Windows Event Log support has been disabled as there is a compatibility issue with GitHub builders Added boost_checkout_lite.sh script which can be used to do a minimal clone of the boost submodule after it's been added but not yet initialized.
- Loading branch information
Showing
19 changed files
with
169 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,6 @@ if(CMAKE_VERSION VERSION_GREATER 3.13 OR CMAKE_VERSION VERSION_EQUAL 3.13) | |
cmake_policy(SET CMP0077 NEW) | ||
endif() | ||
|
||
if(CMAKE_VERSION VERSION_LESS 3.13) | ||
# compatibility for boost import targets use bundled 3.13 FindBoost.cmake | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/legacyModules") | ||
endif() | ||
|
||
# compatibility for osx sierra and on needs to be set before project | ||
set(CMAKE_OSX_DEPLOYMENT_TARGET | ||
10.14 | ||
|
@@ -65,8 +60,7 @@ else() | |
endif() | ||
|
||
if(APPLE) | ||
set(CMAKE_INSTALL_RPATH | ||
"@executable_path/../Frameworks;@executable_path/../boost/lib") | ||
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks") | ||
else() | ||
set(CMAKE_INSTALL_RPATH "$ORIGIN/../lib") | ||
endif() | ||
|
@@ -129,16 +123,6 @@ set(NANO_ROCKSDB_TOOLS | |
OFF | ||
CACHE BOOL "") | ||
|
||
option(NANO_STACKTRACE_BACKTRACE | ||
"Use BOOST_STACKTRACE_USE_BACKTRACE in stacktraces, for POSIX" OFF) | ||
if(NANO_STACKTRACE_BACKTRACE) | ||
add_definitions(-DNANO_STACKTRACE_BACKTRACE=1) | ||
if(BACKTRACE_INCLUDE) | ||
add_definitions( | ||
-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=${BACKTRACE_INCLUDE}) | ||
endif() | ||
endif() | ||
|
||
if(${NANO_TIMED_LOCKS} GREATER 0) | ||
add_definitions(-DNANO_TIMED_LOCKS=${NANO_TIMED_LOCKS}) | ||
add_definitions(-DNANO_TIMED_LOCKS_FILTER=${NANO_TIMED_LOCKS_FILTER}) | ||
|
@@ -360,35 +344,110 @@ else() | |
endif() | ||
|
||
include_directories(${CMAKE_SOURCE_DIR}) | ||
|
||
if(WIN32 | ||
AND NANO_TEST | ||
AND NANO_SHARED_BOOST) | ||
message( | ||
SEND_ERROR | ||
" Linking errors occur if NANO_SHARED_BOOST is used with tests on Windows" | ||
" Disable NANO_SHARED_BOOST or NANO_TEST on Windows") | ||
set(NANO_SHARED_BOOST) | ||
endif() | ||
|
||
set(NANO_SHARED_BOOST | ||
OFF | ||
CACHE BOOL "Build Nano with shared boost") | ||
|
||
if(NANO_SHARED_BOOST) | ||
set(Boost_USE_STATIC_LIBS OFF) | ||
set(Boost_USE_STATIC_RUNTIME OFF) | ||
set(Boost_NO_BOOST_CMAKE ON) | ||
add_definitions(-DBOOST_ALL_DYN_LINK) | ||
else() | ||
set(Boost_USE_STATIC_LIBS ON) | ||
endif() | ||
set(Boost_USE_MULTITHREADED ON) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") | ||
|
||
find_package(Boost 1.81.0 REQUIRED COMPONENTS filesystem log log_setup thread | ||
program_options system) | ||
set(BOOST_MODULE_LIBS | ||
algorithm | ||
align | ||
any | ||
array | ||
asio | ||
assert | ||
atomic | ||
beast | ||
bind | ||
chrono | ||
circular_buffer | ||
concept_check | ||
config | ||
container | ||
container_hash | ||
context | ||
conversion | ||
core | ||
coroutine | ||
date_time | ||
describe | ||
detail | ||
dll | ||
dynamic_bitset | ||
endian | ||
exception | ||
filesystem | ||
foreach | ||
format | ||
function | ||
function_types | ||
functional | ||
fusion | ||
integer | ||
interprocess | ||
intrusive | ||
io | ||
iostreams | ||
iterator | ||
lexical_cast | ||
property_tree | ||
log | ||
logic | ||
math | ||
move | ||
mp11 | ||
mpl | ||
multi_index | ||
multiprecision | ||
numeric/conversion | ||
optional | ||
parameter | ||
phoenix | ||
pool | ||
predef | ||
preprocessor | ||
process | ||
program_options | ||
proto | ||
random | ||
range | ||
ratio | ||
rational | ||
regex | ||
serialization | ||
smart_ptr | ||
spirit | ||
stacktrace | ||
static_assert | ||
static_string | ||
system | ||
thread | ||
throw_exception | ||
tokenizer | ||
tuple | ||
type_index | ||
type_traits | ||
typeof | ||
unordered | ||
utility | ||
variant | ||
variant2 | ||
winapi) | ||
|
||
add_definitions(-DBOOST_ALL_NO_LIB) # Disable automatic boost linking | ||
foreach(lib IN LISTS BOOST_MODULE_LIBS) | ||
add_subdirectory(boost/libs/${lib} EXCLUDE_FROM_ALL) | ||
endforeach() | ||
set(Boost_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/boost/libs/config/include) | ||
include_directories(${BOOST_LIBRARY_INCLUDES}) | ||
add_library(Boost::stacktrace ALIAS boost_stacktrace_basic) | ||
add_definitions(-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED) | ||
|
||
# Workaround for GitHub builders which do not appear to have the Windows Message | ||
# Compiler mc.exe | ||
add_definitions(-DBOOST_LOG_WITHOUT_EVENT_LOG) | ||
|
||
# Workaround for missing reference errata in the boost property_tree module | ||
target_link_libraries(boost_property_tree INTERFACE Boost::any) | ||
target_link_libraries(boost_property_tree INTERFACE Boost::format) | ||
target_link_libraries(boost_property_tree INTERFACE Boost::multi_index) | ||
|
||
# diskhash | ||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") | ||
|
@@ -585,7 +644,6 @@ if(NANO_FUZZER_TEST) | |
endif() | ||
|
||
if(NANO_TEST OR RAIBLOCKS_TEST) | ||
find_package(Boost 1.81.0 REQUIRED COMPONENTS coroutine context) | ||
if(WIN32) | ||
if(MSVC_VERSION) | ||
if(MSVC_VERSION GREATER_EQUAL 1910) | ||
|
@@ -756,16 +814,6 @@ if(NANO_GUI OR RAIBLOCKS_GUI) | |
DESTINATION ${NANO_OSX_PACKAGE_NAME}.app/Contents/Frameworks) | ||
install(FILES "${Qt5_DIR}/../../../plugins/platforms/libqcocoa.dylib" | ||
DESTINATION ${NANO_OSX_PACKAGE_NAME}.app/Contents/PlugIns/platforms) | ||
if(NANO_SHARED_BOOST) | ||
foreach(boost_lib IN LISTS Boost_LIBRARIES) | ||
string(REGEX MATCH "(.+/.*boost_[^-]+)" boost_lib_name ${boost_lib}) | ||
set(boost_dll "${CMAKE_MATCH_1}") | ||
if(${boost_dll} MATCHES "boost") | ||
install(FILES ${boost_dll} | ||
DESTINATION ${NANO_OSX_PACKAGE_NAME}.app/Contents/boost/lib) | ||
endif() | ||
endforeach(boost_lib) | ||
endif() | ||
install(FILES Nano.icns | ||
DESTINATION ${NANO_OSX_PACKAGE_NAME}.app/Contents/Resources) | ||
elseif(WIN32) | ||
|
@@ -794,25 +842,6 @@ if(NANO_GUI OR RAIBLOCKS_GUI) | |
get_filename_component(Qt5_bin_DIR ${Qt5_DIR}/../../../bin ABSOLUTE) | ||
install(TARGETS nano_wallet DESTINATION .) | ||
install(TARGETS nano_wallet_com DESTINATION .) | ||
if(NANO_SHARED_BOOST) | ||
foreach(boost_lib IN LISTS Boost_LIBRARIES) | ||
if(${CMAKE_BUILD_TYPE} MATCHES "Rel") | ||
string(REGEX MATCH "(.+/.*boost_[^-]+-.+-mt-x64.+\)(.lib|a)" | ||
boost_lib_name ${boost_lib}) | ||
set(boost_dll "${CMAKE_MATCH_1}.dll") | ||
if(${boost_dll} MATCHES "boost") | ||
install(FILES ${boost_dll} DESTINATION .) | ||
endif() | ||
else() | ||
string(REGEX MATCH "(.+/.*boost_[^-]+-.+-mt-.+-x64.+\)(.lib|a)" | ||
boost_lib_name ${boost_lib}) | ||
set(boost_dll "${CMAKE_MATCH_1}.dll") | ||
if(${boost_dll} MATCHES "boost") | ||
install(FILES ${boost_dll} DESTINATION .) | ||
endif() | ||
endif() | ||
endforeach(boost_lib) | ||
endif() | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${WIN_REDIST} DESTINATION .) | ||
install(FILES ${Qt5_bin_DIR}/libGLESv2.dll DESTINATION .) | ||
install(FILES ${Qt5_bin_DIR}/Qt5Core.dll DESTINATION .) | ||
|
@@ -826,15 +855,6 @@ if(NANO_GUI OR RAIBLOCKS_GUI) | |
"qt5-default | qtbase5-dev, qtchooser, qt5-qmake, qtbase5-dev-tools") | ||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]") | ||
install(TARGETS nano_wallet RUNTIME DESTINATION ./bin) | ||
if(NANO_SHARED_BOOST) | ||
foreach(boost_lib IN LISTS Boost_LIBRARIES) | ||
string(REGEX MATCH "(.+/.*boost_[^-]+)" boost_lib_name ${boost_lib}) | ||
set(boost_dll "${CMAKE_MATCH_1}.${Boost_VERSION_STRING}") | ||
if(${boost_dll} MATCHES "boost") | ||
install(FILES ${boost_dll} DESTINATION ./lib) | ||
endif() | ||
endforeach(boost_lib) | ||
endif() | ||
set(DEBIAN_POSTINST postinst.in) | ||
set(DEBIAN_POSTRM postrm.in) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
#set -x | ||
#Check out boost submodule with minimum set of modules to reduce size | ||
|
||
# flattened boost libs dependency list | ||
dependencies=("algorithm" "align" "any" "array" "asio" "assert" "atomic" "beast" "bind" "chrono" "circular_buffer" "concept_check" "config" "container" "container_hash" "context" "conversion" "core" "coroutine" "date_time" "describe" "detail" "dll" "dynamic_bitset" "endian" "exception" "filesystem" "foreach" "format" "function" "function_types" "functional" "fusion" "integer" "interprocess" "intrusive" "io" "iostreams" "iterator" "lexical_cast" "log" "logic" "math" "move" "mp11" "mpl" "multi_index" "multiprecision" "numeric_conversion" "optional" "parameter" "phoenix" "pool" "predef" "preprocessor" "process" "program_options" "property_tree" "proto" "random" "range" "ratio" "rational" "regex" "serialization" "smart_ptr" "spirit" "stacktrace" "static_assert" "static_string" "system" "thread" "throw_exception" "tokenizer" "tuple" "type_index" "type_traits" "typeof" "unordered" "utility" "variant" "variant2" "winapi") | ||
|
||
git submodule init boost | ||
cd boost | ||
# deactivate all boost submodules | ||
git submodule foreach 'git config submodule.$sm_path.active false' | ||
# selectivly activate required dependencies | ||
for i in ${dependencies[@]} | ||
do | ||
git config submodule.$i.active true | ||
done | ||
cd .. | ||
# Update all submodules recursivly. Deactivated modules will be skipped by --recursive | ||
git submodule update --jobs 16 --recursive --recommend-shallow --single-branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,4 +26,4 @@ set exit_code=%errorlevel% | |
goto exit | ||
|
||
:exit | ||
exit /B %exit_code% | ||
exit /B %exit_code% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.