1
0
Fork 0
forked from lthn/blockchain

Build Improvements (#10)

This commit is contained in:
Snider 2025-09-24 21:01:35 +01:00 committed by GitHub
parent 2eaa599066
commit a03d081287
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 249 additions and 569 deletions

View file

@ -1,10 +0,0 @@
have_fun: true
code_review:
disable: false
comment_severity_threshold: MEDIUM
max_review_comments: -1
pull_request_opened:
help: false
summary: true
code_review: true
ignore_patterns: []

View file

@ -16,7 +16,7 @@ inputs:
description: "The directory where 7z's working dir will be set"
release:
required: false
default: "true"
default: "false"
description: 'string flag to determine if a release should be created'
release-tag:
required: true
@ -66,23 +66,23 @@ runs:
name: ${{ steps.asset.outputs.key }}
path: ${{ steps.asset.outputs.paths }}
- name: Archive Release
if: inputs.release != 'false'
shell: bash
run: |
STAGING_DIR=$(mktemp -d)
echo "${{ steps.asset.outputs.paths }}" | while read -r file; do
if [[ -n "$file" ]]; then
cp -r "$file" "$STAGING_DIR"
fi
done
7z a -y "${{ inputs.asset-directory }}/${{ steps.asset.outputs.key }}.zip" -w"$STAGING_DIR" .
- name: Make Release
if: inputs.release != 'false'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.chain-network }}-${{ inputs.release-tag }}
prerelease: contains(inputs.chain-network, 'testnet')
files: ${{ inputs.asset-directory }}${{ runner.os == 'Windows' && '\' || '/' }}${{ steps.asset.outputs.key }}.zip
target_commitish: ${{ github.sha }}
# - name: Archive Release
# if: inputs.release != 'false'
# shell: bash
# run: |
# STAGING_DIR=$(mktemp -d)
# echo "${{ steps.asset.outputs.paths }}" | while read -r file; do
# if [[ -n "$file" ]]; then
# cp -r "$file" "$STAGING_DIR"
# fi
# done
# 7z a -y "${{ inputs.asset-directory }}/${{ steps.asset.outputs.key }}.zip" -w"$STAGING_DIR" .
#
# - name: Make Release
# if: inputs.release != 'false'
# uses: softprops/action-gh-release@v2
# with:
# tag_name: ${{ inputs.chain-network }}-${{ inputs.release-tag }}
# prerelease: contains(inputs.chain-network, 'testnet')
# files: ${{ inputs.asset-directory }}${{ runner.os == 'Windows' && '\' || '/' }}${{ steps.asset.outputs.key }}.zip
# target_commitish: ${{ github.sha }}

View file

@ -38,45 +38,14 @@ jobs:
- 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
- name: Install Conan
uses: conan-io/setup-conan@v1
with:
path: ${{ github.workspace }}/build/ccache
key: ccache-${{ inputs.chain-network }}-${{ runner.os }}
home: ${{ github.workspace }}/build/sdk
cache_packages: true
- 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: Install Qt
if: ${{ inputs.build-gui }}
uses: jurplel/install-qt-action@v3
with:
dir: '${{ github.workspace }}/build/qt/'
aqtversion: '==3.1.*'
version: '6.8.3'
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
modules: 'qt5compat qtwebengine qtwebchannel qtpositioning'
- name: Build CLI
if: ${{ inputs.build-cli }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'daemon simplewallet connectivity_tool'
static: 'true'
arch: 'x86-64'
- name: Compile Release
run: make linux_x86_64
- name: CLI Artifacts
if: ${{ inputs.build-cli }}
@ -90,29 +59,4 @@ jobs:
simplewallet
connectivity_tool
asset-type: 'cli'
asset-directory: ${{ github.workspace }}/build/release/src
- name: Build GUI
if: ${{ inputs.build-gui }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'Zano'
build-gui: 'true'
static: 'true'
arch: 'x86-64'
- name: GUI Artifacts
if: ${{ inputs.build-gui }}
uses: ./.github/actions/sign-and-upload-release
with:
chain-network: ${{ inputs.chain-network }}
release-tag: ${{ github.ref_name }}
release: "${{ inputs.release }}"
assets: |
Zano
asset-type: 'gui'
asset-directory: ${{ github.workspace }}/build/release/src
asset-directory: ${{ github.workspace }}/build/linux_x86_64/src

View file

@ -43,64 +43,14 @@ jobs:
- name: install dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache miniupnpc
- run: mkdir -p build/openssl
- run: mkdir -p build/ccache
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
- name: Install Conan
uses: conan-io/setup-conan@v1
with:
path: ${{ github.workspace }}/build/openssl
key: openssl-${{ runner.os }}-${{ runner.arch }}
home: ${{ github.workspace }}/build/sdk
cache_packages: true
- name: ccache caching
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/build/ccache
key: ccache-${{ inputs.chain-network }}-cli-${{ runner.os }}-${{ runner.arch }}
- 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
export MACOSX_DEPLOYMENT_TARGET=12.0
./config --prefix=${{ github.workspace }}/build/openssl --openssldir=${{ github.workspace }}/build/openssl shared zlib
make -j3 && make install_sw install_ssldirs && cd ..
rm -rf openssl-1.1.1w/
- name: Install Qt
if: ${{ inputs.build-gui }}
uses: jurplel/install-qt-action@v3
with:
dir: '${{ github.workspace }}/build/qt/'
aqtversion: '==3.1.*'
version: '6.8.3'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
modules: 'qt5compat qtwebengine qtwebchannel qtpositioning'
- name: Build CLI
uses: ./.github/actions/cmake-build
with:
jobs: '3'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'daemon simplewallet'
- name: Compile Release
run: make mac_arm
- name: CLI Artifacts
if: ${{ inputs.build-cli }}
@ -112,28 +62,6 @@ jobs:
assets: |
zanod
simplewallet
connectivity_tool
asset-type: 'cli'
asset-directory: ${{ github.workspace }}/build/release/src
- name: Build GUI
if: ${{ inputs.build-gui }}
uses: ./.github/actions/cmake-build
with:
jobs: '3'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'Zano'
build-gui: 'true'
- name: GUI Artifacts
if: ${{ inputs.build-gui }}
uses: ./.github/actions/sign-and-upload-release
with:
chain-network: ${{ inputs.chain-network }}
release-tag: ${{ github.ref_name }}
release: "${{ inputs.release }}"
assets: |
Zano.app
asset-type: 'gui'
asset-directory: ${{ github.workspace }}/build/release/src
asset-directory: ${{ github.workspace }}/build/mac_arm/src

View file

@ -38,62 +38,14 @@ jobs:
- name: install dependencies
run: HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache miniupnpc
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v4
- name: Install Conan
uses: conan-io/setup-conan@v1
with:
path: ${{ github.workspace }}/build/openssl
key: openssl-${{ runner.os }}-intel
home: ${{ github.workspace }}/build/sdk
cache_packages: true
- name: ccache caching
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/build/ccache
key: ccache-${{ inputs.chain-network }}-${{ 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
arch: 'x86'
- name: Install Qt
if: ${{ inputs.build-gui }}
uses: jurplel/install-qt-action@v3
with:
dir: '${{ github.workspace }}/build/qt/'
aqtversion: '==3.1.*'
version: '6.8.3'
host: 'mac'
target: 'desktop'
arch: 'clang_64'
modules: 'qt5compat qtwebengine qtwebchannel qtpositioning'
- 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
export MACOSX_DEPLOYMENT_TARGET=12.0
./config --prefix=${{ github.workspace }}/build/openssl --openssldir=${{ github.workspace }}/build/openssl shared zlib
make -j3 && make install_sw install_ssldirs && cd ..
rm -rf openssl-1.1.1w/
- name: Build CLI
if: ${{ inputs.build-cli }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'daemon simplewallet connectivity_tool'
- name: Compile Release
run: make mac_intel
- name: CLI Artifacts
if: ${{ inputs.build-cli }}
@ -107,27 +59,4 @@ jobs:
simplewallet
connectivity_tool
asset-type: 'cli'
asset-directory: ${{ github.workspace }}/build/release/src
- name: Build GUI
if: ${{ inputs.build-gui }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'Zano'
build-gui: 'true'
- name: GUI Artifacts
if: ${{ inputs.build-gui }}
uses: ./.github/actions/sign-and-upload-release
with:
chain-network: ${{ inputs.chain-network }}
release-tag: ${{ github.ref_name }}
release: "${{ inputs.release }}"
assets: |
Zano.app
asset-type: 'gui'
asset-directory: ${{ github.workspace }}/build/release/src
asset-directory: ${{ github.workspace }}/build/mac_intel/src

View file

@ -39,46 +39,14 @@ jobs:
run: |
choco install ccache -y
choco install zip -y
- name: ccache caching
uses: actions/cache@v4
- name: Install Conan
uses: conan-io/setup-conan@v1
with:
path: ${{ github.workspace }}/build/ccache
key: ccache-${{ inputs.chain-network }}-${{ runner.os }}
home: ${{ github.workspace }}/build/sdk
cache_packages: true
- 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: Install Qt
if: ${{ inputs.build-gui }}
uses: jurplel/install-qt-action@v3
with:
dir: '${{ github.workspace }}/build/qt/'
aqtversion: '==3.1.*'
version: '6.8.3'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
modules: 'qt5compat qtwebengine qtwebchannel qtpositioning'
- name: Build CLI
if: ${{ inputs.build-cli }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'daemon simplewallet connectivity_tool'
static: 'false'
generator: 'Visual Studio 17 2022'
arch: 'x86-64'
- name: Compile Release
run: make win_x86_64_msvc
- name: CLI Artifacts
if: ${{ inputs.build-cli }}
@ -92,29 +60,4 @@ jobs:
simplewallet.exe
connectivity_tool.exe
asset-type: 'cli'
asset-directory: ${{ github.workspace }}\build\release\src\Release
- name: Build GUI
if: ${{ inputs.build-gui }}
uses: ./.github/actions/cmake-build
with:
jobs: '4'
build-type: 'Release'
chain-network: ${{ inputs.chain-network }}
boost-root: ${{ steps.install-boost.outputs.BOOST_ROOT }}
target: 'Zano'
build-gui: 'true'
generator: 'Visual Studio 17 2022'
arch: 'x86-64'
- name: GUI Artifacts
if: ${{ inputs.build-gui }}
uses: ./.github/actions/sign-and-upload-release
with:
chain-network: ${{ inputs.chain-network }}
release-tag: ${{ github.ref_name }}
release: "${{ inputs.release }}"
assets: |
Zano.exe
asset-type: 'gui'
asset-directory: ${{ github.workspace }}\build\release\src\Release
asset-directory: ${{ github.workspace }}/build/win_x86_64_msvc/src/Release

3
.gitignore vendored
View file

@ -6,4 +6,5 @@
Thumbs.db
._*
.idea
.vs/*
.vs/*
CMakeUserPresets.json

View file

@ -1,11 +1,13 @@
cmake_minimum_required(VERSION 3.16)
set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect submodule)")
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}")
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")
@ -24,29 +26,28 @@ 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()
#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)
set(ZANO_BOOST_MIN_VER 1.75)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DMOBILE_WALLET_BUILD)
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
if(CMAKE_SYSTEM_NAME STREQUAL "iOS" )
add_definitions(-DIOS_BUILD)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fembed-bitcode -Wno-enum-constexpr-conversion")
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Android")
add_definitions(-DANDROID_BUILD)
message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
message("Android sdk prefix: ${CMAKE_CXX_ANDROID_TOOLCHAIN_PREFIX}")
message("Android CMAKE_CXX_COMPILER prefix: ${CMAKE_CXX_COMPILER}")
message("Android ANDROID_LD: ${ANDROID_LD}")
endif()
endif()
@ -61,9 +62,9 @@ if (UNIX AND NOT APPLE)
endif()
else()
# multi configurations for MSVC and XCode
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
else()
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
@ -87,7 +88,7 @@ set(TESTNET FALSE CACHE BOOL "Compile for testnet")
set(BUILD_GUI FALSE CACHE BOOL "Build qt-daemon")
set(USE_BITCOIN_SECP256K1_FOR_ECDSA FALSE CACHE BOOL "Use bitcoin-secp256k1 library for validating ECDSA(instead of OpenSSL)")
if(NOT USE_BITCOIN_SECP256K1_FOR_ECDSA)
add_definitions(-DUSE_OPEN_SSL_FOR_ECDSA)
add_definitions(-DUSE_OPEN_SSL_FOR_ECDSA)
endif()
@ -96,22 +97,22 @@ include_directories(src contrib/eos_portable_archive contrib contrib/epee/includ
add_definitions(-DSTATICLIB)
if(TESTNET)
message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
add_definitions(-DTESTNET)
message("!!!!!! NOTICE: Project is building for TESTNET !!!!!!")
add_definitions(-DTESTNET)
endif()
if(CAKEWALLET)
message("NOTICE: Building libraries for CAKEWALLET")
add_definitions(-DCAKEWALLET)
add_definitions(-DDISABLE_PFR_SERIALIZATION_SELFCHECK)
message("NOTICE: Building libraries for CAKEWALLET")
add_definitions(-DCAKEWALLET)
add_definitions(-DDISABLE_PFR_SERIALIZATION_SELFCHECK)
endif()
set(OPENSSL_USE_STATIC_LIBS TRUE) # link statically
find_package(OpenSSL REQUIRED)
if(DISABLE_TOR)
message("NOTICE: Building with disabled TOR support!")
add_definitions(-DDISABLE_TOR)
message("NOTICE: Building with disabled TOR support!")
add_definitions(-DDISABLE_TOR)
endif()
@ -128,7 +129,9 @@ endif()
add_definitions("/DBOOST_NO_CXX98_FUNCTION_BASE")
if(WIN32)
add_definitions(-DBOOST_ALL_NO_LIB)
endif()
if(MSVC)
add_definitions("/D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0")
@ -155,7 +158,7 @@ else()
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-implicit-function-declaration -Wno-shift-count-overflow -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration")
else()
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wlogical-op -Wno-error=maybe-uninitialized")
set(WARNINGS "${WARNINGS} -Wno-error=write-strings -Wno-error=uninitialized")
endif()
# Since gcc 4.9 the LTO format is non-standard (slim), so we need the gcc-specific ar and ranlib binaries
@ -203,7 +206,7 @@ else()
else()
set(DEBUG_FLAGS "-g3 -O0")
endif()
set(RELEASE_FLAGS "-Ofast -DNDEBUG -Wno-unused-variable")
set(RELEASE_FLAGS "-O3 -ffast-math -DNDEBUG -Wno-unused-variable")
if(NOT APPLE AND NOT (CMAKE_SYSTEM_NAME STREQUAL "Android"))
set(RELEASE_FLAGS "${RELEASE_FLAGS} -flto=auto -g3")
@ -217,7 +220,7 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC)
if(APPLE)
message(SEND_ERROR "Static build is not supported on MacOS X")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++")
else()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
@ -225,67 +228,38 @@ else()
endif()
# always use local Boost installation rather than the system-wide (unless ZANO_USE_SYSTEM_BOOST is defined for some reason, which is not recommended)
if(NOT DEFINED ENV{ZANO_USE_SYSTEM_BOOST})
set(Boost_NO_SYSTEM_PATHS ON)
endif()
if(MSVC)
# Link Boost statically, consistent with previous setup
if(MSVC OR STATIC)
set(Boost_USE_STATIC_LIBS ON)
if (MSVC)
set(Boost_USE_MULTITHREADED ON)
endif ()
endif()
if(STATIC)
set(Boost_USE_STATIC_LIBS ON)
if(STATIC)
set(Boost_USE_STATIC_RUNTIME ON)
endif()
message("CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_DEPLOYMENT_TARGET 12.00)
if(NOT DEFINED SKIP_BOOST_FATLIB_LIB OR NOT SKIP_BOOST_FATLIB_LIB)
message("Ios: libboost.a included as library")
set(Boost_LIBRARIES "libboost.a")
else()
message("Ios: libboost.a not included as library")
endif()
#workaround for new XCode 12 policy for builds(now it includes a slice for the "arm64" when builds for simulator)
set(__iphoneos_archs "arm64")
#set(__iphonesimulator_archs "arm64,x86_64")
set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphoneos*] "${__iphoneos_archs}")
#set(CMAKE_XCODE_ATTRIBUTE_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
#set(CMAKE_XCODE_ATTRIBUTE_VALID_ARCHS[sdk=iphonesimulator*] "${__iphonesimulator_archs}")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
if(CAKEWALLET)
find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options)
else()
set(Boost_LIBRARY_DIRS "${Boost_LIBRARY_DIRS}/${CMAKE_ANDROID_ARCH_ABI}/")
set(Boost_LIBRARIES "${Boost_LIBRARY_DIRS}libboost_system.a;${Boost_LIBRARY_DIRS}libboost_filesystem.a;${Boost_LIBRARY_DIRS}libboost_thread.a;${Boost_LIBRARY_DIRS}libboost_timer.a;${Boost_LIBRARY_DIRS}libboost_date_time.a;${Boost_LIBRARY_DIRS}libboost_chrono.a;${Boost_LIBRARY_DIRS}libboost_regex.a;${Boost_LIBRARY_DIRS}libboost_serialization.a;${Boost_LIBRARY_DIRS}libboost_atomic.a;${Boost_LIBRARY_DIRS}libboost_program_options.a")
endif()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fPIC")
elseif(APPLE)
find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options)
else()
find_package(Boost ${ZANO_BOOST_MIN_VER} REQUIRED COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options log)
# Define Boost components
set(BOOST_COMPONENTS system filesystem locale thread timer date_time chrono regex serialization atomic program_options)
if(NOT APPLE)
list(APPEND BOOST_COMPONENTS log)
endif()
# Find Boost package using Conan
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
message(STATUS "Using Boost ${Boost_VERSION} from Conan")
message(STATUS "Boost: ${Boost_VERSION} from ${Boost_LIBRARY_DIRS}")
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/contrib/ethereum/libethash)
# Append other needed libraries
if(MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif(NOT MSVC)
if(NOT APPLE AND NOT CAKEWALLET)
set(Boost_LIBRARIES "${Boost_LIBRARIES};")
if(STATIC)
message("NOTICE: Including static ICU libraries")
set(Boost_LIBRARIES "${Boost_LIBRARIES};icui18n.a;icuuc.a;icudata.a;dl")
endif()
endif()
list(APPEND Boost_LIBRARIES ws2_32 mswsock)
elseif(NOT MSVC AND NOT APPLE AND NOT CAKEWALLET AND STATIC)
message("NOTICE: Including static ICU libraries")
list(APPEND Boost_LIBRARIES icui18n.a icuuc.a icudata.a dl)
endif()
if(BUILD_GUI)
@ -320,12 +294,12 @@ else()
endif()
set(BUILD_TESTS FALSE CACHE BOOL "Build Zano tests")
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
set(DISABLE_MDBX FALSE CACHE BOOL "Exclude mdbx from build(need for a first time)")
if(NOT DISABLE_MDBX)
add_definitions(-DENABLED_ENGINE_MDBX)
endif()
add_subdirectory(contrib)
add_subdirectory(src)

View file

@ -4,10 +4,17 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Define CMake generator
ifneq ($(OS),Windows_NT)
system := $(shell uname)
ifneq (, $(findstring MINGW, $(system)))
cmake_gen = -G 'MSYS Makefiles'
endif
endif
PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*))
SORTED_PROFILES := $(sort $(PROFILES))
CONAN_CACHE := $(CURDIR)/build/sdk
DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/cmake/profiles/default
cmake = cmake $(cmake_gen)
@ -27,38 +34,50 @@ build = build
dir_debug = $(build)/debug
dir_release = $(build)/release
all: release
all: help
release:
$(eval command += $(cmake_release))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
release: conan-profile-detect
@echo "Building profile: release"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=Release
cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build/release --config=Release --parallel=2
debug:
$(eval command += $(cmake_debug))
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
debug: conan-profile-detect
@echo "Building profile: debug"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug
cmake -S . -B build/debug -DCMAKE_TOOLCHAIN_FILE=build/debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug
cmake --build build/debug --config=Debug --parallel=2
static: static-release
static-release:
$(eval command += $(cmake_release) $(cmake_static))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
static-release: conan-profile-detect
@echo "Building profile: release-static"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release-static --build=missing
cmake -S . -B build/release-static -DCMAKE_TOOLCHAIN_FILE=build/release-static/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D STATIC=ON
cmake --build build/release-static --config=Release --parallel=2
#
# GUI
#
conan-profile-detect:
@if [ ! -f "$(DEFAULT_CONAN_PROFILE)" ]; then \
echo "Default conan profile not found. Detecting a new one..."; \
CONAN_HOME=$(CONAN_CACHE) conan profile detect --name=default --force; \
fi
gui: gui-release
gui-release:
$(eval command += $(cmake_release) $(cmake_gui))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
gui-debug:
$(eval command += $(cmake_debug) $(cmake_gui))
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE)
# Rule for each profile
$(PROFILES): conan-profile-detect
@echo "Building profile: $@"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/$@ --profile=cmake/profiles/$@ --build=missing
cmake -S . -B build/$@ -DCMAKE_TOOLCHAIN_FILE=build/$@/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build/$@ --config=Release --parallel=2
gui-static: gui-release-static
gui-release-static:
$(eval command += $(cmake_release) $(cmake_gui) $(cmake_static))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE)
help:
@echo "Available targets:"
@printf " %-22s %s\n" "all:" "Build all profiles"
@printf " %-22s %s\n" "clean:" "Clean all build directories"
@printf " %-22s %s\n" "release:" "Build release"
@printf " %-22s %s\n" "static:" "Build static release"
@printf " %-22s %s\n" "debug:" "Build debug"
@$(foreach profile,$(SORTED_PROFILES),printf " %-22s %s\n" "make $(profile):" "Build the $(profile) profile";)
@printf " %-22s %s\n" "help:" "Show this help message"
#
# Tests
@ -66,12 +85,18 @@ gui-release-static:
test: test-release
test-release:
$(eval command += $(cmake_release) $(cmake_tests))
$(call CMAKE,$(dir_release),$(command)) && $(MAKE) && $(MAKE) test
@echo "Building profile: test-release"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-release --build=missing
cmake -S . -B build/test-release -DCMAKE_TOOLCHAIN_FILE=build/test-release/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -D BUILD_TESTS=ON
cmake --build build/test-release --config=Release --parallel=2
$(MAKE) test
test-debug:
$(eval command += $(cmake_debug) $(cmake_tests))
$(call CMAKE,$(dir_debug),$(command)) && $(MAKE) && $(MAKE) test
@echo "Building profile: test-debug"
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-debug --build=missing
cmake -S . -B build/test-debug -DCMAKE_TOOLCHAIN_FILE=build/test-debug/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -D BUILD_TESTS=ON
cmake --build build/test-debug --config=Debug --parallel=2
$(MAKE) test
clean:
rm -rf build
@ -79,4 +104,4 @@ clean:
tags:
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags
.PHONY: all release debug static static-release gui gui-release gui-static gui-release-static gui-debug test test-release test-debug clean tags conan-profile-detect $(PROFILES)

View file

@ -1,67 +0,0 @@
# 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()

11
cmake/profiles/android Normal file
View file

@ -0,0 +1,11 @@
[settings]
os=Android
os.api_level=21
arch=armv8
compiler=clang
compiler.version=11
compiler.libcxx=c++_static
build_type=Release
[conf]
tools.cmake.cmaketoolchain:user_presets=False

11
cmake/profiles/ios Normal file
View file

@ -0,0 +1,11 @@
[settings]
os=iOS
os.version=15.0
arch=armv8
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
[conf]
tools.cmake.cmaketoolchain:user_presets=False

View file

@ -0,0 +1,10 @@
[settings]
os=Linux
arch=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++11
build_type=Release
[conf]
tools.cmake.cmaketoolchain:user_presets=False

10
cmake/profiles/mac_arm Normal file
View file

@ -0,0 +1,10 @@
[settings]
os=Macos
arch=armv8
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
[conf]

10
cmake/profiles/mac_intel Normal file
View file

@ -0,0 +1,10 @@
[settings]
os=Macos
arch=x86_64
compiler=apple-clang
compiler.version=13
compiler.libcxx=libc++
build_type=Release
[conf]

View file

@ -0,0 +1,17 @@
[settings]
os=Windows
arch=x86_64
compiler=gcc
compiler.version=12
compiler.libcxx=libstdc++11
build_type=Release
[options]
# Example: boost:without_test=True
[env]
CC=x86_64-w64-mingw32-gcc
CXX=x86_64-w64-mingw32-g++
[conf]
tools.cmake.cmaketoolchain:user_presets=False

View file

@ -0,0 +1,11 @@
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=static
compiler.version=194
os=Windows
[conf]
tools.cmake.cmaketoolchain:user_presets=False

8
conanfile.txt Normal file
View file

@ -0,0 +1,8 @@
[requires]
zlib/1.3.1
boost/1.85.0
openssl/3.2.0
[generators]
CMakeDeps
CMakeToolchain

View file

@ -51,8 +51,6 @@ ENDMACRO(ENABLE_SHARED_PCH_EXECUTABLE)
##### End of Precompiled Headers macros ######
file(GLOB_RECURSE PCH pch/*)
file(GLOB_RECURSE COMMON common/*)
file(GLOB_RECURSE CRYPTO crypto/*)
@ -68,17 +66,6 @@ file(GLOB_RECURSE CONN_TOOL connectivity_tool/*)
file(GLOB_RECURSE WALLET wallet/*)
file(GLOB_RECURSE MINER miner/*)
if(BUILD_GUI)
if(MSVC)
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/app.rc)
elseif(APPLE)
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h gui/qt-daemon/*.mm)
else()
file(GLOB_RECURSE QTDAEMON gui/qt-daemon/*.cpp gui/qt-daemon/*.h)
endif()
list(FILTER QTDAEMON EXCLUDE REGEX "node_modules")
endif()
source_group(pch FILES ${PCH})
source_group(common FILES ${COMMON})
@ -102,6 +89,7 @@ INIT_SHARED_PCH()
add_library(common ${COMMON})
add_dependencies(common version ${PCH_LIB_NAME})
target_link_libraries(common PUBLIC ${Boost_LIBRARIES})
ENABLE_SHARED_PCH(common COMMON)
if(NOT MSVC AND NOT APPLE AND NOT CLANG) # TODO(unassigned): do we really need the clang equivalent?
@ -146,10 +134,6 @@ if(NOT DISABLE_TOR)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "iOS")
install(TARGETS wallet currency_core crypto common DESTINATION lib)
message("Generating install for iOS")
@ -197,62 +181,3 @@ set_property(TARGET common crypto currency_core rpc stratum wallet PROPERTY FOLD
set_property(TARGET daemon simplewallet connectivity_tool PROPERTY FOLDER "prog")
set_property(TARGET daemon PROPERTY OUTPUT_NAME "zanod")
if(BUILD_GUI)
if(APPLE)
FIND_LIBRARY(COCOA_LIBRARY Cocoa)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(MACOSX_BUNDLE_ICON_FILE app.icns)
add_executable(Zano WIN32 MACOSX_BUNDLE ${QTDAEMON} )
ENABLE_SHARED_PCH(Zano QTDAEMON)
ENABLE_SHARED_PCH_EXECUTABLE(Zano)
#QT5_USE_MODULES(Zano WebEngineWidgets WebChannel)
target_link_libraries(Zano PUBLIC wallet rpc currency_core crypto common zlibstatic ethash Qt6::WebChannel Qt6::WebEngineWidgets Qt6::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto PRIVATE Qt6::Core5Compat)
if (UNIX AND NOT APPLE)
target_link_libraries(Zano PRIVATE rt)
endif()
if(APPLE)
target_link_libraries(Zano PRIVATE ${COCOA_LIBRARY})
set_property(TARGET Zano PROPERTY XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME YES)
endif()
if(MSVC)
target_link_libraries(Zano PRIVATE shlwapi.lib)
endif()
set_property(TARGET Zano PROPERTY FOLDER "prog")
set_target_properties(Zano PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/Info.plist.in)
set(HTML_DIR ${CMAKE_CURRENT_SOURCE_DIR}/gui/qt-daemon/layout/html)
set_target_properties(Zano PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--html-path=${HTML_DIR}")
set(CMAKE_AUTOMOC OFF)
# GUI convenience "bundle"
# set(GUI_DIR ${CMAKE_CURRENT_BINARY_DIR}/gui)
# set_target_properties(Zano PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${GUI_DIR})
# add_custom_command(TARGET Zano POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${HTML_DIR} ${GUI_DIR}/html)
endif()
if(APPLE)
set(SIMPLE_BUNDLE 1)
endif()
if(SIMPLE_BUNDLE)
set(INSTALL_DIR "${CMAKE_BINARY_DIR}/hp-${VERSION}")
install(TARGETS daemon simplewallet connectivity_tool
RUNTIME DESTINATION "${INSTALL_DIR}" COMPONENT Runtime
)
install(FILES ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} DESTINATION "${INSTALL_DIR}/lib")
if(APPLE)
set(FIXUP_COMMAND ${CMAKE_SOURCE_DIR}/utils/macosx_fixup.sh " " ${INSTALL_DIR})
install(CODE "execute_process(COMMAND ${FIXUP_COMMAND})")
endif()
endif()

View file

@ -1050,7 +1050,7 @@ bool process_archive(archive_processor_t& arch_processor, bool is_packing, const
<< "File " << (is_packing ? "packed" : "unpacked") << " from size " << sz << " to " << written_bytes << ENDL
<< "hash of the data is " << epee::string_tools::pod_to_hex(data_hash) << ENDL
<< ENDL
<< " = { \"" << boost::filesystem::basename(path_target) << "\", \"" << epee::string_tools::pod_to_hex(data_hash) << "\", " << written_bytes << ", " << sz << " }" << ENDL;
<< " = { \"" << boost::filesystem::path(path_target).filename().string() << "\", \"" << epee::string_tools::pod_to_hex(data_hash) << "\", " << written_bytes << ", " << sz << " }" << ENDL;
return true;
}