Attached Files | cmake280_WiX.patch [^] (9,448 bytes) 2010-07-06 02:35 [Show Content] [Hide Content]diff --git a/cmake-2.8.0/Modules/CPack.cmake b/cmake-2.8.0/Modules/CPack.cmake
index 93cf28e..8d54337 100644
--- a/cmake-2.8.0/Modules/CPack.cmake
+++ b/cmake-2.8.0/Modules/CPack.cmake
@@ -740,6 +740,7 @@ if(NOT CPACK_GENERATOR)
else(UNIX)
option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
option(CPACK_BINARY_ZIP "Enable to build ZIP packages" OFF)
+ option(CPACK_BINARY_WIX "Enable to build WIX packages" OFF)
endif(UNIX)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_BUNDLE Bundle)
@@ -755,6 +756,7 @@ if(NOT CPACK_GENERATOR)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TBZ2 TBZ2)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_TZ TZ)
cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_ZIP ZIP)
+ cpack_optional_append(CPACK_GENERATOR CPACK_BINARY_WIX WIX)
endif(NOT CPACK_GENERATOR)
@@ -786,7 +788,7 @@ mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX
CPACK_BINARY_DEB CPACK_BINARY_RPM CPACK_BINARY_TZ
CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
- CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+ CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP CPACK_BINARY_WIX)
# Set some other variables
cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
diff --git a/cmake-2.8.0/Modules/CPackWIX.cmake b/cmake-2.8.0/Modules/CPackWIX.cmake
new file mode 100644
index 0000000..34ce152
--- /dev/null
+++ b/cmake-2.8.0/Modules/CPackWIX.cmake
@@ -0,0 +1,36 @@
+
+#=============================================================================
+# Copyright 2007-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+IF(CMAKE_BINARY_DIR)
+ MESSAGE(FATAL_ERROR "CPackWIX.cmake may only be used by CPack internally.")
+ENDIF(CMAKE_BINARY_DIR)
+
+IF(NOT CPACK_WIX_XSL OR NOT CPACK_PACKAGE_FILE_NAME OR NOT CPACK_RESOURCE_FILE_LICENSE OR NOT CPACK_PACKAGE_INSTALL_DIRECTORY)
+ MESSAGE(FATAL_ERROR "Variables required CPACK_WIX_XSL, CPACK_PACKAGE_FILE_NAME, CPACK_RESOURCE_FILE_LICENSE, CPACK_PACKAGE_INSTALL_DIRECTORY")
+ENDIF()
+
+FIND_PROGRAM(WIX_EXE_HEAT heat PATHS "$ENV{ProgramFiles}/Windows Installer XML v3")
+FIND_PROGRAM(WIX_EXE_CNDL candle PATHS "$ENV{ProgramFiles}/Windows Installer XML v3")
+FIND_PROGRAM(WIX_EXE_LGHT light PATHS "$ENV{ProgramFiles}/Windows Installer XML v3")
+
+IF( WIX_EXE_HEAT AND WIX_EXE_CNDL AND WIX_EXE_LGHT )
+ SET(CPACK_WIX_HEAT_COMMAND "\"${WIX_EXE_HEAT}\" dir ${CPACK_PACKAGE_INSTALL_DIRECTORY} -g1 -gg -var var.Source -t:${CPACK_WIX_XSL} -out ${CPACK_PACKAGE_FILE_NAME}.wxs")
+ SET(CPACK_WIX_CNDL_COMMAND "\"${WIX_EXE_CNDL}\" ${CPACK_PACKAGE_FILE_NAME}.wxs -dSource=${CPACK_PACKAGE_FILE_NAME}")
+ SET(CPACK_WIX_LGHT_COMMAND "\"${WIX_EXE_LGHT}\" ${CPACK_PACKAGE_FILE_NAME}.wixobj -ext WixUIExtension -dWixUILicenseRtf=${CPACK_RESOURCE_FILE_LICENSE}")
+ELSE()
+ MESSAGE(FATAL_ERROR "Can not find Wix Executables.")
+ENDIF()
+
+
+
diff --git a/cmake-2.8.0/Source/CMakeLists.txt b/cmake-2.8.0/Source/CMakeLists.txt
index 9099691..a90d43a 100644
--- a/cmake-2.8.0/Source/CMakeLists.txt
+++ b/cmake-2.8.0/Source/CMakeLists.txt
@@ -415,6 +415,7 @@ SET(CPACK_SRCS
CPack/cmCPackTarBZip2Generator.cxx
CPack/cmCPackTarCompressGenerator.cxx
CPack/cmCPackZIPGenerator.cxx
+ CPack/cmCPackWIXGenerator.cxx
)
IF(WIN32 AND UNIX)
diff --git a/cmake-2.8.0/Source/CPack/cmCPackGeneratorFactory.cxx b/cmake-2.8.0/Source/CPack/cmCPackGeneratorFactory.cxx
index a04b403..2e97b99 100644
--- a/cmake-2.8.0/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/cmake-2.8.0/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -17,6 +17,7 @@
#include "cmCPackTarBZip2Generator.h"
#include "cmCPackTarCompressGenerator.h"
#include "cmCPackZIPGenerator.h"
+#include "cmCPackWIXGenerator.h"
#include "cmCPackSTGZGenerator.h"
#include "cmCPackNSISGenerator.h"
#ifdef __APPLE__
@@ -58,6 +59,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
this->RegisterGenerator("ZIP", "ZIP file format",
cmCPackZIPGenerator::CreateGenerator);
+ this->RegisterGenerator("WIX", "MSI file format",
+ cmCPackWIXGenerator::CreateGenerator);
this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
cmCPackTarBZip2Generator::CreateGenerator);
this->RegisterGenerator("TZ", "Tar Compress compression",
diff --git a/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.cxx b/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.cxx
new file mode 100644
index 0000000..debb357
--- /dev/null
+++ b/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.cxx
@@ -0,0 +1,91 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#include "cmCPackWIXGenerator.h"
+
+#include "cmSystemTools.h"
+#include "cmGeneratedFileStream.h"
+#include "cmCPackLog.h"
+
+#include <cmsys/SystemTools.hxx>
+
+//----------------------------------------------------------------------
+cmCPackWIXGenerator::cmCPackWIXGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+cmCPackWIXGenerator::~cmCPackWIXGenerator()
+{
+}
+
+//----------------------------------------------------------------------
+int cmCPackWIXGenerator::InitializeInternal()
+{
+ this->SetOptionIfNotSet("CPACK_INCLUDE_TOPLEVEL_DIRECTORY", "1");
+ this->ReadListFile("CPackWIX.cmake");
+ if ((!this->IsSet("WIX_EXE_HEAT"))
+ || (!this->IsSet("CPACK_WIX_HEAT_COMMAND"))
+ || (!this->IsSet("WIX_EXE_CNDL"))
+ || (!this->IsSet("CPACK_WIX_CNDL_COMMAND"))
+ || (!this->IsSet("WIX_EXE_LGHT"))
+ || (!this->IsSet("CPACK_WIX_LGHT_COMMAND")) )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find a suitable WiX XXprogram"
+ << std::endl);
+ return 0;
+ }
+ return this->Superclass::InitializeInternal();
+}
+
+bool cmCPackWIXGenerator::RunWiXCommand(const char * pszVar, const char* toplevel)
+{
+ bool bRet=true;
+ std::string output;
+ int retVal = -1;
+ std::string cmd = this->GetOption(pszVar);
+ int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output,
+ &retVal, toplevel, this->GeneratorVerbose, 0);
+
+ int iLevel = cmCPackLog::LOG_OUTPUT;
+
+ cmCPackLogger(iLevel, cmd.c_str() << std::endl );
+
+ if ( !res || retVal )
+ {
+ iLevel = cmCPackLog::LOG_ERROR;
+ bRet=false;
+ }
+
+ cmCPackLogger(iLevel, output.c_str() << std::endl );
+
+ return bRet;
+
+}
+
+//----------------------------------------------------------------------
+int cmCPackWIXGenerator::CompressFiles(const char* outFileName,
+ const char* toplevel, const std::vector<std::string>& files)
+{
+ bool bRet=true;
+
+ bRet = this->RunWiXCommand("CPACK_WIX_HEAT_COMMAND", toplevel);
+
+ if (bRet)
+ bRet = this->RunWiXCommand("CPACK_WIX_CNDL_COMMAND", toplevel);
+
+ if (bRet)
+ bRet = this->RunWiXCommand("CPACK_WIX_LGHT_COMMAND", toplevel);
+
+ return ((int) bRet);
+
+}
diff --git a/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.h b/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.h
new file mode 100644
index 0000000..75d6b1e
--- /dev/null
+++ b/cmake-2.8.0/Source/CPack/cmCPackWIXGenerator.h
@@ -0,0 +1,43 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc.
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackWIXGenerator_h
+#define cmCPackWIXGenerator_h
+
+#include "cmCPackGenerator.h"
+
+
+/** \class cmCPackWIXGenerator
+ * \brief A generator for WIX files
+ */
+class cmCPackWIXGenerator : public cmCPackGenerator
+{
+public:
+ cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
+
+ /**
+ * Construct generator
+ */
+ cmCPackWIXGenerator();
+ virtual ~cmCPackWIXGenerator();
+
+protected:
+ virtual int InitializeInternal();
+ int CompressFiles(const char* outFileName, const char* toplevel,
+ const std::vector<std::string>& files);
+ virtual const char* GetOutputExtension() { return ".msi"; }
+
+ bool RunWiXCommand(const char * pszVar, const char* toplevel);
+
+};
+
+#endif
|