Refactor build presets and Makefile targets
Updated CMakePresets.json to add 'testnet' and 'mainnet' workflows, removed unused Windows preset, and improved environment and cache variable handling. Makefile targets for testnet and mainnet workflows were added, and Conan-related targets were renamed for consistency. Added a function to reset ConanPresets.json in CleanBuild.cmake and fixed the path for GetConan.cmake in conan_provider.cmake. Deleted obsolete .idea/cmake.xml.
This commit is contained in:
parent
57983cb865
commit
4a5c5ae742
5 changed files with 93 additions and 66 deletions
9
.idea/cmake.xml
generated
9
.idea/cmake.xml
generated
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CMakeSharedSettings">
|
||||
<configurations>
|
||||
<configuration PROFILE_NAME="Debug" ENABLED="false" GENERATION_DIR="build/debug" CONFIG_NAME="Debug" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="cmake/conan_provider.cmake"" />
|
||||
<configuration PROFILE_NAME="Release" ENABLED="false" GENERATION_DIR="build/release" CONFIG_NAME="Release" GENERATION_OPTIONS="-G "Unix Makefiles" -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="cmake/conan_provider.cmake"" />
|
||||
</configurations>
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -7,64 +7,63 @@
|
|||
},
|
||||
"include": [
|
||||
"ConanPresets.json"
|
||||
|
||||
],
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"displayName": "Default Config",
|
||||
"description": "Default build using Ninja generator",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/default",
|
||||
"cacheVariables": {
|
||||
"TESTNET": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "windows-defaultss",
|
||||
"displayName": "Windows x64 Debug",
|
||||
"description": "Sets Ninja generator, compilers, x64 architecture, build and install directory, debug build type",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/${presetName}",
|
||||
"architecture": {
|
||||
"value": "x64",
|
||||
"strategy": "external"
|
||||
"name": "testnet",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"environment": {
|
||||
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||
},
|
||||
"cacheVariables": {
|
||||
"TESTNET": "ON",
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}"
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":"cmake/conan_provider.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"environment": {
|
||||
"CONAN_HOME": "${sourceDir}/build/sdk"
|
||||
},
|
||||
"vendor": {
|
||||
"microsoft.com/VisualStudioSettings/CMake/1.0": {
|
||||
"hostOS": [ "Windows" ]
|
||||
}
|
||||
},
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"lhs": "${hostSystemName}",
|
||||
"rhs": "Windows"
|
||||
"cacheVariables": {
|
||||
"TESTNET": "OFF",
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES":"cmake/conan_provider.cmake"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default"
|
||||
"name": "testnet",
|
||||
"configurePreset": "testnet"
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet"
|
||||
}
|
||||
],
|
||||
"testPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default",
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet",
|
||||
"output": {"outputOnFailure": true},
|
||||
"execution": {"noTestsAction": "error", "stopOnFailure": true}
|
||||
}
|
||||
],
|
||||
"packagePresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"configurePreset": "default",
|
||||
"name": "mainnet",
|
||||
"configurePreset": "mainnet",
|
||||
"generators": [
|
||||
"TGZ",
|
||||
"ZIP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "testnet",
|
||||
"configurePreset": "testnet",
|
||||
"generators": [
|
||||
"TGZ",
|
||||
"ZIP"
|
||||
|
|
@ -73,23 +72,36 @@
|
|||
],
|
||||
"workflowPresets": [
|
||||
{
|
||||
"name": "default",
|
||||
"name": "testnet",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "default"
|
||||
"name": "testnet"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"type": "test",
|
||||
"name": "default"
|
||||
"name": "testnet"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "default"
|
||||
"name": "testnet"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mainnet",
|
||||
"steps": [
|
||||
{
|
||||
"type": "configure",
|
||||
"name": "mainnet"
|
||||
},
|
||||
{
|
||||
"type": "build",
|
||||
"name": "mainnet"
|
||||
},
|
||||
{
|
||||
"type": "package",
|
||||
"name": "mainnet"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
30
Makefile
30
Makefile
|
|
@ -71,6 +71,12 @@ CC_DOCKER_FILE?=utils/docker/images/lthn-chain/Dockerfile
|
|||
|
||||
all: help
|
||||
|
||||
testnet:
|
||||
cmake --workflow testnet
|
||||
|
||||
mainnet:
|
||||
cmake --workflow mainnet
|
||||
|
||||
release: docs build
|
||||
(cd $(BUILD_FOLDER) && cpack)
|
||||
@rm -rf $(CURDIR)/build/packages/_CPack_Packages
|
||||
|
|
@ -90,18 +96,6 @@ docs: configure
|
|||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=docs --config=Release --parallel=$(CPU_CORES)
|
||||
|
||||
# allowing this target to error quietly saves cross brwoser file detection
|
||||
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: $@"
|
||||
|
|
@ -144,6 +138,18 @@ test-debug:
|
|||
cmake --build build/test-debug --config=Debug --parallel=$(CPU_CORES)
|
||||
$(MAKE) test
|
||||
|
||||
# allowing this target to error quietly saves cross brwoser file detection
|
||||
conan-get:
|
||||
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
|
||||
|
||||
conan-upload:
|
||||
CONAN_HOME=$(CONAN_CACHE) $(CONAN_EXECUTABLE) upload "*" -r=conan_build --confirm
|
||||
|
||||
conan-profile-detect: conan-get
|
||||
cmake -P cmake/ConanProfileSetup.cmake
|
||||
|
||||
docs-dev: configure
|
||||
@echo "Building Documentation"
|
||||
cmake --build build/release --target=serve_docs --config=Release
|
||||
|
|
|
|||
|
|
@ -55,4 +55,22 @@ function(selective_clean_build_dir)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
function(reset_conan_presets)
|
||||
set(CONAN_PRESETS_FILE "${CMAKE_SOURCE_DIR}/ConanPresets.json")
|
||||
|
||||
set(NEW_CONTENT [[{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
|
||||
]
|
||||
}]])
|
||||
message(STATUS "Resetting ${CONAN_PRESETS_FILE} to a clean state.")
|
||||
file(WRITE "${CONAN_PRESETS_FILE}" "${NEW_CONTENT}")
|
||||
message(STATUS "${CONAN_PRESETS_FILE} has been successfully reset.")
|
||||
endfunction()
|
||||
|
||||
selective_clean_build_dir()
|
||||
reset_conan_presets()
|
||||
|
|
|
|||
|
|
@ -572,7 +572,7 @@ macro(conan_provide_dependency method package_name)
|
|||
endif ()
|
||||
if(NOT EXISTS ${CONAN_COMMAND})
|
||||
message(STATUS "CMake-Conan: Local conan not found, attempting to download it.")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/GetConan.cmake"
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/GetConan.cmake"
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
|
||||
if(NOT result EQUAL 0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue