forked from linuxdeepin/dtkwidget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log: 支持Qt6
- Loading branch information
Showing
21 changed files
with
261 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
usr/lib/*/*/*/examples/* | ||
usr/share/dsg/configs/overrides/dtk-example/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
usr/lib/*/lib*.so.* | ||
usr/share/*/*/translations/* | ||
usr/share/dsg/configs/org.deepin.dtkwidget.feature-display.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
usr/lib/*/lib*.so.* | ||
#usr/lib/*/libmsc.so | ||
usr/share/*/*/translations/* | ||
usr/share/dsg/configs/org.deepin.dtkwidget.feature-display.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
usr/lib/*/lib*.so.* | ||
#usr/lib/*/libmsc.so | ||
usr/share/*/*/translations/* | ||
usr/share/dsg/configs/org.deepin.dtkwidget.feature-display.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
set(LIBNAME dtk${DTK_VERSION_MAJOR}widget) | ||
set(DtkWidget Dtk${DTK_VERSION_MAJOR}Widget) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
message(STATUS "Current Qt Version: ${QT_VERSION_MAJOR}") | ||
message(STATUS "Current Dtk Version: ${DTK_VERSION_MAJOR}") | ||
|
||
set(BUILD_EXAMPLES ON CACHE BOOL "Build examples") | ||
set(BUILD_VERSION "0" CACHE STRING "buildversion") | ||
set(BUILD_PLUGINS ON CACHE BOOL "Build plugin and plugin example") | ||
|
||
set(INCLUDE_INSTALL_DIR | ||
"${CMAKE_INSTALL_INCLUDEDIR}/dtk${PROJECT_VERSION_MAJOR}/DWidget" | ||
) | ||
set(TOOL_INSTALL_DIR | ||
"${CMAKE_INSTALL_LIBDIR}/dtk${PROJECT_VERSION_MAJOR}/DWidget/bin" | ||
) | ||
set(LIBRARY_INSTALL_DIR | ||
"${CMAKE_INSTALL_LIBDIR}" | ||
) | ||
set(MKSPECS_INSTALL_DIR | ||
"${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/mkspecs/modules" | ||
CACHE STRING "Install dir for qt pri files" | ||
) | ||
set(CONFIG_CMAKE_INSTALL_DIR | ||
"${CMAKE_INSTALL_LIBDIR}/cmake/${DtkWidget}" | ||
CACHE STRING "Install directory for cmake files" | ||
) | ||
set(PKGCONFIG_INSTALL_DIR | ||
"${CMAKE_INSTALL_LIBDIR}/pkgconfig" | ||
CACHE STRING "Install directory for pkgconfig files" | ||
) | ||
|
||
find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core | ||
Network | ||
Concurrent | ||
Widgets | ||
PrintSupport | ||
LinguistTools | ||
DBus) | ||
find_package(PkgConfig REQUIRED) | ||
|
||
if("${QT_VERSION_MAJOR}" STREQUAL "5") | ||
find_package(Qt5 REQUIRED COMPONENTS X11Extras) | ||
endif() | ||
|
||
file(GLOB D_HEADERS "${PROJECT_SOURCE_DIR}/include/DWidget/*") | ||
|
||
set(AUTOCONFIG ${CMAKE_CURRENT_BINARY_DIR}/dtkwidget_config.h) | ||
get_filename_component(CONFIG_INCLUDE ${AUTOCONFIG} DIRECTORY) | ||
set(CONFIG_CONTENT) | ||
string(APPEND CONFIG_CONTENT "// This is an auto-generated config\n") | ||
|
||
foreach(header ${D_HEADERS}) | ||
get_filename_component(thename ${header} NAME) | ||
string(APPEND CONFIG_CONTENT "#define DTKWIDGET_CLASS_${thename}\n") | ||
endforeach() | ||
|
||
file(WRITE ${AUTOCONFIG} ${CONFIG_CONTENT}) | ||
|
||
file(GLOB_RECURSE PUBLIC_HEADERS "${PROJECT_SOURCE_DIR}/include/*.h") | ||
|
||
list(APPEND PUBLIC_HEADERS ${D_HEADERS}) | ||
list(APPEND PUBLIC_HEADERS ${AUTOCONFIG}) | ||
|
||
set (BUILD_DOCS ON CACHE BOOL "Generate doxygen-based documentation") | ||
|
||
if (NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
if(NOT MSVC) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed -pie") | ||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
set(BUILD_TESTING ON) | ||
endif () | ||
string(REPLACE "-O3" "-Ofast" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE}) | ||
endif() | ||
|
||
if (BUILD_DOCS) | ||
add_subdirectory(docs) | ||
endif () | ||
|
||
add_subdirectory(src) | ||
if(BUILD_TESTING) | ||
message(STATUS "==================================") | ||
message(STATUS " Now Testing is enabled ") | ||
message(STATUS "==================================") | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() | ||
if(BUILD_EXAMPLES) | ||
message(STATUS "===================================") | ||
message(STATUS "You can build and run examples now ") | ||
message(STATUS "===================================") | ||
add_subdirectory(examples) | ||
endif() | ||
add_subdirectory(tools) | ||
|
||
if(BUILD_PLUGINS) | ||
message(STATUS "===================================") | ||
message(STATUS "Plugins will be built later") | ||
message(STATUS "===================================") | ||
add_subdirectory(plugin) | ||
endif() | ||
|
||
configure_package_config_file(misc/DtkWidgetConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/${DtkWidget}Config.cmake | ||
INSTALL_DESTINATION ${CONFIG_CMAKE_INSTALL_DIR} | ||
PATH_VARS TOOL_INSTALL_DIR) | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/${DtkWidget}ConfigVersion.cmake" | ||
VERSION ${DTK_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DtkWidget}Config.cmake DESTINATION ${CONFIG_CMAKE_INSTALL_DIR}) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DtkWidget}ConfigVersion.cmake DESTINATION ${CONFIG_CMAKE_INSTALL_DIR}) | ||
|
||
configure_file(misc/DtkWidget.pc.in ${LIBNAME}.pc @ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | ||
|
||
configure_file(misc/qt_lib_DtkWidget.pri.in qt_lib_DtkWidget.pri @ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qt_lib_DtkWidget.pri DESTINATION "${MKSPECS_INSTALL_DIR}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
set(PLUGIN_NAME PrintPreviewSettingsPlugin) | ||
|
||
find_package(Qt5 REQUIRED COMPONENTS Core) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) | ||
|
||
add_library(${PLUGIN_NAME} SHARED | ||
settingsplugin.h | ||
settingsplugin.cpp | ||
) | ||
|
||
target_link_libraries(${PLUGIN_NAME} PRIVATE | ||
${LIB_NAME} | ||
${LIBNAME} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.