diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e6335e697..e32944c81a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,28 +18,28 @@ jobs: matrix: include: - os: ubuntu-22.04 - cxx: "clang++-14" + cxx: "clang++-15" link: "dynamic" - optimization: "size" + optimization: "debug" assert: "debug" coverage: "nocov" boost: "--build-boost" icu: "" - cc: "clang-14" - flags: "-Os -fPIE" + cc: "clang-15" + flags: "-Og -fPIE" options: "--enable-isystem --enable-avx2 --enable-sse4" packager: "apt" packages: "" - os: ubuntu-22.04 - cxx: "clang++-14" + cxx: "clang++-15" link: "static" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" - cc: "clang-14" + cc: "clang-15" flags: "-Os -fPIE" options: "--enable-isystem --enable-avx2" packager: "apt" @@ -62,40 +62,40 @@ jobs: - os: ubuntu-22.04 cxx: "g++-11" link: "static" - optimization: "debug" + optimization: "size" assert: "ndebug" coverage: "cov" boost: "--build-boost" icu: "--build-icu --with-icu" cc: "gcc-11" - flags: "-Og -g --coverage -fPIE" - options: "--enable-isystem --enable-avx512" + flags: "-Os -g --coverage -fPIE" + options: "--enable-isystem" packager: "apt" packages: "lcov" - os: macos-latest - cxx: "clang++-14" + cxx: "clang++" link: "dynamic" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--with-icu" - cc: "clang-14" + cc: "clang" flags: "-Os -fPIE" options: "--enable-isystem" packager: "brew" packages: "icu4c" - os: macos-latest - cxx: "clang++-14" + cxx: "clang++" link: "static" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" - cc: "clang-14" + cc: "clang" flags: "-Os -fvisibility=hidden -fPIE" options: "--enable-isystem" packager: "brew" @@ -113,7 +113,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare toolchain [generic] run: | @@ -134,7 +134,7 @@ jobs: shell: bash run: | WORKSPACE_SUBPATH="${GITHUB_WORKSPACE%libbitcoin-system}" - echo "LIBBITCOIN_SRC_PATH=$WORKSPACE_SUBPATH" >> $GITHUB_ENV + echo "LIBBITCOIN_SRC_PATH=${WORKSPACE_SUBPATH}" >> $GITHUB_ENV if [[ ${{ matrix.assert }} == 'ndebug' ]]; then echo "ASSERT_NDEBUG=--enable-ndebug" >> $GITHUB_ENV else @@ -146,9 +146,15 @@ jobs: echo "LINKAGE=--disable-shared" >> $GITHUB_ENV fi if [[ ${{ matrix.link }} == 'dynamic' ]]; then - echo "LDFLAGS=-Wl,-rpath,$WORKSPACE_SUBPATH/prefix/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${WORKSPACE_SUBPATH}prefix/lib" >> $GITHUB_ENV fi + - name: Display Compiler details + shell: bash + run: | + ${CC} -v + ${CXX} -v + - name: Display CPU details if: ${{ (runner.os == 'Linux') }} shell: bash @@ -158,8 +164,8 @@ jobs: - name: Execute install.sh run: > ./install.sh - --build-dir=$LIBBITCOIN_SRC_PATH ${{ matrix.options }} - --prefix=$LIBBITCOIN_SRC_PATH/prefix + --build-dir=${{ env.LIBBITCOIN_SRC_PATH }} ${{ matrix.options }} + --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix ${{ env.LINKAGE }} ${{ env.ASSERT_NDEBUG }} ${{ matrix.boost }} @@ -235,28 +241,28 @@ jobs: matrix: include: - os: ubuntu-22.04 - cxx: "clang++-14" + cxx: "clang++-15" link: "dynamic" - optimization: "size" + optimization: "debug" assert: "debug" coverage: "nocov" boost: "--build-boost" icu: "" - cc: "clang-14" - flags: "-Os -fPIE" + cc: "clang-15" + flags: "-Og -fPIE" options: "-Denable-avx2=on -Denable-sse4=on" packager: "apt" packages: "" - os: ubuntu-22.04 - cxx: "clang++-14" + cxx: "clang++-15" link: "static" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" - cc: "clang-14" + cc: "clang-15" flags: "-Os -fPIE" options: "-Denable-avx2=on" packager: "apt" @@ -279,40 +285,40 @@ jobs: - os: ubuntu-22.04 cxx: "g++-11" link: "static" - optimization: "debug" + optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" cc: "gcc-11" - flags: "-Og -fPIE" - options: "-Denable-avx512=on" + flags: "-Os -fPIE" + options: "" packager: "apt" packages: "" - os: macos-latest - cxx: "clang++-14" + cxx: "clang++" link: "dynamic" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--with-icu" - cc: "clang-14" + cc: "clang" flags: "-Os -fPIE" options: "" packager: "brew" packages: "icu4c" - os: macos-latest - cxx: "clang++-14" + cxx: "clang++" link: "static" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" - cc: "clang-14" + cc: "clang" flags: "-Os -fvisibility=hidden -fPIE" options: "" packager: "brew" @@ -330,7 +336,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare toolchain [generic] run: | @@ -351,7 +357,7 @@ jobs: shell: bash run: | WORKSPACE_SUBPATH="${GITHUB_WORKSPACE%libbitcoin-system}" - echo "LIBBITCOIN_SRC_PATH=$WORKSPACE_SUBPATH" >> $GITHUB_ENV + echo "LIBBITCOIN_SRC_PATH=${WORKSPACE_SUBPATH}" >> $GITHUB_ENV if [[ ${{ matrix.packager }} == 'brew' ]]; then echo "CMAKE_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV fi @@ -366,9 +372,15 @@ jobs: echo "LINKAGE=--disable-shared" >> $GITHUB_ENV fi if [[ ${{ matrix.link }} == 'dynamic' ]]; then - echo "LDFLAGS=-Wl,-rpath,$WORKSPACE_SUBPATH/prefix/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${WORKSPACE_SUBPATH}prefix/lib" >> $GITHUB_ENV fi + - name: Display Compiler details + shell: bash + run: | + ${CC} -v + ${CXX} -v + - name: Display CPU details if: ${{ (runner.os == 'Linux') }} shell: bash @@ -378,8 +390,8 @@ jobs: - name: Execute install-cmake.sh run: > ./install-cmake.sh - --build-dir=$LIBBITCOIN_SRC_PATH ${{ matrix.options }} - --prefix=$LIBBITCOIN_SRC_PATH/prefix + --build-dir=${{ env.LIBBITCOIN_SRC_PATH }} ${{ matrix.options }} + --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix ${{ env.LINKAGE }} ${{ env.ASSERT_NDEBUG }} ${{ matrix.boost }} @@ -466,29 +478,29 @@ jobs: include: - os: ubuntu-22.04 preset: "nix-gnu-debug-shared-without_icu" - cxx: "clang++-14" + cxx: "clang++-15" link: "dynamic" - optimization: "size" + optimization: "debug" assert: "debug" coverage: "nocov" boost: "--build-boost" icu: "" - cc: "clang-14" - flags: "-Os -fPIE" + cc: "clang-15" + flags: "-Og -fPIE" options: "-Denable-avx2=on -Denable-sse4=on" packager: "apt" packages: "" - os: ubuntu-22.04 preset: "nix-gnu-release-static-size-with_icu" - cxx: "clang++-14" + cxx: "clang++-15" link: "static" optimization: "size" assert: "ndebug" coverage: "nocov" boost: "--build-boost" icu: "--build-icu --with-icu" - cc: "clang-14" + cc: "clang-15" flags: "-Os -fPIE" options: "-Denable-avx2=on" packager: "apt" @@ -521,7 +533,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Prepare toolchain [generic] run: | @@ -542,7 +554,7 @@ jobs: shell: bash run: | WORKSPACE_SUBPATH="${GITHUB_WORKSPACE%libbitcoin-system}" - echo "LIBBITCOIN_SRC_PATH=$WORKSPACE_SUBPATH" >> $GITHUB_ENV + echo "LIBBITCOIN_SRC_PATH=${WORKSPACE_SUBPATH}" >> $GITHUB_ENV if [[ ${{ matrix.packager }} == 'brew' ]]; then echo "CMAKE_LIBRARY_PATH=/usr/local/lib" >> $GITHUB_ENV fi @@ -557,9 +569,15 @@ jobs: echo "LINKAGE=--disable-shared" >> $GITHUB_ENV fi if [[ ${{ matrix.link }} == 'dynamic' ]]; then - echo "LDFLAGS=-Wl,-rpath,$WORKSPACE_SUBPATH/prefix/${{ matrix.preset }}/lib" >> $GITHUB_ENV + echo "LDFLAGS=-Wl,-rpath,${WORKSPACE_SUBPATH}prefix/${{ matrix.preset }}/lib" >> $GITHUB_ENV fi + - name: Display Compiler details + shell: bash + run: | + ${CC} -v + ${CXX} -v + - name: Display CPU details if: ${{ (runner.os == 'Linux') }} shell: bash @@ -569,8 +587,8 @@ jobs: - name: Execute install-cmakepresets.sh run: > ./install-cmakepresets.sh - --build-dir=$LIBBITCOIN_SRC_PATH ${{ matrix.options }} - --prefix=$LIBBITCOIN_SRC_PATH/prefix/${{ matrix.preset }} + --build-dir=${{ env.LIBBITCOIN_SRC_PATH }} ${{ matrix.options }} + --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix/${{ matrix.preset }} --preset=${{ matrix.preset }} ${{ env.LINKAGE }} ${{ env.ASSERT_NDEBUG }} @@ -688,7 +706,7 @@ jobs: msbuild-architecture: x64 - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize SDK shell: powershell diff --git a/builds/cmake/CMakeLists.txt b/builds/cmake/CMakeLists.txt index 20876439c1..7aeff4b5bb 100644 --- a/builds/cmake/CMakeLists.txt +++ b/builds/cmake/CMakeLists.txt @@ -7,7 +7,7 @@ # libbitcoin-system project configuration. #------------------------------------------------------------------------------ -cmake_minimum_required(VERSION 3.5 FATAL_ERROR) +cmake_minimum_required(VERSION 3.18 FATAL_ERROR) project(libbitcoin-system LANGUAGES C CXX) @@ -18,6 +18,7 @@ include(CheckIncludeFiles) include(CheckSymbolExists) include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) +include(CheckLinkerFlag) set_property(GLOBAL PROPERTY USE_FOLDERS ON) @@ -97,6 +98,14 @@ else() message( FATAL_ERROR "Compiler does not support -Wno-deprecated-copy" ) endif() +# Suppress warning for ignored attributes (arising on template arguments). +check_cxx_compiler_flag( "-Wno-ignored-attributes" HAS_FLAG_WNO-IGNORED-ATTRIBUTES ) +if ( HAS_FLAG_WNO-IGNORED-ATTRIBUTES ) + add_compile_options( "-Wno-ignored-attributes" ) +else() + message( FATAL_ERROR "Compiler does not support -Wno-ignored-attributes" ) +endif() + # Allow use of C99 'long long' type. check_cxx_compiler_flag( "-Wno-long-long" HAS_FLAG_WNO-LONG-LONG ) if ( HAS_FLAG_WNO-LONG-LONG ) @@ -326,11 +335,7 @@ set( boost_system_LIBS "-lboost_system" ) set( boost_thread_LIBS "-lboost_thread" ) set( boost_unit_test_framework_LIBS "-lboost_unit_test_framework" ) -if (enable-ndebug) - set( Boost_LIBRARY_DIR "${Boost_LIBRARY_DIR_DEBUG}" ) -else () - set( Boost_LIBRARY_DIR "${Boost_LIBRARY_DIR_RELEASE}" ) -endif() +set( Boost_LIBRARY_DIR $,"${Boost_LIBRARY_DIR_RELEASE}","${Boost_LIBRARY_DIR_DEBUG}">) set( boost_CPPFLAGS "-I${Boost_INCLUDE_DIR}" ) set( boost_LDFLAGS "-L${Boost_LIBRARY_DIR}" ) @@ -373,81 +378,92 @@ endif() #------------------------------------------------------------------------------ find_package( Secp256K1 0.1.0.20 REQUIRED ) -# Define project common includes directories +# Define project common includes for build. #------------------------------------------------------------------------------ if (BUILD_SHARED_LIBS) - include_directories( SYSTEM - ${Boost_INCLUDE_DIR} - ${pthread_INCLUDE_DIRS} - ${rt_INCLUDE_DIRS} - ${icu_i18n_INCLUDE_DIRS} - ${dl_INCLUDE_DIRS} - ${secp256k1_INCLUDE_DIRS} ) + set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_INCLUDE_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_INCLUDE_DIRS} CACHE STRING "Placeholder" ) else() - include_directories( SYSTEM - ${Boost_INCLUDE_DIR} - ${pthread_INCLUDE_DIRS} - ${rt_INCLUDE_DIRS} - ${icu_i18n_STATIC_INCLUDE_DIRS} - ${dl_INCLUDE_DIRS} - ${secp256k1_STATIC_INCLUDE_DIRS} ) + set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" ) endif() -# Define project common library directories +# Define project common includes directories +#------------------------------------------------------------------------------ +include_directories( SYSTEM + ${Boost_INCLUDE_DIR} + ${pthread_INCLUDE_DIRS} + ${rt_INCLUDE_DIRS} + ${icu_i18n_FOR_BUILD_INCLUDE_DIRS} + ${dl_INCLUDE_DIRS} + ${secp256k1_FOR_BUILD_INCLUDE_DIRS} ) + +# Define project common library directories for build. #------------------------------------------------------------------------------ if (BUILD_SHARED_LIBS) - link_directories( - ${Boost_LIBRARY_DIRS} - ${pthread_LIBRARY_DIRS} - ${rt_LIBRARY_DIRS} - ${icu_i18n_LIBRARY_DIRS} - ${dl_LIBRARY_DIRS} - ${secp256k1_LIBRARY_DIRS} ) + set( icu_i18n_FOR_BUILD_LIBRARY_DIRS ${icu_i18n_LIBRARY_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARY_DIRS ${secp256k1_LIBRARY_DIRS} CACHE STRING "Placeholder" ) else() - link_directories( - ${Boost_LIBRARY_DIRS} - ${pthread_LIBRARY_DIRS} - ${rt_LIBRARY_DIRS} - ${icu_i18n_STATIC_LIBRARY_DIRS} - ${dl_LIBRARY_DIRS} - ${secp256k1_STATIC_LIBRARY_DIRS} ) + set( icu_i18n_FOR_BUILD_LIBRARY_DIRS ${icu_i18n_STATIC_LIBRARY_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARY_DIRS ${secp256k1_STATIC_LIBRARY_DIRS} CACHE STRING "Placeholder" ) +endif() + +# Define project common library directories +#------------------------------------------------------------------------------ +link_directories( + ${Boost_LIBRARY_DIRS} + ${pthread_LIBRARY_DIRS} + ${rt_LIBRARY_DIRS} + ${icu_i18n_FOR_BUILD_LIBRARY_DIRS} + ${dl_LIBRARY_DIRS} + ${secp256k1_FOR_BUILD_LIBRARY_DIRS} ) + +# Define project common linker flags. +#------------------------------------------------------------------------------ +check_linker_flag(CXX "-no_fixup_chains" "no_fixup_chains_FOUND") + +if (no_fixup_chains_FOUND) + add_link_options("-no_fixup_chains") endif() -# Define project common libraries/linker flags. +check_linker_flag(CXX "-fstack-protector" "fstack_protector_FOUND") + +if (fstack_protector_FOUND) + add_link_options("-fstack-protector") +endif() + +check_linker_flag(CXX "-fstack-protector-all" "fstack_protector_all_FOUND") + +if (fstack_protector_all_FOUND) + add_link_options("-fstack-protector-all") +endif() + + +# Define common library usage for build. #------------------------------------------------------------------------------ if (BUILD_SHARED_LIBS) - link_libraries( - "-fstack-protector" - "-fstack-protector-all" - ${Boost_CHRONO_LIBRARY} - ${Boost_IOSTREAMS_LIBRARY} - ${Boost_JSON_LIBRARY} - ${Boost_LOCALE_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_SYSTEM_LIBRARY} - ${Boost_THREAD_LIBRARY} - ${pthread_LIBRARIES} - ${rt_LIBRARIES} - ${icu_i18n_LIBRARIES} - ${dl_LIBRARIES} - ${secp256k1_LIBRARIES} ) + set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_LIBRARIES} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_LIBRARIES} CACHE STRING "Placeholder" ) else() - link_libraries( - "-fstack-protector" - "-fstack-protector-all" - ${Boost_CHRONO_LIBRARY} - ${Boost_IOSTREAMS_LIBRARY} - ${Boost_JSON_LIBRARY} - ${Boost_LOCALE_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_SYSTEM_LIBRARY} - ${Boost_THREAD_LIBRARY} - ${pthread_LIBRARIES} - ${rt_LIBRARIES} - ${icu_i18n_STATIC_LIBRARIES} - ${dl_LIBRARIES} - ${secp256k1_STATIC_LIBRARIES} ) -endif() + set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_STATIC_LIBRARIES} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_STATIC_LIBRARIES} CACHE STRING "Placeholder" ) +endif() + +# Define project common libraries. +#------------------------------------------------------------------------------ +link_libraries( + ${Boost_CHRONO_LIBRARY} + ${Boost_IOSTREAMS_LIBRARY} + ${Boost_JSON_LIBRARY} + ${Boost_LOCALE_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${pthread_LIBRARIES} + ${rt_LIBRARIES} + ${icu_i18n_FOR_BUILD_LIBRARIES} + ${dl_LIBRARIES} + ${secp256k1_FOR_BUILD_LIBRARIES} ) add_definitions( ${icu} ) @@ -598,63 +614,56 @@ add_library( ${CANONICAL_LIB_NAME} "../../src/words/catalogs/electrum_v1.cpp" "../../src/words/catalogs/mnemonic.cpp" ) -# ${CANONICAL_LIB_NAME} project specific include directories. +# ${CANONICAL_LIB_NAME} project specific include directory normalization for build. #------------------------------------------------------------------------------ if (BUILD_SHARED_LIBS) - target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE - "../../include" - ${Boost_INCLUDE_DIR} - ${pthread_INCLUDE_DIRS} - ${rt_INCLUDE_DIRS} - ${icu_i18n_INCLUDE_DIRS} - ${dl_INCLUDE_DIRS} - ${secp256k1_INCLUDE_DIRS} ) + set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_INCLUDE_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_INCLUDE_DIRS} CACHE STRING "Placeholder" ) else() - target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE - "../../include" - ${Boost_INCLUDE_DIR} - ${pthread_INCLUDE_DIRS} - ${rt_INCLUDE_DIRS} - ${icu_i18n_STATIC_INCLUDE_DIRS} - ${dl_INCLUDE_DIRS} - ${secp256k1_STATIC_INCLUDE_DIRS} ) + set( icu_i18n_FOR_BUILD_INCLUDE_DIRS ${icu_i18n_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_INCLUDE_DIRS ${secp256k1_STATIC_INCLUDE_DIRS} CACHE STRING "Placeholder" ) endif() +# ${CANONICAL_LIB_NAME} project specific include directories. +#------------------------------------------------------------------------------ +target_include_directories( ${CANONICAL_LIB_NAME} PRIVATE + "../../include" + ${Boost_INCLUDE_DIR} + ${pthread_INCLUDE_DIRS} + ${rt_INCLUDE_DIRS} + ${icu_i18n_FOR_BUILD_INCLUDE_DIRS} + ${dl_INCLUDE_DIRS} + ${secp256k1_FOR_BUILD_INCLUDE_DIRS} ) + target_include_directories( ${CANONICAL_LIB_NAME} PUBLIC "../../include" ) -# ${CANONICAL_LIB_NAME} project specific libraries/linker flags. +# ${CANONICAL_LIB_NAME} project specific libraries noramalization for build. #------------------------------------------------------------------------------ if (BUILD_SHARED_LIBS) - target_link_libraries( ${CANONICAL_LIB_NAME} - ${Boost_CHRONO_LIBRARY} - ${Boost_IOSTREAMS_LIBRARY} - ${Boost_JSON_LIBRARY} - ${Boost_LOCALE_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_SYSTEM_LIBRARY} - ${Boost_THREAD_LIBRARY} - ${pthread_LIBRARIES} - ${rt_LIBRARIES} - ${icu_i18n_LIBRARIES} - ${dl_LIBRARIES} - ${secp256k1_LIBRARIES} ) + set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_LIBRARIES} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_LIBRARIES} CACHE STRING "Placeholder" ) else() - target_link_libraries( ${CANONICAL_LIB_NAME} - ${Boost_CHRONO_LIBRARY} - ${Boost_IOSTREAMS_LIBRARY} - ${Boost_JSON_LIBRARY} - ${Boost_LOCALE_LIBRARY} - ${Boost_PROGRAM_OPTIONS_LIBRARY} - ${Boost_SYSTEM_LIBRARY} - ${Boost_THREAD_LIBRARY} - ${pthread_LIBRARIES} - ${rt_LIBRARIES} - ${icu_i18n_STATIC_LIBRARIES} - ${dl_LIBRARIES} - ${secp256k1_STATIC_LIBRARIES} ) + set( icu_i18n_FOR_BUILD_LIBRARIES ${icu_i18n_STATIC_LIBRARIES} CACHE STRING "Placeholder" ) + set( secp256k1_FOR_BUILD_LIBRARIES ${secp256k1_STATIC_LIBRARIES} CACHE STRING "Placeholder" ) endif() +# ${CANONICAL_LIB_NAME} project specific libraries/linker flags. +#------------------------------------------------------------------------------ +target_link_libraries( ${CANONICAL_LIB_NAME} + ${Boost_CHRONO_LIBRARY} + ${Boost_IOSTREAMS_LIBRARY} + ${Boost_JSON_LIBRARY} + ${Boost_LOCALE_LIBRARY} + ${Boost_PROGRAM_OPTIONS_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${pthread_LIBRARIES} + ${rt_LIBRARIES} + ${icu_i18n_FOR_BUILD_LIBRARIES} + ${dl_LIBRARIES} + ${secp256k1_FOR_BUILD_LIBRARIES} ) + # Define libbitcoin-system-examples project. #------------------------------------------------------------------------------ if (with-examples) diff --git a/configure.ac b/configure.ac index 6b40067ebe..d0ee1cf59d 100644 --- a/configure.ac +++ b/configure.ac @@ -249,12 +249,24 @@ AS_CASE([${CC}], [*], [AX_CHECK_COMPILE_FLAG([-Wno-deprecated-copy], [CXXFLAGS="$CXXFLAGS -Wno-deprecated-copy"])]) +# Suppress warning for ignored attributes (arising on template arguments). +#------------------------------------------------------------------------------ +AS_CASE([${CC}], [*], + [AX_CHECK_COMPILE_FLAG([-Wno-ignored-attributes], + [CXXFLAGS="$CXXFLAGS -Wno-ignored-attributes"])]) + # Conflict in stdlib under clang. Enabled in clang only. #------------------------------------------------------------------------------ AS_CASE([${CC}], [*clang*], [AX_CHECK_COMPILE_FLAG([-Wno-mismatched-tags], [CXXFLAGS="$CXXFLAGS -Wno-mismatched-tags"])]) +# Address -undefined dynamic_lookup MacOS error. +#------------------------------------------------------------------------------ +AS_CASE([${CC}], [*], + [AX_CHECK_LINK_FLAG([-no_fixup_chains], + [LDFLAGS="$LDFLAGS -no_fixup_chains"])]) + # Protect stack. #------------------------------------------------------------------------------ AS_CASE([${CC}], [*], diff --git a/install-cmake.sh b/install-cmake.sh index 810612cbb9..8496d53eee 100755 --- a/install-cmake.sh +++ b/install-cmake.sh @@ -442,15 +442,9 @@ set_pkgconfigdir() set_with_boost_prefix() { if [[ $BUILD_BOOST ]]; then - # Boost has no pkg-config, m4 searches in the following order: - # --with-boost=, /usr, /usr/local, /opt, /opt/local, $BOOST_ROOT. - # We use --with-boost to prioritize the --prefix path when we build it. - # Otherwise standard paths suffice for Linux, Homebrew and MacPorts. - # ax_boost_base.m4 appends /include and adds to BOOST_CPPFLAGS - # ax_boost_base.m4 searches for /lib /lib64 and adds to BOOST_LDFLAGS - # - # cmake does not process this argument, so it has been zeroed out. - with_boost="" + # Boost detection via FindBoost.cmake provides for path hint via + # $BOOT_ROOT environment variable only. + export BOOST_ROOT="$PREFIX" fi } @@ -470,6 +464,7 @@ display_configuration() display_message "WITH_ICU : $WITH_ICU" display_message "BUILD_ICU : $BUILD_ICU" display_message "BUILD_BOOST : $BUILD_BOOST" + display_message "BOOST_ROOT : $BOOST_ROOT" display_message "BUILD_DIR : $BUILD_DIR" display_message "CUMULATIVE_FILTERED_ARGS : $CUMULATIVE_FILTERED_ARGS" display_message "CUMULATIVE_FILTERED_ARGS_CMAKE : $CUMULATIVE_FILTERED_ARGS_CMAKE" @@ -714,7 +709,7 @@ cmake_project_directory() local PROJ_CONFIG_DIR PROJ_CONFIG_DIR=$(pwd) - cmake $@ builds/cmake + cmake -LA $@ builds/cmake make_jobs "$JOBS" if [[ $TEST == true ]]; then diff --git a/install-cmakepresets.sh b/install-cmakepresets.sh index e54f6330f4..87b99ed67c 100755 --- a/install-cmakepresets.sh +++ b/install-cmakepresets.sh @@ -503,15 +503,9 @@ set_pkgconfigdir() set_with_boost_prefix() { if [[ $BUILD_BOOST ]]; then - # Boost has no pkg-config, m4 searches in the following order: - # --with-boost=, /usr, /usr/local, /opt, /opt/local, $BOOST_ROOT. - # We use --with-boost to prioritize the --prefix path when we build it. - # Otherwise standard paths suffice for Linux, Homebrew and MacPorts. - # ax_boost_base.m4 appends /include and adds to BOOST_CPPFLAGS - # ax_boost_base.m4 searches for /lib /lib64 and adds to BOOST_LDFLAGS - # - # cmake does not process this argument, so it has been zeroed out. - with_boost="" + # Boost detection via FindBoost.cmake provides for path hint via + # $BOOT_ROOT environment variable only. + export BOOST_ROOT="$PREFIX" fi } @@ -531,6 +525,7 @@ display_configuration() display_message "WITH_ICU : $WITH_ICU" display_message "BUILD_ICU : $BUILD_ICU" display_message "BUILD_BOOST : $BUILD_BOOST" + display_message "BOOST_ROOT : $BOOST_ROOT" display_message "BUILD_DIR : $BUILD_DIR" display_message "PRESET_ID : $PRESET_ID" display_message "CUMULATIVE_FILTERED_ARGS : $CUMULATIVE_FILTERED_ARGS" @@ -779,7 +774,7 @@ cmake_project_directory() push_directory "builds/cmake" display_message "Preparing cmake --preset=$PRESET $@" - cmake --preset=$PRESET $@ + cmake -LA --preset=$PRESET $@ popd push_directory "obj/$PRESET" diff --git a/install.sh b/install.sh index 88da3d478e..7613fc6966 100755 --- a/install.sh +++ b/install.sh @@ -389,6 +389,7 @@ set_with_boost_prefix() # ax_boost_base.m4 appends /include and adds to BOOST_CPPFLAGS # ax_boost_base.m4 searches for /lib /lib64 and adds to BOOST_LDFLAGS with_boost="--with-boost=$PREFIX" + export BOOST_ROOT="$PREFIX" fi } @@ -408,6 +409,7 @@ display_configuration() display_message "WITH_ICU : $WITH_ICU" display_message "BUILD_ICU : $BUILD_ICU" display_message "BUILD_BOOST : $BUILD_BOOST" + display_message "BOOST_ROOT : $BOOST_ROOT" display_message "BUILD_DIR : $BUILD_DIR" display_message "PREFIX : $PREFIX" display_message "DISABLE_SHARED : $DISABLE_SHARED"