forked from lthn/blockchain
Add caching and dependency installation steps for ARM, Intel, and macOS builds
This commit is contained in:
parent
dd7a19ac6f
commit
bccf8c024b
6 changed files with 246 additions and 99 deletions
56
.github/workflows/build-linux-arm64.yml
vendored
56
.github/workflows/build-linux-arm64.yml
vendored
|
|
@ -11,8 +11,47 @@ on:
|
|||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-arm64
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install -y autotools-dev git build-essential libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: gcc-linux-arm64
|
||||
name: compile-arm64
|
||||
needs: cache
|
||||
runs-on: ubuntu-22.04-arm
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
|
|
@ -27,7 +66,9 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
@ -36,15 +77,8 @@ jobs:
|
|||
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
|
||||
- name: Install Conan
|
||||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -52,4 +86,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
|
|
|
|||
56
.github/workflows/build-linux-intel.yml
vendored
56
.github/workflows/build-linux-intel.yml
vendored
|
|
@ -11,8 +11,48 @@ on:
|
|||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: install dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: sudo apt-get install -y autotools-dev git build-essential
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
|
||||
build:
|
||||
name: gcc-linux-x86_64
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
|
|
@ -27,7 +67,9 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
@ -35,14 +77,8 @@ jobs:
|
|||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Install Conan
|
||||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -50,4 +86,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
|
|
|
|||
59
.github/workflows/build-macos-arm64.yml
vendored
59
.github/workflows/build-macos-arm64.yml
vendored
|
|
@ -12,8 +12,44 @@ on:
|
|||
|
||||
|
||||
jobs:
|
||||
build-cli:
|
||||
name: apple-clang-armv8
|
||||
cache:
|
||||
name: cache-armv8
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=3 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: compile-armv8
|
||||
needs: cache
|
||||
runs-on: macos-15
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
|
|
@ -22,11 +58,12 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
@ -35,18 +72,8 @@ jobs:
|
|||
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Install Conan
|
||||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: false
|
||||
|
||||
# - name: Compile Release
|
||||
# run: make apple-clang-armv8 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=3 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
|
||||
run: make release CPU_CORES=3 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -54,4 +81,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
|
|
|
|||
52
.github/workflows/build-macos-intel.yml
vendored
52
.github/workflows/build-macos-intel.yml
vendored
|
|
@ -11,8 +11,43 @@ on:
|
|||
type: string
|
||||
|
||||
jobs:
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: apple-clang-x86_64
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: macos-13
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
|
|
@ -21,11 +56,12 @@ jobs:
|
|||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
|
||||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
@ -33,14 +69,8 @@ jobs:
|
|||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Install Conan
|
||||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -48,4 +78,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
|
|
|
|||
53
.github/workflows/build-windows-intel.yml
vendored
53
.github/workflows/build-windows-intel.yml
vendored
|
|
@ -11,8 +11,43 @@ on:
|
|||
type: string
|
||||
|
||||
jobs:
|
||||
msvc-194:
|
||||
name: msvc-194-x86_64
|
||||
cache:
|
||||
name: cache-x86_64
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Cache SDK Folder
|
||||
id: cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
lookup-only: true
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- name: Checkout Project
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
uses: actions/checkout@v4.2.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
python-version: 3.x
|
||||
- if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Compile Dependencies
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
make upload-conan-cache
|
||||
|
||||
build:
|
||||
name: compile-x86_64
|
||||
needs: cache
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Project
|
||||
|
|
@ -24,7 +59,9 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
@ -32,14 +69,8 @@ jobs:
|
|||
python-version: 3.x
|
||||
- run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]"
|
||||
|
||||
- name: Install Conan
|
||||
uses: conan-io/setup-conan@v1
|
||||
with:
|
||||
home: ${{ github.workspace }}/build/sdk
|
||||
cache_packages: false
|
||||
|
||||
- name: Compile Release
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
|
||||
run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} CONAN_USER=ci-user CONAN_PASSWORD=${{ secrets.CONAN_PASSWORD }}
|
||||
|
||||
- name: CLI Artifacts
|
||||
uses: ./.github/actions/upload-artifacts
|
||||
|
|
@ -47,4 +78,4 @@ jobs:
|
|||
chain-network: ${{ inputs.chain-network }}
|
||||
assets: lethean-*
|
||||
asset-type: 'cli'
|
||||
asset-directory: ${{ github.workspace }}/build/release/packages
|
||||
asset-directory: ${{ github.workspace }}/build/packages
|
||||
|
|
|
|||
69
Makefile
69
Makefile
|
|
@ -52,76 +52,67 @@ ifeq ($(OS),Windows_NT)
|
|||
endif
|
||||
endif
|
||||
|
||||
#testnet-genesis-new:
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_PREMINE_WALLET=1 -DPREMINE_WALLET_PASSWORD=12345678) && cmake --build ./src --target premine_wallet || true
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
# $(eval command += $(cmake_release) $(testnet))
|
||||
# $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
#
|
||||
#genesis-new:
|
||||
# $(eval command += $(cmake_release))
|
||||
# $(call CMAKE,$(dir_release),$(command) -DGENERATE_FRESH_GENESIS=1) && cmake --build ./src --target genesis_generator
|
||||
# $(eval command += $(cmake_release))
|
||||
# $(call CMAKE,$(dir_release),$(command)) && $(MAKE)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# Safety net – ensure we always have a positive integer.
|
||||
# -----------------------------------------------------------------
|
||||
CPU_CORES := $(or $(CPU_CORES),1)
|
||||
CPU_CORES := $(shell expr $(CPU_CORES) + 0 2>/dev/null || echo 1)
|
||||
#CONAN_CPU_COUNT=$(CPU_CORES)
|
||||
CONAN_CPU_COUNT=$(CPU_CORES)
|
||||
|
||||
|
||||
PROFILES := $(patsubst cmake/profiles/%,%,$(wildcard cmake/profiles/*))
|
||||
SORTED_PROFILES := $(sort $(PROFILES))
|
||||
CONAN_CACHE := $(CURDIR)/build/sdk
|
||||
CONAN_URL:=https://artifacts.host.uk.com/artifactory/api/conan/conan-build
|
||||
CONAN_USER:=public
|
||||
CONAN_PASSWORD:=Lethean1234
|
||||
DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/profiles/default
|
||||
CONAN_EXECUTABLE := $(CURDIR)/build/bin/conan
|
||||
CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile
|
||||
# Detect if we are on Windows
|
||||
ifeq ($(OS), Windows_NT)
|
||||
# If so, define a prefix to clear the problematic env vars
|
||||
FIX_ENV := CFLAGS="" CXXFLAGS=""
|
||||
else
|
||||
# Otherwise, the prefix is empty
|
||||
FIX_ENV :=
|
||||
endif
|
||||
|
||||
all: help
|
||||
|
||||
release: docs build
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||
|
||||
build: configure
|
||||
cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
|
||||
|
||||
debug: conan-profile-detect
|
||||
@echo "Building profile: debug"
|
||||
$(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/debug --build=missing -s build_type=Debug
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) 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 -DTESTNET=$(TESTNET)
|
||||
cmake --build build/debug --config=Debug --parallel=$(CPU_CORES)
|
||||
|
||||
|
||||
build-deps: conan-profile-detect
|
||||
@echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||
$(FIX_ENV) CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE)
|
||||
|
||||
configure: build-deps
|
||||
@echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)"
|
||||
cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||
|
||||
docs: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
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
|
||||
get-conan:
|
||||
cmake -P cmake/GetConan.cmake
|
||||
(CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote add conan_build $(CONAN_URL) && \
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) remote login conan_build $(CONAN_USER) -p $(CONAN_PASSWORD)) || true
|
||||
|
||||
upload-conan-cache:
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) upload "*" -r=conan_build --confirm
|
||||
|
||||
conan-profile-detect: get-conan
|
||||
cmake -P cmake/ConanProfileSetup.cmake
|
||||
|
||||
# Rule for each profile
|
||||
$(PROFILES): conan-profile-detect
|
||||
@echo "Building profile: $@"
|
||||
CFLAGS="" CXXFLAGS="" CONAN_HOME=$(CONAN_CACHE) conan install . -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . -pr:h=cmake/profiles/$@ --build=missing -s build_type=$(BUILD_TYPE)
|
||||
cmake -S . -B $(BUILD_FOLDER) -DCMAKE_TOOLCHAIN_FILE=$(BUILD_FOLDER)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION)
|
||||
cmake --build $(BUILD_FOLDER) --config=$(BUILD_TYPE) --parallel=$(CPU_CORES)
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
|
|
@ -129,6 +120,7 @@ $(PROFILES): conan-profile-detect
|
|||
help:
|
||||
@echo "Available targets:"
|
||||
@printf " %-42s %s\n" "make clean" "Clean all build directories"
|
||||
@printf " %-42s %s\n" "make get-conan" "Download and install conan locally"
|
||||
@printf " %-42s %s\n" "make release" "Build release"
|
||||
@printf " %-42s %s\n" "make static" "Build static release"
|
||||
@printf " %-42s %s\n" "make debug" "Build debug"
|
||||
|
|
@ -147,32 +139,29 @@ help:
|
|||
test: test-release
|
||||
test-release:
|
||||
@echo "Building profile: test-release"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-release --build=missing -s build_type=$(BUILD_TYPE)
|
||||
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=$(CPU_CORES)
|
||||
$(MAKE) test
|
||||
|
||||
test-debug:
|
||||
@echo "Building profile: test-debug"
|
||||
CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE)
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --output-folder=build/test-debug --build=missing -s build_type=$(BUILD_TYPE)
|
||||
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=$(CPU_CORES)
|
||||
$(MAKE) test
|
||||
|
||||
|
||||
docs: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
docs-dev: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=serve_docs --config=Release
|
||||
|
||||
|
||||
clean:
|
||||
@cmake -P cmake/CleanBuild.cmake
|
||||
|
||||
clean-build:
|
||||
rm -rf build
|
||||
|
||||
tags:
|
||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||
|
||||
.PHONY: all release docker-chain-node debug docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect $(PROFILES)
|
||||
.PHONY: all release upload-conan-cache docker-chain-node debug docs docs-dev configure static static-release test test-release test-debug clean tags conan-profile-detect get-conan $(PROFILES)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue