CPackWiX: Add variables for custom tool extensions and flags
This commit is contained in:
parent
6f2ec64504
commit
096591b96a
|
@ -123,9 +123,31 @@
|
||||||
# This variable provides an optional list of extra WiX object (.wixobj)
|
# This variable provides an optional list of extra WiX object (.wixobj)
|
||||||
# and/or WiX library (.wixlib) files. The full path to objects and libraries
|
# and/or WiX library (.wixlib) files. The full path to objects and libraries
|
||||||
# is required.
|
# is required.
|
||||||
|
#
|
||||||
|
# .. variable:: CPACK_WIX_EXTENSIONS
|
||||||
|
#
|
||||||
|
# This variable provides a list of additional extensions for the WiX
|
||||||
|
# tools light and candle.
|
||||||
|
#
|
||||||
|
# .. variable:: CPACK_WIX_<TOOL>_EXTENSIONS
|
||||||
|
#
|
||||||
|
# This is the tool specific version of CPACK_WIX_EXTENSIONS.
|
||||||
|
# ``<TOOL>`` can be either LIGHT or CANDLE.
|
||||||
|
#
|
||||||
|
# .. variable:: CPACK_WIX_<TOOL>_EXTRA_FLAGS
|
||||||
|
#
|
||||||
|
# This list variable allows you to pass additional
|
||||||
|
# flags to the WiX tool ``<TOOL>``.
|
||||||
|
#
|
||||||
|
# Use it at your own risk.
|
||||||
|
# Future versions of CPack may generate flags which may be in conflict
|
||||||
|
# with your own flags.
|
||||||
|
#
|
||||||
|
# ``<TOOL>`` can be either LIGHT or CANDLE.
|
||||||
|
#
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright 2012 Kitware, Inc.
|
# Copyright 2013 Kitware, Inc.
|
||||||
#
|
#
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
# see accompanying file Copyright.txt for details.
|
# see accompanying file Copyright.txt for details.
|
||||||
|
|
|
@ -83,6 +83,15 @@ bool cmCPackWIXGenerator::RunCandleCommand(
|
||||||
command << " -nologo";
|
command << " -nologo";
|
||||||
command << " -arch " << GetArchitecture();
|
command << " -arch " << GetArchitecture();
|
||||||
command << " -out " << QuotePath(objectFile);
|
command << " -out " << QuotePath(objectFile);
|
||||||
|
|
||||||
|
for(extension_set_t::const_iterator i = candleExtensions.begin();
|
||||||
|
i != candleExtensions.end(); ++i)
|
||||||
|
{
|
||||||
|
command << " -ext " << QuotePath(*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
AddCustomFlags("CPACK_WIX_CANDLE_EXTRA_FLAGS", command);
|
||||||
|
|
||||||
command << " " << QuotePath(sourceFile);
|
command << " " << QuotePath(sourceFile);
|
||||||
|
|
||||||
return RunWiXCommand(command.str());
|
return RunWiXCommand(command.str());
|
||||||
|
@ -100,12 +109,21 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
|
||||||
command << QuotePath(executable);
|
command << QuotePath(executable);
|
||||||
command << " -nologo";
|
command << " -nologo";
|
||||||
command << " -out " << QuotePath(packageFileNames.at(0));
|
command << " -out " << QuotePath(packageFileNames.at(0));
|
||||||
command << " -ext WixUIExtension";
|
|
||||||
|
for(extension_set_t::const_iterator i = lightExtensions.begin();
|
||||||
|
i != lightExtensions.end(); ++i)
|
||||||
|
{
|
||||||
|
command << " -ext " << QuotePath(*i);
|
||||||
|
}
|
||||||
|
|
||||||
const char* const cultures = GetOption("CPACK_WIX_CULTURES");
|
const char* const cultures = GetOption("CPACK_WIX_CULTURES");
|
||||||
if(cultures)
|
if(cultures)
|
||||||
{
|
{
|
||||||
command << " -cultures:" << cultures;
|
command << " -cultures:" << cultures;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AddCustomFlags("CPACK_WIX_LIGHT_EXTRA_FLAGS", command);
|
||||||
|
|
||||||
command << " " << objectFiles;
|
command << " " << objectFiles;
|
||||||
|
|
||||||
return RunWiXCommand(command.str());
|
return RunWiXCommand(command.str());
|
||||||
|
@ -180,6 +198,13 @@ bool cmCPackWIXGenerator::InitializeWiXConfiguration()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CollectExtensions("CPACK_WIX_EXTENSIONS", candleExtensions);
|
||||||
|
CollectExtensions("CPACK_WIX_CANDLE_EXTENSIONS", candleExtensions);
|
||||||
|
|
||||||
|
lightExtensions.insert("WixUIExtension");
|
||||||
|
CollectExtensions("CPACK_WIX_EXTENSIONS", lightExtensions);
|
||||||
|
CollectExtensions("CPACK_WIX_LIGHT_EXTENSIONS", lightExtensions);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -865,3 +890,35 @@ bool cmCPackWIXGenerator::IsLegalIdCharacter(char c)
|
||||||
(c >= 'A' && c <= 'Z') ||
|
(c >= 'A' && c <= 'Z') ||
|
||||||
c == '_' || c == '.';
|
c == '_' || c == '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmCPackWIXGenerator::CollectExtensions(
|
||||||
|
const std::string& variableName, extension_set_t& extensions)
|
||||||
|
{
|
||||||
|
const char *variableContent = GetOption(variableName.c_str());
|
||||||
|
if(!variableContent) return;
|
||||||
|
|
||||||
|
std::vector<std::string> list;
|
||||||
|
cmSystemTools::ExpandListArgument(variableContent, list);
|
||||||
|
|
||||||
|
for(std::vector<std::string>::const_iterator i = list.begin();
|
||||||
|
i != list.end(); ++i)
|
||||||
|
{
|
||||||
|
extensions.insert(*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmCPackWIXGenerator::AddCustomFlags(
|
||||||
|
const std::string& variableName, std::ostream& stream)
|
||||||
|
{
|
||||||
|
const char *variableContent = GetOption(variableName.c_str());
|
||||||
|
if(!variableContent) return;
|
||||||
|
|
||||||
|
std::vector<std::string> list;
|
||||||
|
cmSystemTools::ExpandListArgument(variableContent, list);
|
||||||
|
|
||||||
|
for(std::vector<std::string>::const_iterator i = list.begin();
|
||||||
|
i != list.end(); ++i)
|
||||||
|
{
|
||||||
|
stream << " " << QuotePath(*i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
typedef std::map<std::string, std::string> id_map_t;
|
typedef std::map<std::string, std::string> id_map_t;
|
||||||
typedef std::map<std::string, size_t> ambiguity_map_t;
|
typedef std::map<std::string, size_t> ambiguity_map_t;
|
||||||
typedef std::map<std::string, cmWIXShortcut> shortcut_map_t;
|
typedef std::map<std::string, cmWIXShortcut> shortcut_map_t;
|
||||||
|
typedef std::set<std::string> extension_set_t;
|
||||||
|
|
||||||
bool InitializeWiXConfiguration();
|
bool InitializeWiXConfiguration();
|
||||||
|
|
||||||
|
@ -129,10 +130,19 @@ private:
|
||||||
|
|
||||||
static bool IsLegalIdCharacter(char c);
|
static bool IsLegalIdCharacter(char c);
|
||||||
|
|
||||||
|
void CollectExtensions(
|
||||||
|
const std::string& variableName, extension_set_t& extensions);
|
||||||
|
|
||||||
|
void AddCustomFlags(
|
||||||
|
const std::string& variableName, std::ostream& stream);
|
||||||
|
|
||||||
std::vector<std::string> wixSources;
|
std::vector<std::string> wixSources;
|
||||||
id_map_t pathToIdMap;
|
id_map_t pathToIdMap;
|
||||||
ambiguity_map_t idAmbiguityCounter;
|
ambiguity_map_t idAmbiguityCounter;
|
||||||
shortcut_map_t shortcutMap;
|
shortcut_map_t shortcutMap;
|
||||||
|
|
||||||
|
extension_set_t candleExtensions;
|
||||||
|
extension_set_t lightExtensions;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue