From 9389b678803fdcd5b82e2c813299824ddd56e8dc Mon Sep 17 00:00:00 2001 From: Snider Date: Wed, 1 Oct 2025 22:28:07 +0100 Subject: [PATCH] Add STATIC build option and update CI workflows Introduces a STATIC flag to the Makefile for controlling static builds, passing the appropriate Conan and CMake options. Updates the Windows CI workflow to use STATIC=1 for release builds and adjusts Docker build arguments for consistency. --- .github/workflows/build-docker.yml | 3 +-- .github/workflows/build-windows-intel.yml | 2 +- Makefile | 11 +++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index bdf6e18a..389b1fc9 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -49,8 +49,7 @@ jobs: platforms: linux/amd64,linux/arm64 build-args: | BUILD_TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} - THREADS=2 - BUILD_TARGET=gcc-linux-x86_64 + BUILD_THREADS=2 BUILD_LOCAL=1 tags: lthn/chain:${{ inputs.chain-network == 'testnet' && 'testnet' || 'latest' }} cache-from: type=gha diff --git a/.github/workflows/build-windows-intel.yml b/.github/workflows/build-windows-intel.yml index 8c5b3dd3..6808bba5 100644 --- a/.github/workflows/build-windows-intel.yml +++ b/.github/workflows/build-windows-intel.yml @@ -42,7 +42,7 @@ jobs: run: make docs - name: Compile Release - run: make release CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} + run: make release STATIC=1 CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} - name: CLI Artifacts uses: ./.github/actions/upload-artifacts diff --git a/Makefile b/Makefile index 3184aa23..2fbc1252 100644 --- a/Makefile +++ b/Makefile @@ -80,11 +80,18 @@ CONAN_CACHE := $(CURDIR)/build/sdk DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/profiles/default CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile + +ifeq ($(STATIC), 1) + CONAN_STATIC_FLAG = True +else + CONAN_STATIC_FLAG = False +endif + all: help release: conan-profile-detect @echo "Building profile: $(BUILD_TYPE) testnet=$(TESTNET)" - CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE) + CONAN_HOME=$(CONAN_CACHE) conan install . --build=missing -s build_type=$(BUILD_TYPE) -o static=$(CONAN_STATIC_FLAG) 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) @@ -145,7 +152,7 @@ test-debug: configure: @echo "Running Config: release" CONAN_HOME=$(CONAN_CACHE) conan install . --output-folder=build/release --build=missing -s build_type=$(BUILD_TYPE) - cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) + cmake -S . -B build/release -DCMAKE_TOOLCHAIN_FILE=build/release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DSTATIC=$(STATIC) -DTESTNET=$(TESTNET) -DBUILD_VERSION=$(BUILD_VERSION) docs: configure @echo "Building Documentation"