mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
cmake: add options ENABLE_DIALOG_DESIGNER and HAVE_UI_LOADER
This commit is contained in:
parent
731c05454d
commit
fd6974ca65
@ -9,22 +9,42 @@ set(DEFAULT_ITEM_PADDING 0)
|
||||
option(ENABLE_ZINT "Enable libzint build for barcode support" OFF)
|
||||
option(LIMEREPORT_STATIC "Build LimeReport as static library" OFF)
|
||||
option(LIMEREPORT_DEMO "Build LimeReport demos" OFF)
|
||||
option(ENABLE_DIALOG_DESIGNER "Enable dialog designer" OFF)
|
||||
option(HAVE_UI_LOADER "Enable ui loader" OFF)
|
||||
option(USE_QT6 "Use Qt6" OFF)
|
||||
|
||||
if (ENABLE_DIALOG_DESIGNER AND NOT HAVE_UI_LOADER)
|
||||
message(FATAL_ERROR "You need to enable HAVE_UI_LOADER")
|
||||
endif()
|
||||
|
||||
if(USE_QT6)
|
||||
find_package(QT NAMES Qt6)
|
||||
else()
|
||||
find_package(QT NAMES Qt5)
|
||||
endif(USE_QT6)
|
||||
find_package(
|
||||
Qt${QT_VERSION_MAJOR}
|
||||
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport REQUIRED
|
||||
)
|
||||
|
||||
find_package(
|
||||
Qt${QT_VERSION_MAJOR}
|
||||
COMPONENTS UiTools
|
||||
)
|
||||
COMPONENTS Core Widgets Sql Network Xml Svg Qml PrintSupport REQUIRED)
|
||||
|
||||
if(HAVE_UI_LOADER)
|
||||
find_package(
|
||||
Qt${QT_VERSION_MAJOR}
|
||||
COMPONENTS UiTools REQUIRED)
|
||||
endif()
|
||||
|
||||
if(ENABLE_DIALOG_DESIGNER)
|
||||
if(USE_QT6)
|
||||
if(ENABLE_DIALOG_DESIGNER)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponentsPrivate REQUIRED)
|
||||
endif()
|
||||
else()
|
||||
if(ENABLE_DIALOG_DESIGNER)
|
||||
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer DesignerComponents REQUIRED)
|
||||
endif()
|
||||
endif(USE_QT6)
|
||||
endif()
|
||||
|
||||
# Old Qt does not provide QT_VERSION_MAJOR
|
||||
if (NOT QT_VERSION_MAJOR)
|
||||
string(SUBSTRING ${QT_VERSION} 0 1 QT_VERSION_MAJOR)
|
||||
@ -41,8 +61,10 @@ endif()
|
||||
add_subdirectory(3rdparty)
|
||||
|
||||
if (LIMEREPORT_DEMO)
|
||||
add_subdirectory(console)
|
||||
add_subdirectory(designer)
|
||||
add_subdirectory(demo_r1)
|
||||
add_subdirectory(demo_r2)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@ -318,7 +340,6 @@ ${PROJECT_NAME}/translationeditor/translationeditor.ui
|
||||
|
||||
|
||||
${PROJECT_NAME}/databrowser/lrdatabrowser.qrc
|
||||
${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc
|
||||
${PROJECT_NAME}/items/items.qrc
|
||||
${PROJECT_NAME}/objectinspector/lobjectinspector.qrc
|
||||
${PROJECT_NAME}/report.qrc
|
||||
@ -326,6 +347,28 @@ ${PROJECT_NAME}/scriptbrowser/lrscriptbrowser.qrc
|
||||
${PROJECT_NAME}/translationeditor/translationeditor.qrc
|
||||
)
|
||||
|
||||
if(ENABLE_DIALOG_DESIGNER)
|
||||
set(DIALOG_DESIGNER_SOURCES
|
||||
${PROJECT_NAME}/dialogdesigner/lrdialogdesigner.h
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/namespace_global.h
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.h
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.h
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.h
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethostconstants.h
|
||||
|
||||
${PROJECT_NAME}/dialogdesigner/lrdialogdesigner.cpp
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/formresizer.cpp
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/sizehandlerect.cpp
|
||||
${PROJECT_NAME}/dialogdesigner/3rdparty/qtcreator/designerintegrationv2/widgethost.cpp
|
||||
|
||||
${PROJECT_NAME}/dialogdesigner/templates/Dialog.ui
|
||||
${PROJECT_NAME}/dialogdesigner/dialogdesigner.qrc)
|
||||
|
||||
message(STATUS "DesignerComponents found")
|
||||
list( APPEND LIMEREPORT_SOURCES ${DIALOG_DESIGNER_SOURCES} )
|
||||
|
||||
endif()
|
||||
|
||||
if (ENABLE_ZINT)
|
||||
list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/items/lrbarcodeitem.cpp)
|
||||
list(APPEND LIMEREPORT_SOURCES ${PROJECT_NAME}/items/lrbarcodeitem.h)
|
||||
@ -369,11 +412,11 @@ else()
|
||||
target_compile_definitions( ${PROJECT_NAME} INTERFACE -DLIMEREPORT_IMPORTS)
|
||||
endif()
|
||||
|
||||
if(Qt${QT_VERSION_MAJOR}UiTools_FOUND)
|
||||
if(HAVE_UI_LOADER)
|
||||
target_compile_definitions( ${PROJECT_NAME} PRIVATE -DHAVE_UI_LOADER)
|
||||
target_link_libraries( ${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::UiTools)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries( ${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
@ -384,6 +427,30 @@ target_link_libraries( ${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Svg)
|
||||
|
||||
if(ENABLE_DIALOG_DESIGNER)
|
||||
target_compile_definitions(${PROJECT_NAME} PUBLIC -DHAVE_QTDESIGNER_INTEGRATION)
|
||||
if(${QT_VERSION_MAJOR} STREQUAL 5)
|
||||
target_link_libraries( ${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Designer
|
||||
Qt${QT_VERSION_MAJOR}::DesignerComponents)
|
||||
endif()
|
||||
|
||||
if(${QT_VERSION_MAJOR} STREQUAL 6)
|
||||
target_link_libraries( ${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::Designer
|
||||
Qt${QT_VERSION_MAJOR}::DesignerComponentsPrivate)
|
||||
endif()
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} PRIVATE
|
||||
limereport/dialogdesigner/3rdparty/qtcreator
|
||||
limereport/dialogdesigner/3rdparty/designer
|
||||
limereport/dialogdesigner/3rdparty/qtcreator/designerintegrationv2)
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} PRIVATE
|
||||
${CMAKE_PREFIX_PATH}/include/QtDesigner/${QT_VERSION}/QtDesigner/private)
|
||||
|
||||
endif(ENABLE_DIALOG_DESIGNER)
|
||||
|
||||
if(ENABLE_ZINT)
|
||||
target_link_libraries( ${PROJECT_NAME} PRIVATE QZint)
|
||||
endif(ENABLE_ZINT)
|
||||
@ -392,7 +459,6 @@ target_compile_definitions( ${PROJECT_NAME} PRIVATE -DDEFAULT_ITEM_PADDING=${DEF
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} PRIVATE
|
||||
limereport/
|
||||
${CMAKE_BINARY_DIR}/limereport
|
||||
limereport/base
|
||||
limereport/bands
|
||||
limereport/databrowser
|
||||
@ -403,6 +469,9 @@ target_include_directories( ${PROJECT_NAME} PRIVATE
|
||||
limereport/serializators
|
||||
limereport/scripteditor )
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} PUBLIC
|
||||
${CMAKE_BINARY_DIR}/limereport )
|
||||
|
||||
target_include_directories( ${PROJECT_NAME} INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
||||
|
17
console/CMakeLists.txt
Normal file
17
console/CMakeLists.txt
Normal file
@ -0,0 +1,17 @@
|
||||
project(console)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
main.cpp
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} main.cpp ${PROJECT_SOURCES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
limereport-qt${QT_VERSION_MAJOR}
|
||||
)
|
||||
|
@ -9,6 +9,7 @@ set(PROJECT_SOURCES
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
r1.qrc
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} main.cpp ${PROJECT_SOURCES})
|
||||
|
25
demo_r2/CMakeLists.txt
Normal file
25
demo_r2/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
project(demo_r2)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set(PROJECT_SOURCES
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mainwindow.ui
|
||||
demo_r2.qrc
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} main.cpp ${PROJECT_SOURCES})
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::PrintSupport
|
||||
Qt${QT_VERSION_MAJOR}::Qml
|
||||
Qt${QT_VERSION_MAJOR}::Sql
|
||||
limereport-qt${QT_VERSION_MAJOR}
|
||||
)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "lrdialogdesigner.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QDesignerActionEditorInterface>
|
||||
#include <QDesignerComponents>
|
||||
#include <QDesignerFormEditorInterface>
|
||||
@ -14,7 +13,7 @@
|
||||
#include <QPluginLoader>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#if HAVE_QT5
|
||||
#if (QT_VERSION > QT_VERSION_CHECK(5, 0, 0))
|
||||
#include <QDesignerIntegration>
|
||||
#endif
|
||||
#if HAVE_QT4
|
||||
|
@ -55,6 +55,8 @@ void initResources()
|
||||
Q_INIT_RESOURCE(items);
|
||||
Q_INIT_RESOURCE(lrscriptbrowser);
|
||||
Q_INIT_RESOURCE(translationeditor);
|
||||
#endif
|
||||
#ifdef ENABLE_DIALOG_DESIGNER
|
||||
Q_INIT_RESOURCE(dialogdesigner);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user