MantisBT - CMake
View Issue Details
0013203CMakeCPackpublic2012-05-08 15:082013-04-17 08:54
David Golub 
David Cole 
normalminorN/A
closedfixed 
Intel x64Microsoft WindowsWindows 7
CMake 2.8.8 
CMake 2.8.11CMake 2.8.11 
0013203: Add support for 64-bit NSIS
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
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.
No tags attached.
related to 0013202closed David Cole CPack fails with latest prerelease NSIS 
patch 0001-CPack-NSIS-Fix-compatibility-issues-with-prerelease-.patch (1,335) 2012-05-09 15:36
https://public.kitware.com/Bug/file/4322/0001-CPack-NSIS-Fix-compatibility-issues-with-prerelease-.patch
patch 0001-CPack-NSIS-Add-support-for-64-bit-NSIS-13203.patch (3,485) 2012-05-09 15:37
https://public.kitware.com/Bug/file/4323/0001-CPack-NSIS-Add-support-for-64-bit-NSIS-13203.patch
Issue History
2012-05-08 15:08David GolubNew Issue
2012-05-08 16:48Eric NOULARDRelationship addedchild of 0013202
2012-05-08 16:48Eric NOULARDRelationship replacedrelated to 0013202
2012-05-08 17:02David ColeNote Added: 0029427
2012-05-09 15:36David GolubFile Added: 0001-CPack-NSIS-Fix-compatibility-issues-with-prerelease-.patch
2012-05-09 15:37David GolubNote Added: 0029458
2012-05-09 15:37David GolubFile Added: 0001-CPack-NSIS-Add-support-for-64-bit-NSIS-13203.patch
2012-06-20 18:34David ColeAssigned To => David Cole
2012-06-20 18:34David ColeStatusnew => assigned
2012-08-14 19:12David ColeTarget Version => CMake 2.8.10
2012-09-20 17:18David ColeNote Added: 0031074
2012-10-01 15:20David ColeNote Added: 0031143
2012-10-01 15:20David ColeTarget VersionCMake 2.8.10 => CMake 2.8.11
2012-11-20 16:59David ColeNote Added: 0031634
2012-11-20 16:59David ColeStatusassigned => resolved
2012-11-20 16:59David ColeFixed in Version => CMake 2.8.11
2012-11-20 16:59David ColeResolutionopen => fixed
2013-04-17 08:54Robert MaynardNote Added: 0032874
2013-04-17 08:54Robert MaynardStatusresolved => closed

Notes
(0029427)
David Cole   
2012-05-08 17:02   
Please create patches for CMake using git, based on the 'master' branch, and then:

  git format-patch -1

And then attach the resulting .patch file to this issue in the bug tracker.

Thanks.
(0029458)
David Golub   
2012-05-09 15:37   
I've uploaded the patch file as you've requested.
(0031074)
David Cole   
2012-09-20 17:18   
I will try to get this in soon, in time for 2.8.10-rc1
(0031143)
David Cole   
2012-10-01 15:20   
The deadline has past for getting proposed changes into CMake 2.8.10-rc1: setting target version to 2.8.11
(0031634)
David Cole   
2012-11-20 16:59   
Fix pushed and merged to the 'next' branch:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6ff730a4983d15f3e115a919eb18d866f8c65507 [^]

I had to rewrite the commit a little bit to adapt to code that has since been added to master regarding the UNICODE build of the NSIS installer builder. Take a look at this, and try it out in this form to make sure it still works for you with your 64-bit build of NSIS. (It will prefer a UNICODE install of NSIS over a non-UNICODE install, whether seeking the 32-bit or the 64-bit installer...)

Thanks for your contribution!
(0032874)
Robert Maynard   
2013-04-17 08:54   
Closing resolved issues that have not been updated in more than 4 months.