# Packing for Windows build using NSIS

INCLUDE(TargetArch)

target_architecture(TARGET_ARCH)

IF ( ${TARGET_ARCH} STREQUAL "x86_64" )
    SET(SYSTEM_NAME "win64")
    SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
ELSE ( ${TARGET_ARCH} STREQUAL "x86_64" )
    SET(SYSTEM_NAME "win32" )
    SET(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES32")
ENDIF (${TARGET_ARCH} STREQUAL "x86_64")

SET (DEPENDS_DIR "${CMAKE_SOURCE_DIR}/package/depends/${SYSTEM_NAME}/" )
INSTALL(DIRECTORY ${DEPENDS_DIR}/bin ${DEPENDS_DIR}/etc ${DEPENDS_DIR}/data DESTINATION ".")

## variables that apply to all packages
SET(CPACK_PACKAGE_FILE_NAME "maplite-${MAPLITE_VERSION}-${SYSTEM_NAME}")
SET(CPACK_PACKAGE_EXECUTABLES "mapviewer;MapLite Map Viewer")

SET(CPACK_GENERATOR "NSIS" CACHE STRING "CPack package generator type (i.e ZIP,NSIS,TGZ,DEB,RPM, -- see CPack for valid stypes")
SET(CPACK_NSIS_DISPLAY_NAME "MapLite")
SET(CPACK_NSIS_INSTALLER_ICON_CODE "")
SET(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
SET(CPACK_NSIS_MODIFY_PATH "ON")

SET(CPACK_SOURCE_GENERATOR "TGZ")
SET(CPACK_PACKAGE_NAME "maplite")

SET(CPACK_PACKAGE_CONTACT "malasiot@iti.gr")

SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/package/README.txt")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "maplite is a viewer of custom maps")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Maplite")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "maplite")
SET(CPACK_PACKAGE_VENDOR "ITI")
SET(CPACK_PACKAGE_VERSION "${MAPLITE_VERSION}")
SET(CPACK_PACKAGE_VERSION_MAJOR "${MAPLITE_MAJOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_MINOR "${MAPLITE_MINOR_VERSION}")
SET(CPACK_PACKAGE_VERSION_PATCH "${MAPLITE_PATCH_VERSION}")
SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/package/README.txt")

INCLUDE(CPack)
