diff --git a/.appveyor.yml b/.appveyor.yml index 7fb8f808..d55f9da8 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,6 @@ version: 2.6.0-branch-{branch}-build-{build} +#BUILD!!! # Skipping commits affecting specific files (GitHub only). # More details here: https://www.appveyor.com/docs/appveyor-yml and https://www.appveyor.com/docs/how-to/filtering-commits skip_commits: diff --git a/CMakeLists.txt b/CMakeLists.txt index 23500cf8..c16ce76f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,6 +210,11 @@ if(UNIX) endif() elseif(WIN32) set(CPACK_GENERATOR NSIS ${CPACK_GENERATOR}) + if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") + set(TRICE_IS_64_BIT 1) + else() + set(TRICE_IS_64_BIT 0) + endif() # Configure file with custom definitions for NSIS. configure_file( diff --git a/cmake/NSIS.definitions.nsh.in b/cmake/NSIS.definitions.nsh.in index cc4b014c..b8ec4c05 100644 --- a/cmake/NSIS.definitions.nsh.in +++ b/cmake/NSIS.definitions.nsh.in @@ -1 +1,2 @@ -!define NSIS_SOURCE_PATH "@PROJECT_SOURCE_DIR@" \ No newline at end of file +!define NSIS_SOURCE_PATH "@PROJECT_SOURCE_DIR@" +!define NSIS_IS_64_BIT @TRICE_IS_64_BIT@ \ No newline at end of file diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 30cf0cd7..15002032 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -3,9 +3,6 @@ Name "@CPACK_PACKAGE_NAME@" BrandingText "@CPACK_PACKAGE_FILE_NAME@" OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@" -!define UNINSTKEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" -!define DEFAULTNORMALDESTINATON "$ProgramFiles\Cockatrice" -!define DEFAULTPORTABLEDESTINATON "$Desktop\CockatricePortable" !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@" RequestExecutionlevel highest @@ -18,6 +15,7 @@ Var PortableMode !include LogicLib.nsh !include FileFunc.nsh !include MUI2.nsh +!include x64.nsh !define MUI_ABORTWARNING !define MUI_WELCOMEFINISHPAGE_BITMAP "${NSIS_SOURCE_PATH}\cmake\leftimage.bmp" @@ -46,8 +44,19 @@ Page Custom PortableModePageCreate PortableModePageLeave !insertmacro MUI_LANGUAGE English Function .onInit -StrCpy $NormalDestDir "${DEFAULTNORMALDESTINATON}" -StrCpy $PortableDestDir "${DEFAULTPORTABLEDESTINATON}" + +${If} ${NSIS_IS_64_BIT} == 1 + ${IfNot} ${RunningX64} + MessageBox MB_OK|MB_ICONEXCLAMATION "This version of Cockatrice requires a 64-bit Windows system." + Abort + ${EndIf} + StrCpy $NormalDestDir "$ProgramFiles64\Cockatrice" + SetRegView 64 +${Else} + StrCpy $NormalDestDir "$ProgramFiles\Cockatrice" +${EndIf} + +StrCpy $PortableDestDir "$Desktop\CockatricePortable" ${GetParameters} $9 @@ -75,7 +84,7 @@ ${Else} ${EndIf} ${If} $InstDir == "" - ; User did not use /D to specify a directory, + ; User did not use /D to specify a directory, ; we need to set a default based on the install mode StrCpy $InstDir $0 ${EndIf} @@ -83,6 +92,13 @@ Call SetModeDestinationFromInstdir FunctionEnd +Function un.onInit + +${If} ${NSIS_IS_64_BIT} == 1 + SetRegView 64 +${EndIf} + +FunctionEnd Function RequireAdmin UserInfo::GetAccountType @@ -190,21 +206,29 @@ ${If} $PortableMode = 0 WriteUninstaller "$INSTDIR\uninstall.exe" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayIcon" "$INSTDIR\cockatrice.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayVersion" "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "EstimatedSize" "$0" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" "$INSTDIR" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoRepair" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "Publisher" "Cockatrice team" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@" IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check VcRedist86Exists: ExecWait '"$INSTDIR\vc_redist.x86.exe" /passive /norestart' + Delete "$INSTDIR\vc_redist.x86.exe" PastVcRedist86Check: IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check VcRedist64Exists: ExecWait '"$INSTDIR\vc_redist.x64.exe" /passive /norestart' + Delete "$INSTDIR\vc_redist.x64.exe" PastVcRedist64Check: ${Else}