forked from linuxdeepin/dtkgui
-
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.
chore: Adapt Qt6 && Dtk6 compilation
Since xdgiconloader is not adapted to Qt6, libxdg is disabled by default when compiling Dtk6 Do not install dconfig file in dtkgui to avoid conficts with dtk6gui C++ 17 by default DVERSION ==> DTK_VERSION cmake_minimum_required 3.13 tools install to CMAKE_INSTALL_LIBEXECDIR
- Loading branch information
Showing
26 changed files
with
270 additions
and
1,167 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,135 +1,20 @@ | ||
cmake_minimum_required(VERSION 3.5) | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
set(DVERSION "5.6.8" CACHE STRING "define project version") | ||
set(DTK_VERSION "5.6.11" CACHE STRING "define project version") | ||
project(DtkGui | ||
VERSION ${DVERSION} | ||
VERSION ${DTK_VERSION} | ||
DESCRIPTION "DTK Gui module" | ||
HOMEPAGE_URL "https://github.com/linuxdeepin/dtkgui" | ||
LANGUAGES CXX C | ||
) | ||
set(LIB_NAME dtkgui) | ||
|
||
# Set install path | ||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) | ||
set(CMAKE_INSTALL_PREFIX /usr) | ||
endif () | ||
|
||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_AUTOMOC ON) | ||
set(CMAKE_AUTORCC ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
|
||
# Set build option | ||
option(DTK_DISABLE_LIBXDG "Disable libxdg" OFF) | ||
option(DTK_DISABLE_LIBRSVG "Disable librsvg" OFF) | ||
option(DTK_DISABLE_EX_IMAGE_FORMAT "Disable libraw and freeimage" OFF) | ||
set(BUILD_DOCS ON CACHE BOOL "Generate doxygen-based documentation") | ||
|
||
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/dtk${PROJECT_VERSION_MAJOR}/DGui") | ||
set(TOOL_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/dtk${PROJECT_VERSION_MAJOR}/DGui/bin") | ||
set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") | ||
set(MKSPECS_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/qt5/mkspecs/modules" CACHE STRING "Install dir for qt pri module files") | ||
set(CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/DtkGui") | ||
set(PKGCONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig") | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra -fopenmp") | ||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") | ||
if (CMAKE_BUILD_TYPE STREQUAL "Debug") | ||
set(BUILD_TESTING ON) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -fno-omit-frame-pointer") | ||
else () | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast") | ||
endif () | ||
|
||
set(CONFIGNAME include/global/dtkgui_config.h) | ||
file(WRITE ${CONFIGNAME} | ||
"// This is an auto-generated header, please don't modify it.\n" | ||
) | ||
file(GLOB CONFIGSOURCE include/DtkGui/*) | ||
|
||
foreach(FILENAME ${CONFIGSOURCE}) | ||
get_filename_component(thefile ${FILENAME} NAME) | ||
file(APPEND ${CONFIGNAME} "#define DTKGUI_CLASS_${thefile}\n") | ||
endforeach() | ||
|
||
# Generate cmake config file | ||
configure_package_config_file(misc/DtkGuiConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/DtkGuiConfig.cmake | ||
INSTALL_DESTINATION "${CONFIG_INSTALL_DIR}" | ||
PATH_VARS TOOL_INSTALL_DIR | ||
) | ||
# Generate cmake version file | ||
write_basic_package_version_file( | ||
"${CMAKE_CURRENT_BINARY_DIR}/DtkGuiConfigVersion.cmake" | ||
VERSION ${DVERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
# Install cmake config file and version file to CONFIG_INSTALL_DIR | ||
install(FILES | ||
${CMAKE_CURRENT_BINARY_DIR}/DtkGuiConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/DtkGuiConfigVersion.cmake | ||
DESTINATION "${CONFIG_INSTALL_DIR}" | ||
) | ||
# Install pkgconfig file | ||
configure_file(misc/dtkgui.pc.in dtkgui.pc @ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dtkgui.pc DESTINATION "${PKGCONFIG_INSTALL_DIR}") | ||
# Install pri module | ||
configure_file(misc/qt_lib_dtkgui.pri.in qt_lib_dtkgui.pri @ONLY) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qt_lib_dtkgui.pri DESTINATION "${MKSPECS_INSTALL_DIR}") | ||
|
||
set(GUISGNAME DtkGuis) | ||
|
||
file(WRITE ${GUISGNAME} | ||
"// This is an auto-generated header, please don't modify it.\n" | ||
"#ifndef DTK_GUI_MODULE_H\n" | ||
"#define DTK_GUI_MODULE_H\n" | ||
) | ||
file(GLOB FILEGRAGTOWRITSOURCE include/filedrag/*) | ||
|
||
foreach(FILENAME ${FILEGRAGTOWRITSOURCE}) | ||
get_filename_component(thefile ${FILENAME} NAME) | ||
file(APPEND ${GUISGNAME} "#include \"${thefile}\"\n") | ||
endforeach() | ||
file(GLOB KERNELTOWRITESOURCE include/kernel/*) | ||
foreach(FILENAME ${KERNELTOWRITESOURCE}) | ||
get_filename_component(thefile ${FILENAME} NAME) | ||
file(APPEND ${GUISGNAME} "#include \"${thefile}\"\n") | ||
endforeach() | ||
file(GLOB UTILTOWRITESOURCE include/util/*) | ||
foreach(FILENAME ${UTILTOWRITESOURCE}) | ||
get_filename_component(thefile ${FILENAME} NAME) | ||
file(APPEND ${GUISGNAME} "#include \"${thefile}\"\n") | ||
endforeach() | ||
file(APPEND ${GUISGNAME} "#endif") | ||
install(FILES DtkGuis DESTINATION "${INCLUDE_INSTALL_DIR}") | ||
|
||
# Find common dependencies | ||
find_package(Qt5 REQUIRED COMPONENTS Gui DBus Network) | ||
find_package(PkgConfig REQUIRED) | ||
find_package(Dtk REQUIRED COMPONENTS Core) | ||
pkg_check_modules(librsvg REQUIRED IMPORTED_TARGET librsvg-2.0) | ||
|
||
# Check optional image handler dependencies. | ||
find_package(FreeImage) | ||
pkg_check_modules(libraw IMPORTED_TARGET libraw) | ||
if(FreeImage_FOUND AND libraw_FOUND) | ||
set(EX_IMAGE_FORMAT_LIBS_FOUND ON) | ||
if("${PROJECT_VERSION_MAJOR}" STREQUAL "5") | ||
set(QT_VERSION_MAJOR "5") | ||
elseif("${PROJECT_VERSION_MAJOR}" STREQUAL "6") | ||
set(QT_VERSION_MAJOR "6") | ||
set(DTK_VERSION_MAJOR "6") | ||
else() | ||
message(SEND_ERROR "not support Prject Version ${PROJECT_VERSION}.") | ||
endif() | ||
|
||
add_subdirectory(src) | ||
if(BUILD_TESTING) | ||
enable_testing() | ||
add_subdirectory(tests) | ||
endif() | ||
add_subdirectory(tools) | ||
add_subdirectory(examples) | ||
|
||
if (BUILD_DOCS) | ||
add_subdirectory(docs) | ||
endif () | ||
|
||
include(dtkgui.cmake) |
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 +1 @@ | ||
usr/lib/*/*/DGui/bin/* | ||
usr/*/*/DGui/bin/* |
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,2 @@ | ||
usr/lib/*/lib*.so.* | ||
usr/share/dsg/*/* | ||
#usr/share/dsg/*/* |
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.