Refactor Windows packaging configuration in CMake
- Updated the CMake packaging script to conditionally set the CPACK_GENERATOR based on the environment, differentiating between CI/CD builds and local builds. - Enhanced NSIS-specific configuration to only apply for local builds, improving clarity and maintainability. - Adjusted package file naming conventions for Windows builds to reflect the environment, ensuring consistency across different build scenarios.
This commit is contained in:
@@ -27,8 +27,17 @@ endif()
|
||||
|
||||
# Platform-specific configuration
|
||||
if(WIN32)
|
||||
# Windows NSIS installer configuration
|
||||
# Windows packaging configuration (conditional based on environment)
|
||||
if(DEFINED ENV{GITHUB_ACTIONS})
|
||||
# CI/CD build - use only ZIP (NSIS not available)
|
||||
set(CPACK_GENERATOR "ZIP")
|
||||
else()
|
||||
# Local build - use both NSIS installer and ZIP
|
||||
set(CPACK_GENERATOR "NSIS;ZIP")
|
||||
endif()
|
||||
|
||||
# NSIS-specific configuration (only for local builds with NSIS available)
|
||||
if(NOT DEFINED ENV{GITHUB_ACTIONS})
|
||||
set(CPACK_NSIS_DISPLAY_NAME "Yaze - Zelda3 Editor")
|
||||
set(CPACK_NSIS_PACKAGE_NAME "Yaze")
|
||||
set(CPACK_NSIS_CONTACT "scawful@github.com")
|
||||
@@ -46,13 +55,22 @@ if(WIN32)
|
||||
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Yaze.lnk'"
|
||||
"Delete '$DESKTOP\\\\Yaze.lnk'"
|
||||
)
|
||||
endif()
|
||||
|
||||
# Windows architecture detection
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if(DEFINED ENV{GITHUB_ACTIONS})
|
||||
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-windows-x64")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-win64")
|
||||
endif()
|
||||
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
|
||||
else()
|
||||
if(DEFINED ENV{GITHUB_ACTIONS})
|
||||
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-windows-x86")
|
||||
else()
|
||||
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-win32")
|
||||
endif()
|
||||
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user