CMakeLists.txt 3.95 KB
Newer Older
1
cmake_minimum_required (VERSION 3.13 FATAL_ERROR)
2
3
4

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
5

6
# KDE Application Version, managed by release script
7
set (RELEASE_SERVICE_VERSION_MAJOR "21")
8
set (RELEASE_SERVICE_VERSION_MINOR "07")
9
10
set (RELEASE_SERVICE_VERSION_MICRO "70")
set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
11

12
project(cantor VERSION ${RELEASE_SERVICE_VERSION})
Albert Astals Cid's avatar
Albert Astals Cid committed
13

Stefan Gerlach's avatar
Stefan Gerlach committed
14
set(KF5_MIN_VERSION "5.70.0")
15

16
find_package(ECM 5.15.0 REQUIRED CONFIG)
17
set(CMAKE_MODULE_PATH ${cantor_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )
18

19
20
21
set( SharedMimeInfo_MINIMUM_VERSION "1.3" ) #TODO: What is the minimum required version?
find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED)

22
find_package(Qt5 5.8.0 CONFIG REQUIRED
23
24
    Core
    Widgets
25
    PrintSupport
26
27
28
    Svg
    Xml
    XmlPatterns
29
    Test
30
31
32
    Help
    WebEngine
    WebEngineWidgets)
33

34
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED
35
    Config
36
    Crash
37
    Completion
38
    DocTools
39
    NewStuff
40
    IconThemes
41
42
43
44
    TextEditor
    CoreAddons
    Archive
    Parts
45
    SyntaxHighlighting
46
    TextWidgets
47
    KIO
48
    XmlGui
49
50
    I18n
)
51

52
find_package(Poppler "0.62.0" REQUIRED COMPONENTS Qt5)
53
54


55
56
57
58
if(NOT WIN32)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED Pty)
endif()

59
60
option(USE_LIBSPECTRE "Use libspectre library" ON)

61
62
63
64
include(FeatureSummary)
include(ECMInstallIcons)
include(ECMSetupVersion)
include(KDEInstallDirs)
65
include(KDECompilerSettings NO_POLICY_SCOPE)
66
67
include(KDECMakeSettings)
include(KDEFrameworkCompilerSettings)
Laurent Montel's avatar
Laurent Montel committed
68
include(ECMAddAppIcon)
69
include(GenerateExportHeader)
70

71
add_subdirectory(thirdparty)
72
73
# Need to set this here, because variable can't move from subdirectory (thirdparty) to upper cmake scope
set(Discount_FOUND TRUE)
74

75
if(NOT WIN32 AND USE_LIBSPECTRE)
76
    set_package_properties(LibSpectre PROPERTIES DESCRIPTION "A PostScript rendering library"
77
        URL "https://www.freedesktop.org/wiki/Software/libspectre/"
78
79
80
        TYPE OPTIONAL
        PURPOSE "Support for rendering EPS files in Cantor")

81
    find_package(LibSpectre)
82
    if(LIBSPECTRE_FOUND)
83
        set(WITH_EPS On)
84
    else(LIBSPECTRE_FOUND)
85
        set(WITH_EPS Off)
86
    endif(LIBSPECTRE_FOUND)
87

88
else()
89
    set(WITH_EPS Off)
90
endif()
91

92
#[[
93
find_package(Discount 2.2.0)
Yifei Wu's avatar
Yifei Wu committed
94
95
96
97
set_package_properties(Discount PROPERTIES DESCRIPTION "A C implementation of the Markdown markup language"
    URL "https://www.pell.portland.or.us/~orc/Code/discount/"
    TYPE OPTIONAL
    PURPOSE "Used for Markdown entries in Cantor")
98
]]#
Yifei Wu's avatar
Yifei Wu committed
99

100
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
101
102
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT")

Filipe Saraiva's avatar
Filipe Saraiva committed
103
kde_enable_exceptions()
104

105
106
107
108
# FIXME Looks like docbook on Windows don't buildable at all, so it are temporarily disabled
if(NOT WIN32)
    add_subdirectory(doc)
endif(NOT WIN32)
109
110
add_subdirectory(src)
add_subdirectory(icons)
111

112
113
114
115
116
117
118
119
set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Cantor")
configure_package_config_file(
    ${CMAKE_CURRENT_SOURCE_DIR}/CantorConfig.cmake.in
    ${CMAKE_CURRENT_BINARY_DIR}/CantorConfig.cmake
    INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR}/
    #PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR
)

120
ecm_setup_version(${RELEASE_SERVICE_VERSION}
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    VARIABLE_PREFIX CANTOR
    VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/cantor_version.h"
    PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/CantorConfigVersion.cmake"
)
install(
    FILES ${CMAKE_CURRENT_BINARY_DIR}/CantorConfig.cmake
          ${CMAKE_CURRENT_BINARY_DIR}/CantorConfigVersion.cmake
    DESTINATION ${CMAKECONFIG_INSTALL_DIR}
    COMPONENT Devel
)

install(EXPORT CantorTargets
    DESTINATION "${CMAKECONFIG_INSTALL_DIR}"
    FILE CantorTargets.cmake
    NAMESPACE Cantor::
)


Andreas Cord-Landwehr's avatar
Andreas Cord-Landwehr committed
139
ki18n_install(po)
140
141
142
if (KF5DocTools_FOUND)
    kdoctools_install(po)
endif()
143
install(FILES org.kde.cantor.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
144

145
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)