Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

CMakeLists.txt 3.51 KB
Newer Older
Linus Jahn's avatar
Linus Jahn committed
1
cmake_minimum_required(VERSION 2.8.11)
2 3
set(CMAKE_CXX_STANDARD 14)
set(QT_MIN_VERSION "5.7.0")
4
set(BOOST_MIN_VERSION "1.34.1")
Linus Jahn's avatar
Linus Jahn committed
5 6 7

project(kaidan)

8 9
# CMake options
option(I18N "Enable i18n support" FALSE)
10
option(SAILFISH_OS "Build with Sailfish OS GUI, needs libs/kaidansf submodule" FALSE)
11

12 13 14 15
# application name
set(APPLICATION_ID "harbour.kaidan")
set(APPLICATION_NAME "kaidan")
set(APPLICATION_DISPLAY_NAME "Kaidan")
16
set(APPLICATION_DESCRIPTION "Cross platform XMPP client")
17

18

Linus Jahn's avatar
Linus Jahn committed
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
# Version
set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")

set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if(VERSION_EXTRA)
	set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
endif()


# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

# Instruct CMake to run moc, uic and rcc automatically when needed.
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

# Set output path for executables
set(EXECUTABLE_OUTPUT_PATH "bin")


43 44 45 46
#
# Dependecies
#

Linus Jahn's avatar
Linus Jahn committed
47 48 49 50
# CMake module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")

# Find packages
51
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Qml Quick Sql)
Linus Jahn's avatar
Linus Jahn committed
52 53
find_package(KF5Kirigami REQUIRED)
find_package(Swiften REQUIRED)
54
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED COMPONENTS signals)
55
include(GNUInstallDirs)
Linus Jahn's avatar
Linus Jahn committed
56

57

58
#
59
# Load submodules
60 61
#

62 63 64 65
# Main kaidan sources
include("${CMAKE_SOURCE_DIR}/src/CMakeLists.txt")

# I18n support
66 67 68
if(I18N)
	include("${CMAKE_SOURCE_DIR}/i18n/CMakeLists.txt")
endif()
69

70 71 72 73 74 75 76 77 78 79
# Sailfish OS GUI
if(SAILFISH_OS)
	if(EXISTS "${CMAKE_SOURCE_DIR}/libs/kaidansf/CMakeLists.txt")
		include("${CMAKE_SOURCE_DIR}/libs/kaidansf/CMakeLists.txt")
	else()
		message(FATAL_ERROR "Could NOT find KaidanSF adaptions for Sailfish OS.")
	endif()
endif()


80 81 82
#
# Sources / Resources
#
Linus Jahn's avatar
Linus Jahn committed
83

84 85 86 87 88
# normal kirigami GUI, if no Sailfish OS build
if(NOT SAILFISH_OS)
	set(KAIDAN_QML_QRC kaidan_qml.qrc)
endif()

Linus Jahn's avatar
Linus Jahn committed
89
add_executable(${PROJECT_NAME}
90 91 92 93
	${KAIDAN_SOURCES}
	${KAIDAN_QML_QRC}
	${I18N_QRC_CPP}     # only set if enabled
	${KAIDANSF_SOURCES} #
Linus Jahn's avatar
Linus Jahn committed
94 95
)

96

97 98 99 100
#
# Linker Flags
#

Linus Jahn's avatar
Linus Jahn committed
101 102
target_link_libraries(${PROJECT_NAME}
	Qt5::Core
103
	Qt5::Sql
Linus Jahn's avatar
Linus Jahn committed
104 105
	Qt5::Qml
	Qt5::Quick
106
	Boost::signals
Linus Jahn's avatar
Linus Jahn committed
107 108
	${SWIFTEN_LIBRARY}
)
109

110

111 112 113 114
#
# Global C++ variables
#

115 116 117 118 119 120 121
if(SAILFISH_OS)
	set(KAIDAN_COMPILE_DEFINITIONS
		SAILFISH_OS=True
		PLATFORM_DISPLAY_NAME="Sailfish OS"
	)
endif()

122 123 124 125
target_compile_definitions(${PROJECT_NAME} PRIVATE
	APPLICATION_ID="${APPLICATION_ID}"
	APPLICATION_NAME="${APPLICATION_NAME}"
	APPLICATION_DISPLAY_NAME="${APPLICATION_DISPLAY_NAME}"
126
	APPLICATION_DESCRIPTION="${APPLICATION_DESCRIPTION}"
127 128

	VERSION_STRING="${VERSION_STRING}"
129

130 131
	DEBUG_SOURCE_PATH="${CMAKE_SOURCE_DIR}"

132
	BOOST_SIGNALS_NO_DEPRECATION_WARNING=True
133 134

	${KAIDAN_COMPILE_DEFINITIONS}
135
)
136 137 138


#
139
# Install Kaidan
140 141
#

142 143 144 145 146 147
if(UNIX AND NOT APPLE)
	# install kaidan binary
	install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE_OUTPUT_PATH}/${PROJECT_NAME}
		DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
	)

148 149 150 151 152
	# install kaidan media
	# install(DIRECTORY "data/images"
	# 	DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}"
	# )

153 154 155 156 157 158 159 160
	# install icon (scalable + 128x)
	install(FILES "misc/kaidan.svg"
		DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/apps"
	)
	install(FILES "misc/kaidan-128x128.png"
		DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/128x128/apps"
		RENAME "kaidan.png"
	)
161 162 163 164 165

	# install desktop file
	install(FILES "misc/kaidan.desktop"
		DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/applications"
	)
166
endif()