CMakeLists: compile error fixed.
This commit is contained in:
parent
10e32d12a9
commit
ac52c2710c
|
@ -10,6 +10,8 @@ option(RIBBONUI_BUILD_EXAMPLES "Build RibbonUI APP." ON)
|
||||||
option(RIBBONUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
|
option(RIBBONUI_BUILD_FRAMELESSHEPLER "Build FramelessHelper." ON)
|
||||||
option(RIBBONUI_BUILD_STATIC_LIB "Build RibbonUI static library." OFF)
|
option(RIBBONUI_BUILD_STATIC_LIB "Build RibbonUI static library." OFF)
|
||||||
|
|
||||||
|
add_subdirectory(lib_source)
|
||||||
|
|
||||||
if (RIBBONUI_BUILD_EXAMPLES)
|
if (RIBBONUI_BUILD_EXAMPLES)
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
endif()
|
endif()
|
||||||
|
@ -18,8 +20,6 @@ if(NOT RIBBONUI_QML_PLUGIN_DIRECTORY)
|
||||||
set(RIBBONUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/RibbonUI CACHE PATH "RibbonUI Plugin Path")
|
set(RIBBONUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/RibbonUI CACHE PATH "RibbonUI Plugin Path")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(lib_source)
|
|
||||||
|
|
||||||
message("---------------------------- RibbonUI ----------------------------")
|
message("---------------------------- RibbonUI ----------------------------")
|
||||||
message("Build RibbonUI APP: ${RIBBONUI_BUILD_EXAMPLES}")
|
message("Build RibbonUI APP: ${RIBBONUI_BUILD_EXAMPLES}")
|
||||||
message("Build RibbonUI static library: ${RIBBONUI_BUILD_STATIC_LIB}")
|
message("Build RibbonUI static library: ${RIBBONUI_BUILD_STATIC_LIB}")
|
||||||
|
|
|
@ -97,16 +97,19 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
)
|
)
|
||||||
|
|
||||||
if(RIBBONUI_BUILD_STATIC_LIB)
|
if(RIBBONUI_BUILD_STATIC_LIB)
|
||||||
add_definitions(-DRIBBONUI_BUILD_STATIC_LIB)
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
Qt::Quick
|
|
||||||
RibbonUIplugin
|
RibbonUIplugin
|
||||||
)
|
)
|
||||||
else()
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
RIBBONUI_BUILD_STATIC_LIB
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
RibbonUI
|
RibbonUI
|
||||||
)
|
)
|
||||||
endif()
|
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
|
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
||||||
qt_standard_project_setup()
|
qt_standard_project_setup()
|
||||||
qt_policy(SET QTP0001 NEW)
|
qt_policy(SET QTP0001 NEW)
|
||||||
|
@ -70,18 +72,38 @@ qt_add_qml_module(${PROJECT_NAME}
|
||||||
RESOURCE_PREFIX "/qt/qml/"
|
RESOURCE_PREFIX "/qt/qml/"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (MINGW)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "d")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (RIBBONUI_BUILD_STATIC_LIB)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||||
|
RIBBONUI_BUILD_STATIC_LIB
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(${PROJECT_NAME}
|
target_compile_definitions(${PROJECT_NAME}
|
||||||
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
|
||||||
|
RIBBONUI_LIBRARY
|
||||||
|
)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::CorePrivate
|
Qt::CorePrivate
|
||||||
Qt::QuickPrivate
|
Qt::QuickPrivate
|
||||||
Qt::QmlPrivate
|
Qt::QmlPrivate
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} PUBLIC
|
target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||||
FramelessHelper::Core
|
FramelessHelper::Core
|
||||||
FramelessHelper::Quick
|
FramelessHelper::Quick
|
||||||
)
|
)
|
||||||
|
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||||
|
${PROJECT_SOURCE_DIR}
|
||||||
|
${PROJECT_SOURCE_DIR}/3rdparty/framelesshelper/include
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY ${RIBBONUI_QML_PLUGIN_DIRECTORY} DESTINATION ${CMAKE_INSTALL_PREFIX}/imports)
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} PUBLIC ${PROJECT_SOURCE_DIR})
|
|
||||||
|
|
|
@ -5,6 +5,18 @@
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
#include <QtQml/qqmlregistration.h>
|
#include <QtQml/qqmlregistration.h>
|
||||||
|
|
||||||
|
#ifndef RIBBONUI_API
|
||||||
|
# ifdef RIBBONUI_BUILD_STATIC_LIB
|
||||||
|
# define RIBBONUI_API
|
||||||
|
# else // RIBBONUI_BUILD_STATIC_LIB
|
||||||
|
# ifdef RIBBONUI_LIBRARY
|
||||||
|
# define RIBBONUI_API Q_DECL_EXPORT
|
||||||
|
# else // RIBBONUI_LIBRARY
|
||||||
|
# define RIBBONUI_API Q_DECL_IMPORT
|
||||||
|
# endif // RIBBONUI_LIBRARY
|
||||||
|
# endif // RIBBONUI_BUILD_STATIC_LIB
|
||||||
|
#endif // RIBBONUI_API
|
||||||
|
|
||||||
namespace RibbonIconsFilledEnum {
|
namespace RibbonIconsFilledEnum {
|
||||||
Q_NAMESPACE
|
Q_NAMESPACE
|
||||||
enum class RibbonIcons_Filled{
|
enum class RibbonIcons_Filled{
|
||||||
|
|
|
@ -18,8 +18,8 @@ class RibbonUI : public QQuickItem
|
||||||
public:
|
public:
|
||||||
static RibbonUI* instance();
|
static RibbonUI* instance();
|
||||||
static RibbonUI* create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return instance();}
|
static RibbonUI* create(QQmlEngine *qmlEngine, QJSEngine *jsEngine){return instance();}
|
||||||
static void init();
|
RIBBONUI_API static void init();
|
||||||
static void registerTypes(QQmlEngine *qmlEngine);
|
RIBBONUI_API static void registerTypes(QQmlEngine *qmlEngine);
|
||||||
private:
|
private:
|
||||||
explicit RibbonUI(QQuickItem *parent = nullptr);
|
explicit RibbonUI(QQuickItem *parent = nullptr);
|
||||||
Q_DISABLE_COPY_MOVE(RibbonUI)
|
Q_DISABLE_COPY_MOVE(RibbonUI)
|
||||||
|
|
Loading…
Reference in New Issue