From 314fc797615dffcd4b1ac8c4d0b7bc1b97eaaa92 Mon Sep 17 00:00:00 2001 From: shareong <740310627@qq.com> Date: Tue, 12 Mar 2024 21:21:19 +0800 Subject: [PATCH] unified boost version --- .github/workflows/workflow.yml | 39 +----- CMakeLists.txt | 6 +- bcos-boostssl/CMakeLists.txt | 3 +- bcos-boostssl/utility/NewTimer.h | 4 +- cmake/BuildDocs.cmake | 35 ------ cmake/CompilerSettings.cmake | 2 + cmake/CopyClangFormat.cmake | 22 ---- cmake/DepsEnv.cmake | 58 +++++++++ cmake/GenerateSources.cmake | 21 ---- cmake/InstallBoostSSL.cmake | 4 - cmake/LICENSE | 201 ------------------------------- cmake/ProjectBcosUtilities.cmake | 17 ++- cmake/README.md | 2 - cmake/config.cmake | 17 +-- cmake/test/CMakeLists.txt | 1 - sample/CMakeLists.txt | 12 +- sample/boostssl_delay_perf.cpp | 2 - sample/echo_server_sample.cpp | 2 - sample/http_server_sample.cpp | 2 - test/CMakeLists.txt | 3 +- 20 files changed, 89 insertions(+), 364 deletions(-) delete mode 100644 cmake/BuildDocs.cmake delete mode 100644 cmake/CopyClangFormat.cmake create mode 100644 cmake/DepsEnv.cmake delete mode 100644 cmake/GenerateSources.cmake delete mode 100644 cmake/InstallBoostSSL.cmake delete mode 100644 cmake/LICENSE delete mode 100644 cmake/README.md diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 08b9266..0d38f94 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -126,7 +126,9 @@ jobs: - name: install CentOS dependencies run: | yum install -y epel-release centos-release-scl - yum install -y git make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-7 libzstd-devel zlib-devel flex bison python-devel python3-devel && source /opt/rh/devtoolset-7/enable + yum install -y make gcc gcc-c++ glibc-static glibc-devel openssl cmake3 ccache devtoolset-7 libzstd-devel zlib-devel flex bison python-devel python3-devel && source /opt/rh/devtoolset-7/enable + yum reinstall -y -q https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm + yum install -y -q git - name: configure run: | source /opt/rh/devtoolset-7/enable @@ -137,38 +139,3 @@ jobs: source /opt/rh/devtoolset-7/enable mkdir -p build && cd build make -j4 - build_with_windows: - name: build_with_windows - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [windows-2019] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - uses: actions/cache@v2 - id: cache - with: - path: | - /home/runner/.hunter - /github/home/.hunter - /Users/runner/.hunter - /home/runner/.hunter/_Base/Download/ - /github/home/.hunter/_Base/Download/ - /Users/runner/.hunter/_Base/Download/ - C:/.hunter/ - C:/.hunter/_Base/Download/ - ccache - key: hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - restore-keys: | - hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}-${{ hashFiles('.github/workflows/workflow.yml') }} - hunter-msvc-v3-notest-${{ runner.temp }}-${{ github.base_ref }}- - hunter-msvc-v3-notest-${{ runner.temp }}- - - name: Add MSbuild to PATH - uses: microsoft/setup-msbuild@v1.1 - - name: configure - if: runner.os == 'Windows' - run: mkdir -p build && cd build && cmake -G "Visual Studio 16 2019" -A x64 ../ -DHUNTER_CONFIGURATION_TYPES=Release -DHUNTER_STATUS_DEBUG=ON - - name: compile - run: cd build && MSBuild bcos-boostssl.sln /p:Configuration=Release /p:Platform=x64 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a9e005c..da09e1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,6 @@ # ------------------------------------------------------------------------------ cmake_minimum_required(VERSION 3.10) -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum OS X deployment version") include(FetchContent) @@ -45,9 +44,8 @@ include(Options) configure_project() include(CompilerSettings) -# Boost -hunter_add_package(Boost COMPONENTS all) -find_package(Boost CONFIG REQUIRED log chrono system filesystem thread iostreams) +# dependencies environment +include(DepsEnv) # OpenSSL hunter_add_package(OpenSSL) diff --git a/bcos-boostssl/CMakeLists.txt b/bcos-boostssl/CMakeLists.txt index 59c19c6..f897b0d 100644 --- a/bcos-boostssl/CMakeLists.txt +++ b/bcos-boostssl/CMakeLists.txt @@ -3,5 +3,4 @@ file(GLOB_RECURSE SRCS "*.cpp") file(GLOB_RECURSE HEADERS "*.h") add_library(${BOOSTSSL_TARGET} ${SRCS} ${HEADERS}) -target_link_libraries(${BOOSTSSL_TARGET} PUBLIC bcos-utilities Boost::system Boost::filesystem -Boost::log Boost::chrono Boost::iostreams Boost::thread OpenSSL::SSL OpenSSL::Crypto) \ No newline at end of file +target_link_libraries(${BOOSTSSL_TARGET} PUBLIC bcos-utilities OpenSSL::SSL OpenSSL::Crypto) diff --git a/bcos-boostssl/utility/NewTimer.h b/bcos-boostssl/utility/NewTimer.h index cb9b030..186ef9c 100644 --- a/bcos-boostssl/utility/NewTimer.h +++ b/bcos-boostssl/utility/NewTimer.h @@ -22,9 +22,9 @@ */ #pragma once #include "bcos-utilities/BoostLog.h" +#include "bcos-utilities/Common.h" #include #include -#include "bcos-utilities/Common.h" #include namespace bcos @@ -249,7 +249,7 @@ class TimerFactory BCOS_LOG(INFO) << LOG_BADGE("stopThread") << LOG_DESC("stop the timer thread"); m_ioService->stop(); - if (m_worker->get_id() != std::this_thread::get_id()) + if (!(m_worker->get_id() == std::this_thread::get_id())) { m_worker->join(); m_worker.reset(); diff --git a/cmake/BuildDocs.cmake b/cmake/BuildDocs.cmake deleted file mode 100644 index dcf1d3d..0000000 --- a/cmake/BuildDocs.cmake +++ /dev/null @@ -1,35 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (C) 2021 FISCO BCOS. -# SPDX-License-Identifier: Apache-2.0 -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------------------------ -# File: BuildDocs.cmake -# Function: Documentation build cmake -# ------------------------------------------------------------------------------ -find_package(Doxygen QUIET) -if(DOXYGEN_FOUND) - # Requirements: doxygen graphviz - set(doxyfile_in "${CMAKE_CURRENT_LIST_DIR}/.Doxyfile.in") - set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") - configure_file(${doxyfile_in} ${doxyfile} @ONLY) -elseif() - message(WARNING "Doxygen is needed to build the documentation. Please install doxygen and graphviz") -endif() -function(buildDoc TARGET) - if(DOXYGEN_FOUND) - # Add doc target - add_custom_target(${TARGET} COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating documentation with Doxygen..." VERBATIM) - endif() -endfunction() \ No newline at end of file diff --git a/cmake/CompilerSettings.cmake b/cmake/CompilerSettings.cmake index 27d8fa4..c6c5034 100644 --- a/cmake/CompilerSettings.cmake +++ b/cmake/CompilerSettings.cmake @@ -38,6 +38,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA add_compile_options(-Wall) add_compile_options(-pedantic) add_compile_options(-Wextra) + add_compile_options(-Wno-sign-compare) + add_compile_options(-Wno-deprecated-declarations) # add_compile_options(-Wno-unused-variable) # add_compile_options(-Wno-unused-parameter) # add_compile_options(-Wno-unused-function) diff --git a/cmake/CopyClangFormat.cmake b/cmake/CopyClangFormat.cmake deleted file mode 100644 index f6950d5..0000000 --- a/cmake/CopyClangFormat.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (C) 2021 FISCO BCOS. -# SPDX-License-Identifier: Apache-2.0 -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ------------------------------------------------------------------------------ -# File: CompilerSettings.cmake -# Function: Common cmake file for setting compilation environment variables -# ------------------------------------------------------------------------------ - -set(clang_format_file_in ${CMAKE_CURRENT_LIST_DIR}/.clang-format) -set(clang_format_file "${CMAKE_CURRENT_SOURCE_DIR}/.clang-format") -configure_file(${clang_format_file_in} ${clang_format_file} @ONLY) \ No newline at end of file diff --git a/cmake/DepsEnv.cmake b/cmake/DepsEnv.cmake new file mode 100644 index 0000000..28cb355 --- /dev/null +++ b/cmake/DepsEnv.cmake @@ -0,0 +1,58 @@ +if(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(SYSTEM_NAME "linux") +elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set(SYSTEM_NAME "osx") +else() + message(FATAL_ERROR "Unknown operating system: ${CMAKE_SYSTEM_NAME}") +endif() + +if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(PROCESSOR_NAME "x64") +elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + set(PROCESSOR_NAME "arm64") +else() + message(FATAL_ERROR "Unknown processor name: ${CMAKE_SYSTEM_PROCESSOR}") +endif() + +set(BCOS_UTILITIES_PROJECT BcosUtilitiesProject) + +set(VCPKG_BUILD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps/src/${BCOS_UTILITIES_PROJECT}/vcpkg_installed/${PROCESSOR_NAME}-${SYSTEM_NAME}) +message("vcpkg build path: ${VCPKG_BUILD_PATH}") +set(VCPKG_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps/src/${BCOS_UTILITIES_PROJECT}/vcpkg_installed/${PROCESSOR_NAME}-${SYSTEM_NAME}/lib) +message("vcpkg lib path: ${VCPKG_LIB_PATH}") +set(VCPKG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/deps/src/${BCOS_UTILITIES_PROJECT}/vcpkg_installed/${PROCESSOR_NAME}-${SYSTEM_NAME}/include) +message("vcpkg include path: ${VCPKG_INCLUDE_PATH}") + +#include +include_directories(${VCPKG_INCLUDE_PATH}) + +#lib +#unit_test_framework +set(BOOST_UNIT_TEST ${VCPKG_LIB_PATH}/libboost_unit_test_framework.a) + +#log +set(BOOST_LOG ${VCPKG_LIB_PATH}/libboost_log.a) + +#log_setup +set(BOOST_LOG_SETUP ${VCPKG_LIB_PATH}/libboost_log_setup.a) + +#filesystem +set(BOOST_FILESYSTEM ${VCPKG_LIB_PATH}/libboost_filesystem.a) + +#chrono +set(BOOST_CHRONO ${VCPKG_LIB_PATH}/libboost_chrono.a) + +#thread +set(BOOST_THREAD ${VCPKG_LIB_PATH}/libboost_thread.a) + +#serialization +set(BOOST_SERIALIZATION ${VCPKG_LIB_PATH}/libboost_serialization.a) + +#iostreams +set(BOOST_IOSTREAMS ${VCPKG_LIB_PATH}/libboost_iostreams.a) + +#system +set(BOOST_SYSTEM ${VCPKG_LIB_PATH}/libboost_system.a) + +#zlib +set(ZLIB ${VCPKG_LIB_PATH}/libz.a) diff --git a/cmake/GenerateSources.cmake b/cmake/GenerateSources.cmake deleted file mode 100644 index 93ccfed..0000000 --- a/cmake/GenerateSources.cmake +++ /dev/null @@ -1,21 +0,0 @@ -function(protobuf_generate_cpp PROTO_SRCS PROTO_HDRS MESSAGES_PROTOS PROTO_PATH PROTO_DIR GENERATED_BASE_DIR GENERATED_DIR) - set(MESSAGES_SRCS) - set(MESSAGES_HDRS) - foreach(proto_file ${MESSAGES_PROTOS}) - get_filename_component(proto_dir_abs ${PROTO_DIR} ABSOLUTE) - set(proto_file_abs ${proto_dir_abs}/${proto_file}) - get_filename_component(basename ${proto_file} NAME_WE) - set(generated_files ${GENERATED_DIR}/${basename}.pb.cc ${GENERATED_DIR}/${basename}.pb.h) - - add_custom_command( - OUTPUT ${generated_files} - COMMAND protobuf::protoc --cpp_out ${GENERATED_BASE_DIR} -I ${PROTO_PATH} ${proto_file_abs} - COMMENT "Generating ${generated_files} from ${proto_file_abs}" - VERBATIM - ) - list(APPEND MESSAGES_SRCS ${GENERATED_DIR}/${basename}.pb.cc) - list(APPEND MESSAGES_HDRS ${GENERATED_DIR}/${basename}.pb.h) - endforeach() - set(PROTO_SRCS ${MESSAGES_SRCS} PARENT_SCOPE) - set(PROTO_HDRS ${MESSAGES_HDRS} PARENT_SCOPE) -endfunction(protobuf_generate_cpp) \ No newline at end of file diff --git a/cmake/InstallBoostSSL.cmake b/cmake/InstallBoostSSL.cmake deleted file mode 100644 index 37b278c..0000000 --- a/cmake/InstallBoostSSL.cmake +++ /dev/null @@ -1,4 +0,0 @@ -hunter_add_package(bcos-boostssl) -hunter_add_package(OpenSSL) -find_package(OpenSSL REQUIRED) -find_package(bcos-boostssl CONFIG REQUIRED) \ No newline at end of file diff --git a/cmake/LICENSE b/cmake/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/cmake/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/cmake/ProjectBcosUtilities.cmake b/cmake/ProjectBcosUtilities.cmake index 9047a3e..fab04c8 100644 --- a/cmake/ProjectBcosUtilities.cmake +++ b/cmake/ProjectBcosUtilities.cmake @@ -1,23 +1,28 @@ include(ExternalProject) -ExternalProject_Add(BcosUtilitiesLib +ExternalProject_Add( + ${BCOS_UTILITIES_PROJECT} PREFIX ${CMAKE_SOURCE_DIR}/deps - GIT_REPOSITORY https://github.com/Shareong//bcos-utilities.git - GIT_TAG a59f0673386a82c8ed89d88690264e1b02bc7347 + GIT_REPOSITORY https://github.com/FISCO-BCOS/bcos-utilities.git + GIT_TAG 67b4adc13b7ef6f9e1d70c32d34bc0a05364ec18 BUILD_IN_SOURCE 1 - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX= -DCMAKE_INSTALL_LIBDIR=lib LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 ) -ExternalProject_Get_Property(BcosUtilitiesLib INSTALL_DIR) +ExternalProject_Get_Property(${BCOS_UTILITIES_PROJECT} INSTALL_DIR) add_library(bcos-utilities STATIC IMPORTED) set(BCOS_UTILITIES_LIBRARY ${INSTALL_DIR}/lib/libbcos-utilities.a) set(BCOS_UTILITIES_INCLUDE_DIR ${INSTALL_DIR}/include) + file(MAKE_DIRECTORY ${INSTALL_DIR}/lib) # Must exist. file(MAKE_DIRECTORY ${BCOS_UTILITIES_INCLUDE_DIR}) # Must exist. + set_property(TARGET bcos-utilities PROPERTY IMPORTED_LOCATION ${BCOS_UTILITIES_LIBRARY}) set_property(TARGET bcos-utilities PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${BCOS_UTILITIES_INCLUDE_DIR}) -add_dependencies(bcos-utilities BcosUtilitiesLib) +set_property(TARGET bcos-utilities PROPERTY INTERFACE_LINK_LIBRARIES ${BOOST_LOG} ${BOOST_LOG_SETUP} ${BOOST_FILESYSTEM} ${BOOST_CHRONO} ${BOOST_THREAD} ${BOOST_SERIALIZATION} ${BOOST_IOSTREAMS} ${BOOST_SYSTEM} ${ZLIB}) + +add_dependencies(bcos-utilities ${BCOS_UTILITIES_PROJECT}) unset(INSTALL_DIR) diff --git a/cmake/README.md b/cmake/README.md deleted file mode 100644 index 1973e04..0000000 --- a/cmake/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# bcos-cmake-scripts -the core common cmake files for all repos of FISCO BCOS 3.0 diff --git a/cmake/config.cmake b/cmake/config.cmake index 96188d3..6476c47 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -1,16 +1,5 @@ hunter_config( - Boost VERSION "1.83" - URL "https://psychz.dl.sourceforge.net/project/boost/boost/1.83.0/boost_1_83_0.tar.bz2" - SHA1 75b1f569134401d178ad2aaf97a2993898dd7ee3 - CMAKE_ARGS CONFIG_MACRO=BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX -) - -# hunter_config(bcos-utilities VERSION 1.0.0 -# URL https://github.com/Shareong//bcos-utilities/archive/a59f0673386a82c8ed89d88690264e1b02bc7347.tar.gz -# SHA1 7b0ef2ea5c05b7c71b39875cd0df94a5670b0e57 -# ) - -hunter_config(OpenSSL VERSION tassl_1.1.1b_v1.4-local - URL https://${URL_BASE}/FISCO-BCOS/TASSL-1.1.1b/archive/f9d60fa510e5fbe24413b4abdf1ea3a48f9ee6aa.tar.gz - SHA1 e56121278bf07587d58d154b4615f96575957d6f + OpenSSL VERSION tassl_1.1.1b + URL https://${URL_BASE}/FISCO-BCOS/TASSL-1.1.1b/archive/5144cc460da7b7de36e27780aba0fd928da222ed.tar.gz + SHA1 e0d6de3a5abb2ea09cdf3fd22e50bd8b866125d6 ) diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index 86f23ab..4601faa 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -30,7 +30,6 @@ project(bcos-cmake-scripts-test VERSION "3.0") include(Options) configure_project() include(CompilerSettings) -include(BuildDocs) include(Coverage) config_coverage("test_cov" "") diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt index 2fcf048..189b4d2 100644 --- a/sample/CMakeLists.txt +++ b/sample/CMakeLists.txt @@ -8,19 +8,19 @@ hunter_add_package(OpenSSL) find_package(OpenSSL REQUIRED) add_executable(http-server-sample http_server_sample.cpp) -target_link_libraries(http-server-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(http-server-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) add_executable(echo-server-sample echo_server_sample.cpp) -target_link_libraries(echo-server-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(echo-server-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) add_executable(echo-client-sample echo_client_sample.cpp) -target_link_libraries(echo-client-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(echo-client-sample PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) add_executable(msg-codec-perf msg_codec_perf.cpp) -target_link_libraries(msg-codec-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(msg-codec-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) add_executable(boostssl-delay-perf boostssl_delay_perf.cpp) -target_link_libraries(boostssl-delay-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(boostssl-delay-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) add_executable(boostssl-throughput-perf boostssl_throughput_perf.cpp) -target_link_libraries(boostssl-throughput-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto) +target_link_libraries(boostssl-throughput-perf PUBLIC jsoncpp_lib_static ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto) diff --git a/sample/boostssl_delay_perf.cpp b/sample/boostssl_delay_perf.cpp index 13dc8a4..0121340 100644 --- a/sample/boostssl_delay_perf.cpp +++ b/sample/boostssl_delay_perf.cpp @@ -199,12 +199,10 @@ void workAsServer(std::string listenIp, uint16_t listenPort, bool disableSsl) wsService->start(); - int i = 0; while (true) { // std::cerr << " boostssl deplay perf server working ..." << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - i++; } } diff --git a/sample/echo_server_sample.cpp b/sample/echo_server_sample.cpp index 72fb040..959dd75 100644 --- a/sample/echo_server_sample.cpp +++ b/sample/echo_server_sample.cpp @@ -132,12 +132,10 @@ int main(int argc, char** argv) wsService->start(); - int i = 0; while (true) { // TEST_SERVER_LOG(INFO, MODULE_NAME) << LOG_BADGE(" [Main] ===>>>> "); std::this_thread::sleep_for(std::chrono::milliseconds(1)); - i++; } return EXIT_SUCCESS; diff --git a/sample/http_server_sample.cpp b/sample/http_server_sample.cpp index c9974f2..a393d94 100644 --- a/sample/http_server_sample.cpp +++ b/sample/http_server_sample.cpp @@ -94,12 +94,10 @@ int main(int argc, char** argv) }); wsService->start(); - int i = 0; while (true) { BCOS_LOG(INFO) << LOG_BADGE(" [Main] ===>>>> "); std::this_thread::sleep_for(std::chrono::milliseconds(5000)); - i++; } return EXIT_SUCCESS; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7f27147..eeb246a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,5 +24,4 @@ config_test_cases("" "${SOURCES}" bin/${TEST_BINARY_NAME} "") add_executable(${TEST_BINARY_NAME} ${SOURCES}) target_include_directories(${TEST_BINARY_NAME} PRIVATE .) -find_package(Boost CONFIG REQUIRED unit_test_framework) -target_link_libraries(${TEST_BINARY_NAME} ${BOOSTSSL_TARGET} bcos-utilities::bcos-utilities OpenSSL::SSL OpenSSL::Crypto Boost::unit_test_framework) +target_link_libraries(${TEST_BINARY_NAME} ${BOOSTSSL_TARGET} bcos-utilities OpenSSL::SSL OpenSSL::Crypto ${BOOST_UNIT_TEST})