Merge topic 'cpack-nsis64-patches'

6ff730a CPack/NSIS: Add support for 64-bit NSIS (#13203)
51da766 CPack/NSIS: Fix compatibility issues with prerelease NSIS (#13202)
This commit is contained in:
Brad King 2012-11-27 13:34:13 -05:00 committed by CMake Topic Stage
commit f30393e28a
4 changed files with 30 additions and 4 deletions

View File

@ -37,6 +37,9 @@
;Set compression ;Set compression
SetCompressor @CPACK_NSIS_COMPRESSOR@ SetCompressor @CPACK_NSIS_COMPRESSOR@
;Require administrator access
RequestExecutionLevel admin
@CPACK_NSIS_DEFINES@ @CPACK_NSIS_DEFINES@
!include Sections.nsh !include Sections.nsh
@ -119,7 +122,7 @@ Var AR_RegFlags
"exit_${SecName}:" "exit_${SecName}:"
!macroend !macroend
!macro RemoveSection SecName !macro RemoveSection_CPack SecName
; This macro is used to call section's Remove_... macro ; This macro is used to call section's Remove_... macro
;from the uninstaller. ;from the uninstaller.
;Input: section index constant name specified in Section command. ;Input: section index constant name specified in Section command.
@ -841,7 +844,7 @@ Section "Uninstall"
DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
; Removes all optional components ; Removes all optional components
!insertmacro SectionList "RemoveSection" !insertmacro SectionList "RemoveSection_CPack"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP

View File

@ -61,6 +61,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
{ {
this->RegisterGenerator("NSIS", "Null Soft Installer", this->RegisterGenerator("NSIS", "Null Soft Installer",
cmCPackNSISGenerator::CreateGenerator); cmCPackNSISGenerator::CreateGenerator);
this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
cmCPackNSISGenerator::CreateGenerator64);
} }
#ifdef __CYGWIN__ #ifdef __CYGWIN__
if (cmCPackCygwinBinaryGenerator::CanGenerate()) if (cmCPackCygwinBinaryGenerator::CanGenerate())

View File

@ -33,8 +33,9 @@
#endif #endif
//---------------------------------------------------------------------- //----------------------------------------------------------------------
cmCPackNSISGenerator::cmCPackNSISGenerator() cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64)
{ {
Nsis64 = nsis64;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -359,6 +360,21 @@ int cmCPackNSISGenerator::InitializeInternal()
bool gotRegValue = false; bool gotRegValue = false;
#ifdef _WIN32 #ifdef _WIN32
if (Nsis64)
{
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
cmsys::SystemTools::KeyWOW64_64) )
{
gotRegValue = true;
}
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
cmsys::SystemTools::KeyWOW64_64) )
{
gotRegValue = true;
}
}
if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue( if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath, "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
cmsys::SystemTools::KeyWOW64_32) ) cmsys::SystemTools::KeyWOW64_32) )

View File

@ -27,10 +27,13 @@ class cmCPackNSISGenerator : public cmCPackGenerator
public: public:
cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator); cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
static cmCPackGenerator* CreateGenerator64()
{ return new cmCPackNSISGenerator(true); }
/** /**
* Construct generator * Construct generator
*/ */
cmCPackNSISGenerator(); cmCPackNSISGenerator(bool nsis64 = false);
virtual ~cmCPackNSISGenerator(); virtual ~cmCPackNSISGenerator();
protected: protected:
@ -77,6 +80,8 @@ protected:
/// Translations any newlines found in the string into \\r\\n, so that the /// Translations any newlines found in the string into \\r\\n, so that the
/// resulting string can be used within NSIS. /// resulting string can be used within NSIS.
static std::string TranslateNewlines(std::string str); static std::string TranslateNewlines(std::string str);
bool Nsis64;
}; };
#endif #endif