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

0001 # SPDX-FileCopyrightText: 2014 Vishesh Handa <vhanda@kde.org>
0002 # SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
0003 # SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
0004 # SPDX-License-Identifier: LGPL-2.1-or-later
0005 #
0006 # Common Library
0007 #
0008 set(LIB_SRCS
0009     imagestorage.cpp
0010     exiv2extractor.cpp
0011     filesystemimagefetcher.cpp
0012     ${LIB_SRCS}
0013 )
0014 
0015 add_library(kokocommon SHARED ${LIB_SRCS})
0016 target_link_libraries(kokocommon
0017     Qt::Core
0018     Qt::Positioning
0019     Qt::Sql
0020     Qt::Svg
0021     KF${QT_MAJOR_VERSION}::CoreAddons
0022     KF${QT_MAJOR_VERSION}::DBusAddons
0023     KF${QT_MAJOR_VERSION}::FileMetaData
0024     KF${QT_MAJOR_VERSION}::ConfigGui
0025     KF${QT_MAJOR_VERSION}::ConfigCore
0026     LibExiv2::LibExiv2
0027 )
0028 
0029 generate_export_header(kokocommon BASE_NAME KOKO EXPORT_FILE_NAME koko_export.h)
0030 set_target_properties(kokocommon PROPERTIES
0031     VERSION 0.0.1
0032     SOVERSION 0.0.1
0033 )
0034 
0035 install(TARGETS kokocommon EXPORT KokoLibraryTargets ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
0036 
0037 #
0038 # Application
0039 #
0040 
0041 set(koko_SRCS
0042     main.cpp
0043     openfilemodel.cpp
0044     reversegeocoder.cpp
0045     filesystemtracker.cpp
0046     processor.cpp
0047     committimer.cpp
0048     imageprocessorrunnable.cpp
0049     vectorimage.cpp
0050     controller.cpp
0051     kdtree.cpp
0052     resources.qrc
0053 )
0054 
0055 kconfig_add_kcfg_files(koko_SRCS kokoconfig.kcfgc GENERATE_MOC)
0056 
0057 add_executable(koko ${koko_SRCS})
0058 
0059 target_link_libraries(koko
0060     Qt::Quick
0061     Qt::Widgets
0062     Qt::Qml
0063     Qt::Positioning
0064     KF${QT_MAJOR_VERSION}::ConfigCore
0065     KF${QT_MAJOR_VERSION}::I18n
0066     KF${QT_MAJOR_VERSION}::CoreAddons
0067     KF${QT_MAJOR_VERSION}::KIOCore
0068     kokocommon
0069 )
0070 
0071 target_include_directories(koko PRIVATE ${CMAKE_BINARY_DIR})
0072 
0073 if(ANDROID)
0074     target_link_libraries(koko Qt::AndroidExtras)
0075 else()
0076     target_link_libraries(koko KF${QT_MAJOR_VERSION}::WindowSystem)
0077 endif()
0078 
0079 target_compile_definitions(koko PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
0080 
0081 install(TARGETS koko ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
0082 
0083 #
0084 # QML Plugin
0085 #
0086 set (qml_plugin_SRCS
0087     qmlplugins.cpp
0088     dirmodelutils.cpp
0089     openfilemodel.cpp
0090     imagelocationmodel.cpp
0091     imagefavoritesmodel.cpp
0092     imagetagsmodel.cpp
0093     imagetimemodel.cpp
0094     imagefoldermodel.cpp
0095     sortmodel.cpp
0096     imagelistmodel.cpp
0097     notificationmanager.cpp
0098     types.cpp
0099     roles.cpp
0100     fileinfo.cpp
0101     displaycolorspace.cpp
0102 )
0103 
0104 add_library (kokoqmlplugin SHARED ${qml_plugin_SRCS})
0105 
0106 target_link_libraries (kokoqmlplugin
0107     Qt::Qml
0108     KF${QT_MAJOR_VERSION}::KIOCore
0109     KF${QT_MAJOR_VERSION}::KIOFileWidgets
0110     KF${QT_MAJOR_VERSION}::KIOWidgets
0111     KF${QT_MAJOR_VERSION}::GuiAddons
0112     KF${QT_MAJOR_VERSION}::I18n
0113     KF${QT_MAJOR_VERSION}::Notifications
0114     kokocommon
0115 )
0116 
0117 install (TARGETS kokoqmlplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/koko)
0118 install (FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/koko)
0119 install (FILES org.kde.koko.desktop DESTINATION ${KDE_INSTALL_APPDIR})
0120 
0121 # FIXME this needs to be adapted for Qt6
0122 if (TARGET Qt::X11Extras AND TARGET XCB::XCB)
0123     target_compile_definitions(kokoqmlplugin PRIVATE HAVE_X11)
0124     target_link_libraries(kokoqmlplugin Qt::X11Extras XCB::XCB)
0125 endif()
0126 
0127 #
0128 # Reverse GeoLookup Data
0129 #
0130 # Packagers can download the file and put it in the tarball
0131 if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip)
0132     file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/cities1000.zip DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0133 endif()
0134 
0135 if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip)
0136     file (DOWNLOAD "http://download.geonames.org/export/dump/cities1000.zip"
0137                 ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip
0138         SHOW_PROGRESS
0139         STATUS status
0140     )
0141     list(GET status 0 status_code) 
0142     if(NOT status_code EQUAL 0)
0143         message(FATAL_ERROR "You need to download some files separately. See the packaging section of README.md.")
0144     endif()
0145 endif()
0146 
0147 execute_process(
0148     COMMAND ${CMAKE_COMMAND} -E tar -xzf ${CMAKE_CURRENT_BINARY_DIR}/cities1000.zip
0149     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
0150 )
0151 
0152 if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt)
0153     file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin1CodesASCII.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0154 endif()
0155 
0156 if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt)
0157     file (DOWNLOAD "http://download.geonames.org/export/dump/admin1CodesASCII.txt"
0158                 ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt
0159         SHOW_PROGRESS
0160         STATUS status
0161     )
0162     list(GET status 0 status_code) 
0163     if(NOT status_code EQUAL 0)
0164         message(FATAL_ERROR "You need to download some files separately. See the packaging section of README.md.")
0165     endif()
0166 endif()
0167 file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/admin1CodesASCII.txt ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt)
0168 
0169 if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt)
0170     file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/admin2Codes.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
0171 endif()
0172 
0173 if (NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt)
0174     file (DOWNLOAD "http://download.geonames.org/export/dump/admin2Codes.txt"
0175                 ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt
0176         SHOW_PROGRESS
0177         STATUS status
0178     )
0179     list(GET status 0 status_code) 
0180     if(NOT status_code EQUAL 0)
0181         message(FATAL_ERROR "You need to download some files separately. See the packaging section of README.md.")
0182     endif()
0183 endif()
0184 
0185 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/cities1000.txt DESTINATION ${KDE_INSTALL_DATADIR}/koko)
0186 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin1Codes.txt DESTINATION ${KDE_INSTALL_DATADIR}/koko)
0187 install (FILES ${CMAKE_CURRENT_BINARY_DIR}/admin2Codes.txt DESTINATION ${KDE_INSTALL_DATADIR}/koko)
0188 install (FILES countries.csv DESTINATION ${KDE_INSTALL_DATADIR}/koko)
0189 install (FILES koko.notifyrc DESTINATION ${KDE_INSTALL_KNOTIFYRCDIR})