1
0
Fork 0
forked from lthn/blockchain

Refactor Conan executable path handling and remove Windows-specific runtime settings from Makefile

This commit is contained in:
snider 2025-10-06 20:12:37 +01:00
parent e0dee18c86
commit e3dfe68ec8
3 changed files with 9 additions and 14 deletions

View file

@ -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)"

View file

@ -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
)

View file

@ -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")