blockchain/cmake/CPackConfig.cmake
Snider ef776a93cc
Add CMake and Conan presets, update build config (#26)
* Add CMake and Conan presets, update build config

Introduces CMakePresets.json and ConanPresets.json for standardized build configuration. Updates Makefile to use CMake presets, modifies .gitignore for IDE files, and refines conanfile.py to support CI option and preset integration.

* Update Makefile

* Update _on-pr.yml

* Refactor build presets and folder layout for Windows

Updated Makefile and GitHub workflow to use configurable build and configure presets, improving flexibility for different environments. Adjusted CMakePresets.json to fix preset naming and version, and refactored conanfile.py to set build folders based on compiler type, ensuring correct folder structure for MSVC and other compilers.

* Update build presets and CPack config for Windows

Set PRESET_CONFIGURE to 'conan-default' for Windows builds in Makefile and GitHub workflow. Broaden CPack packaging conditions to include additional build types and comment out WIX generator settings for Windows in CPackConfig.cmake.
2025-10-09 00:25:29 +01:00

79 lines
No EOL
3.3 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" OR CMAKE_BUILD_TYPE STREQUAL "")
set(CPACK_PACKAGE_NAME "${package_name}")
set(CPACK_PACKAGE_VENDOR "${package_vendor}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${package_description}")
set(CPACK_PACKAGE_VERSION "${BUILD_VERSION}")
set(CPACK_PACKAGE_CONTACT "${package_contact}")
set(CPACK_PACKAGE_HOMEPAGE_URL "${package_website}")
#set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local") # Linux/macOS default
#if(WIN32)
# set(CPACK_PACKAGING_INSTALL_PREFIX "C:/Program Files/${PROJECT_NAME}")
#endif()
if(APPLE)
if("${package_macos_installer}" STREQUAL "DMG")
# set(CPACK_GENERATOR "DragNDrop")
# set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/resources/dmg_background.png")
# set(CPACK_DMG_VOLUME_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
# message(STATUS "Registered CPACK_GENERATOR: DragNDrop")
else ()
# set(CPACK_GENERATOR "productbuild")
# set(CPACK_PRODUCTBUILD_IDENTIFIER "${package_macos_pkg_productbuild_identifier}")
# set(CPACK_PRODUCTBUILD_SIGNING_IDENTITY "Developer ID Installer: Your Company (TEAMID)")
# message(STATUS "Registered CPACK_GENERATOR: productbuild")
endif ()
elseif(WIN32)
# set(CPACK_GENERATOR "WIX")
# message(STATUS "Registered CPACK_GENERATOR: WIX")
# set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/resources/windows_icon.ico")
# set(CPACK_WIX_LICENSE_RTF "${CMAKE_SOURCE_DIR}/LICENSE.rtf")
# set(CPACK_WIX_UPGRADE_GUID "D3F5A9C1-4B2E-4F5A-9C71-123456789ABC") # change once per major version
else()
# set(CPACK_GENERATOR "DEB")
# message(STATUS "Registered CPACK_GENERATOR: deb")
# set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${package_contact}")
# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.28)")
# set(CPACK_DEBIAN_PACKAGE_SECTION "utils")
# set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
# postinstall script (e.g., to register a systemd service)
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
# "${CMAKE_SOURCE_DIR}/scripts/postinstall.sh")
endif()
list(APPEND CPACK_GENERATOR "TXZ" "ZIP")
message(STATUS "Registered CPACK_GENERATOR: tgz")
message(STATUS "Registered CPACK_GENERATOR: zip")
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
set(CPACK_ARCHIVE_COMPONENT_INSTALL OFF)
set(CPACK_COMPONENTS_ALL)
set(CPACK_GENERATE_SHASUM ON)
set(CPACK_SHASUM_ALGORITHM SHA256)
message(STATUS "Using SHA256 Checksums")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")
# set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/build/packages")
install(FILES README.md LICENSE.txt
DESTINATION "share/doc/${PROJECT_NAME}"
)
set(_arch "${CMAKE_SYSTEM_PROCESSOR}")
if(_arch MATCHES "AMD64|x86_64")
set(_arch "x86_64")
elseif(_arch MATCHES "arm64|aarch64")
set(_arch "arm64")
endif()
string(TOLOWER "${CMAKE_SYSTEM_NAME}" _sys_name_lc)
set(CPACK_PACKAGE_FILE_NAME
"${package_name}-${CPACK_PACKAGE_VERSION}-${_sys_name_lc}-${_arch}")
include(CPack)
endif()