From 2bf93f891a8dcdac764f3dde5e6c981213289315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Tue, 12 Apr 2016 19:16:52 +0200 Subject: [PATCH] Redesigned about dialogs 64b Windows build stuff --- gpxsee64.nsi | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/cpuarch.h | 42 +++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 gpxsee64.nsi create mode 100644 src/cpuarch.h diff --git a/gpxsee64.nsi b/gpxsee64.nsi new file mode 100644 index 00000000..1a9d61d2 --- /dev/null +++ b/gpxsee64.nsi @@ -0,0 +1,159 @@ +!include "MUI2.nsh" +!include "x64.nsh" + +; The name of the installer +Name "GPXSee" + +; The file to write +OutFile "install.exe" + +; Required execution level +RequestExecutionLevel admin + +; The default installation directory +InstallDir "$PROGRAMFILES64\GPXSee" + +; Registry key to check for directory (so if you install again, it will +; overwrite the old one automatically) +InstallDirRegKey HKLM "Software\GPXSee" "Install_Dir" + +; Registry key for uninstaller +!define REGENTRY "Software\Microsoft\Windows\CurrentVersion\Uninstall\GPXSee" + +; Start menu page configuration +!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" +!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\GPXSee" +!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "GPXSee" + +Var StartMenuFolder + +;-------------------------------- + +; Pages + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "licence.txt" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +;-------------------------------- + +; Languages +!insertmacro MUI_LANGUAGE "English" + +Function .onInit + ${If} ${RunningX64} + SetRegView 64 + ${Else} + MessageBox MB_OK "The 64b version of GPXSee can not be run on 32b systems." + Abort + ${EndIf} +FunctionEnd + +; The stuff to install +Section "GPXSee (required)" SEC_APP + + SectionIn RO + + ; Set output path to the installation directory. + SetOutPath $INSTDIR + + ; Put the files there + File "gpxsee.exe" + File "maps.txt" + + ; Write the installation path into the registry + WriteRegStr HKLM SOFTWARE\GPXSee "Install_Dir" "$INSTDIR" + + ; Write the uninstall keys for Windows + WriteRegStr HKLM "${REGENTRY}" "DisplayName" "GPXSee" + WriteRegStr HKLM "${REGENTRY}" "Publisher" "Martin Tuma" + WriteRegStr HKLM "${REGENTRY}" "DisplayVersion" "2.12" + WriteRegStr HKLM "${REGENTRY}" "UninstallString" '"$INSTDIR\uninstall.exe"' + WriteRegDWORD HKLM "${REGENTRY}" "NoModify" 1 + WriteRegDWORD HKLM "${REGENTRY}" "NoRepair" 1 + WriteUninstaller "$INSTDIR\uninstall.exe" + + ; Create start menu entry and add links + SetShellVarContext all + !insertmacro MUI_STARTMENU_WRITE_BEGIN Application + CreateDirectory "$SMPROGRAMS\$StartMenuFolder" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" + CreateShortCut "$SMPROGRAMS\$StartMenuFolder\GPXSee.lnk" "$INSTDIR\gpxsee.exe" + !insertmacro MUI_STARTMENU_WRITE_END + +SectionEnd + +Section "QT libs" SEC_QT + + File "Qt5Core.dll" + File "Qt5Gui.dll" + File "Qt5Widgets.dll" + File "Qt5PrintSupport.dll" + File "Qt5Network.dll" + File "libGLESv2.dll" + File /r "platforms" + File /r "imageformats" + +SectionEnd + +Section "MSVC runtime" SEC_MSVC + + DetailPrint "Checking whether Visual C++ 2015 Redistributable is already installed..." + ReadRegDword $R0 HKLM "SOFTWARE\Wow6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64" "Installed" + StrCmp $R0 "1" 0 +3 + DetailPrint "Visual C++ 2015 Redistributable is already installed, skipping install." + Goto done + + DetailPrint "Installing Visual C++ 2015 Redistributable..." + SetOutPath $TEMP + File "VC_redist.x64.exe" + ExecWait '"$TEMP/VC_redist.x64.exe" /install /quiet /norestart' + + done: +SectionEnd + +;-------------------------------- + +; Uninstaller + +Section "Uninstall" + + ; Remove registry keys + DeleteRegKey HKLM "${REGENTRY}" + DeleteRegKey HKLM SOFTWARE\GPXSee + + ; Remove directories used + RMDir /r "$INSTDIR" + + ; Remove Start menu entries + SetShellVarContext all + !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder + Delete "$SMPROGRAMS\$StartMenuFolder\*.*" + RMDir "$SMPROGRAMS\$StartMenuFolder" + +SectionEnd + +;------------------------------- + +;Descriptions + +;Language strings +LangString DESC_QT ${LANG_ENGLISH} \ + "QT Library. Unselct only if you have QT already installed!" +LangString DESC_MSVC ${LANG_ENGLISH} \ + "Visual C++ 2015 runtime components. Unselct only if you have the runtime already installed!" +LangString DESC_APP ${LANG_ENGLISH} \ + "GPXSee application" + +;Assign language strings to sections +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QT} $(DESC_QT) + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MSVC} $(DESC_MSVC) + !insertmacro MUI_DESCRIPTION_TEXT ${SEC_APP} $(DESC_APP) +!insertmacro MUI_FUNCTION_DESCRIPTION_END \ No newline at end of file diff --git a/src/cpuarch.h b/src/cpuarch.h new file mode 100644 index 00000000..6bfb0119 --- /dev/null +++ b/src/cpuarch.h @@ -0,0 +1,42 @@ +#ifndef CPUARCH_H +#define CPUARCH_H + +#include + +#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) + +#if defined(__arm64__) + #define CPU_ARCH_STR "arm64" +#elif defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) + #define CPU_ARCH_STR "arm" +#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) \ + || defined(_M_X64) + #define CPU_ARCH_STR "x86_64" +#elif defined(__i386) || defined(__i386__) || defined(_M_IX86) + #define CPU_ARCH_STR "i386" +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + #define CPU_ARCH_STR "ia64" +#elif defined(_MIPS_ARCH_MIPS64) || defined(__mips64) + #define CPU_ARCH_STR "mips64" +#elif defined(__mips) || defined(__mips__) || defined(_M_MRX000) + #define CPU_ARCH_STR "mips" +#elif defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__) + #define CPU_ARCH_STR "power64" +#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \ + || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \ + || defined(_M_MPPC) || defined(_M_PPC) + #define CPU_ARCH_STR "power" +#else + #define CPU_ARCH_STR "unknown" +#endif + +#define CPU_ARCH QString(CPU_ARCH_STR) + +#else // QT_VERSION < 5.4 + +#include +#define CPU_ARCH QSysInfo::buildCpuArchitecture() + +#endif // QT_VERSION < 5.4 + +#endif // CPUARCH_H