MantisBT - CMake
View Issue Details
0011575CMakeCPackpublic2010-12-07 08:552013-05-06 09:32
Timothy St. Clair 
David Cole 
highfeaturealways
closedfixed 
WindowsWindows*
CMake 2.8.3 
CMake 2.8.11CMake 2.8.11 
0011575: Addition of WiX to CPack
The attached patch are the modifications needed to add WiX to cpack.

Please let me know what you require in order to get upstream.

e.g. what docs are needed, etc.
http://annealingtechnologies.blogspot.com/2010/02/wix-and-cpack-integration.html [^]
No tags attached.
related to 0010939closed David Cole Add WiX support 
patch cmake-2.8.3-wix.patch (10,010) 2010-12-07 08:55
https://public.kitware.com/Bug/file/3549/cmake-2.8.3-wix.patch
patch cmake-2.8.3-wix-forward.patch (9,998) 2010-12-07 09:06
https://public.kitware.com/Bug/file/3550/cmake-2.8.3-wix-forward.patch
patch 0001-CPack-Add-WiX-generator-for-building-.msi-installers.patch (10,966) 2012-08-25 11:53
https://public.kitware.com/Bug/file/4439/0001-CPack-Add-WiX-generator-for-building-.msi-installers.patch
patch 0001-alternate-WiX-cpack-implementation.patch (15,552) 2012-09-03 13:42
https://public.kitware.com/Bug/file/4451/0001-alternate-WiX-cpack-implementation.patch
patch 0001-CPack-WiX-Generator.patch (33,985) 2012-09-10 03:27
https://public.kitware.com/Bug/file/4474/0001-CPack-WiX-Generator.patch
patch 0001-CPack-WiX-Generator-2.patch (43,943) 2012-09-12 10:27
https://public.kitware.com/Bug/file/4479/0001-CPack-WiX-Generator-2.patch
patch 0001-CPack-WiX-Generator-3.patch (45,927) 2012-10-03 10:11
https://public.kitware.com/Bug/file/4510/0001-CPack-WiX-Generator-3.patch
Issue History
2010-12-07 08:55Timothy St. ClairNew Issue
2010-12-07 08:55Timothy St. ClairFile Added: cmake-2.8.3-wix.patch
2010-12-07 09:04Timothy St. ClairNote Added: 0023750
2010-12-07 09:06Timothy St. ClairFile Added: cmake-2.8.3-wix-forward.patch
2010-12-07 09:15David ColeNote Added: 0023751
2010-12-07 16:56Eric NOULARDNote Added: 0023777
2010-12-08 08:25David ColeRelationship addedrelated to 0010939
2011-01-17 12:06David ColeNote Added: 0024767
2011-01-17 12:12Timothy St. ClairNote Added: 0024768
2011-01-17 17:00David ColeAssigned To => David Cole
2011-01-17 17:00David ColeStatusnew => assigned
2011-10-25 22:13David ColeAssigned ToDavid Cole =>
2011-10-25 22:13David ColeStatusassigned => backlog
2012-04-24 17:01Patrick SpendrinNote Added: 0029326
2012-04-24 18:28Eric NOULARDNote Added: 0029329
2012-04-25 08:53David ColeNote Added: 0029335
2012-04-25 08:55David ColeNote Added: 0029336
2012-04-25 08:56David ColeNote Added: 0029337
2012-08-12 08:10David ColeAssigned To => David Cole
2012-08-12 08:10David ColeStatusbacklog => assigned
2012-08-12 08:10David ColeTarget Version => CMake 2.8.10
2012-08-12 10:15Patrick SpendrinNote Added: 0030460
2012-08-25 11:53David ColeFile Added: 0001-CPack-Add-WiX-generator-for-building-.msi-installers.patch
2012-08-25 12:00David ColeNote Added: 0030759
2012-08-25 12:01David ColeNote Edited: 0030759bug_revision_view_page.php?bugnote_id=30759#r789
2012-09-03 13:42Nils GladitzFile Added: 0001-alternate-WiX-cpack-implementation.patch
2012-09-03 13:42Nils GladitzNote Added: 0030822
2012-09-04 08:20Nils GladitzNote Added: 0030908
2012-09-04 16:11David ColeNote Added: 0030919
2012-09-06 02:58Nils GladitzNote Added: 0030938
2012-09-10 03:27Nils GladitzFile Added: 0001-CPack-WiX-Generator.patch
2012-09-10 03:36Nils GladitzNote Added: 0030973
2012-09-12 10:27Nils GladitzFile Added: 0001-CPack-WiX-Generator-2.patch
2012-09-12 10:32Nils GladitzNote Added: 0031009
2012-09-12 15:13David ColeNote Added: 0031018
2012-09-12 15:59Nils GladitzNote Added: 0031021
2012-09-19 02:42Nils GladitzNote Added: 0031054
2012-09-20 17:11David ColeNote Added: 0031071
2012-09-20 19:55David ColeNote Added: 0031076
2012-09-21 12:05Nils GladitzNote Added: 0031081
2012-10-01 15:10David ColeNote Added: 0031140
2012-10-01 15:13David ColeTarget VersionCMake 2.8.10 => CMake 2.8.11
2012-10-02 02:35Nils GladitzNote Added: 0031144
2012-10-03 10:11Nils GladitzFile Added: 0001-CPack-WiX-Generator-3.patch
2012-10-03 10:18Nils GladitzNote Added: 0031163
2012-12-03 11:07David ColeNote Added: 0031818
2012-12-03 11:07David ColeStatusassigned => resolved
2012-12-03 11:07David ColeFixed in Version => CMake 2.8.11
2012-12-03 11:07David ColeResolutionopen => fixed
2012-12-04 15:47David ColeNote Added: 0031829
2013-05-06 09:32Robert MaynardNote Added: 0032983
2013-05-06 09:32Robert MaynardStatusresolved => closed

Notes
(0023750)
Timothy St. Clair   
2010-12-07 09:04   
realized my patch was a reverse patch, whoops.
(0023751)
David Cole   
2010-12-07 09:15   
For one thing, it needs a test in the test suite that explicitly exercises the WiX generator... And then we would need to make sure we set up a dashboard machine with whatever tools are necessary to run that test. Looks like perhaps a little more documentation is in order as well.

Also, all of your CPACK_WIX_* variables should be documented in CPack.cmake. See the CPACK_NSIS_* variables all listed out there.

And a documentation comment in CPack.cmake that sort of gives you basic instructions about how to install/run WiX would be good.

I don't have time to go into more detail at the moment, but I'll add more notes here later.

Thanks.
(0023777)
Eric NOULARD   
2010-12-07 16:56   
I would suggest
adding documentation in a separate CPackWIX.cmake.

The CPack.cmake is becoming huge and it will become
less and less easy to avoid overlapping changes.

I'd rather create a CPackNSIS.cmake and put the documentation there
in order to make CPack.cmake smaller that adding more thing
in it, see some comments in CPack documentation enhancement bug:
http://public.kitware.com/Bug/view.php?id=10067 [^]
(0024767)
David Cole   
2011-01-17 12:06   
One other thought I have here:

Why should we support WiX, when it's really just an intermediary to get to an *.msi installer? Why don't we simply write a CPack generator that creates a Visual Studio deployment project directly?

Then it could produce msi files without installing any other tools... Just having Visual Studio installed would be sufficient.
(0024768)
Timothy St. Clair   
2011-01-17 12:12   
Because you would have to do it for * and it's not supported in express editions. This would allow you to use any generator on *windows and still create a .msi
(0029326)
Patrick Spendrin   
2012-04-24 17:01   
Given that I need to produce MSI Installers and want to work on this bug, could you specify where the tests are for testing the cpack generators? I only found one for all generators in the Tests/ subdirectory in the git repository.
Also, are there any other requirements besides moving the documentation to CPackWIX.cmake?
(0029329)
Eric NOULARD   
2012-04-24 18:28   
Hi Patrick,

The CPack tests are in subdirectories of Tests/ directory namely
Tests/CPackComponents
Tests/CPackComponentsForAll
Tests/CPackTestAllGenerators

those test are driven by the Tests/CMakeLists.txt file (search for CPack in it).

Concerning the documentation starting with 2.8.8 CPack has builtin basic
documentation markup support which makes it easy to add documentation
to cpack --help-variable and cpack --help-command.

Have a look at CPackRPM.cmake or any other CPack*.cmake from 2.8.8
and you'll see examples.
If you have any question about that just ask.

Concerning the tests may be you can explain us what kind of tools is needed
for this new generator.
(0029335)
David Cole   
2012-04-25 08:53   
When adding to the tests, you may need to modify the CMake/Tests/CMakeLists.txt file to include a chunk similar to this, but for WiX instead of NSIS:

    if(NSIS_MAKENSIS_EXECUTABLE)
      set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS}
        -DCPACK_BINARY_NSIS:BOOL=ON)
    endif(NSIS_MAKENSIS_EXECUTABLE)

That's for the CPackComponents test.

Then we'll need to install whatever tools are necessary to test the WiX functionality on some of our dashboard machines, preferably several to cover 32 vs 64-bit, vs 8, 9, 10 and 11, or some combinatorial subset of those types of things.

We should also have a good understanding of any version requirements of the WiX tool, and hopefully be able to detect that version from the CPack code so that we can enforce a minimum required version of WiX.

Is it just one command line tool needed (in addition to a VS installation with msi builder capabilities)? My understanding is that it's just one tool that processes an xml file and produces an msi installer. Is that correct?
(0029336)
David Cole   
2012-04-25 08:55   
As you're working on this, I think all the CPack variables necessary (if any) should be ALL CAPS, even though WiX has a funky capitalization... (Just to be consistent and blend in with the pre-existing CPack variables.)
(0029337)
David Cole   
2012-04-25 08:56   
Sorry for the stupid questions in my earlier two notes. I just read through the patch and see that there are multiple tools, and that you are already blending in well with all caps variables.

Thanks!
(0030460)
Patrick Spendrin   
2012-08-12 10:15   
I will hopefully submit the patch in the coming days, I still have some doc issues.
(0030759)
David Cole   
2012-08-25 12:00   
(edited on: 2012-08-25 12:01)
I have uploaded a new patch "0001-CPack-Add-WiX-generator-for-building-.msi-installers.patch" that applies cleanly on top of today's 'master' branch of CMake.

This patch still requires a few more additions before we can take it:
(1) adding documentation of the WiX CPack variables, and (2) adding a test that covers the WiX generator, ... and possibly somebody helping me getting WiX set up on a dashboard machine so that we can guarantee that it's getting tested nightly.

If somebody can add that stuff to the "0001-patch" file and upload a new version of it, I can get it tested.

(0030822)
Nils Gladitz   
2012-09-03 13:42   
I've tried using the patch but had some problems with it.
- "CompressFiles" does not seem to be virtual or get called from the generator itself (the only reference I found was in bills-comments.txt)
- Tool paths seem to have changed with the WiX version that I tried 3.6rc
- ${CPACK_PACKAGE_INSTALL_DIRECTORY} is passed to heat (probably meant this->toplevel?)
- I wasn't sure how the required schema file should look like

I tried writing an alternate implementation (attached; I haven't done anything like this with git before so I hope this works).
I've reused most of the skeleton setup provided by the initial patch but try to generate my own xml source file instead of having the heat tool generate it automatically.
I'm hoping this will make component installations easier to implement.

I've used this WiX version (3.6rc): http://wix.codeplex.com/releases/view/88566 [^] (final version is supposed to get released today).
The WiX installer sets the WIX environment variable which points at the install location; I don't know if this is provided by earlier versions but it is what I use in the generator to locate the tools.

There are currently no custom CPack variables for the generator (at least none a regular user should have to touch; do those have a special naming convention?).

The test "CPackTestAllGenerators" seems to pick up the generator and an .msi is generated.
CPackComponents and CPackComponentsForAll seem to be identical from their description but the former only seems to test one generator (though not the same on every platform) and the later seems to be for generators which implement "one-file-per-group"(?).
I'm not sure where or how one would/should add the WiX generator but at the moment component installs are not implemented either way.

There would still be a lot of work to do (component installations, proper gui for feature and install location selection, upgrade guid specification, start menu intergration etc.) to get it on the same level as the other available generators.
Is anyone else still working on this or can I put some time into it?

What would be the minimal feature set to get a first version of this included in a release?
(0030908)
Nils Gladitz   
2012-09-04 08:20   
I guess I should have also mentioned that the patch I attached is "0001-alternate-WiX-cpack-implementation.patch".

Stable WiX 3.6 has been released now as well: http://wix.codeplex.com/releases/view/93929 [^]
(0030919)
David Cole   
2012-09-04 16:11   
Regarding your questions in 0011575:0030822

"Is anyone else still working on this or can I put some time into it?"

If they are, they should be posting about it here. To the best of my knowledge, nobody else is actively working on this. (If you are monitoring this bug, and have conflicting information here, please add a note to say who's doing what...)

"What would be the minimal feature set to get a first version of this included in a release?"

Ideally, CPack should "just work" for the new generator and produce a working installer for "Tests/Tutorial/Step6" without changing the test code at all.

If that's not possible, then documentation in CPackWiX.cmake saying what needs to be done to get it to work with a project.

All the new CPack variables should be documented in CPackWiX.cmake, (use the NSIS or another one as a model).

And finally, a test should be added in the CMake test suite that activates testing of the WiX CPack generator if the WiX tools are found on the machine. This way, the CMake test suite will automatically run the CPack WiX tests on any dashboard machine as long as the WiX tools are installed on it in their default location. (Or, second best, we can modify the script of some dashboards to explicitly point to the WiX tools, or put them in the PATH just for the script, on a given machine if necessary.)

I will be happy to accept this patch into 'next' for testing on the dashboards as soon as it's fully documented and testable.
(0030938)
Nils Gladitz   
2012-09-06 02:58   
Thanks, then I call dibs :)
(0030973)
Nils Gladitz   
2012-09-10 03:36   
I uploaded 0001-CPack-WiX-Generator.patch.

Things I added are:

- a modified version of an existing test that verifies an installer has been created and runs WiX validation tools on generated source files and the installer.

- new variable CPACK_WIX_UPGRADE_GUID with documentation.

- 64 bit installers (x64; I'm not sure how to detect/distinguish it from ia64)

I think the Tutorial Step6 code "just works" except for the license resouce file currently being ignored.

The whole thing is still a bit minimalistic feature wise ... could someone take a look at it though and tell me if I'm on the right track?
(0031009)
Nils Gladitz   
2012-09-12 10:32   
I've uploaded 0001-CPack-WiX-Generator-2.patch which adds:
- display of license file
- custom install directory
- non ASCII (windows codepage) filenames (I'd like to add this to the test case somehow but it would probably break as soon as it is run on a system with a different codepage)
- upgrade logic
- hard requirement for WiX 3.6
- new cpack variables CPACK_WIX_LICENSE_RTF and CPACK__PRODUCT_GUID + documentation
(0031018)
David Cole   
2012-09-12 15:13   
This looks good upon cursory inspection. We will probably re-write bits of it as we apply. For example, we don't have any calls to std::throw* in the CMake code base right now, so I'd rather not introduce them here. Also, we don't use any "../" style paths in #include directives to the best of my knowledge, so those things will change. Possibly others as I have time to more deeply dive into an analysis of this latest "-2" patch.

Questions for you:
  - is there anything else left to do, or do you want us to consider the "-2" patch for merging to 'next' and testing on the dashboards...?
  - could you point me to the proper definitive URL for downloading and trying out WiX 3.6?

Thanks for the patch -- looks pretty complete in terms of testing and documentation. Also, looks like projects will be able to override the default "WIX.template.in" file, which is fabulous.
(0031021)
Nils Gladitz   
2012-09-12 15:59   
Merge of the -2 patch into next sounds good!

There is plenty more that could be done (components, start menu entries, user customizations, ...) but it would be good to have a first version out there that is tested and gets some feedback.
Also I can incorporate your changes into future development before I drift apart too far.
Could it be marked "experimental" in the first release (to hint at possible future breaking changes) or would something like that be frowned upon?

You can get the WiX Toolset installer "WiX36.exe" here:
http://wix.codeplex.com/releases/view/93929 [^]

I use the WIX environment variable (set by the installer)
so any running processes (e.g. ctest) may have to be restarted to pick it up.

Thanks for putting time into this!
(0031054)
Nils Gladitz   
2012-09-19 02:42   
Is there anything I can/should do to make the merge easier?
(0031071)
David Cole   
2012-09-20 17:11   
Nope, thanks for offering, though.

Unless...... can you submit a Nightly dashboard that tests the WiX CPack generator?

I'm downloading the WiX36.exe now on my own machine. If I can it to work on my machine, I'll see if I can set it up on one of Kitware's dashboard machines, too, so we can get this merged into 'next'.
(0031076)
David Cole   
2012-09-20 19:55   
This worked ok on my machine, and can even build an installer for CMake itself with one minor extra patch to CMake's source code:

$ git diff
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index 3a72eaa..c659d59 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -51,3 +51,9 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
     set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
   endif()
 endif()
+
+if("${CPACK_GENERATOR}" STREQUAL "WIX")
+ # WIX installers require at most a 4 component version number, where
+ # each component is an integer between 0 and 65534 inclusive
+ set(CPACK_PACKAGE_VERSION "@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@")
+endif()

Hopefully, tomorrow I can find the time to install WiX on one of our Windows dashboard machines, and make sure the tests running there actually exercise the new code. Once I do that, I'll feel fairly comfortable merging this to 'next' and trying to get it into 'master' in time for 2.8.10.

Thanks a ton for your work on this -- looks pretty nice so far.
(0031081)
Nils Gladitz   
2012-09-21 12:05   
Nice. And thanks! I'm glad this works for you as well.
I've got permission to run a nightly dashboard at work and the experimental submission I tried seems to have worked (vista32tempo3.scivis).

If all goes well the scheduler should trigger nightly builds at 01:15am UTC.
Hope that is about right ... I get confused by all those timezones.

Is there anything else I should configure or change to gear this towards exercising WiX? (different submission track or git branch or test filter?)
(0031140)
David Cole   
2012-10-01 15:10   
Unfortunately, we've run out of time for 2.8.10 on this one. I can't spend any more time on this over the next 2 weeks, but I can re-visit it at that point, and try to get it into 'next' so that it can be in 2.8.11

For now, folks interested in this can (and should) certainly apply the latest patch and see how it works for them.

For the record, what remains to be done here is: style cleanup (no ".." in #include directives, follow CMake spacing and brace style), no use of std::throw until such time as we prove it's acceptable in all the compilers that CMake builds with on our dashboards, the test does not get activated automatically because the find_program call does not work because WIX is an empty variable in the context of Tests/CMakeLists.txt, and I need to add a dashboard on a machine at kitware where WiX is installed.

I got to the point where I know this list of stuff that needs to be done, but unfortunately now, we're up against the CMake 2.8.10-rc1 deadline with not enough time to actually do the tasks. So. This is still alive, but it's moving to the CMake 2.8.11 release.
(0031144)
Nils Gladitz   
2012-10-02 02:35   
I understand. Thanks for the update!

The thing with the WIX variable in Test/CMakeLists.txt certainly looks wrong. I'm not sure why or how this was working here ... it should be using $ENV{WIX}.
(0031163)
Nils Gladitz   
2012-10-03 10:18   
I've uploaded a new patch 0001-CPack-WiX-Generator-3.patch in which I:
- replaced C++ exception handling with C style error reporting
- fixed indentation (I hope I found them all)
- replaced all ".." relative include paths
- integrated your modification in 0011575:0031076
- modified the WiX template to rollback previous installations on failed upgrades
- use $ENV{WIX} in Tests/CMakeLists.txt

I hope this will make merging this a little easier.
(0031818)
David Cole   
2012-12-03 11:07   
Patch tested and pushed to the stage and merged to 'next':

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

Will keep an eye on the dashboards today and tomorrow. Will be in 2.8.11 in January...

Thanks for your persistence.
(0031829)
David Cole   
2012-12-04 15:47   
This commit and its two parents were also necessary to address issues that popped up on the Continuous and Nightly dashboards:

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

Hopefully, tomorrow, it will be green and clean for our next merge-to-master session...
(0032983)
Robert Maynard   
2013-05-06 09:32   
Closing resolved issues that have not been updated in more than 4 months.