[cmake-developers] [CMake 0013203]: Add support for 64-bit NSIS

Mantis Bug Tracker mantis at public.kitware.com
Tue May 8 15:08:33 EDT 2012


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=13203 
====================================================================== 
Reported By:                David Golub
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   13203
Category:                   CPack
Reproducibility:            N/A
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2012-05-08 15:08 EDT
Last Modified:              2012-05-08 15:08 EDT
====================================================================== 
Summary:                    Add support for 64-bit NSIS
Description: 
I recently created a 64-bit port of NSIS, which is available at
http://www.bitbucket.org/dgolub/nsis64.  I'd like to submit a patch to CPack to
add support for building 64-bit installers:

diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx
b/Source/CPack/cmCPackGeneratorFactory.cxx
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -49,6 +49,8 @@
     cmCPackSTGZGenerator::CreateGenerator);
   this->RegisterGenerator("NSIS", "Null Soft Installer",
     cmCPackNSISGenerator::CreateGenerator);
+  this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
+    cmCPackNSISGenerator::CreateGenerator64);
 #ifdef __CYGWIN__
   this->RegisterGenerator("CygwinBinary", "Cygwin Binary Installer",
                           cmCPackCygwinBinaryGenerator::CreateGenerator);
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx
b/Source/CPack/cmCPackNSISGenerator.cxx
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -33,8 +33,9 @@
 #endif
 
 //----------------------------------------------------------------------
-cmCPackNSISGenerator::cmCPackNSISGenerator()
+cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64)
 {
+  Nsis64 = nsis64;
 }
 
 //----------------------------------------------------------------------
@@ -358,16 +359,28 @@
   bool gotRegValue = true;
 
 #ifdef _WIN32
-  if ( !cmsys::SystemTools::ReadRegistryValue(
-      "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
-      cmsys::SystemTools::KeyWOW64_32) )
+  if (Nsis64)
     {
     if ( !cmsys::SystemTools::ReadRegistryValue(
-        "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
+        "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
+        cmsys::SystemTools::KeyWOW64_64) )
       {
       gotRegValue = false;
       }
     }
+  else
+    {
+    if ( !cmsys::SystemTools::ReadRegistryValue(
+        "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
+        cmsys::SystemTools::KeyWOW64_32) )
+      {
+      if ( !cmsys::SystemTools::ReadRegistryValue(
+          "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath) )
+        {
+        gotRegValue = false;
+        }
+      }
+    }
 
   if (gotRegValue)
     {
diff --git a/Source/CPack/cmCPackNSISGenerator.h
b/Source/CPack/cmCPackNSISGenerator.h
--- a/Source/CPack/cmCPackNSISGenerator.h
+++ b/Source/CPack/cmCPackNSISGenerator.h
@@ -27,10 +27,13 @@
 public:
   cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
 
+  static cmCPackGenerator* CreateGenerator64()
+    { return new cmCPackNSISGenerator(true); }
+
   /**
    * Construct generator
    */
-  cmCPackNSISGenerator();
+  cmCPackNSISGenerator(bool nsis64 = false);
   virtual ~cmCPackNSISGenerator();
 
 protected:
@@ -75,6 +78,8 @@
   /// Translations any newlines found in the string into \\r\\n, so that the
   /// resulting string can be used within NSIS.
   static std::string TranslateNewlines(std::string str);
+
+  bool Nsis64;
 };
 
 #endif


Additional Information: 
Please note that this patch is dependent on the patch submitted with bug 13202,
as the 64-bit port of NSIS is based on the latest code from the NSIS Subversion
repository.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2012-05-08 15:08 David Golub    New Issue                                    
======================================================================




More information about the cmake-developers mailing list