cmake_minimum_required ( VERSION 3.13 )
option ( APPVEYOR_BUILD "Build on appveyor" OFF )
option ( CI_BUILD "Set when building in CI. Enables -Werror where possible" OFF )
option ( ASAN "Compile with address sanitizers" OFF )
option ( QML_DEBUGGING "Enable qml debugging" OFF )
option ( COMPILE_QML "Compile Qml. It will make Nheko faster, but you will need to recompile it, when you update Qt." OFF )
set (
C M A K E _ T O O L C H A I N _ F I L E " $ { C M A K E _ C U R R E N T _ L I S T _ D I R } / t o o l c h a i n . c m a k e "
C A C H E
F I L E P A T H " D e f a u l t t o o l c h a i n "
)
set ( CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard" )
set ( CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard to be supported" )
set ( CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "compile as PIC by default" )
option ( HUNTER_ENABLED "Enable Hunter package manager" OFF )
include ( "cmake/HunterGate.cmake" )
HunterGate (
U R L " h t t p s : / / g i t h u b . c o m / c p p - p m / h u n t e r / a r c h i v e / v 0 . 2 3 . 2 8 8 . t a r . g z "
S H A 1 " 6 c 9 b 2 b c 6 0 6 d 8 6 a e 3 1 f 9 6 a 6 2 f c 6 8 f 0 a 5 9 3 0 2 4 8 1 5 b "
)
option ( USE_BUNDLED_BOOST "Use the bundled version of Boost." ${ HUNTER_ENABLED } )
option ( USE_BUNDLED_SPDLOG "Use the bundled version of spdlog."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_OLM "Use the bundled version of libolm." ${ HUNTER_ENABLED } )
option ( USE_BUNDLED_GTEST "Use the bundled version of Google Test."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_CMARK "Use the bundled version of cmark."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_JSON "Use the bundled version of nlohmann json."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_OPENSSL "Use the bundled version of OpenSSL."
O F F )
option ( USE_BUNDLED_MTXCLIENT "Use the bundled version of the Matrix Client library." ${ HUNTER_ENABLED } )
option ( USE_BUNDLED_LMDB "Use the bundled version of lmdb."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++."
$ { H U N T E R _ E N A B L E D } )
option ( USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt5Keychain."
$ { H U N T E R _ E N A B L E D } )
list ( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" )
if ( ${ CMAKE_VERSION } VERSION_LESS "3.14.0" )
message ( "Adding FetchContent_MakeAvailable" )
# from cmakes sources
macro ( FetchContent_MakeAvailable )
foreach ( contentName IN ITEMS ${ ARGV } )
string ( TOLOWER ${ contentName } contentNameLower )
FetchContent_GetProperties ( ${ contentName } )
if ( NOT ${ contentNameLower } _POPULATED )
FetchContent_Populate ( ${ contentName } )
# Only try to call add_subdirectory() if the populated content
# can be treated that way. Protecting the call with the check
# allows this function to be used for projects that just want
# to ensure the content exists, such as to provide content at
# a known location.
if ( EXISTS ${ ${contentNameLower } _SOURCE_DIR}/CMakeLists.txt )
add_subdirectory ( ${ ${contentNameLower } _SOURCE_DIR}
$ { $ { c o n t e n t N a m e L o w e r } _ B I N A R Y _ D I R } )
endif ( )
endif ( )
endforeach ( )
endmacro ( )
endif ( )
# Include Qt basic functions
include ( QtCommon )
project ( nheko LANGUAGES CXX C )
include ( GNUInstallDirs )
set ( CPACK_PACKAGE_VERSION_MAJOR "0" )
set ( CPACK_PACKAGE_VERSION_MINOR "8" )
set ( CPACK_PACKAGE_VERSION_PATCH "2" )
set ( PROJECT_VERSION_MAJOR ${ CPACK_PACKAGE_VERSION_MAJOR } )
set ( PROJECT_VERSION_MINOR ${ CPACK_PACKAGE_VERSION_MINOR } )
set ( PROJECT_VERSION_PATCH ${ CPACK_PACKAGE_VERSION_PATCH } )
# Set PROJECT_VERSION_PATCH & PROJECT_VERSION_TWEAK to 0 if not present
# Needed by add_project_meta.
fix_project_version ( )
# Set additional project information
set ( COMPANY "Nheko" )
set ( COPYRIGHT "Copyright (c) 2020 Nheko Contributors" )
set ( IDENTIFIER "io.github.nheko-reborn.nheko" )
add_project_meta ( META_FILES_TO_INCLUDE )
if ( NOT MSVC AND NOT APPLE )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads REQUIRED )
endif ( )
if ( BUILD_DOCS )
find_package ( Doxygen )
if ( DOXYGEN_FOUND )
set ( DOXYGEN_IN ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/Doxyfile.in )
set ( DOXYGEN_OUT ${ CMAKE_CURRENT_BINARY_DIR } /Doxyfile )
configure_file ( ${ DOXYGEN_IN } ${ DOXYGEN_OUT } )
add_custom_target ( docs ALL
C O M M A N D $ { D O X Y G E N _ E X E C U T A B L E } $ { D O X Y G E N _ O U T }
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R }
C O M M E N T " G e n e r a t i n g A P I d o c u m e n t a t i o n w i t h D o x y g e n "
V E R B A T I M )
else ( DOXYGEN_FOUND )
message ( "Doxygen need to be installed to generate the doxygen documentation" )
endif ( DOXYGEN_FOUND )
endif ( )
#
# LMDB
#
#include(LMDB)
if ( USE_BUNDLED_LMDB )
hunter_add_package ( lmdb )
find_package ( liblmdb CONFIG REQUIRED )
target_include_directories ( liblmdb::lmdb INTERFACE
" $ { H U N T E R _ I N S T A L L _ P R E F I X } / i n c l u d e / l m d b " )
else ( )
find_package ( LMDB REQUIRED )
endif ( )
#
# Discover Qt dependencies.
#
find_package ( Qt5 COMPONENTS Core Widgets LinguistTools Concurrent Svg Multimedia Qml QuickControls2 QuickWidgets REQUIRED )
find_package ( Qt5QuickCompiler )
find_package ( Qt5DBus )
if ( USE_BUNDLED_QTKEYCHAIN )
include ( FetchContent )
FetchContent_Declare (
q t 5 k e y c h a i n
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / f r a n k o s t e r f e l d / q t k e y c h a i n . g i t
G I T _ T A G v 0 . 1 2 . 0
)
if ( BUILD_SHARED_LIBS )
set ( QTKEYCHAIN_STATIC OFF CACHE INTERNAL "" )
else ( )
set ( QTKEYCHAIN_STATIC ON CACHE INTERNAL "" )
endif ( )
set ( BUILD_TEST_APPLICATION OFF CACHE INTERNAL "" )
FetchContent_MakeAvailable ( qt5keychain )
else ( )
find_package ( Qt5Keychain REQUIRED )
endif ( )
if ( APPLE )
find_package ( Qt5MacExtras REQUIRED )
endif ( APPLE )
if ( Qt5Widgets_FOUND )
if ( Qt5Widgets_VERSION VERSION_LESS 5.10.0 )
message ( STATUS "Qt version ${Qt5Widgets_VERSION}" )
message ( WARNING "Minimum supported Qt5 version is 5.10!" )
endif ( )
endif ( Qt5Widgets_FOUND )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
if ( NOT MSVC )
set (
C M A K E _ C X X _ F L A G S
" $ { C M A K E _ C X X _ F L A G S } \
- W a l l \
- W e x t r a \
- p i p e \
- p e d a n t i c \
- f s i z e d - d e a l l o c a t i o n \
- f d i a g n o s t i c s - c o l o r = a l w a y s \
- W u n r e a c h a b l e - c o d e \
- W n o - a t t r i b u t e s "
)
if ( NOT CMAKE_COMPILER_IS_GNUCXX )
# -Wshadow is buggy and broken in GCC, so do not enable it.
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow" )
endif ( )
endif ( )
if ( MSVC )
set (
C M A K E _ C X X _ F L A G S
" $ { C M A K E _ C X X _ F L A G S } / b i g o b j "
)
endif ( )
if ( NOT ( CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES ) )
set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING
" C h o o s e t h e t y p e o f b u i l d , o p t i o n s a r e : N o n e D e b u g R e l e a s e R e l W i t h D e b I n f o M i n S i z e R e l . "
F O R C E )
message ( "Setting build type to '${CMAKE_BUILD_TYPE}'" )
else ( NOT ( CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES ) )
message ( "Build type set to '${CMAKE_BUILD_TYPE}'" )
endif ( NOT ( CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES ) )
set ( SPDLOG_DEBUG_ON false )
# Windows doesn't handle CMAKE_BUILD_TYPE.
if ( NOT WIN32 )
if ( CMAKE_BUILD_TYPE STREQUAL "Debug" )
set ( SPDLOG_DEBUG_ON true )
else ( )
set ( SPDLOG_DEBUG_ON false )
endif ( )
endif ( )
find_program ( GIT git )
if ( GIT )
execute_process (
W O R K I N G _ D I R E C T O R Y $ { C M A K E _ S O U R C E _ D I R }
C O M M A N D $ { G I T } r e v - p a r s e - - s h o r t H E A D
O U T P U T _ V A R I A B L E G I T _ O U T O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E
)
if ( GIT_OUT )
set ( CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${GIT_OUT}" )
else ( )
set ( CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}" )
endif ( )
endif ( GIT )
set ( CPACK_PACKAGE_VERSION ${ CPACK_PACKAGE_VERSION_MAJOR } . ${ CPACK_PACKAGE_VERSION_MINOR } . ${ CPACK_PACKAGE_VERSION_PATCH } )
set ( PROJECT_VERSION ${ CPACK_PACKAGE_VERSION } )
message ( STATUS "Version: ${PROJECT_VERSION}" )
cmake_host_system_information ( RESULT BUILD_HOST QUERY HOSTNAME )
set ( BUILD_USER $ENV{ USER } )
configure_file ( cmake/nheko.h config/nheko.h )
#
# Declare source and header files.
#
set ( SRC_FILES
# Dialogs
s r c / d i a l o g s / C r e a t e R o o m . c p p
s r c / d i a l o g s / F a l l b a c k A u t h . c p p
s r c / d i a l o g s / I m a g e O v e r l a y . c p p
s r c / d i a l o g s / I n v i t e U s e r s . c p p
s r c / d i a l o g s / J o i n R o o m . c p p
s r c / d i a l o g s / L e a v e R o o m . c p p
s r c / d i a l o g s / L o g o u t . c p p
s r c / d i a l o g s / M e m b e r L i s t . c p p
s r c / d i a l o g s / P r e v i e w U p l o a d O v e r l a y . c p p
s r c / d i a l o g s / R e C a p t c h a . c p p
s r c / d i a l o g s / R e a d R e c e i p t s . c p p
# Emoji
s r c / e m o j i / E m o j i M o d e l . c p p
s r c / e m o j i / P r o v i d e r . c p p
# Timeline
s r c / t i m e l i n e / E v e n t S t o r e . c p p
s r c / t i m e l i n e / I n p u t B a r . c p p
s r c / t i m e l i n e / R e a c t i o n . c p p
s r c / t i m e l i n e / T i m e l i n e V i e w M a n a g e r . c p p
s r c / t i m e l i n e / T i m e l i n e M o d e l . c p p
s r c / t i m e l i n e / D e l e g a t e C h o o s e r . c p p
# UI components
s r c / u i / A v a t a r . c p p
s r c / u i / B a d g e . c p p
s r c / u i / D r o p S h a d o w . c p p
s r c / u i / F l a t B u t t o n . c p p
s r c / u i / F l o a t i n g B u t t o n . c p p
s r c / u i / I n f o M e s s a g e . c p p
s r c / u i / L a b e l . c p p
s r c / u i / L o a d i n g I n d i c a t o r . c p p
s r c / u i / N h e k o C u r s o r S h a p e . c p p
s r c / u i / N h e k o D r o p A r e a . c p p
s r c / u i / O v e r l a y M o d a l . c p p
s r c / u i / O v e r l a y W i d g e t . c p p
s r c / u i / R a i s e d B u t t o n . c p p
s r c / u i / R i p p l e . c p p
s r c / u i / R i p p l e O v e r l a y . c p p
s r c / u i / S n a c k B a r . c p p
s r c / u i / T e x t F i e l d . c p p
s r c / u i / T e x t L a b e l . c p p
s r c / u i / T h e m e . c p p
s r c / u i / T h e m e M a n a g e r . c p p
s r c / u i / T o g g l e B u t t o n . c p p
s r c / u i / U s e r P r o f i l e . c p p
s r c / u i / R o o m S e t t i n g s . c p p
# Generic notification stuff
s r c / n o t i f i c a t i o n s / M a n a g e r . c p p
s r c / A v a t a r P r o v i d e r . c p p
s r c / B l u r h a s h P r o v i d e r . c p p
s r c / C a c h e . c p p
s r c / C a l l D e v i c e s . c p p
s r c / C a l l M a n a g e r . c p p
s r c / C h a t P a g e . c p p
s r c / C l i p b o a r d . c p p
s r c / C o l o r I m a g e P r o v i d e r . c p p
s r c / C o m m u n i t i e s L i s t . c p p
s r c / C o m m u n i t i e s L i s t I t e m . c p p
s r c / C o m p l e t i o n P r o x y M o d e l . c p p
s r c / D e v i c e V e r i f i c a t i o n F l o w . c p p
s r c / E v e n t A c c e s s o r s . c p p
s r c / I n v i t e e I t e m . c p p
s r c / L o g g i n g . c p p
s r c / L o g i n P a g e . c p p
s r c / M a i n W i n d o w . c p p
s r c / M a t r i x C l i e n t . c p p
s r c / M x c I m a g e P r o v i d e r . c p p
s r c / O l m . c p p
s r c / R e g i s t e r P a g e . c p p
s r c / R o o m I n f o L i s t I t e m . c p p
s r c / R o o m L i s t . c p p
s r c / S S O H a n d l e r . c p p
s r c / S i d e B a r A c t i o n s . c p p
s r c / S p l i t t e r . c p p
s r c / T r a y I c o n . c p p
s r c / U s e r I n f o W i d g e t . c p p
s r c / U s e r S e t t i n g s P a g e . c p p
s r c / U s e r s M o d e l . c p p
s r c / R o o m s M o d e l . c p p
s r c / U t i l s . c p p
s r c / W e b R T C S e s s i o n . c p p
s r c / W e l c o m e P a g e . c p p
s r c / p o p u p s / P o p u p I t e m . c p p
s r c / p o p u p s / S u g g e s t i o n s P o p u p . c p p
s r c / p o p u p s / U s e r M e n t i o n s . c p p
s r c / m a i n . c p p
t h i r d _ p a r t y / b l u r h a s h / b l u r h a s h . c p p
)
include ( FeatureSummary )
if ( USE_BUNDLED_BOOST )
hunter_add_package ( Boost COMPONENTS iostreams system thread )
endif ( )
find_package ( Boost 1.70 REQUIRED
C O M P O N E N T S i o s t r e a m s
s y s t e m
t h r e a d )
if ( USE_BUNDLED_OPENSSL )
hunter_add_package ( OpenSSL )
endif ( )
find_package ( OpenSSL 1.1.0 REQUIRED )
if ( USE_BUNDLED_MTXCLIENT )
include ( FetchContent )
FetchContent_Declare (
M a t r i x C l i e n t
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / N h e k o - R e b o r n / m t x c l i e n t . g i t
G I T _ T A G 5 d 2 f 0 5 5 e a 9 4 0 3 7 7 0 0 3 9 d d f 6 6 b 1 9 0 0 f 8 9 0 c d 5 c d e 7
)
set ( BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "" )
set ( BUILD_LIB_TESTS OFF CACHE INTERNAL "" )
FetchContent_MakeAvailable ( MatrixClient )
else ( )
find_package ( MatrixClient 0.5.1 REQUIRED )
endif ( )
if ( USE_BUNDLED_OLM )
include ( FetchContent )
FetchContent_Declare (
O l m
G I T _ R E P O S I T O R Y h t t p s : / / g i t l a b . m a t r i x . o r g / m a t r i x - o r g / o l m . g i t
G I T _ T A G 3 . 1 . 4
)
set ( OLM_TESTS OFF CACHE INTERNAL "" )
FetchContent_MakeAvailable ( Olm )
else ( )
find_package ( Olm 3 REQUIRED )
set_package_properties ( Olm PROPERTIES
D E S C R I P T I O N " A n i m p l e m e n t a t i o n o f t h e D o u b l e R a t c h e t c r y p t o g r a p h i c r a t c h e t "
U R L " h t t p s : / / g i t . m a t r i x . o r g / g i t / o l m / a b o u t / "
T Y P E R E Q U I R E D
)
endif ( )
if ( USE_BUNDLED_SPDLOG )
hunter_add_package ( spdlog )
endif ( )
find_package ( spdlog 1.0.0 CONFIG REQUIRED )
if ( USE_BUNDLED_CMARK )
include ( FetchContent )
FetchContent_Declare (
c m a r k
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / c o m m o n m a r k / c m a r k . g i t
G I T _ T A G 2 4 2 e 2 7 7 a 6 6 1 e c 7 e 5 1 f 3 4 d c a f 8 6 c 1 9 2 5 d 5 5 0 b 1 4 9 8 #0.29.0 << doesn't work with fetch content yet
C M A K E _ A R G S " C M A R K _ S T A T I C = O N C M A R K _ S H A R E D = O F F C M A R K _ T E S T S = O F F C M A R K _ T E S T S = O F F "
)
FetchContent_MakeAvailable ( cmark )
if ( MSVC )
add_library ( cmark::cmark ALIAS libcmark )
else ( )
add_library ( cmark::cmark ALIAS libcmark_static )
endif ( )
else ( )
find_package ( cmark REQUIRED 0.29.0 )
endif ( )
if ( USE_BUNDLED_JSON )
hunter_add_package ( nlohmann_json )
endif ( )
find_package ( nlohmann_json 3.2.0 )
set_package_properties ( nlohmann_json PROPERTIES
D E S C R I P T I O N " J S O N f o r M o d e r n C + + , a C + + 1 1 h e a d e r - o n l y J S O N c l a s s "
U R L " h t t p s : / / n l o h m a n n . g i t h u b . i o / j s o n / "
T Y P E R E Q U I R E D
)
if ( USE_BUNDLED_LMDBXX )
include ( FetchContent )
FetchContent_Declare (
l m d b x x
U R L " h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / h o y t e c h / l m d b x x / 1 . 0 . 0 / l m d b + + . h "
D O W N L O A D _ N O _ E X T R A C T T R U E
)
if ( NOT lmdbxx_POPULATED )
FetchContent_Populate ( lmdbxx )
endif ( )
add_library ( lmdbxx INTERFACE )
target_include_directories ( lmdbxx INTERFACE ${ lmdbxx_SOURCE_DIR } )
add_library ( lmdbxx::lmdbxx ALIAS lmdbxx )
else ( )
if ( NOT LMDBXX_INCLUDE_DIR )
find_path ( LMDBXX_INCLUDE_DIR
N A M E S l m d b + + . h
P A T H S / u s r / i n c l u d e
/ u s r / l o c a l / i n c l u d e
$ E N V { L I B _ D I R } / i n c l u d e
$ E N V { L I B _ D I R } / i n c l u d e / l m d b x x )
endif ( )
add_library ( lmdbxx INTERFACE )
target_include_directories ( lmdbxx INTERFACE ${ LMDBXX_INCLUDE_DIR } )
add_library ( lmdbxx::lmdbxx ALIAS lmdbxx )
endif ( )
include ( FindPkgConfig )
pkg_check_modules ( GSTREAMER IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18 )
if ( TARGET PkgConfig::GSTREAMER )
add_feature_info ( voip ON "GStreamer found. Call support is enabled automatically." )
pkg_check_modules ( XCB IMPORTED_TARGET xcb xcb-ewmh )
if ( TARGET PkgConfig::XCB )
add_feature_info ( "Window selection when screen sharing (X11)" ON "XCB-EWMH found. Window selection is enabled when screen sharing (X11)." )
else ( )
add_feature_info ( "Window selection when screen sharing (X11)" OFF "XCB-EWMH could not be found on your system. Screen sharing (X11) is limited to the entire screen only. To enable window selection, make sure xcb and xcb-ewmh can be found via pkgconfig." )
endif ( )
else ( )
add_feature_info ( voip OFF "GStreamer could not be found on your system. As a consequence call support has been disabled. If you don't want that, make sure gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18 can be found via pkgconfig." )
endif ( )
# single instance functionality
set ( QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication" )
add_subdirectory ( third_party/SingleApplication-3.2.0-dc8042b/ )
feature_summary ( WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES )
qt5_wrap_cpp ( MOC_HEADERS
# Dialogs
s r c / d i a l o g s / C r e a t e R o o m . h
s r c / d i a l o g s / F a l l b a c k A u t h . h
s r c / d i a l o g s / I m a g e O v e r l a y . h
s r c / d i a l o g s / I n v i t e U s e r s . h
s r c / d i a l o g s / J o i n R o o m . h
s r c / d i a l o g s / L e a v e R o o m . h
s r c / d i a l o g s / L o g o u t . h
s r c / d i a l o g s / M e m b e r L i s t . h
s r c / d i a l o g s / P r e v i e w U p l o a d O v e r l a y . h
s r c / d i a l o g s / R a w M e s s a g e . h
s r c / d i a l o g s / R e C a p t c h a . h
s r c / d i a l o g s / R e a d R e c e i p t s . h
# Emoji
s r c / e m o j i / E m o j i M o d e l . h
s r c / e m o j i / P r o v i d e r . h
# Timeline
s r c / t i m e l i n e / E v e n t S t o r e . h
s r c / t i m e l i n e / I n p u t B a r . h
s r c / t i m e l i n e / R e a c t i o n . h
s r c / t i m e l i n e / T i m e l i n e V i e w M a n a g e r . h
s r c / t i m e l i n e / T i m e l i n e M o d e l . h
s r c / t i m e l i n e / D e l e g a t e C h o o s e r . h
# UI components
s r c / u i / A v a t a r . h
s r c / u i / B a d g e . h
s r c / u i / L o a d i n g I n d i c a t o r . h
s r c / u i / I n f o M e s s a g e . h
s r c / u i / F l a t B u t t o n . h
s r c / u i / L a b e l . h
s r c / u i / F l o a t i n g B u t t o n . h
s r c / u i / M e n u . h
s r c / u i / N h e k o C u r s o r S h a p e . h
s r c / u i / N h e k o D r o p A r e a . h
s r c / u i / O v e r l a y W i d g e t . h
s r c / u i / S n a c k B a r . h
s r c / u i / R a i s e d B u t t o n . h
s r c / u i / R i p p l e . h
s r c / u i / R i p p l e O v e r l a y . h
s r c / u i / T e x t F i e l d . h
s r c / u i / T e x t L a b e l . h
s r c / u i / T o g g l e B u t t o n . h
s r c / u i / T h e m e . h
s r c / u i / T h e m e M a n a g e r . h
s r c / u i / U s e r P r o f i l e . h
s r c / u i / R o o m S e t t i n g s . h
s r c / n o t i f i c a t i o n s / M a n a g e r . h
s r c / A v a t a r P r o v i d e r . h
s r c / B l u r h a s h P r o v i d e r . h
s r c / C a c h e _ p . h
s r c / C a l l D e v i c e s . h
s r c / C a l l M a n a g e r . h
s r c / C h a t P a g e . h
s r c / C l i p b o a r d . h
s r c / C o m m u n i t i e s L i s t . h
s r c / C o m m u n i t i e s L i s t I t e m . h
s r c / C o m p l e t i o n P r o x y M o d e l . h
s r c / D e v i c e V e r i f i c a t i o n F l o w . h
s r c / I n v i t e e I t e m . h
s r c / L o g i n P a g e . h
s r c / M a i n W i n d o w . h
s r c / M x c I m a g e P r o v i d e r . h
s r c / R e g i s t e r P a g e . h
s r c / R o o m I n f o L i s t I t e m . h
s r c / R o o m L i s t . h
s r c / S S O H a n d l e r . h
s r c / S i d e B a r A c t i o n s . h
s r c / S p l i t t e r . h
s r c / T r a y I c o n . h
s r c / U s e r I n f o W i d g e t . h
s r c / U s e r S e t t i n g s P a g e . h
s r c / U s e r s M o d e l . h
s r c / R o o m s M o d e l . h
s r c / W e b R T C S e s s i o n . h
s r c / W e l c o m e P a g e . h
s r c / p o p u p s / P o p u p I t e m . h
s r c / p o p u p s / S u g g e s t i o n s P o p u p . h
s r c / p o p u p s / U s e r M e n t i o n s . h
)
#
# Bundle translations.
#
include ( Translations )
set ( TRANSLATION_DEPS ${ LANG_QRC } ${ QRC } ${ QM_SRC } )
if ( APPLE )
set ( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa" )
set ( SRC_FILES ${ SRC_FILES } src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp src/emoji/MacHelper.mm )
if ( ${ CMAKE_VERSION } VERSION_GREATER_EQUAL "3.16.0" )
set_source_files_properties ( src/notifications/ManagerMac.mm src/emoji/MacHelper.mm PROPERTIES SKIP_PRECOMPILE_HEADERS ON )
endif ( )
elseif ( WIN32 )
file ( DOWNLOAD
" h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / m o h a b o u j e / W i n T o a s t / 4 1 e d 1 c 5 8 d 5 d c e 0 e e 9 c 0 1 d b d e a c 0 5 b e 4 5 3 5 8 d 4 f 5 7 / s r c / w i n t o a s t l i b . c p p "
$ { P R O J E C T _ S O U R C E _ D I R } / s r c / w i n t o a s t l i b . c p p
E X P E C T E D _ H A S H S H A 2 5 6 = 1 A 1 A 7 C E 4 1 C 1 0 5 2 B 1 2 9 4 6 7 9 8 F 4 A 6 C 6 7 C E 1 F A D 2 0 9 C 9 6 7 F 5 E D 4 D 7 2 0 B 1 7 3 5 2 7 E 2 0 7 3 )
file ( DOWNLOAD
" h t t p s : / / r a w . g i t h u b u s e r c o n t e n t . c o m / m o h a b o u j e / W i n T o a s t / 4 1 e d 1 c 5 8 d 5 d c e 0 e e 9 c 0 1 d b d e a c 0 5 b e 4 5 3 5 8 d 4 f 5 7 / s r c / w i n t o a s t l i b . h "
$ { P R O J E C T _ S O U R C E _ D I R } / s r c / w i n t o a s t l i b . h
E X P E C T E D _ H A S H S H A 2 5 6 = b 4 4 8 1 0 2 3 c 5 7 8 2 7 3 3 7 9 5 8 3 8 b e 2 2 b f 1 a 7 5 f 4 5 d 8 7 4 5 8 c d 4 d 9 a 5 a 7 5 f 6 6 4 a 1 4 6 e e a 1 1 )
set ( SRC_FILES ${ SRC_FILES } src/notifications/ManagerWin.cpp src/wintoastlib.cpp )
else ( )
set ( SRC_FILES ${ SRC_FILES } src/notifications/ManagerLinux.cpp )
endif ( )
set ( NHEKO_DEPS
$ { S R C _ F I L E S }
$ { U I _ H E A D E R S }
$ { M O C _ H E A D E R S }
$ { T R A N S L A T I O N _ D E P S }
$ { M E T A _ F I L E S _ T O _ I N C L U D E } )
if ( ASAN )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,undefined" )
endif ( )
if ( WIN32 )
add_executable ( nheko WIN32 ${ OS_BUNDLE } ${ NHEKO_DEPS } )
target_compile_definitions ( nheko PRIVATE _WIN32_WINNT=0x0601 )
else ( )
add_executable ( nheko ${ OS_BUNDLE } ${ NHEKO_DEPS } )
endif ( )
if ( APPLE )
target_link_libraries ( nheko PRIVATE Qt5::MacExtras )
elseif ( WIN32 )
target_compile_definitions ( nheko PRIVATE WIN32_LEAN_AND_MEAN )
target_link_libraries ( nheko PRIVATE ${ NTDLIB } Qt5::WinMain )
if ( MSVC )
target_compile_options ( nheko PUBLIC "/Zc:__cplusplus" )
endif ( )
else ( )
target_link_libraries ( nheko PRIVATE Qt5::DBus )
endif ( )
target_include_directories ( nheko PRIVATE src includes third_party/blurhash third_party/cpp-httplib-0.5.12 )
# Fixup bundled keychain include dirs
if ( USE_BUNDLED_QTKEYCHAIN )
target_include_directories ( nheko PRIVATE ${ qt5keychain_SOURCE_DIR } ${ qt5keychain_BINARY_DIR } )
endif ( )
target_link_libraries ( nheko PRIVATE
M a t r i x C l i e n t : : M a t r i x C l i e n t
B o o s t : : i o s t r e a m s
B o o s t : : s y s t e m
B o o s t : : t h r e a d
c m a r k : : c m a r k
s p d l o g : : s p d l o g
Q t 5 : : W i d g e t s
Q t 5 : : S v g
Q t 5 : : C o n c u r r e n t
Q t 5 : : M u l t i m e d i a
Q t 5 : : Q m l
Q t 5 : : Q u i c k C o n t r o l s 2
Q t 5 : : Q u i c k W i d g e t s
q t 5 k e y c h a i n
n l o h m a n n _ j s o n : : n l o h m a n n _ j s o n
l m d b x x : : l m d b x x
l i b l m d b : : l m d b
S i n g l e A p p l i c a t i o n : : S i n g l e A p p l i c a t i o n )
if ( ${ CMAKE_VERSION } VERSION_GREATER_EQUAL "3.16.0" )
target_precompile_headers ( nheko
P R I V A T E
< s t r i n g >
< a l g o r i t h m >
)
endif ( )
if ( TARGET PkgConfig::GSTREAMER )
target_link_libraries ( nheko PRIVATE PkgConfig::GSTREAMER )
target_compile_definitions ( nheko PRIVATE GSTREAMER_AVAILABLE )
if ( TARGET PkgConfig::XCB )
target_link_libraries ( nheko PRIVATE PkgConfig::XCB )
target_compile_definitions ( nheko PRIVATE XCB_AVAILABLE )
endif ( )
endif ( )
if ( MSVC )
target_link_libraries ( nheko PRIVATE ntdll )
endif ( )
if ( QML_DEBUGGING )
target_compile_definitions ( nheko PRIVATE QML_DEBUGGING )
endif ( )
if ( NOT MSVC AND NOT HAIKU )
if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD )
target_compile_options ( nheko PRIVATE "-Werror" )
endif ( )
endif ( )
set_target_properties ( nheko PROPERTIES SKIP_BUILD_RPATH TRUE )
if ( UNIX AND NOT APPLE )
install ( TARGETS nheko RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" )
install ( FILES "resources/nheko-16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko-512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "nheko.png" )
install ( FILES "resources/nheko.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" RENAME "nheko.svg" )
install ( FILES "resources/nheko.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" )
install ( FILES "resources/nheko.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" )
if ( NOT TARGET uninstall )
configure_file (
" $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n "
" $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e "
I M M E D I A T E @ O N L Y )
add_custom_target ( uninstall
C O M M A N D $ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e )
endif ( )
endif ( )