Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
51465da1
Commit
51465da1
authored
Jul 16, 2015
by
Daniel Pfeifer
Committed by
Brad King
Mar 23, 2016
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPack/IFW: port to cmXMLWriter
parent
754485af
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
81 additions
and
103 deletions
+81
-103
Source/CPack/IFW/cmCPackIFWGenerator.cxx
Source/CPack/IFW/cmCPackIFWGenerator.cxx
+8
-7
Source/CPack/IFW/cmCPackIFWGenerator.h
Source/CPack/IFW/cmCPackIFWGenerator.h
+3
-2
Source/CPack/IFW/cmCPackIFWInstaller.cxx
Source/CPack/IFW/cmCPackIFWInstaller.cxx
+36
-53
Source/CPack/IFW/cmCPackIFWInstaller.h
Source/CPack/IFW/cmCPackIFWInstaller.h
+2
-2
Source/CPack/IFW/cmCPackIFWPackage.cxx
Source/CPack/IFW/cmCPackIFWPackage.cxx
+30
-37
Source/CPack/IFW/cmCPackIFWPackage.h
Source/CPack/IFW/cmCPackIFWPackage.h
+2
-2
No files found.
Source/CPack/IFW/cmCPackIFWGenerator.cxx
View file @
51465da1
...
...
@@ -27,7 +27,7 @@
#include <cmSystemTools.h>
#include <cmMakefile.h>
#include <cmGeneratedFileStream.h>
#include <cmXML
Safe
.h>
#include <cmXML
Writer
.h>
#include <cmVersionConfig.h>
#include <cmTimestamp.h>
...
...
@@ -611,18 +611,19 @@ cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
}
//----------------------------------------------------------------------------
void
cmCPackIFWGenerator
::
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
)
void
cmCPackIFWGenerator
::
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
)
{
xout
<<
"<!-- Generated by CPack "
<<
CMake_VERSION
<<
" IFW generator "
std
::
stringstream
comment
;
comment
<<
"Generated by CPack "
<<
CMake_VERSION
<<
" IFW generator "
<<
"for QtIFW "
;
if
(
IsVersionLess
(
"2.0"
))
{
xou
t
<<
"less 2.0"
;
commen
t
<<
"less 2.0"
;
}
else
{
xou
t
<<
FrameworkVersion
;
commen
t
<<
FrameworkVersion
;
}
xou
t
<<
" tools at "
<<
cmTimestamp
().
CurrentTime
(
""
,
true
)
<<
" -->"
<<
std
::
endl
;
commen
t
<<
" tools at "
<<
cmTimestamp
().
CurrentTime
(
""
,
true
)
;
xout
.
Comment
(
comment
.
str
().
c_str
())
;
}
Source/CPack/IFW/cmCPackIFWGenerator.h
View file @
51465da1
...
...
@@ -13,12 +13,13 @@
#ifndef cmCPackIFWGenerator_h
#define cmCPackIFWGenerator_h
#include <cmGeneratedFileStream.h>
#include <CPack/cmCPackGenerator.h>
#include "cmCPackIFWPackage.h"
#include "cmCPackIFWInstaller.h"
class
cmXMLWriter
;
/** \class cmCPackIFWGenerator
* \brief A generator for Qt Installer Framework tools
*
...
...
@@ -121,7 +122,7 @@ protected: // Methods
cmCPackIFWPackage
*
GetGroupPackage
(
cmCPackComponentGroup
*
group
)
const
;
cmCPackIFWPackage
*
GetComponentPackage
(
cmCPackComponent
*
component
)
const
;
void
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
);
void
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
);
protected:
// Data
...
...
Source/CPack/IFW/cmCPackIFWInstaller.cxx
View file @
51465da1
...
...
@@ -17,7 +17,7 @@
#include <CPack/cmCPackLog.h>
#include <cmGeneratedFileStream.h>
#include <cmXML
Safe
.h>
#include <cmXML
Writer
.h>
#ifdef cmCPackLogger
# undef cmCPackLogger
...
...
@@ -334,30 +334,27 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
}
// Output stream
cmGeneratedFileStream
xout
((
Directory
+
"/config/config.xml"
).
data
());
cmGeneratedFileStream
fout
((
Directory
+
"/config/config.xml"
).
data
());
cmXMLWriter
xout
(
fout
);
xout
<<
"<?xml version=
\"
1.0
\"
?>"
<<
std
::
endl
;
xout
.
StartDocument
()
;
WriteGeneratedByToStrim
(
xout
);
xout
<<
"<Installer>"
<<
std
::
endl
;
xout
.
StartElement
(
"Installer"
)
;
xout
<<
" <Name>"
<<
cmXMLSafe
(
Name
).
str
()
<<
"</Name>"
<<
std
::
endl
;
xout
<<
" <Version>"
<<
Version
<<
"</Version>"
<<
std
::
endl
;
xout
<<
" <Title>"
<<
cmXMLSafe
(
Title
).
str
()
<<
"</Title>"
<<
std
::
endl
;
xout
.
Element
(
"Name"
,
Name
);
xout
.
Element
(
"Version"
,
Version
);
xout
.
Element
(
"Title"
,
Title
);
if
(
!
Publisher
.
empty
())
{
xout
<<
" <Publisher>"
<<
cmXMLSafe
(
Publisher
).
str
()
<<
"</Publisher>"
<<
std
::
endl
;
xout
.
Element
(
"Publisher"
,
Publisher
);
}
if
(
!
ProductUrl
.
empty
())
{
xout
<<
" <ProductUrl>"
<<
ProductUrl
<<
"</
ProductUrl
>"
<<
std
::
endl
;
xout
.
Element
(
"
ProductUrl
"
,
ProductUrl
)
;
}
// ApplicationIcon
...
...
@@ -369,8 +366,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
name
=
cmSystemTools
::
GetFilenameWithoutExtension
(
name
);
cmsys
::
SystemTools
::
CopyFileIfDifferent
(
InstallerApplicationIcon
.
data
(),
path
.
data
());
xout
<<
" <InstallerApplicationIcon>"
<<
name
<<
"</InstallerApplicationIcon>"
<<
std
::
endl
;
xout
.
Element
(
"InstallerApplicationIcon"
,
name
);
}
// WindowIcon
...
...
@@ -380,8 +376,7 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
std
::
string
path
=
Directory
+
"/config/"
+
name
;
cmsys
::
SystemTools
::
CopyFileIfDifferent
(
InstallerWindowIcon
.
data
(),
path
.
data
());
xout
<<
" <InstallerWindowIcon>"
<<
name
<<
"</InstallerWindowIcon>"
<<
std
::
endl
;
xout
.
Element
(
"InstallerWindowIcon"
,
name
);
}
// Logo
...
...
@@ -390,104 +385,91 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
std
::
string
name
=
cmSystemTools
::
GetFilenameName
(
Logo
);
std
::
string
path
=
Directory
+
"/config/"
+
name
;
cmsys
::
SystemTools
::
CopyFileIfDifferent
(
Logo
.
data
(),
path
.
data
());
xout
<<
" <Logo>"
<<
name
<<
"</Logo>"
<<
std
::
endl
;
xout
.
Element
(
"Logo"
,
name
)
;
}
// Start menu
if
(
!
IsVersionLess
(
"2.0"
))
{
xout
<<
" <StartMenuDir>"
<<
StartMenuDir
<<
"</StartMenuDir>"
<<
std
::
endl
;
xout
.
Element
(
"StartMenuDir"
,
StartMenuDir
);
}
// Target dir
if
(
!
TargetDir
.
empty
())
{
xout
<<
" <TargetDir>"
<<
TargetDir
<<
"</
TargetDir
>"
<<
std
::
endl
;
xout
.
Element
(
"
TargetDir
"
,
TargetDir
)
;
}
// Admin target dir
if
(
!
AdminTargetDir
.
empty
())
{
xout
<<
" <AdminTargetDir>"
<<
AdminTargetDir
<<
"</AdminTargetDir>"
<<
std
::
endl
;
xout
.
Element
(
"AdminTargetDir"
,
AdminTargetDir
);
}
// Remote repositories
if
(
!
Repositories
.
empty
())
{
xout
<<
" <
RemoteRepositories
>"
<<
std
::
endl
;
xout
.
StartElement
(
"
RemoteRepositories
"
)
;
for
(
std
::
vector
<
RepositoryStruct
>::
iterator
rit
=
Repositories
.
begin
();
rit
!=
Repositories
.
end
();
++
rit
)
{
xout
<<
" <Repository>"
<<
std
::
endl
;
xout
.
StartElement
(
"Repository"
)
;
// Url
xout
<<
" <Url>"
<<
rit
->
Url
<<
"</Url>"
<<
std
::
endl
;
xout
.
Element
(
"Url"
,
rit
->
Url
);
// Enabled
if
(
!
rit
->
Enabled
.
empty
())
{
xout
<<
" <Enabled>"
<<
rit
->
Enabled
<<
"</Enabled>"
<<
std
::
endl
;
xout
.
Element
(
"Enabled"
,
rit
->
Enabled
);
}
// Username
if
(
!
rit
->
Username
.
empty
())
{
xout
<<
" <Username>"
<<
rit
->
Username
<<
"</Username>"
<<
std
::
endl
;
xout
.
Element
(
"Username"
,
rit
->
Username
);
}
// Password
if
(
!
rit
->
Password
.
empty
())
{
xout
<<
" <Password>"
<<
rit
->
Password
<<
"</Password>"
<<
std
::
endl
;
xout
.
Element
(
"Password"
,
rit
->
Password
);
}
// DisplayName
if
(
!
rit
->
DisplayName
.
empty
())
{
xout
<<
" <DisplayName>"
<<
rit
->
DisplayName
<<
"</DisplayName>"
<<
std
::
endl
;
xout
.
Element
(
"DisplayName"
,
rit
->
DisplayName
);
}
xout
<<
" </Repository>"
<<
std
::
endl
;
xout
.
EndElement
()
;
}
xout
<<
" </RemoteRepositories>"
<<
std
::
endl
;
xout
.
EndElement
()
;
}
// Maintenance tool
if
(
!
IsVersionLess
(
"2.0"
)
&&
!
MaintenanceToolName
.
empty
())
{
xout
<<
" <MaintenanceToolName>"
<<
MaintenanceToolName
<<
"</MaintenanceToolName>"
<<
std
::
endl
;
xout
.
Element
(
"MaintenanceToolName"
,
MaintenanceToolName
);
}
// Maintenance tool ini file
if
(
!
IsVersionLess
(
"2.0"
)
&&
!
MaintenanceToolIniFile
.
empty
())
{
xout
<<
" <MaintenanceToolIniFile>"
<<
MaintenanceToolIniFile
<<
"</MaintenanceToolIniFile>"
<<
std
::
endl
;
xout
.
Element
(
"MaintenanceToolIniFile"
,
MaintenanceToolIniFile
);
}
// Different allows
if
(
IsVersionLess
(
"2.0"
))
{
// CPack IFW default policy
xout
<<
" <!-- CPack IFW default policy for QtIFW less 2.0 -->"
<<
std
::
endl
;
xout
<<
" <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>"
<<
std
::
endl
;
xout
<<
" <AllowSpaceInPath>true</AllowSpaceInPath>"
<<
std
::
endl
;
xout
.
Comment
(
"CPack IFW default policy for QtIFW less 2.0"
);
xout
.
Element
(
"AllowNonAsciiCharacters"
,
"true"
);
xout
.
Element
(
"AllowSpaceInPath"
,
"true"
);
}
else
{
if
(
!
AllowNonAsciiCharacters
.
empty
())
{
xout
<<
" <AllowNonAsciiCharacters>"
<<
AllowNonAsciiCharacters
<<
"</AllowNonAsciiCharacters>"
<<
std
::
endl
;
xout
.
Element
(
"AllowNonAsciiCharacters"
,
AllowNonAsciiCharacters
);
}
if
(
!
AllowSpaceInPath
.
empty
())
{
xout
<<
" <AllowAllowSpaceInPath>"
<<
AllowSpaceInPath
<<
"</AllowSpaceInPath>"
<<
std
::
endl
;
xout
.
Element
(
"AllowSpaceInPath"
,
AllowSpaceInPath
);
}
}
...
...
@@ -497,10 +479,11 @@ void cmCPackIFWInstaller::GenerateInstallerFile()
std
::
string
name
=
cmSystemTools
::
GetFilenameName
(
ControlScript
);
std
::
string
path
=
Directory
+
"/config/"
+
name
;
cmsys
::
SystemTools
::
CopyFileIfDifferent
(
ControlScript
.
data
(),
path
.
data
());
xout
<<
" <
ControlScript
>"
<<
name
<<
"</ControlScript>"
<<
std
::
endl
;
xout
.
Element
(
"
ControlScript
"
,
name
)
;
}
xout
<<
"</Installer>"
<<
std
::
endl
;
xout
.
EndElement
();
xout
.
EndDocument
();
}
//----------------------------------------------------------------------------
...
...
@@ -535,7 +518,7 @@ void cmCPackIFWInstaller::GeneratePackageFiles()
}
}
void
cmCPackIFWInstaller
::
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
)
void
cmCPackIFWInstaller
::
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
)
{
if
(
Generator
)
Generator
->
WriteGeneratedByToStrim
(
xout
);
}
Source/CPack/IFW/cmCPackIFWInstaller.h
View file @
51465da1
...
...
@@ -13,11 +13,11 @@
#ifndef cmCPackIFWInstaller_h
#define cmCPackIFWInstaller_h
#include <cmGeneratedFileStream.h>
#include <cmStandardIncludes.h>
class
cmCPackIFWPackage
;
class
cmCPackIFWGenerator
;
class
cmXMLWriter
;
/** \class cmCPackIFWInstaller
* \brief A binary installer to be created CPack IFW generator
...
...
@@ -115,7 +115,7 @@ public: // Internal implementation
std
::
string
Directory
;
protected:
void
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
);
void
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
);
};
#endif // cmCPackIFWInstaller_h
Source/CPack/IFW/cmCPackIFWPackage.cxx
View file @
51465da1
...
...
@@ -18,6 +18,7 @@
#include <cmGeneratedFileStream.h>
#include <cmTimestamp.h>
#include <cmXMLWriter.h>
//----------------------------------------------------------------- Logger ---
#ifdef cmCPackLogger
...
...
@@ -447,35 +448,28 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
// Output stream
cmGeneratedFileStream
xout
((
Directory
+
"/meta/package.xml"
).
data
());
cmGeneratedFileStream
fout
((
Directory
+
"/meta/package.xml"
).
data
());
cmXMLWriter
xout
(
fout
);
xout
<<
"<?xml version=
\"
1.0
\"
?>"
<<
std
::
endl
;
xout
.
StartDocument
()
;
WriteGeneratedByToStrim
(
xout
);
xout
<<
"<Package>"
<<
std
::
endl
;
xout
.
StartElement
(
"Package"
)
;
xout
<<
" <DisplayName>"
<<
DisplayName
<<
"</DisplayName>"
<<
std
::
endl
;
xout
.
Element
(
"DisplayName"
,
DisplayName
);
xout
.
Element
(
"Description"
,
Description
);
xout
.
Element
(
"Name"
,
Name
);
xout
.
Element
(
"Version"
,
Version
);
xout
<<
" <Description>"
<<
Description
<<
"</Description>"
<<
std
::
endl
;
xout
<<
" <Name>"
<<
Name
<<
"</Name>"
<<
std
::
endl
;
xout
<<
" <Version>"
<<
Version
<<
"</Version>"
<<
std
::
endl
;
xout
<<
" <ReleaseDate>"
;
if
(
ReleaseDate
.
empty
())
if
(
!
ReleaseDate
.
empty
())
{
xout
<<
cmTimestamp
().
CurrentTime
(
"%Y-%m-%d"
,
tru
e
);
xout
.
Element
(
"ReleaseDate"
,
ReleaseDat
e
);
}
else
{
xout
<<
ReleaseDate
;
xout
.
Element
(
"
ReleaseDate
"
,
cmTimestamp
().
CurrentTime
(
"%Y-%m-%d"
,
true
))
;
}
xout
<<
"</ReleaseDate>"
<<
std
::
endl
;
// Script (copy to meta dir)
if
(
!
Script
.
empty
())
...
...
@@ -483,7 +477,7 @@ void cmCPackIFWPackage::GeneratePackageFile()
std
::
string
name
=
cmSystemTools
::
GetFilenameName
(
Script
);
std
::
string
path
=
Directory
+
"/meta/"
+
name
;
cmsys
::
SystemTools
::
CopyFileIfDifferent
(
Script
.
data
(),
path
.
data
());
xout
<<
" <Script>"
<<
name
<<
"</Script>"
<<
std
::
endl
;
xout
.
Element
(
"Script"
,
name
)
;
}
// Dependencies
...
...
@@ -501,16 +495,16 @@ void cmCPackIFWPackage::GeneratePackageFile()
// Write dependencies
if
(
!
compDepSet
.
empty
())
{
xout
<<
" <D
ependencies
>"
;
std
::
stringstream
d
ependencies
;
std
::
set
<
DependenceStruct
>::
iterator
it
=
compDepSet
.
begin
();
xout
<<
it
->
NameWithCompare
();
dependencies
<<
it
->
NameWithCompare
();
++
it
;
while
(
it
!=
compDepSet
.
end
())
{
xout
<<
","
<<
it
->
NameWithCompare
();
dependencies
<<
","
<<
it
->
NameWithCompare
();
++
it
;
}
xout
<<
"</
Dependencies
>"
<<
std
::
endl
;
xout
.
Element
(
"
Dependencies
"
,
dependencies
.
str
())
;
}
// Licenses (copy to meta dir)
...
...
@@ -524,43 +518,42 @@ void cmCPackIFWPackage::GeneratePackageFile()
}
if
(
!
licenses
.
empty
())
{
xout
<<
" <Licenses>"
<<
std
::
endl
;
xout
.
StartElement
(
"Licenses"
)
;
for
(
size_t
i
=
0
;
i
<
licenses
.
size
();
i
+=
2
)
{
xout
<<
" <
License
"
<<
"name=
\"
"
<<
licenses
[
i
]
<<
"
\"
"
<<
"file=
\"
"
<<
licenses
[
i
+
1
]
<<
"
\"
"
<<
"/>"
<<
std
::
endl
;
xout
.
StartElement
(
"
License"
);
xout
.
Attribute
(
"name"
,
licenses
[
i
]
);
xout
.
Attribute
(
"file"
,
licenses
[
i
+
1
]
);
xout
.
EndElement
()
;
}
xout
<<
" </Licenses>"
<<
std
::
endl
;
xout
.
EndElement
()
;
}
if
(
!
ForcedInstallation
.
empty
())
{
xout
<<
" <ForcedInstallation>"
<<
ForcedInstallation
<<
"</ForcedInstallation>"
<<
std
::
endl
;
xout
.
Element
(
"ForcedInstallation"
,
ForcedInstallation
);
}
if
(
!
Virtual
.
empty
())
{
xout
<<
" <
Virtual
>"
<<
Virtual
<<
"</Virtual>"
<<
std
::
endl
;
xout
.
Element
(
"
Virtual
"
,
Virtual
)
;
}
else
if
(
!
Default
.
empty
())
{
xout
<<
" <Default>"
<<
Default
<<
"</Default>"
<<
std
::
endl
;
xout
.
Element
(
"Default"
,
Default
)
;
}
// Priority
if
(
!
SortingPriority
.
empty
())
{
xout
<<
" <SortingPriority>"
<<
SortingPriority
<<
"</SortingPriority>"
<<
std
::
endl
;
xout
.
Element
(
"SortingPriority"
,
SortingPriority
);
}
xout
<<
"</Package>"
<<
std
::
endl
;
xout
.
EndElement
();
xout
.
EndDocument
();
}
void
cmCPackIFWPackage
::
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
)
void
cmCPackIFWPackage
::
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
)
{
if
(
Generator
)
Generator
->
WriteGeneratedByToStrim
(
xout
);
}
Source/CPack/IFW/cmCPackIFWPackage.h
View file @
51465da1
...
...
@@ -14,12 +14,12 @@
#define cmCPackIFWPackage_h
#include <cmStandardIncludes.h>
#include <cmGeneratedFileStream.h>
class
cmCPackComponent
;
class
cmCPackComponentGroup
;
class
cmCPackIFWInstaller
;
class
cmCPackIFWGenerator
;
class
cmXMLWriter
;
/** \class cmCPackIFWPackage
* \brief A single component to be installed by CPack IFW generator
...
...
@@ -135,7 +135,7 @@ public: // Internal implementation
std
::
string
Directory
;
protected:
void
WriteGeneratedByToStrim
(
cm
GeneratedFileStream
&
xout
);
void
WriteGeneratedByToStrim
(
cm
XMLWriter
&
xout
);
};
#endif // cmCPackIFWPackage_h
Brad King
@brad.king
mentioned in commit
40576675
·
Mar 23, 2016
mentioned in commit
40576675
mentioned in commit 405766757c10e6e6cfeddf6ae01ab6877cfc5a6d
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment