mirror of
https://github.com/reactos/CMake.git
synced 2024-11-28 14:01:21 +00:00
Autogen: Add ManySources test
The QtAutogen/ManySources test generates a number of source, header, .ui and .qrc files that get AUTOMOC, AUTOUIC and AUTORCC processed. This stresses the concurrency framework in `cmQtAutoMocUic` and should reveal any issues with that.
This commit is contained in:
parent
a3f062091f
commit
58f04b6ecf
35
Tests/QtAutogen/ManySources/CMakeLists.txt
Normal file
35
Tests/QtAutogen/ManySources/CMakeLists.txt
Normal file
@ -0,0 +1,35 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(ManySources)
|
||||
include("../AutogenGuiTest.cmake")
|
||||
|
||||
# Test AUTOMOC and AUTOUIC on many source files to stress the concurrent
|
||||
# parsing and processing framework.
|
||||
|
||||
set(CSD ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(CBD ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(SRCS main.cpp)
|
||||
set(MAIN_INCLUDES "\n// Item includes\n")
|
||||
set(MAIN_ITEMS "\n// Items\n")
|
||||
|
||||
set(NUM 24)
|
||||
foreach(III RANGE 1 ${NUM})
|
||||
configure_file(${CSD}/object.h.in ${CBD}/object_${III}.h)
|
||||
configure_file(${CSD}/item.h.in ${CBD}/item_${III}.h)
|
||||
configure_file(${CSD}/item.cpp.in ${CBD}/item_${III}.cpp)
|
||||
configure_file(${CSD}/view.ui.in ${CBD}/view_${III}.ui)
|
||||
configure_file(${CSD}/data.qrc.in ${CBD}/data_${III}.qrc)
|
||||
|
||||
list(APPEND SRCS ${CBD}/item_${III}.cpp)
|
||||
list(APPEND SRCS ${CBD}/data_${III}.qrc)
|
||||
|
||||
string(APPEND MAIN_INCLUDES "#include \"item_${III}.h\"\n")
|
||||
string(APPEND MAIN_ITEMS "Item_${III} item_${III};\n")
|
||||
string(APPEND MAIN_ITEMS "item_${III}.TheSlot();\n")
|
||||
endforeach()
|
||||
|
||||
configure_file(${CSD}/main.cpp.in ${CBD}/main.cpp)
|
||||
|
||||
add_executable(manySources ${SRCS} ${CBD}/main.cpp)
|
||||
target_link_libraries(manySources ${QT_LIBRARIES})
|
||||
set_target_properties(manySources PROPERTIES AUTOMOC 1 AUTOUIC 1 AUTORCC 1)
|
7
Tests/QtAutogen/ManySources/data.qrc.in
Normal file
7
Tests/QtAutogen/ManySources/data.qrc.in
Normal file
@ -0,0 +1,7 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>object_@III@.h</file>
|
||||
<file>item_@III@.h</file>
|
||||
<file>item_@III@.cpp</file>
|
||||
</qresource>
|
||||
</RCC>
|
27
Tests/QtAutogen/ManySources/item.cpp.in
Normal file
27
Tests/QtAutogen/ManySources/item.cpp.in
Normal file
@ -0,0 +1,27 @@
|
||||
#include "item_@III@.h"
|
||||
#include "object_@III@.h"
|
||||
// AUTOUIC include
|
||||
#include <ui_view_@III@.h>
|
||||
|
||||
class LocalObject_@III@ : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
LocalObject_@III@() = default;
|
||||
~LocalObject_@III@() = default;
|
||||
};
|
||||
|
||||
void Item_@III@ ::TheSlot()
|
||||
{
|
||||
LocalObject_@III@ localObject;
|
||||
Object_@III@ obj;
|
||||
obj.ObjectSlot();
|
||||
|
||||
Ui_View_@III@ ui_view;
|
||||
}
|
||||
|
||||
// AUTOMOC includes
|
||||
#include "item_@III@.moc"
|
||||
#include "moc_item_@III@.cpp"
|
||||
#include "moc_object_@III@.cpp"
|
15
Tests/QtAutogen/ManySources/item.h.in
Normal file
15
Tests/QtAutogen/ManySources/item.h.in
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef ITEM_@III@HPP
|
||||
#define ITEM_@III@HPP
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Item_@III@ : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_SLOT
|
||||
void TheSlot();
|
||||
};
|
||||
|
||||
#endif
|
7
Tests/QtAutogen/ManySources/main.cpp.in
Normal file
7
Tests/QtAutogen/ManySources/main.cpp.in
Normal file
@ -0,0 +1,7 @@
|
||||
@MAIN_INCLUDES@
|
||||
|
||||
int main(int argv, char** args)
|
||||
{
|
||||
@MAIN_ITEMS@
|
||||
return 0;
|
||||
}
|
15
Tests/QtAutogen/ManySources/object.h.in
Normal file
15
Tests/QtAutogen/ManySources/object.h.in
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef OBJECT_@III@H
|
||||
#define OBJECT_@III@H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Object_@III@ : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Q_SLOT
|
||||
void ObjectSlot(){};
|
||||
};
|
||||
|
||||
#endif
|
24
Tests/QtAutogen/ManySources/view.ui.in
Normal file
24
Tests/QtAutogen/ManySources/view.ui.in
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>View_@III@</class>
|
||||
<widget class="QWidget" name="Base">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -5,6 +5,7 @@ ADD_AUTOGEN_TEST(AutogenTargetDepends)
|
||||
ADD_AUTOGEN_TEST(Complex QtAutogen)
|
||||
ADD_AUTOGEN_TEST(GlobalAutogenTarget)
|
||||
ADD_AUTOGEN_TEST(LowMinimumVersion lowMinimumVersion)
|
||||
ADD_AUTOGEN_TEST(ManySources manySources)
|
||||
ADD_AUTOGEN_TEST(MocOnly mocOnly)
|
||||
ADD_AUTOGEN_TEST(MocOptions mocOptions)
|
||||
ADD_AUTOGEN_TEST(ObjectLibrary someProgram)
|
||||
|
Loading…
Reference in New Issue
Block a user