Warning, /utilities/konsole/src/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 # cmake-options : -DCMAKE_DISABLE_FIND_PACKAGE_LibKonq=TRUE or FALSE; default is FALSE
0002 
0003 add_definitions(-DTRANSLATION_DOMAIN=\"konsole\")
0004 
0005 ### Handle DragonFlyBSD here instead of using __DragonFly__
0006 IF(${CMAKE_SYSTEM_NAME} MATCHES "DragonFly")
0007   set(HAVE_OS_DRAGONFLYBSD 1)
0008 else()
0009   set(HAVE_OS_DRAGONFLYBSD 0)
0010 endif()
0011 
0012 include(CheckIncludeFiles)
0013 include(ECMAddAppIcon)
0014 
0015 configure_file(config-konsole.h.cmake
0016               ${CMAKE_CURRENT_BINARY_DIR}/config-konsole.h)
0017 
0018 ### Tests
0019 if(BUILD_TESTING)
0020     if (NOT WIN32)
0021         find_package(Qt6Test ${QT_MIN_VERSION} CONFIG REQUIRED)
0022         add_subdirectory(autotests)
0023         add_subdirectory(tests)
0024     endif()
0025 endif()
0026 
0027 
0028 ### Security concerns about sendText and runCommand dbus methods being public
0029 option(REMOVE_SENDTEXT_RUNCOMMAND_DBUS_METHODS "Konsole: remove sendText and runCommand dbus methods" OFF)
0030 
0031 ### Security concerns about reading arbitrary screen positions
0032 option(ENABLE_DECRQCRA "Konsole: enable DEC request checksum rectangular area" OFF)
0033 
0034 ### Development tools
0035 option(KONSOLE_BUILD_UNI2CHARACTERWIDTH "Konsole: build uni2characterwidth executable" OFF)
0036 
0037 ### Konsole source files shared between embedded terminal and main application
0038 # qdbuscpp2xml -m  Session.h -o org.kde.konsole.Session.xml
0039 # qdbuscpp2xml -M -s ViewManager.h -o org.kde.konsole.Konsole.xml
0040 
0041 # Generate dbus .xml files; do not store .xml in source folder
0042 qt_generate_dbus_interface(ViewManager.h org.kde.konsole.Window.xml OPTIONS -m)
0043 
0044 qt_add_dbus_adaptor(windowadaptors_SRCS
0045                     ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Window.xml
0046                     ViewManager.h
0047                     Konsole::ViewManager)
0048 
0049 # qdbuscpp2xml -m  Session.h -o org.kde.konsole.Session.xml
0050 # Generate dbus .xml files; do not store .xml in source folder
0051 qt_generate_dbus_interface(session/Session.h org.kde.konsole.Session.xml OPTIONS -m)
0052 
0053 qt_add_dbus_adaptor(
0054     sessionadaptors_SRCS
0055     ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Session.xml
0056     session/Session.h
0057     Konsole::Session
0058 )
0059 
0060 set(konsole_LIBS
0061     KF6::XmlGui
0062     Qt::Multimedia
0063     Qt::PrintSupport
0064     Qt::Xml
0065     KF6::Notifications
0066     KF6::WindowSystem
0067     KF6::TextWidgets
0068     KF6::GuiAddons
0069     KF6::IconThemes
0070     KF6::Bookmarks
0071     KF6::I18n
0072     KF6::KIOWidgets
0073     KF6::DBusAddons
0074     KF6::NewStuffCore
0075 )
0076 
0077 if (NOT WIN32)
0078     list(APPEND konsole_LIBS
0079         KF6::Pty
0080         KF6::GlobalAccel
0081     )
0082 endif()
0083 
0084 if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
0085     #kinfo_getfile() is in libutil
0086     list(APPEND konsole_LIBS util)
0087 endif()
0088 
0089 # TODO: Move this to an internal folder if it grows too much.
0090 # This konsoleprivate_core is the "core" library that depends in nothing from konsole itself
0091 # so we can start to detangle the codebase.
0092 set(konsoleprivate_core_SRCS
0093     ShellCommand.cpp
0094 )
0095 
0096 ecm_qt_declare_logging_category(
0097     konsoleprivate_core_SRCS
0098     HEADER konsoledebug.h
0099     IDENTIFIER KonsoleDebug
0100     CATEGORY_NAME org.kde.konsole
0101     DESCRIPTION "Konsole"
0102     EXPORT KONSOLE
0103 )
0104 
0105 add_library(konsoleprivate_core STATIC ${konsoleprivate_core_SRCS})
0106 # Needed to link this static lib to shared libs
0107 set_target_properties(konsoleprivate_core PROPERTIES POSITION_INDEPENDENT_CODE ON)
0108 target_link_libraries(konsoleprivate_core KF6::CoreAddons)
0109 
0110 set(konsolehelpers_SRCS
0111     LabelsAligner.cpp
0112 )
0113 add_library(konsolehelpers
0114     STATIC
0115     ${konsolehelpers_SRCS}
0116 )
0117 set_target_properties(konsolehelpers PROPERTIES POSITION_INDEPENDENT_CODE ON)
0118 target_link_libraries(konsolehelpers
0119     Qt::Core
0120     Qt::Widgets
0121 )
0122 
0123 add_subdirectory(colorscheme)
0124 add_subdirectory(keyboardtranslator)
0125 add_subdirectory(characters)
0126 add_subdirectory(decoders)
0127 add_subdirectory(plugins)
0128 if (WIN32)
0129     set(ptyqt_srcs ptyqt/iptyprocess.cpp ptyqt/conptyprocess.cpp)
0130 endif()
0131 
0132 set(konsoleprivate_SRCS ${windowadaptors_SRCS}
0133                         BookmarkHandler.cpp
0134                         BookmarkMenu.cpp
0135                         CheckableSessionModel.cpp
0136                         CopyInputDialog.cpp
0137                         Emulation.cpp
0138                         EscapeSequenceUrlExtractor.cpp
0139                         FontDialog.cpp
0140                         HistorySizeDialog.cpp
0141                         KeyBindingEditor.cpp
0142                         LabelsAligner.cpp
0143                         NullProcessInfo.cpp
0144                         PrintOptions.cpp
0145                         ProcessInfo.cpp
0146                         Pty.cpp
0147                         RenameTabDialog.cpp
0148                         SSHProcessInfo.cpp
0149                         SaveHistoryTask.cpp
0150                         Screen.cpp
0151                         ScreenWindow.cpp
0152                         ScrollState.cpp
0153                         SearchHistoryTask.cpp
0154                         ShouldApplyProperty.cpp
0155                         UnixProcessInfo.cpp
0156                         ViewManager.cpp
0157                         ViewProperties.cpp
0158                         Vt102Emulation.cpp
0159                         WindowSystemInfo.cpp
0160                         ZModemDialog.cpp
0161                         filterHotSpots/EscapeSequenceUrlFilter.cpp
0162                         filterHotSpots/EscapeSequenceUrlFilterHotSpot.cpp
0163                         filterHotSpots/FileFilter.cpp
0164                         filterHotSpots/FileFilterHotspot.cpp
0165                         filterHotSpots/Filter.cpp
0166                         filterHotSpots/FilterChain.cpp
0167                         filterHotSpots/HotSpot.cpp
0168                         filterHotSpots/RegExpFilter.cpp
0169                         filterHotSpots/RegExpFilterHotspot.cpp
0170                         filterHotSpots/TerminalImageFilterChain.cpp
0171                         filterHotSpots/UrlFilter.cpp
0172                         filterHotSpots/UrlFilterHotspot.cpp
0173                         filterHotSpots/ColorFilter.cpp
0174                         filterHotSpots/ColorFilterHotSpot.cpp
0175                         history/HistoryFile.cpp
0176                         history/HistoryScroll.cpp
0177                         history/HistoryScrollFile.cpp
0178                         history/HistoryScrollNone.cpp
0179                         history/HistoryType.cpp
0180                         history/HistoryTypeFile.cpp
0181                         history/HistoryTypeNone.cpp
0182                         history/compact/CompactHistoryScroll.cpp
0183                         history/compact/CompactHistoryType.cpp
0184                         widgets/DetachableTabBar.cpp
0185                         widgets/EditProfileDialog.cpp
0186                         widgets/HistorySizeWidget.cpp
0187                         widgets/IncrementalSearchBar.cpp
0188                         widgets/RenameTabWidget.cpp
0189                         widgets/TabTitleFormatButton.cpp
0190 
0191                         terminalDisplay/extras/CompositeWidgetFocusWatcher.cpp
0192                         terminalDisplay/extras/AutoScrollHandler.cpp
0193                         terminalDisplay/extras/HighlightScrolledLines.cpp
0194 
0195                         terminalDisplay/TerminalDisplay.cpp
0196                         terminalDisplay/TerminalPainter.cpp
0197                         terminalDisplay/TerminalScrollBar.cpp
0198                         terminalDisplay/TerminalColor.cpp
0199                         terminalDisplay/TerminalFonts.cpp
0200                         terminalDisplay/TerminalBell.cpp
0201 
0202                         profile/Profile.cpp
0203                         profile/ProfileCommandParser.cpp
0204                         profile/ProfileGroup.cpp
0205                         profile/ProfileList.cpp
0206                         profile/ProfileReader.cpp
0207                         profile/ProfileWriter.cpp
0208                         profile/ProfileManager.cpp
0209                         profile/ProfileModel.cpp
0210 
0211                         ${ptyqt_srcs} # windows conpty backend
0212 
0213                         ${sessionadaptors_SRCS}
0214                         session/Session.cpp
0215                         session/SessionController.cpp
0216                         session/SessionDisplayConnection.cpp
0217                         session/SessionGroup.cpp
0218                         session/SessionListModel.cpp
0219                         session/SessionManager.cpp
0220                         session/SessionTask.cpp
0221                         ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Session.xml
0222 
0223                         widgets/TerminalDisplayAccessible.cpp
0224                         widgets/TerminalHeaderBar.cpp
0225                         widgets/ViewContainer.cpp
0226                         widgets/ViewSplitter.cpp
0227                         widgets/KonsolePrintManager.cpp
0228                         ${CMAKE_CURRENT_BINARY_DIR}/org.kde.konsole.Window.xml)
0229 
0230 kconfig_add_kcfg_files(konsoleprivate_SRCS settings/KonsoleSettings.kcfgc)
0231 
0232 ### Konsole Application
0233 
0234 ki18n_wrap_ui(konsoleprivate_SRCS
0235     CopyInputDialog.ui
0236     HistorySizeDialog.ui
0237     KeyBindingEditor.ui
0238     PrintOptions.ui       # Temporary to build session static library
0239     RenameTabDialog.ui
0240     settings/GeneralSettings.ui
0241     settings/MemorySettings.ui
0242     settings/PartInfo.ui
0243     settings/ProfileSettings.ui
0244     settings/TabBarSettings.ui
0245     settings/TemporaryFilesSettings.ui
0246     settings/ThumbnailsSettings.ui
0247     widgets/EditProfileAdvancedPage.ui
0248     widgets/EditProfileAppearancePage.ui
0249     widgets/EditProfileGeneralPage.ui
0250     widgets/EditProfileKeyboardPage.ui
0251     widgets/EditProfileMousePage.ui
0252     widgets/EditProfileScrollingPage.ui
0253     widgets/EditProfileTabsPage.ui
0254     widgets/HistorySizeWidget.ui
0255     widgets/RenameTabWidget.ui
0256 )
0257 
0258 # add the resource files for the ui files
0259 qt_add_resources( konsoleprivate_SRCS ../desktop/konsole.qrc)
0260 
0261 add_library(konsoleprivate ${konsoleprivate_SRCS})
0262 generate_export_header(konsoleprivate BASE_NAME konsoleprivate)
0263 
0264 find_package(ZLIB)
0265 
0266 target_link_libraries(konsoleprivate
0267     PUBLIC
0268     konsoleprivate_core
0269     konsolecolorscheme
0270     keyboardtranslator
0271     konsolehelpers
0272     konsolecharacters
0273     konsoledecoders
0274     KF6::NewStuffCore
0275     KF6::NewStuffWidgets
0276     ${konsole_LIBS}
0277     ZLIB::ZLIB
0278     ICU::uc
0279     ICU::i18n
0280 )
0281 
0282 target_link_libraries(konsoleprivate
0283     PUBLIC
0284     Qt6::Core5Compat
0285     PRIVATE
0286     KF6::IconWidgets
0287     KF6::BookmarksWidgets
0288 )
0289 
0290 set_target_properties(konsoleprivate PROPERTIES
0291     VERSION ${RELEASE_SERVICE_VERSION}
0292 )
0293 
0294 install(TARGETS konsoleprivate ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
0295 
0296 add_library(konsoleapp SHARED Application.cpp
0297    MainWindow.cpp
0298    settings/ConfigurationDialog.cpp
0299    settings/ConfigDialogButtonGroupManager.cpp
0300    settings/TemporaryFilesSettings.cpp
0301    settings/GeneralSettings.cpp
0302    settings/MemorySettings.cpp
0303    settings/ProfileSettings.cpp
0304    settings/TabBarSettings.cpp
0305    settings/ThumbnailsSettings.cpp
0306    pluginsystem/IKonsolePlugin.cpp
0307    pluginsystem/PluginManager.cpp
0308    delegates/ProfileShortcutDelegate.cpp
0309 )
0310 
0311 generate_export_header(konsoleapp BASE_NAME konsoleapp)
0312 
0313 target_compile_definitions(konsoleapp PRIVATE -DRELEASE_SERVICE_VERSION="${RELEASE_SERVICE_VERSION}")
0314 
0315 target_link_libraries(konsoleapp
0316   konsoleprivate
0317   KF6::XmlGui
0318   KF6::WindowSystem
0319   KF6::Bookmarks
0320   KF6::I18n
0321   KF6::KIOWidgets
0322   KF6::NotifyConfig
0323   KF6::Crash
0324 )
0325 
0326 set_target_properties(konsoleapp PROPERTIES
0327     VERSION ${RELEASE_SERVICE_VERSION}
0328 )
0329 
0330 install(TARGETS konsoleapp ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)
0331 
0332 set(konsole_SRCS
0333    main.cpp
0334 )
0335 
0336 # Sets the icon on Windows and OSX
0337 ecm_add_app_icon(ICONS_SOURCES ICONS ${ICONS_SRCS})
0338 
0339 add_executable(konsole ${konsole_SRCS} ${ICONS_SOURCES})
0340 target_link_libraries(konsole
0341   konsoleprivate
0342   konsoleapp
0343   KF6::XmlGui
0344   KF6::WindowSystem
0345   KF6::Bookmarks
0346   KF6::I18n
0347   KF6::KIOWidgets
0348   KF6::NotifyConfig
0349   KF6::Crash
0350 )
0351 
0352 if(APPLE)
0353     set_target_properties(konsole PROPERTIES
0354         MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.konsole"
0355         MACOSX_BUNDLE_BUNDLE_NAME "Konsole"
0356         MACOSX_BUNDLE_DISPLAY_NAME "Konsole"
0357         MACOSX_BUNDLE_INFO_STRING "Konsole, the KDE terminal emulator"
0358         MACOSX_BUNDLE_LONG_VERSION_STRING "Konsole ${RELEASE_SERVICE_VERSION}"
0359         MACOSX_BUNDLE_SHORT_VERSION_STRING "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}"
0360         MACOSX_BUNDLE_BUNDLE_VERSION "${RELEASE_SERVICE_VERSION}"
0361         MACOSX_BUNDLE_COPYRIGHT "1997-2022 The Konsole Developers")
0362 endif()
0363 
0364 install(TARGETS konsole ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
0365 
0366 ### Embedded Konsole KPart
0367 
0368 set(konsolepart_PART_SRCS Part.cpp
0369     settings/PartInfo.cpp
0370     settings/ProfileSettings.cpp
0371     delegates/ProfileShortcutDelegate.cpp
0372 )
0373 
0374 add_library(konsolepart MODULE ${konsolepart_PART_SRCS})
0375 generate_export_header(konsolepart BASE_NAME konsole)
0376 set_target_properties(konsolepart PROPERTIES DEFINE_SYMBOL KONSOLE_PART)
0377 target_link_libraries(konsolepart
0378     KF6::Parts
0379     KF6::XmlGui
0380     konsoleprivate
0381 )
0382 
0383 install(TARGETS konsolepart DESTINATION ${KDE_INSTALL_PLUGINDIR}/kf6/parts)
0384 
0385 # Add cmake-options -DBUILD_COVERAGE=ON -DCOVERAGE_GENERATE_HTML=ON
0386 if(COVERAGE_GENERATE_HTML)
0387   # find required tools - no error checking
0388   find_program(LCOV lcov REQUIRED)
0389   find_program(GENHTML genhtml REQUIRED)
0390 
0391   add_custom_target(coverage
0392     # runs tests to get .gcda files
0393     COMMAND ctest --progress
0394     # generate data
0395     COMMAND ${LCOV} --directory . --capture --output-file coverage.info
0396     # generate report
0397     COMMAND ${GENHTML} --ignore-errors source --demangle-cpp -o coverage coverage.info
0398     WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
0399 endif()
0400