Merge branch 'fix-Qt-Autogen' into release

This commit is contained in:
Brad King 2014-08-11 09:59:46 -04:00
commit c6f1c5585a
8 changed files with 84 additions and 7 deletions

View File

@ -1786,8 +1786,8 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
std::string::size_type matchOffset = 0; std::string::size_type matchOffset = 0;
const std::string absPath = cmsys::SystemTools::GetFilenamePath( const std::string realName =
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; cmsys::SystemTools::GetRealPath(absFilename.c_str());
matchOffset = 0; matchOffset = 0;
if ((strstr(contentsString.c_str(), "ui_") != NULL) if ((strstr(contentsString.c_str(), "ui_") != NULL)
@ -1804,7 +1804,7 @@ void cmQtAutoGenerators::ParseForUic(const std::string& absFilename,
// finding the correct header, so we need to remove the ui_ part // finding the correct header, so we need to remove the ui_ part
basename = basename.substr(3); basename = basename.substr(3);
includedUis[absPath] = basename; includedUis[realName] = basename;
matchOffset += uiIncludeRegExp.end(); matchOffset += uiIncludeRegExp.end();
} while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset)); } while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset));
@ -1960,7 +1960,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
return false; return false;
} }
bool cmQtAutoGenerators::GenerateUi(const std::string& path, bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
const std::string& uiFileName) const std::string& uiFileName)
{ {
if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false)) if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false))
@ -1968,6 +1968,9 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& path,
cmsys::SystemTools::MakeDirectory(this->Builddir.c_str()); cmsys::SystemTools::MakeDirectory(this->Builddir.c_str());
} }
const std::string path = cmsys::SystemTools::GetFilenamePath(
realName.c_str()) + '/';
std::string ui_output_file = "ui_" + uiFileName + ".h"; std::string ui_output_file = "ui_" + uiFileName + ".h";
std::string ui_input_file = path + uiFileName + ".ui"; std::string ui_input_file = path + uiFileName + ".ui";
@ -2074,6 +2077,8 @@ bool cmQtAutoGenerators::GenerateQrc()
} }
} }
command.push_back("-name");
command.push_back(basename);
command.push_back("-o"); command.push_back("-o");
command.push_back(rcc_output_file); command.push_back(rcc_output_file);
command.push_back(*si); command.push_back(*si);

View File

@ -48,7 +48,7 @@ private:
bool RunAutogen(cmMakefile* makefile); bool RunAutogen(cmMakefile* makefile);
bool GenerateMoc(const std::string& sourceFile, bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName); const std::string& mocFileName);
bool GenerateUi(const std::string& path, const std::string& uiFileName); bool GenerateUi(const std::string& realName, const std::string& uiFileName);
bool GenerateQrc(); bool GenerateQrc();
void ParseCppFile(const std::string& absFilename, void ParseCppFile(const std::string& absFilename,
const std::vector<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,

View File

@ -64,9 +64,9 @@ add_custom_command(
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in"
) )
add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp
xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot> xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>
test.qrc resourcetester.cpp generated.cpp test.qrc second_resource.qrc resourcetester.cpp generated.cpp
) )
set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h") set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h")

View File

@ -16,6 +16,8 @@ void ResourceTester::doTest()
{ {
if (!QFile::exists(":/CMakeLists.txt")) if (!QFile::exists(":/CMakeLists.txt"))
qApp->exit(EXIT_FAILURE); qApp->exit(EXIT_FAILURE);
if (!QFile::exists(":/main.cpp"))
qApp->exit(EXIT_FAILURE);
QTimer::singleShot(0, qApp, SLOT(quit())); QTimer::singleShot(0, qApp, SLOT(quit()));
} }

View File

@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>main.cpp</file>
</qresource>
</RCC>

View File

@ -0,0 +1,14 @@
#include "second_widget.h"
#include "ui_second_widget.h"
SecondWidget::SecondWidget(QWidget *parent)
: QWidget(parent), ui(new Ui::SecondWidget)
{
ui->setupUi(this);
}
SecondWidget::~SecondWidget()
{
delete ui;
}

View File

@ -0,0 +1,19 @@
#include <QWidget>
namespace Ui
{
class SecondWidget;
}
class SecondWidget : public QWidget
{
Q_OBJECT
public:
explicit SecondWidget(QWidget *parent = 0);
~SecondWidget();
private:
Ui::SecondWidget* ui;
};

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SecondWidget</class>
<widget class="QWidget" name="SecondWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>80</x>
<y>20</y>
<width>94</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>