diff --git a/.gemini/config.yaml b/.gemini/config.yaml new file mode 100644 index 00000000..e8560858 --- /dev/null +++ b/.gemini/config.yaml @@ -0,0 +1,10 @@ +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: [] \ No newline at end of file diff --git a/.github/actions/cmake-build/action.yml b/.github/actions/cmake-build/action.yml new file mode 100644 index 00000000..ace56f4b --- /dev/null +++ b/.github/actions/cmake-build/action.yml @@ -0,0 +1,63 @@ +# .github/actions/cmake-build/action.yml +name: 'Build Project with CMake' +description: 'Builds the project using CMake with specified options.' +inputs: + chain-network: + description: 'The network type (e.g., mainnet, testnet).' + required: true + boost-root: + description: 'The root directory of the Boost installation.' + required: true + build-type: + description: 'The CMake build type (e.g., Release, Debug).' + required: false + default: 'Release' + jobs: + description: 'Number of parallel jobs for the build.' + required: false + default: '3' + target: + description: 'The specific CMake target(s) to build.' + required: false + default: '' + build-gui: + description: 'Set to true to enable building the GUI.' + required: false + static: + description: 'Build statically.' + required: false + generator: + description: 'The CMake generator to use.' + required: false + arch: + description: 'The target architecture.' + required: false + +runs: + using: "composite" + steps: + - id: set_paths + shell: bash + run: echo "build_dir_name=$(echo ${{ inputs.build-type }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT + + - name: Build Project + uses: threeal/cmake-action@v2.1.0 + env: + CCACHE_TEMPDIR: ${{ github.workspace }}/build/ccache + OPENSSL_ROOT_DIR: ${{ github.workspace }}/build/openssl + BOOST_ROOT: ${{ inputs.boost-root }} + with: + build-dir: build/${{ steps.set_paths.outputs.build_dir_name }} + generator: ${{ inputs.generator }} + build-args: | + --parallel ${{ inputs.jobs }} + --config ${{ inputs.build-type }} + ${{ inputs.target && format('--target {0}', inputs.target) }} + options: | + ${{ inputs.static && 'STATIC=ON' }} + ${{ inputs.chain-network == 'testnet' && 'TESTNET=ON' }} + ${{ inputs.arch && format('ARCH={0}', inputs.arch) }} + CMAKE_BUILD_TYPE=${{ inputs.build-type }} + ${{ inputs.build-gui && 'BUILD_GUI=ON' }} + Boost_INCLUDE_DIR=${{ inputs.boost-root }}/include + Boost_LIBRARY_DIRS=${{ inputs.boost-root }}/lib \ No newline at end of file diff --git a/.github/actions/sign-and-upload-release/action.yml b/.github/actions/sign-and-upload-release/action.yml new file mode 100644 index 00000000..503c9ccd --- /dev/null +++ b/.github/actions/sign-and-upload-release/action.yml @@ -0,0 +1,88 @@ +# .github/actions/sign-and-upload-release/action.yml +name: 'Sign and Upload Release' +description: 'Archives and uploads signed binaries to a GitHub release' +inputs: + chain-network: + required: true + description: 'The chain network name to use in filenames, mainnet or testnet' + assets: + description: "A \\n separated string list of filenames to archive; if asset is a abs path, it's respected" + required: false + asset-type: + required: true + description: 'The asset type: cli, gui, ANYTHING; used as a separator for different release packages for the same arch' + asset-directory: + required: true + description: "The directory where 7z's working dir will be set" + release: + required: false + default: "true" + description: 'string flag to determine if a release should be created' + release-tag: + required: true + description: 'The tag for the release' + +runs: + using: "composite" + steps: + - name: compute file name + id: asset + shell: bash + run: | + ARCH=${{ runner.arch }} + RUNNER_OS=${{ runner.os }} + LOWERCASE_ARCH=$(echo "$ARCH" | tr '[:upper:]' '[:lower:]') + TARGET_OS=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]') + FILENAME="${{ inputs.chain-network }}-${{ inputs.asset-type }}-${TARGET_OS}-${LOWERCASE_ARCH}" + echo "key=$FILENAME" >> $GITHUB_OUTPUT + + # Format the output to be a multi-line string. + # This is the correct way to pass a multi-line string in GITHUB_OUTPUT. + echo "paths<> "$GITHUB_OUTPUT" + + # Iterate through each filename + echo "${{ inputs.assets }}" | while read -r file; do + if [[ -z "$file" ]]; then + continue + fi + # Check if the file is an absolute path + if [[ "$file" == /* ]] || [[ "$file" =~ ^[a-zA-Z]: ]]; then + FULL_PATH="$file" + else + # It's a relative path, so join it with the asset directory + if [[ "${{ runner.os }}" == "Windows" ]]; then + FULL_PATH="${{ inputs.asset-directory }}\\$file" + else + FULL_PATH="${{ inputs.asset-directory }}/$file" + fi + fi + echo "$FULL_PATH" >> "$GITHUB_OUTPUT" + done + echo "EOF" >> "$GITHUB_OUTPUT" + + - name: Upload Artifacts + uses: actions/upload-artifact@v4.6.2 + with: + 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 }} \ No newline at end of file diff --git a/.github/workflows/_maint-cache.yml b/.github/workflows/_maint-cache.yml new file mode 100644 index 00000000..a398ef28 --- /dev/null +++ b/.github/workflows/_maint-cache.yml @@ -0,0 +1,25 @@ +name: Clear all Github actions caches on sundays +on: + schedule: + - cron: "0 0 * * 0" + workflow_dispatch: +# pull_request: +# types: +# - opened +# - synchronize +# - reopened +# branches: +# - dev +# - main +# paths-ignore: +# - '**.md' + +jobs: + my-job: + name: Delete all caches + runs-on: ubuntu-24.04 + env: + GH_TOKEN: ${{ github.token }} + steps: + - name: Clear caches + run: gh cache delete --all --repo ${{ github.repository }} \ No newline at end of file diff --git a/.github/workflows/_on-pr-fast.yml b/.github/workflows/_on-pr-fast.yml new file mode 100644 index 00000000..bdd670bb --- /dev/null +++ b/.github/workflows/_on-pr-fast.yml @@ -0,0 +1,28 @@ +name: PR Fast + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request: + types: + - opened + - synchronize + - reopened + branches: + - dev + - main + paths-ignore: + - '**.md' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-macos-arm64: + name: Compile + uses: ./.github/workflows/build-macos-arm64.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + release: false + build-gui: false \ No newline at end of file diff --git a/.github/workflows/_on-pr.yml b/.github/workflows/_on-pr.yml new file mode 100644 index 00000000..518cbdb5 --- /dev/null +++ b/.github/workflows/_on-pr.yml @@ -0,0 +1,42 @@ +name: PR + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + pull_request_review: + pull_request: + types: + - review_requested + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build-linux: + name: Compile + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + uses: ./.github/workflows/build-linux.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-windows: + name: Compile + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + uses: ./.github/workflows/build-windows.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-macos-arm64: + name: Compile + uses: ./.github/workflows/build-macos-arm64.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-macos-intel: + name: Compile + if: github.event.review.state == 'approved' && !github.event.pull_request.draft + uses: ./.github/workflows/build-macos-intel.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + diff --git a/.github/workflows/_on-push.yml b/.github/workflows/_on-push.yml new file mode 100644 index 00000000..ab651da0 --- /dev/null +++ b/.github/workflows/_on-push.yml @@ -0,0 +1,39 @@ +name: Push Full Build + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + push: + branches: + - 'dev' + - 'main' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-linux: + name: Compile + uses: ./.github/workflows/build-linux.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-windows: + name: Compile + uses: ./.github/workflows/build-windows.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-macos-arm64: + name: Compile + uses: ./.github/workflows/build-macos-arm64.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + + build-macos-intel: + name: Compile + uses: ./.github/workflows/build-macos-intel.yml + with: + chain-network: ${{ github.ref_name == 'main' && 'mainnet' || 'testnet' }} + diff --git a/.github/workflows/_on-release.yml b/.github/workflows/_on-release.yml new file mode 100644 index 00000000..2ccb20ad --- /dev/null +++ b/.github/workflows/_on-release.yml @@ -0,0 +1,65 @@ +name: Push Full Build + +on: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + release: + types: [ published ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + determine-network: + runs-on: ubuntu-latest + outputs: + chain-network: ${{ steps.get_branch.outputs.chain_network }} + steps: + - name: Get release information from API + id: get_branch + run: | + # Use the GitHub CLI to get the release details by tag name + # The result is a JSON object + RELEASE_INFO=$(gh release view --json targetCommitish -t ${{ github.ref_name }}) + + # Extract the target commitish (the source branch) + SOURCE_BRANCH=$(echo "$RELEASE_INFO" | jq -r '.targetCommitish') + + # Set the chain network based on the source branch + if [ "$SOURCE_BRANCH" == "dev" ]; then + echo "chain_network=testnet" >> $GITHUB_OUTPUT + else + echo "chain_network=mainnet" >> $GITHUB_OUTPUT + fi + + echo "Source Branch: $SOURCE_BRANCH" + echo "Chain Network: ${{ steps.get_branch.outputs.chain_network }}" + + build-linux: + name: Compile + needs: determine-network + uses: ./.github/workflows/build-linux.yml + with: + chain-network: ${{ needs.determine-network.outputs.chain-network }} + + build-windows: + name: Compile + needs: determine-network + uses: ./.github/workflows/build-windows.yml + with: + chain-network: ${{ needs.determine-network.outputs.chain-network }} + + build-macos-arm64: + name: Compile + needs: determine-network + uses: ./.github/workflows/build-macos-arm64.yml + with: + chain-network: ${{ needs.determine-network.outputs.chain-network }} + + build-macos-intel: + name: Compile + needs: determine-network + uses: ./.github/workflows/build-macos-intel.yml + with: + chain-network: ${{ needs.determine-network.outputs.chain-network }} diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 00000000..5eed8c90 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,118 @@ +name: build-linux + +on: + workflow_call: + inputs: + chain-network: + description: "The network to use, can either be testnet, stagenet or mainnet" + default: testnet + required: false + type: string + build-cli: + description: "Should the CLI be built" + default: true + required: false + type: boolean + build-gui: + description: "Should the GUI be built" + default: true + required: false + type: boolean + release: + description: "Make a release" + default: true + required: false + type: boolean + +jobs: + build: + name: Linux + 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-${{ inputs.chain-network }}-${{ 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: 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: CLI Artifacts + if: ${{ inputs.build-cli }} + uses: ./.github/actions/sign-and-upload-release + with: + chain-network: ${{ inputs.chain-network }} + release-tag: ${{ github.ref_name }} + release: "${{ inputs.release }}" + 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: '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 \ No newline at end of file diff --git a/.github/workflows/build-macos-arm64.yml b/.github/workflows/build-macos-arm64.yml new file mode 100644 index 00000000..0f34098d --- /dev/null +++ b/.github/workflows/build-macos-arm64.yml @@ -0,0 +1,139 @@ +name: build-macos-arm64 +permissions: + contents: write +on: + workflow_call: + inputs: + chain-network: + description: "The network to use, can either be testnet, stagenet or mainnet" + default: testnet + required: false + type: string + build-cli: + description: "Should the CLI be built" + default: true + required: false + type: boolean + build-gui: + description: "Should the GUI be built" + default: true + required: false + type: boolean + release: + description: "Make a release" + default: true + required: false + type: boolean + release-tag: + required: false + type: string + description: 'The tag for the release' + +jobs: + build-cli: + name: MacOS Arm64 + runs-on: macos-15 + 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 + + - run: mkdir -p build/openssl + - run: mkdir -p build/ccache + - name: Cache OpenSSL + id: cache-openssl + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/build/openssl + key: openssl-${{ runner.os }}-${{ runner.arch }} + + - 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: CLI Artifacts + if: ${{ inputs.build-cli }} + uses: ./.github/actions/sign-and-upload-release + with: + chain-network: ${{ inputs.chain-network }} + release-tag: ${{ github.ref_name }} + release: "${{ inputs.release }}" + assets: | + zanod + simplewallet + 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 diff --git a/.github/workflows/build-macos-intel.yml b/.github/workflows/build-macos-intel.yml new file mode 100644 index 00000000..8b8e7c86 --- /dev/null +++ b/.github/workflows/build-macos-intel.yml @@ -0,0 +1,133 @@ +name: build-macos-intel + +on: + workflow_call: + inputs: + chain-network: + description: "The network to use, can either be testnet, stagenet or mainnet" + default: testnet + required: false + type: string + build-cli: + description: "Should the CLI be built" + default: true + required: false + type: boolean + build-gui: + description: "Should the GUI be built" + default: true + required: false + type: boolean + release: + description: "Make a release" + default: true + required: false + type: boolean + +jobs: + build: + name: MacOS Intel + 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: openssl-${{ runner.os }}-intel + + - 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: CLI Artifacts + if: ${{ inputs.build-cli }} + uses: ./.github/actions/sign-and-upload-release + with: + chain-network: ${{ inputs.chain-network }} + release-tag: ${{ github.ref_name }} + release: "${{ inputs.release }}" + 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: '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 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..e7510891 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,120 @@ +name: build-windows + +on: + workflow_call: + inputs: + chain-network: + description: "The network to use, can either be testnet, stagenet or mainnet" + default: testnet + required: false + type: string + build-cli: + description: "Should the CLI be built" + default: true + required: false + type: boolean + build-gui: + description: "Should the GUI be built" + default: true + required: false + type: boolean + release: + description: "Make a release" + default: true + required: false + type: boolean + +jobs: + build: + name: Windows + 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-${{ inputs.chain-network }}-${{ 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: 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: CLI Artifacts + if: ${{ inputs.build-cli }} + uses: ./.github/actions/sign-and-upload-release + with: + chain-network: ${{ inputs.chain-network }} + release-tag: ${{ github.ref_name }} + release: "${{ inputs.release }}" + assets: | + zanod.exe + 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 diff --git a/.github/workflows/testnet-cli-linux.yml b/.github/workflows/testnet-cli-linux.yml deleted file mode 100644 index 57b5e8cc..00000000 --- a/.github/workflows/testnet-cli-linux.yml +++ /dev/null @@ -1,74 +0,0 @@ -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 deleted file mode 100644 index 3542ea0c..00000000 --- a/.github/workflows/testnet-cli-macos-arm64.yml +++ /dev/null @@ -1,92 +0,0 @@ -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 deleted file mode 100644 index 7aed702b..00000000 --- a/.github/workflows/testnet-cli-macos-intel.yml +++ /dev/null @@ -1,90 +0,0 @@ -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 deleted file mode 100644 index b4c317cb..00000000 --- a/.github/workflows/testnet-cli-windows.yml +++ /dev/null @@ -1,79 +0,0 @@ -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 e90f8730..8e772571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ find_package(OpenSSL REQUIRED) if(APPLE) - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15) + set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) endif() set(USE_PCH FALSE CACHE BOOL "Use shared precompiled headers") @@ -289,10 +289,8 @@ elseif(NOT MSVC) endif() if(BUILD_GUI) - cmake_minimum_required(VERSION 3.1) # <-- this is important for Linux GUI build, don't touch it -- sowle - find_package(Qt5Widgets REQUIRED) - find_package(Qt5WebEngineWidgets REQUIRED) - find_package(Qt5WebChannel REQUIRED) + find_package(Qt6 REQUIRED COMPONENTS Core5Compat Widgets WebEngineWidgets WebChannel PrintSupport) + message(STATUS "Found QT Packages") endif() set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version") diff --git a/README.md b/README.md index 6fe0bdad..dcee9f03 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,16 @@ Be sure to clone the repository properly:\ ### Dependencies -| component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | -|--|--|--|--| -| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 | -| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 | -| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) | -| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 | -| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 | -| [Boost](https://www.boost.org/users/download/) | 1.75 | 1.84 | 1.84 | -| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 3.4 | -| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 5.8.0 | 5.15.2 | 5.15.2 | +| component / version | minimum
(not recommended but may work) | recommended | most recent of what we have ever tested | +|-----------------------------------------------------------------------------------------------------|--------------------------------------------|----------------|-----------------------------------------| +| gcc (Linux) | 8.4.0 | 9.4.0 | 12.3.0 | +| llvm/clang (Linux) | UNKNOWN | 7.0.1 | 8.0.0 | +| [MSVC](https://visualstudio.microsoft.com/downloads/) (Windows) | 2017 (15.9.30) | 2022 (17.11.5) | 2022 (17.12.3) | +| [XCode](https://developer.apple.com/downloads/) (macOS) | 12.3 | 14.3 | 15.2 | +| [CMake](https://cmake.org/download/) | 3.26.3 | 3.26.3 | 3.31.6 | +| [Boost](https://www.boost.org/users/download/) | 1.75 | 1.84 | 1.84 | +| [OpenSSL](https://www.openssl.org/source/) [(win)](https://slproweb.com/products/Win32OpenSSL.html) | 1.1.1n | 1.1.1w | 3.4 | +| [Qt](https://download.qt.io/archive/qt/) (*only for GUI*) | 6.8.3 | 6.8.3 | 6.8.3 | Note:\ [*server version*] denotes steps required for building command-line tools (daemon, simplewallet, etc.).\ @@ -54,25 +54,35 @@ Recommended OS versions: Ubuntu 20.04, 22.04 LTS. In the following steps we assume that you cloned Zano into '~/zano' folder in your home directory. -4. Download and build Boost\ - (Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, **edit line 4** accordingly.) + 4. Download and build Boost\ + (Assuming you have cloned Zano into the 'zano' folder. If you used a different location for Zano, **edit line 4** accordingly.) - curl -OL https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.bz2 - echo "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454 boost_1_84_0.tar.bz2" | shasum -c && tar -xjf boost_1_84_0.tar.bz2 - rm boost_1_84_0.tar.bz2 && cd boost_1_84_0 - ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log - ./b2 && cd .. - Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end. + curl -OL https://archives.boost.io/release/1.84.0/source/boost_1_84_0.tar.bz2 + echo "cc4b893acf645c9d4b698e9a0f08ca8846aa5d6c68275c14c3e7949c24109454 boost_1_84_0.tar.bz2" | shasum -c && tar -xjf boost_1_84_0.tar.bz2 + rm boost_1_84_0.tar.bz2 && cd boost_1_84_0 + ./bootstrap.sh --with-libraries=system,filesystem,thread,date_time,chrono,regex,serialization,atomic,program_options,locale,timer,log + ./b2 && cd .. + Make sure that you see "The Boost C++ Libraries were successfully built!" message at the end. -5. Install Qt\ -(*GUI version only, skip this step if you're building server version*) + 5. Install Qt\ + (*GUI version only, skip this step if you're building server version*) - [*GUI version*] + [*GUI version*] - curl -OL https://download.qt.io/new_archive/qt/5.11/5.11.2/qt-opensource-linux-x64-5.11.2.run - chmod +x qt-opensource-linux-x64-5.11.2.run - ./qt-opensource-linux-x64-5.11.2.run - Then follow the instructions in Wizard. Don't forget to tick the WebEngine module checkbox! + curl -L -O https://download.qt.io/official_releases/online_installers/qt-online-installer-linux-x64-online.run && + chmod u+x qt-online-installer-linux-x64-online.run + ./qt-online-installer-linux-x64-online.run \ + --accept-licenses \ + --default-answer \ + --confirm-command install \ + qt.qt6.683.linux_gcc_64 \ + qt.qt6.683.addons.qt5compat.linux_gcc_64 \ + qt.qt6.683.addons.qtpositioning.linux_gcc_64 \ + qt.qt6.683.addons.qtwebchannel.linux_gcc_64 \ + qt.qt6.683.addons.qtwebsockets.linux_gcc_64 \ + qt.qt6.683.addons.qtwebengine.linux_gcc_64 \ + qt.qt6.683.addons.qtwebview.linux_gcc_64 + This will download the online installer and perform an unattended installation with the Chromium-based WebEngine 6. Install OpenSSL diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6bdcea2..0eeb1950 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -211,19 +211,18 @@ if(BUILD_GUI) ENABLE_SHARED_PCH_EXECUTABLE(Zano) #QT5_USE_MODULES(Zano WebEngineWidgets WebChannel) - find_package(Qt5PrintSupport REQUIRED) - target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebChannel Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto) + 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 rt) + target_link_libraries(Zano PRIVATE rt) endif() if(APPLE) - target_link_libraries(Zano ${COCOA_LIBRARY}) + 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 shlwapi.lib) + target_link_libraries(Zano PRIVATE shlwapi.lib) endif() set_property(TARGET Zano PROPERTY FOLDER "prog") @@ -235,9 +234,9 @@ if(BUILD_GUI) 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) +# 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) diff --git a/src/gui/qt-daemon/application/mainwindow.cpp b/src/gui/qt-daemon/application/mainwindow.cpp index 30ca6bc8..97bf0397 100644 --- a/src/gui/qt-daemon/application/mainwindow.cpp +++ b/src/gui/qt-daemon/application/mainwindow.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "string_coding.h" #include "gui_utils.h" @@ -616,7 +617,13 @@ void MainWindow::restore_pos(bool consider_showed) } else { - QPoint point = QApplication::desktop()->screenGeometry().bottomRight(); + QScreen* screen = QGuiApplication::primaryScreen(); + if (!screen) + { + LOG_ERROR("No primary screen found, cannot restore window position."); + return; + } + QPoint point = screen->geometry().bottomRight(); if (m_config.m_window_position.first + m_config.m_window_size.second > point.x() || m_config.m_window_position.second + m_config.m_window_size.first > point.y() ) @@ -1099,7 +1106,7 @@ bool MainWindow::update_tor_status(const view::current_action_status& opt) CATCH_ENTRY2(false); } -bool MainWindow::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +bool MainWindow::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) { TRY_ENTRY(); #ifdef WIN32 diff --git a/src/gui/qt-daemon/application/mainwindow.h b/src/gui/qt-daemon/application/mainwindow.h index 30dc1b6c..9344d65f 100644 --- a/src/gui/qt-daemon/application/mainwindow.h +++ b/src/gui/qt-daemon/application/mainwindow.h @@ -58,7 +58,7 @@ class MainWindow : public QMainWindow, public: MainWindow(); - ~MainWindow(); + ~MainWindow() override; bool init_backend(int argc, char* argv[]); bool show_inital(); @@ -240,7 +240,7 @@ private: virtual bool set_options(const view::gui_options& opt); virtual bool update_tor_status(const view::current_action_status& opt); //--------- QAbstractNativeEventFilter --------------------------- - virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result); + bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override; //---------------------------------------------- diff --git a/src/gui/qt-daemon/main.cpp b/src/gui/qt-daemon/main.cpp index 8d3a3244..89722222 100644 --- a/src/gui/qt-daemon/main.cpp +++ b/src/gui/qt-daemon/main.cpp @@ -1,3 +1,4 @@ +// Copyright (c) 2017-2025 Lethean VPN // Copyright (c) 2014-2018 Zano Project // Copyright (c) 2014-2018 The Louisdor Project // Copyright (c) 2012-2013 The Boolberry developers @@ -6,29 +7,24 @@ #include #include "application/mainwindow.h" -#include "qdebug.h" -#include -#include -//#include "qtlogger.h" +// #include "qdebug.h" +#include +// ReSharper disable once CppUnusedIncludeDirective #include "include_base_utils.h" #include "currency_core/currency_config.h" #ifdef Q_OS_DARWIN #include "application/urleventfilter.h" #endif +namespace +{ + using string_encoding::wstring_to_utf8; + using string_tools::set_module_name_and_folder; +} + int main(int argc, char *argv[]) { -//#if defined(ARCH_CPU_X86_64) && _MSC_VER <= 1800 - // VS2013's CRT only checks the existence of FMA3 instructions, not the - // enabled-ness of them at the OS level (this is fixed in VS2015). We force - // off usage of FMA3 instructions in the CRT to avoid using that path and - // hitting illegal instructions when running on CPUs that support FMA3, but - // OSs that don't. Because we use the static library CRT we have to call - // this function once in each DLL. - // See http://crbug.com/436603. -// _set_FMA3_enable(0); -//#endif // ARCH_CPU_X86_64 && _MSC_VER <= 1800 - + if(argc > 1) std::cout << argv[1] << std::endl; @@ -37,28 +33,20 @@ int main(int argc, char *argv[]) _set_FMA3_enable(0); #endif //mutex to let InnoSetup know about running instance - ::CreateMutex(NULL, FALSE, CURRENCY_NAME_BASE "_instance"); - //::CreateMutex(NULL, FALSE, "Global\\" CURRENCY_NAME_BASE "_instance"); + CreateMutexA(nullptr, FALSE, CURRENCY_NAME_BASE "_instance"); #endif #ifdef WIN32 WCHAR sz_file_name[MAX_PATH + 1] = L""; - ::GetModuleFileNameW(NULL, sz_file_name, MAX_PATH + 1); - std::string path_to_process_utf8 = epee::string_encoding::wstring_to_utf8(sz_file_name); + GetModuleFileNameW(nullptr, sz_file_name, MAX_PATH + 1); + std::string path_to_process_utf8 = wstring_to_utf8(sz_file_name); #else std::string path_to_process_utf8 = argv[0]; #endif TRY_ENTRY(); - epee::string_tools::set_module_name_and_folder(path_to_process_utf8); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); -#ifdef _MSC_VER -#if _MSC_VER >= 1910 - QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps - //qputenv("QT_SCALE_FACTOR", "0.75"); -#endif -#endif + set_module_name_and_folder(path_to_process_utf8); log_space::get_set_log_detalisation_level(true, LOG_LEVEL_0); log_space::get_set_need_thread_id(true, true); @@ -82,7 +70,7 @@ int main(int argc, char *argv[]) viewer.setWindowTitle(CURRENCY_NAME_BASE); viewer.show_inital(); - int res = app.exec(); + int res = QApplication::exec(); LOG_PRINT_L0("Process exit with code: " << res); return res; CATCH_ENTRY2(0);