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:
scawful
2025-09-26 18:04:27 -04:00
parent 281fc84499
commit dedbe078d3

View File

@@ -27,8 +27,17 @@ endif()
# Platform-specific configuration # Platform-specific configuration
if(WIN32) 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") 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_DISPLAY_NAME "Yaze - Zelda3 Editor")
set(CPACK_NSIS_PACKAGE_NAME "Yaze") set(CPACK_NSIS_PACKAGE_NAME "Yaze")
set(CPACK_NSIS_CONTACT "scawful@github.com") set(CPACK_NSIS_CONTACT "scawful@github.com")
@@ -46,13 +55,22 @@ if(WIN32)
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Yaze.lnk'" "Delete '$SMPROGRAMS\\\\$START_MENU\\\\Yaze.lnk'"
"Delete '$DESKTOP\\\\Yaze.lnk'" "Delete '$DESKTOP\\\\Yaze.lnk'"
) )
endif()
# Windows architecture detection # Windows architecture detection
if(CMAKE_SIZEOF_VOID_P EQUAL 8) 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") set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-win64")
endif()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
else()
if(DEFINED ENV{GITHUB_ACTIONS})
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-windows-x86")
else() else()
set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-win32") set(CPACK_PACKAGE_FILE_NAME "yaze-${CPACK_PACKAGE_VERSION}-win32")
endif()
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES") set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
endif() endif()