[Cmake-commits] CMake branch, next, updated. v3.6.2-2654-g4d42faf
Brad King
brad.king at kitware.com
Fri Sep 30 10:06:24 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 4d42faf205e28bf47a38ac2168e24842f44f9219 (commit)
via bcafc399c581974c21631275adc2bba3e0e7d535 (commit)
via 98b11f252c821e60da6492b2f27a84c68d6f2a2b (commit)
from 1b199a944ad58e12b8f10fc8ca482769b8edf647 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d42faf205e28bf47a38ac2168e24842f44f9219
commit 4d42faf205e28bf47a38ac2168e24842f44f9219
Merge: 1b199a9 bcafc39
Author: Brad King <brad.king at kitware.com>
AuthorDate: Fri Sep 30 10:06:22 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Sep 30 10:06:22 2016 -0400
Merge topic 'autogen-empty-qrc' into next
bcafc399 QtAutogen: Add test for empty qrc file
98b11f25 QtAutogen: Allow .qrc files that do not contain any file reference
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bcafc399c581974c21631275adc2bba3e0e7d535
commit bcafc399c581974c21631275adc2bba3e0e7d535
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Sep 30 09:53:35 2016 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Sep 30 10:02:49 2016 -0400
QtAutogen: Add test for empty qrc file
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index e35e1d1..c713d1c 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -44,10 +44,16 @@ else()
endif()
+# -- RCC only
add_executable(rcconly rcconly.cpp second_resource.qrc)
set_property(TARGET rcconly PROPERTY AUTORCC ON)
target_link_libraries(rcconly ${QT_QTCORE_TARGET})
+# -- RCC empty
+add_executable(rcc_empty rcc_empty.cpp rcc_empty_resource.qrc)
+set_property(TARGET rcc_empty PROPERTY AUTORCC ON)
+target_link_libraries(rcc_empty ${QT_QTCORE_TARGET})
+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DFOO -DSomeDefine="Barx")
diff --git a/Tests/QtAutogen/rcc_empty.cpp b/Tests/QtAutogen/rcc_empty.cpp
new file mode 100644
index 0000000..3f9f9a2
--- /dev/null
+++ b/Tests/QtAutogen/rcc_empty.cpp
@@ -0,0 +1,9 @@
+
+extern int qInitResources_rcc_empty_resource();
+
+int main(int, char**)
+{
+ // Fails to link if the symbol is not present.
+ qInitResources_rcc_empty_resource();
+ return 0;
+}
diff --git a/Tests/QtAutogen/rcc_empty_resource.qrc b/Tests/QtAutogen/rcc_empty_resource.qrc
new file mode 100644
index 0000000..4ca9cd5
--- /dev/null
+++ b/Tests/QtAutogen/rcc_empty_resource.qrc
@@ -0,0 +1,4 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+</qresource>
+</RCC>
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=98b11f252c821e60da6492b2f27a84c68d6f2a2b
commit 98b11f252c821e60da6492b2f27a84c68d6f2a2b
Author: Sebastian Holtermann <sebholt at xwmw.org>
AuthorDate: Fri Sep 30 10:47:01 2016 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Fri Sep 30 10:02:48 2016 -0400
QtAutogen: Allow .qrc files that do not contain any file reference
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 71687ac..f5936bf 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -434,13 +434,15 @@ static std::string ReadAll(const std::string& filename)
return stream.str();
}
-static std::string ListQt5RccInputs(cmSourceFile* sf,
- cmGeneratorTarget const* target,
- std::vector<std::string>& depends)
+/// @brief Reads the resource files list from from a .qrc file - Qt5 version
+/// @return True if the .qrc file was successfully parsed
+static bool ListQt5RccInputs(cmSourceFile* sf, cmGeneratorTarget const* target,
+ std::vector<std::string>& depends)
{
std::string rccCommand = GetRccExecutable(target);
bool hasDashDashList = false;
+ // Read rcc features
{
std::vector<std::string> command;
command.push_back(rccCommand);
@@ -456,15 +458,12 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
hasDashDashList = true;
}
}
-
- std::vector<std::string> qrcEntries;
-
+ // Run rcc list command
std::vector<std::string> command;
command.push_back(rccCommand);
command.push_back(hasDashDashList ? "--list" : "-list");
std::string absFile = cmsys::SystemTools::GetRealPath(sf->GetFullPath());
-
command.push_back(absFile);
std::string rccStdOut;
@@ -480,16 +479,17 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
<< rccStdOut << "\n"
<< rccStdErr << std::endl;
std::cerr << err.str();
- return std::string();
+ return false;
}
+ // Parse rcc list output
{
std::istringstream ostr(rccStdOut);
std::string oline;
while (std::getline(ostr, oline)) {
oline = cmQtAutoGeneratorsStripCR(oline);
if (!oline.empty()) {
- qrcEntries.push_back(oline);
+ depends.push_back(oline);
}
}
}
@@ -508,29 +508,27 @@ static std::string ListQt5RccInputs(cmSourceFile* sf,
err << "AUTOGEN: error: Rcc lists unparsable output " << eline
<< std::endl;
std::cerr << err.str();
- return std::string();
+ return false;
}
pos += searchString.length();
std::string::size_type sz = eline.size() - pos - 1;
- qrcEntries.push_back(eline.substr(pos, sz));
+ depends.push_back(eline.substr(pos, sz));
}
}
}
- depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end());
- return cmJoin(qrcEntries, "@list_sep@");
+ return true;
}
-static std::string ListQt4RccInputs(cmSourceFile* sf,
- std::vector<std::string>& depends)
+/// @brief Reads the resource files list from from a .qrc file - Qt4 version
+/// @return True if the .qrc file was successfully parsed
+static bool ListQt4RccInputs(cmSourceFile* sf,
+ std::vector<std::string>& depends)
{
const std::string qrcContents = ReadAll(sf->GetFullPath());
cmsys::RegularExpression fileMatchRegex("(<file[^<]+)");
- std::string entriesList;
- const char* sep = "";
-
size_t offset = 0;
while (fileMatchRegex.find(qrcContents.c_str() + offset)) {
std::string qrcEntry = fileMatchRegex.match(1);
@@ -547,12 +545,21 @@ static std::string ListQt4RccInputs(cmSourceFile* sf,
qrcEntry = sf->GetLocation().GetDirectory() + "/" + qrcEntry;
}
- entriesList += sep;
- entriesList += qrcEntry;
- sep = "@list_sep@";
depends.push_back(qrcEntry);
}
- return entriesList;
+ return true;
+}
+
+/// @brief Reads the resource files list from from a .qrc file
+/// @return True if the rcc file was successfully parsed
+static bool ListQtRccInputs(const std::string& qtMajorVersion,
+ cmSourceFile* sf, cmGeneratorTarget const* target,
+ std::vector<std::string>& depends)
+{
+ if (qtMajorVersion == "5") {
+ return ListQt5RccInputs(sf, target, depends);
+ }
+ return ListQt4RccInputs(sf, depends);
}
static void SetupAutoRccTarget(cmGeneratorTarget const* target)
@@ -615,16 +622,12 @@ static void SetupAutoRccTarget(cmGeneratorTarget const* target)
}
optionSep = ";";
- std::vector<std::string> depends;
-
std::string entriesList;
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
- if (qtMajorVersion == "5") {
- entriesList = ListQt5RccInputs(sf, target, depends);
+ std::vector<std::string> depends;
+ if (ListQtRccInputs(qtMajorVersion, sf, target, depends)) {
+ entriesList = cmJoin(depends, "@list_sep@");
} else {
- entriesList = ListQt4RccInputs(sf, depends);
- }
- if (entriesList.empty()) {
return;
}
}
@@ -778,11 +781,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
rcc_output.push_back(rcc_output_file);
}
if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"))) {
- if (qtMajorVersion == "5") {
- ListQt5RccInputs(sf, target, depends);
- } else {
- ListQt4RccInputs(sf, depends);
- }
+ ListQtRccInputs(qtMajorVersion, sf, target, depends);
#if defined(_WIN32) && !defined(__CYGWIN__)
// Cannot use PRE_BUILD because the resource files themselves
// may not be sources within the target so VS may not know the
-----------------------------------------------------------------------
Summary of changes:
Source/cmQtAutoGeneratorInitializer.cxx | 67 ++++++++++----------
Tests/QtAutogen/CMakeLists.txt | 6 ++
Tests/QtAutogen/{rcconly.cpp => rcc_empty.cpp} | 4 +-
.../{sameName/data.qrc => rcc_empty_resource.qrc} | 1 -
4 files changed, 41 insertions(+), 37 deletions(-)
copy Tests/QtAutogen/{rcconly.cpp => rcc_empty.cpp} (50%)
copy Tests/QtAutogen/{sameName/data.qrc => rcc_empty_resource.qrc} (73%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list