From e3dfe68ec8776c3a72e0a348c40c0c042041216a Mon Sep 17 00:00:00 2001 From: snider Date: Mon, 6 Oct 2025 20:12:37 +0100 Subject: [PATCH] Refactor Conan executable path handling and remove Windows-specific runtime settings from Makefile --- Makefile | 11 ++--------- cmake/ConanProfileSetup.cmake | 10 ++++++---- cmake/GetConan.cmake | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 8bd8fa9b..c12611af 100644 --- a/Makefile +++ b/Makefile @@ -66,14 +66,7 @@ CONAN_CACHE := $(CURDIR)/build/sdk DEFAULT_CONAN_PROFILE := $(CONAN_CACHE)/profiles/default CONAN_EXECUTABLE := $(CURDIR)/build/bin/conan CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile -CONAN_OPTIONS:= -s compiler.cppstd=17 -# Detect if we are on Windows -ifeq ($(OS), Windows_NT) - # If so, define a prefix to clear the problematic env vars - CONAN_OPTIONS+= -s compiler.runtime=static -else - # Otherwise, the prefix is empty -endif + all: help release: docs build @@ -92,7 +85,7 @@ debug: conan-profile-detect build-deps: conan-profile-detect @echo "Build Dependencies: $(BUILD_TYPE) testnet=$(TESTNET)" - CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE) $(CONAN_OPTIONS) + CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) install . --build=missing -s build_type=$(BUILD_TYPE) configure: build-deps @echo "Running Configure: $(BUILD_TYPE) testnet=$(TESTNET)" diff --git a/cmake/ConanProfileSetup.cmake b/cmake/ConanProfileSetup.cmake index 4ab9c164..c6a0e803 100644 --- a/cmake/ConanProfileSetup.cmake +++ b/cmake/ConanProfileSetup.cmake @@ -1,13 +1,15 @@ -# Use the CONAN_HOME from the environment, or default to a local directory. - set(CONAN_HOME "${CMAKE_SOURCE_DIR}/build/sdk") set(DEFAULT_PROFILE "${CONAN_HOME}/profiles/default") - +if(WIN32) + set(CONAN_EXECUTABLE "${CMAKE_SOURCE_DIR}/build/bin/conan.exe") +else() + set(CONAN_EXECUTABLE "${CMAKE_SOURCE_DIR}/build/bin/conan") +endif() if(NOT EXISTS "${DEFAULT_PROFILE}") message(STATUS "Conan default profile not found. Detecting a new one...") set(ENV{CONAN_HOME} "${CONAN_HOME}") execute_process( - COMMAND "${CMAKE_SOURCE_DIR}/build/bin/conan" profile detect --name=default --force + COMMAND "${CONAN_EXECUTABLE}" profile detect --name=default --force WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE return_code ) diff --git a/cmake/GetConan.cmake b/cmake/GetConan.cmake index 1a60eb2e..9b7437ee 100644 --- a/cmake/GetConan.cmake +++ b/cmake/GetConan.cmake @@ -19,7 +19,7 @@ if(NOT CMAKE_BINARY_DIR) endif() if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") set(CONAN_INSTALL_DIR "${CMAKE_SOURCE_DIR}/build/bin") - set(CONAN_EXECUTABLE "${CONAN_INSTALL_DIR}/bin/conan.exe") + set(CONAN_EXECUTABLE "${CMAKE_SOURCE_DIR}/build/bin/conan.exe") else () set(CONAN_INSTALL_DIR "${CMAKE_SOURCE_DIR}/build") set(CONAN_EXECUTABLE "${CONAN_INSTALL_DIR}/bin/conan")