diff --git a/.github/workflows/testnet-cli-linux.yml b/.github/workflows/testnet-cli-linux.yml new file mode 100644 index 00000000..57b5e8cc --- /dev/null +++ b/.github/workflows/testnet-cli-linux.yml @@ -0,0 +1,74 @@ +name: testnet-cli-linux + +on: + release: + types: + - published + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + branches: + - dev + paths-ignore: + - '**.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-project: + name: Build Project + runs-on: ubuntu-22.04 + steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + submodules: recursive + + - name: install dependencies + run: sudo apt-get install -y autotools-dev libicu-dev libbz2-dev git screen checkinstall zlib1g-dev ccache miniupnpc + + - name: ccache caching + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/ccache + key: ccache-testnet-cli-${{ runner.os }} + + - name: Install boost + uses: MarkusJx/install-boost@6d8df42f57de83c5b326b5b83e7b35d650030103 + id: install-boost + with: + boost_version: 1.84.0 + boost_install_dir: ${{ github.workspace }}/build/boost_1_84_0 + platform_version: 22.04 + toolset: gcc + arch: x86 + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache + with: + build-dir: build/release + build-args: | + -j2 + --config Release + options: | + STATIC=TRUE + TESTNET=TRUE + ARCH=x86-64 + CMAKE_BUILD_TYPE=Release + Boost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include + Boost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib + + - name: Upload Binaries + uses: actions/upload-artifact@v4 + with: + name: testnet-cli-linux + path: | + ${{ github.workspace }}/build/release/src/zanod + ${{ github.workspace }}/build/release/src/simplewallet + ${{ github.workspace }}/build/release/src/connectivity_tool diff --git a/.github/workflows/testnet-cli-macos-arm64.yml b/.github/workflows/testnet-cli-macos-arm64.yml new file mode 100644 index 00000000..3542ea0c --- /dev/null +++ b/.github/workflows/testnet-cli-macos-arm64.yml @@ -0,0 +1,92 @@ +name: testnet-cli-macos-arm64 + +on: + release: + types: + - published + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + branches: + - dev + paths-ignore: + - '**.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-project: + name: Build Project + runs-on: macos-14 + steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + submodules: recursive + + - name: install dependencies + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache miniupnpc + + - name: Cache OpenSSL + id: cache-openssl + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/openssl + key: ${{ runner.os }}-arm64-openssl + + - name: ccache caching + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/ccache + key: ccache-testnet-cli-${{ runner.os }}-arm64 + + + - name: Install boost + uses: MarkusJx/install-boost@6d8df42f57de83c5b326b5b83e7b35d650030103 + id: install-boost + with: + boost_version: 1.84.0 + boost_install_dir: ${{ github.workspace }}/build/boost_1_84_0 + platform_version: 14 + toolset: clang + arch: aarch64 + + - name: Build OpenSSL + if: steps.cache-openssl.outputs.cache-hit != 'true' + run: | + cd build + curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz + echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar -xjf openssl-1.1.1w.tar.gz + rm openssl-1.1.1w.tar.gz && cd openssl-1.1.1w + ./config --prefix=${{ github.workspace }}/build/openssl --openssldir=${{ github.workspace }}/build/openssl shared zlib + make && make install && cd .. + rm -rf openssl-1.1.1w/ + + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache + OPENSSL_ROOT_DIR: ${{ github.workspace }}/build/openssl + with: + build-dir: build/release + build-args: | + -j2 + --config Release + options: | + TESTNET=TRUE + CMAKE_BUILD_TYPE=Release + Boost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include + Boost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib + - name: Upload Binaries + uses: actions/upload-artifact@v4 + with: + name: testnet-cli-macos-arm64 + path: | + ${{ github.workspace }}/build/release/src/zanod + ${{ github.workspace }}/build/release/src/simplewallet + ${{ github.workspace }}/build/release/src/connectivity_tool diff --git a/.github/workflows/testnet-cli-macos-intel.yml b/.github/workflows/testnet-cli-macos-intel.yml new file mode 100644 index 00000000..7aed702b --- /dev/null +++ b/.github/workflows/testnet-cli-macos-intel.yml @@ -0,0 +1,90 @@ +name: testnet-cli-macos-intel + +on: + release: + types: + - published + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + branches: + - dev + paths-ignore: + - '**.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-project: + name: Build Project + runs-on: macos-13 + steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + submodules: recursive + + - name: install dependencies + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache miniupnpc + + - name: Cache OpenSSL + id: cache-openssl + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/openssl + key: ${{ runner.os }}-intel-openssl + + - name: ccache caching + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/ccache + key: ccache-testnet-cli-${{ runner.os }}-intel + + - name: Install boost + uses: MarkusJx/install-boost@6d8df42f57de83c5b326b5b83e7b35d650030103 + id: install-boost + with: + boost_version: 1.84.0 + boost_install_dir: ${{ github.workspace }}/build/boost_1_84_0 + platform_version: 13 + toolset: clang + + - name: Build OpenSSL + if: steps.cache-openssl.outputs.cache-hit != 'true' + run: | + cd build + curl -OL https://www.openssl.org/source/openssl-1.1.1w.tar.gz + echo "cf3098950cb4d853ad95c0841f1f9c6d3dc102dccfcacd521d93925208b76ac8 openssl-1.1.1w.tar.gz" | shasum -c && tar -xjf openssl-1.1.1w.tar.gz + rm openssl-1.1.1w.tar.gz && cd openssl-1.1.1w + ./config --prefix=${{ github.workspace }}/build/openssl --openssldir=${{ github.workspace }}/build/openssl shared zlib + make && make install && cd .. + rm -rf openssl-1.1.1w/ + + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache + OPENSSL_ROOT_DIR: ${{ github.workspace }}/build/openssl + with: + build-dir: build/release + build-args: | + -j2 + --config Release + options: | + TESTNET=TRUE + CMAKE_BUILD_TYPE=Release + Boost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include + Boost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib + - name: Upload Binaries + uses: actions/upload-artifact@v4 + with: + name: testnet-cli-macos-intel + path: | + ${{ github.workspace }}/build/release/src/zanod + ${{ github.workspace }}/build/release/src/simplewallet + ${{ github.workspace }}/build/release/src/connectivity_tool diff --git a/.github/workflows/testnet-cli-windows.yml b/.github/workflows/testnet-cli-windows.yml new file mode 100644 index 00000000..b4c317cb --- /dev/null +++ b/.github/workflows/testnet-cli-windows.yml @@ -0,0 +1,79 @@ +name: testnet-cli-windows + +on: + release: + types: + - published + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + branches: + - dev + paths-ignore: + - '**.md' + +#concurrency: +# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} +# cancel-in-progress: true + +jobs: + build-project: + name: Build Project + runs-on: windows-2022 + steps: + - name: Checkout Project + uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + submodules: recursive + + - name: Eat the Choco + run: | + choco install ccache -y + choco install zip -y + + - name: ccache caching + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/ccache + key: ccache-testnet-cli-${{ runner.os }} + + - name: Install boost + uses: MarkusJx/install-boost@6d8df42f57de83c5b326b5b83e7b35d650030103 + id: install-boost + with: + boost_version: 1.84.0 + boost_install_dir: ${{ github.workspace }}/build/boost_1_84_0 + platform_version: 2022 + toolset: msvc + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 + env: + BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }} + CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache + with: + build-dir: build/release + generator: Visual Studio 17 2022 + build-args: | + -j4 + --config Release + options: | + STATIC=FALSE + TESTNET=TRUE + ARCH=x86-64 + CMAKE_BUILD_TYPE=Release + Boost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include + Boost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib + + - name: Upload Binaries + uses: actions/upload-artifact@v4 + with: + name: testnet-cli-windows + path: | + ${{ github.workspace }}/build/release/src/Release/zanod.exe + ${{ github.workspace }}/build/release/src/Release/simplewallet.exe + ${{ github.workspace }}/build/release/src/Release/connectivity_tool.exe + ${{ github.workspace }}/build/release/src/zanod.exe + ${{ github.workspace }}/build/release/src/simplewallet.exe + ${{ github.workspace }}/build/release/src/connectivity_tool.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index 4aa125a5..e90f8730 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,16 @@ cmake_minimum_required(VERSION 3.16) PROJECT(Zano) - +set(VERSION "1.0") message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") +list(INSERT CMAKE_MODULE_PATH 0 + "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -set(VERSION "1.0") - if(POLICY CMP0043) cmake_policy(SET CMP0043 NEW) endif() @@ -21,7 +20,16 @@ endif() if(POLICY CMP0144) cmake_policy(SET CMP0144 NEW) endif() +if(POLICY CMP0167) + cmake_policy(SET CMP0167 OLD) +endif() +option (USE_CCACHE "Use ccache if a usable instance is found" ON) +if (USE_CCACHE) + include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable. +else() + message(STATUS "ccache deselected") +endif() set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -198,7 +206,7 @@ else() set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable") if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Android")) - set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto -g3") + set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto=auto -g3") endif() #if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT MINGW) # set(RELEASE_FLAGS "${RELEASE_FLAGS} -fno-fat-lto-objects") diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake new file mode 100644 index 00000000..94bf79f3 --- /dev/null +++ b/cmake/FindCcache.cmake @@ -0,0 +1,67 @@ +# Copyright (c) 2014-2024, The Monero Project +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, are +# permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be +# used to endorse or promote products derived from this software without specific +# prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +# THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# - Try to find readline include dirs and libraries +# +# Automatically finds ccache build accelerator, if it's found in PATH. +# +# Usage of this module as follows: +# +# project(monero) +# include(FindCcache) # Include AFTER the project() macro to be able to reach the CMAKE_CXX_COMPILER variable +# +# Properties modified by this module: +# +# GLOBAL PROPERTY RULE_LAUNCH_COMPILE set to ccache, when ccache found +# GLOBAL PROPERTY RULE_LAUNCH_LINK set to ccache, when ccache found + +find_program(CCACHE_FOUND ccache) +if (CCACHE_FOUND) + # Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups) + set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp") + file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[ +cmake_minimum_required(VERSION 3.5) +project(test) +option (CCACHE "") +file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }") +set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}") +set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}") +add_executable(main test.cpp) +]=]) + try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}") + unset(TEST_PROJECT) + if (${RET}) + # Success + message(STATUS "Found usable ccache: ${CCACHE_FOUND}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}") + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND}") + else() + message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}") + endif() +else() + message(STATUS "ccache NOT found! Please install it for faster rebuilds.") +endif() \ No newline at end of file diff --git a/contrib/tor-connect b/contrib/tor-connect index 1be2073e..b589edb1 160000 --- a/contrib/tor-connect +++ b/contrib/tor-connect @@ -1 +1 @@ -Subproject commit 1be2073ed3da5e9e6e94e8362548df26a22b1bd2 +Subproject commit b589edb1906dccb387cfeded6ed12286c5f0405f