Format CMakeLists.txt

This commit is contained in:
Loren Burkholder 2023-09-23 22:29:50 -04:00
parent 03be9e479a
commit 58ac409f31
No known key found for this signature in database
GPG key ID: AB62CB312CEC2BBC

View file

@ -17,7 +17,7 @@ set(
CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake" CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
CACHE CACHE
FILEPATH "Default toolchain" FILEPATH "Default toolchain"
) )
set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard") set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard to be supported") 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") set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "compile as PIC by default")
@ -68,12 +68,12 @@ option(USE_BUNDLED_BLURHASH "Use the bundled version of blurhash." ON)
include(CMakeDependentOption) include(CMakeDependentOption)
set(VOIP_DEFAULT ON) set(VOIP_DEFAULT ON)
if (APPLE OR WIN32) if(APPLE OR WIN32)
set(VOIP_DEFAULT OFF) set(VOIP_DEFAULT OFF)
endif() endif()
option(VOIP "Whether to enable voip support. Disable this, if you don't have gstreamer." ${VOIP_DEFAULT}) option(VOIP "Whether to enable voip support. Disable this, if you don't have gstreamer." ${VOIP_DEFAULT})
set(X11_DEFAULT) set(X11_DEFAULT)
if (WIN32 OR APPLE OR HAIKU) if(WIN32 OR APPLE OR HAIKU)
set(X11_DEFAULT OFF) set(X11_DEFAULT OFF)
endif() endif()
option(X11 "Whether to enable X11 specific features (screenshare, window roles)." ${X11_DEFAULT}) option(X11 "Whether to enable X11 specific features (screenshare, window roles)." ${X11_DEFAULT})
@ -85,7 +85,6 @@ if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message("Adding FetchContent_MakeAvailable") message("Adding FetchContent_MakeAvailable")
# from cmakes sources # from cmakes sources
macro(FetchContent_MakeAvailable) macro(FetchContent_MakeAvailable)
foreach(contentName IN ITEMS ${ARGV}) foreach(contentName IN ITEMS ${ARGV})
string(TOLOWER ${contentName} contentNameLower) string(TOLOWER ${contentName} contentNameLower)
FetchContent_GetProperties(${contentName}) FetchContent_GetProperties(${contentName})
@ -103,7 +102,6 @@ if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
endif() endif()
endif() endif()
endforeach() endforeach()
endmacro() endmacro()
endif() endif()
@ -137,10 +135,10 @@ if(NOT MSVC AND NOT APPLE)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
endif() endif()
if (BUILD_DOCS) if(BUILD_DOCS)
find_package(Doxygen) find_package(Doxygen)
if (DOXYGEN_FOUND) if(DOXYGEN_FOUND)
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Doxyfile.in) set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Doxyfile.in)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
@ -151,31 +149,30 @@ if (BUILD_DOCS)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" COMMENT "Generating API documentation with Doxygen"
VERBATIM ) VERBATIM )
else (DOXYGEN_FOUND) else(DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation") message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND) endif(DOXYGEN_FOUND)
endif() endif()
# #
## coeurl ## coeurl
# #
## Need to repeat all libevent deps?!? ## Need to repeat all libevent deps?!?
if (USE_BUNDLED_LIBEVENT) if(USE_BUNDLED_LIBEVENT)
hunter_add_package_safe(Libevent) hunter_add_package_safe(Libevent)
find_package(Libevent CONFIG REQUIRED) find_package(Libevent CONFIG REQUIRED)
else() else()
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(libevent_core REQUIRED IMPORTED_TARGET libevent_core) pkg_check_modules(libevent_core REQUIRED IMPORTED_TARGET libevent_core)
if (WIN32) if(WIN32)
pkg_check_modules(libevent_windows REQUIRED IMPORTED_TARGET libevent_windows) pkg_check_modules(libevent_windows REQUIRED IMPORTED_TARGET libevent_windows)
else() else()
pkg_check_modules(libevent_pthreads REQUIRED IMPORTED_TARGET pkg_check_modules(libevent_pthreads REQUIRED IMPORTED_TARGET libevent_pthreads)
libevent_pthreads)
endif() endif()
endif() endif()
# curl # curl
if (USE_BUNDLED_LIBCURL) if(USE_BUNDLED_LIBCURL)
hunter_add_package_safe(CURL) hunter_add_package_safe(CURL)
find_package(CURL CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED)
else() else()
@ -201,19 +198,19 @@ if(USE_BUNDLED_COEURL)
else() else()
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(coeurl IMPORTED_TARGET coeurl>=0.3.0) pkg_check_modules(coeurl IMPORTED_TARGET coeurl>=0.3.0)
if (TARGET PkgConfig::coeurl) if(TARGET PkgConfig::coeurl)
set(COEURL_TARGET_NAME PkgConfig::coeurl) set(COEURL_TARGET_NAME PkgConfig::coeurl)
endif() endif()
endif() endif()
if(NOT TARGET PkgConfig::coeurl) if(NOT TARGET PkgConfig::coeurl)
find_package(coeurl 0.2.1 CONFIG) find_package(coeurl 0.2.1 CONFIG)
if (TARGET coeurl::coeurl) if(TARGET coeurl::coeurl)
set(COEURL_TARGET_NAME coeurl::coeurl) set(COEURL_TARGET_NAME coeurl::coeurl)
endif() endif()
endif() endif()
if (NOT COEURL_TARGET_NAME) if(NOT COEURL_TARGET_NAME)
message(ERROR "Couldn't find coeurl") message(ERROR "Couldn't find coeurl")
endif() endif()
@ -225,7 +222,6 @@ else()
pkg_check_modules(re2 REQUIRED IMPORTED_TARGET re2) pkg_check_modules(re2 REQUIRED IMPORTED_TARGET re2)
endif() endif()
# #
# LMDB # LMDB
# #
@ -247,7 +243,7 @@ find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qm
#find_package(Qt6QuickCompiler) #find_package(Qt6QuickCompiler)
find_package(Qt6DBus) find_package(Qt6DBus)
if (USE_BUNDLED_QTKEYCHAIN) if(USE_BUNDLED_QTKEYCHAIN)
include(FetchContent) include(FetchContent)
set(BUILD_WITH_QT6 ON) set(BUILD_WITH_QT6 ON)
FetchContent_Declare( FetchContent_Declare(
@ -255,7 +251,7 @@ if (USE_BUNDLED_QTKEYCHAIN)
GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
GIT_TAG v0.14.0 GIT_TAG v0.14.0
) )
if (BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
set(QTKEYCHAIN_STATIC OFF CACHE INTERNAL "") set(QTKEYCHAIN_STATIC OFF CACHE INTERNAL "")
else() else()
set(QTKEYCHAIN_STATIC ON CACHE INTERNAL "") set(QTKEYCHAIN_STATIC ON CACHE INTERNAL "")
@ -266,8 +262,8 @@ else()
find_package(Qt6Keychain REQUIRED) find_package(Qt6Keychain REQUIRED)
endif() endif()
if (Qt6Widgets_FOUND) if(Qt6Widgets_FOUND)
if (Qt6Widgets_VERSION VERSION_LESS 6.5.0) if(Qt6Widgets_VERSION VERSION_LESS 6.5.0)
message(STATUS "Qt version ${Qt6Widgets_VERSION}") message(STATUS "Qt version ${Qt6Widgets_VERSION}")
message(WARNING "Minimum supported Qt6 version is 6.5!") message(WARNING "Minimum supported Qt6 version is 6.5!")
endif() endif()
@ -286,14 +282,14 @@ if(NOT MSVC)
-Wunreachable-code \ -Wunreachable-code \
-Wno-attributes" -Wno-attributes"
) )
if (NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCXX)
# -Wshadow is buggy and broken in GCC, so do not enable it. # -Wshadow is buggy and broken in GCC, so do not enable it.
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328 # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
endif() endif()
endif() endif()
if (MSVC) if(MSVC)
set( set(
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /bigobj" "${CMAKE_CXX_FLAGS} /bigobj"
@ -507,11 +503,10 @@ set(SRC_FILES
includes/jdenticoninterface.h includes/jdenticoninterface.h
src/main.cpp src/main.cpp
) )
include(FeatureSummary) include(FeatureSummary)
if(USE_BUNDLED_OPENSSL) if(USE_BUNDLED_OPENSSL)
hunter_add_package_safe(OpenSSL) hunter_add_package_safe(OpenSSL)
endif() endif()
@ -547,7 +542,7 @@ if(USE_BUNDLED_CMARK)
CMAKE_ARGS "CMARK_STATIC=ON CMARK_SHARED=OFF CMARK_TESTS=OFF CMARK_TESTS=OFF" CMAKE_ARGS "CMARK_STATIC=ON CMARK_SHARED=OFF CMARK_TESTS=OFF CMARK_TESTS=OFF"
) )
FetchContent_MakeAvailable(cmark) FetchContent_MakeAvailable(cmark)
if (MSVC) if(MSVC)
add_library(cmark::cmark ALIAS cmark) add_library(cmark::cmark ALIAS cmark)
else() else()
add_library(cmark::cmark ALIAS cmark_static) add_library(cmark::cmark ALIAS cmark_static)
@ -564,7 +559,7 @@ set_package_properties(nlohmann_json PROPERTIES
DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class" DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
URL "https://nlohmann.github.io/json/" URL "https://nlohmann.github.io/json/"
TYPE REQUIRED TYPE REQUIRED
) )
if(USE_BUNDLED_LMDBXX) if(USE_BUNDLED_LMDBXX)
include(FetchContent) include(FetchContent)
@ -587,7 +582,6 @@ else()
/usr/local/include /usr/local/include
$ENV{LIB_DIR}/include $ENV{LIB_DIR}/include
$ENV{LIB_DIR}/include/lmdbxx) $ENV{LIB_DIR}/include/lmdbxx)
endif() endif()
add_library(lmdbxx INTERFACE) add_library(lmdbxx INTERFACE)
target_include_directories(lmdbxx INTERFACE ${LMDBXX_INCLUDE_DIR}) target_include_directories(lmdbxx INTERFACE ${LMDBXX_INCLUDE_DIR})
@ -608,12 +602,12 @@ else()
find_package(MatrixClient 0.9.0 REQUIRED) find_package(MatrixClient 0.9.0 REQUIRED)
endif() endif()
if (VOIP) if(VOIP)
include(FindPkgConfig) include(FindPkgConfig)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18) pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
endif() endif()
if (X11 AND NOT WIN32 AND NOT APPLE AND NOT HAIKU) if(X11 AND NOT WIN32 AND NOT APPLE AND NOT HAIKU)
pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh) pkg_check_modules(XCB REQUIRED IMPORTED_TARGET xcb xcb-ewmh)
endif() endif()
@ -624,7 +618,7 @@ add_subdirectory(third_party/SingleApplication-3.3.2/)
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
# this must be defined here to make the moc work properly # this must be defined here to make the moc work properly
if (NOT APPLE AND NOT WIN32) if(NOT APPLE AND NOT WIN32)
add_compile_definitions(NHEKO_DBUS_SYS) add_compile_definitions(NHEKO_DBUS_SYS)
endif() endif()
@ -637,13 +631,13 @@ else()
qt_add_resources(QRC resources/res.qrc) qt_add_resources(QRC resources/res.qrc)
endif() endif()
if (APPLE) if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -framework Foundation -framework Cocoa -framework UserNotifications")
set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp src/emoji/MacHelper.mm src/emoji/MacHelper.h) set(SRC_FILES ${SRC_FILES} src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/notifications/ManagerMac.cpp src/emoji/MacHelper.mm src/emoji/MacHelper.h)
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0") if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/emoji/MacHelper.mm src/emoji/MacHelper.h PROPERTIES SKIP_PRECOMPILE_HEADERS ON) set_source_files_properties( src/notifications/NotificationManagerProxy.h src/notifications/MacNotificationDelegate.h src/notifications/MacNotificationDelegate.mm src/notifications/ManagerMac.mm src/emoji/MacHelper.mm src/emoji/MacHelper.h PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif() endif()
elseif (WIN32) elseif(WIN32)
file(DOWNLOAD file(DOWNLOAD
"https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.cpp" "https://raw.githubusercontent.com/mohabouje/WinToast/41ed1c58d5dce0ee9c01dbdeac05be45358d4f57/src/wintoastlib.cpp"
${PROJECT_SOURCE_DIR}/src/wintoastlib.cpp ${PROJECT_SOURCE_DIR}/src/wintoastlib.cpp
@ -655,7 +649,7 @@ elseif (WIN32)
EXPECTED_HASH SHA256=b4481023c5782733795838be22bf1a75f45d87458cd4d9a5a75f664a146eea11) EXPECTED_HASH SHA256=b4481023c5782733795838be22bf1a75f45d87458cd4d9a5a75f664a146eea11)
set(SRC_FILES ${SRC_FILES} src/notifications/ManagerWin.cpp src/wintoastlib.cpp src/wintoastlib.h) set(SRC_FILES ${SRC_FILES} src/notifications/ManagerWin.cpp src/wintoastlib.cpp src/wintoastlib.h)
else () else()
set(SRC_FILES ${SRC_FILES} set(SRC_FILES ${SRC_FILES}
src/dbus/NhekoDBusApi.h src/dbus/NhekoDBusApi.h
src/dbus/NhekoDBusBackend.h src/dbus/NhekoDBusBackend.h
@ -663,7 +657,7 @@ else ()
src/dbus/NhekoDBusBackend.cpp src/dbus/NhekoDBusBackend.cpp
src/notifications/ManagerLinux.cpp src/notifications/ManagerLinux.cpp
) )
endif () endif()
set(NHEKO_DEPS set(NHEKO_DEPS
${SRC_FILES} ${SRC_FILES}
@ -675,12 +669,12 @@ if(ASAN)
endif() endif()
if(WIN32) if(WIN32)
qt_add_executable (nheko WIN32 ${OS_BUNDLE} ${NHEKO_DEPS}) qt_add_executable(nheko WIN32 ${OS_BUNDLE} ${NHEKO_DEPS})
target_compile_definitions(nheko PRIVATE _WIN32_WINNT=0x0601 NOMINMAX WIN32_LEAN_AND_MEAN STRICT) target_compile_definitions(nheko PRIVATE _WIN32_WINNT=0x0601 NOMINMAX WIN32_LEAN_AND_MEAN STRICT)
else() else()
qt_add_executable (nheko ${OS_BUNDLE} ${NHEKO_DEPS}) qt_add_executable(nheko ${OS_BUNDLE} ${NHEKO_DEPS})
if (HAVE_BACKTRACE_SYMBOLS_FD AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") if(HAVE_BACKTRACE_SYMBOLS_FD AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
set_target_properties(nheko PROPERTIES ENABLE_EXPORTS ON) set_target_properties(nheko PROPERTIES ENABLE_EXPORTS ON)
endif() endif()
endif() endif()
@ -811,12 +805,11 @@ qt_add_qml_module(nheko
SOURCES SOURCES
src/UserDirectoryModel.cpp src/UserDirectoryModel.cpp
src/UserDirectoryModel.h src/UserDirectoryModel.h
) )
#qt_target_qml_sources(nheko #qt_target_qml_sources(nheko
# #PREFIX "/" # #PREFIX "/"
#) #)
# #
# Bundle translations # Bundle translations
# #
@ -824,22 +817,21 @@ file(GLOB LANG_TS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/resources/langs/*.ts")
qt_add_translations(nheko RESOURCE_PREFIX "/translations" TS_FILES qt_add_translations(nheko RESOURCE_PREFIX "/translations" TS_FILES
${LANG_TS_SRC} SOURCES ${QML_SOURCES} ${SRC_FILES}) ${LANG_TS_SRC} SOURCES ${QML_SOURCES} ${SRC_FILES})
if(WIN32) if(WIN32)
target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN) target_compile_definitions(nheko PRIVATE WIN32_LEAN_AND_MEAN)
if(MSVC) if(MSVC)
target_compile_options(nheko PUBLIC "/Zc:__cplusplus") target_compile_options(nheko PUBLIC "/Zc:__cplusplus")
endif() endif()
else() else()
target_link_libraries (nheko PRIVATE Qt6::DBus) target_link_libraries(nheko PRIVATE Qt6::DBus)
if (FLATPAK) if(FLATPAK)
target_compile_definitions(nheko PRIVATE NHEKO_FLATPAK) target_compile_definitions(nheko PRIVATE NHEKO_FLATPAK)
endif() endif()
endif() endif()
target_include_directories(nheko PRIVATE src includes src/timeline/ src/ui/ src/encryption/ src/voip/) target_include_directories(nheko PRIVATE src includes src/timeline/ src/ui/ src/encryption/ src/voip/)
if (USE_BUNDLED_CPPHTTPLIB) if(USE_BUNDLED_CPPHTTPLIB)
target_include_directories(nheko PRIVATE third_party/cpp-httplib-0.5.12) target_include_directories(nheko PRIVATE third_party/cpp-httplib-0.5.12)
target_sources(nheko PRIVATE third_party/cpp-httplib-0.5.12/httplib.h) target_sources(nheko PRIVATE third_party/cpp-httplib-0.5.12/httplib.h)
else() else()
@ -847,7 +839,7 @@ else()
target_link_libraries(nheko PRIVATE httplib::httplib) target_link_libraries(nheko PRIVATE httplib::httplib)
endif() endif()
if (USE_BUNDLED_BLURHASH) if(USE_BUNDLED_BLURHASH)
target_include_directories(nheko PRIVATE third_party/blurhash) target_include_directories(nheko PRIVATE third_party/blurhash)
set(BLURHASH_SRC_FILES set(BLURHASH_SRC_FILES
third_party/blurhash/blurhash.cpp third_party/blurhash/blurhash.cpp
@ -861,11 +853,11 @@ else()
endif() endif()
# Fixup bundled keychain include dirs # Fixup bundled keychain include dirs
if (USE_BUNDLED_QTKEYCHAIN) if(USE_BUNDLED_QTKEYCHAIN)
target_include_directories(nheko PRIVATE ${qt6keychain_SOURCE_DIR} ${qt6keychain_BINARY_DIR}) target_include_directories(nheko PRIVATE ${qt6keychain_SOURCE_DIR} ${qt6keychain_BINARY_DIR})
endif() endif()
if (NOT JSON_ImplicitConversions) if(NOT JSON_ImplicitConversions)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "JSON_USE_IMPLICIT_CONVERSIONS=\$<BOOL:OFF>;JSON_DIAGNOSTICS=\$<BOOL:OFF>" INTERFACE_COMPILE_DEFINITIONS "JSON_USE_IMPLICIT_CONVERSIONS=\$<BOOL:OFF>;JSON_DIAGNOSTICS=\$<BOOL:OFF>"
) )
@ -897,11 +889,11 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
) )
endif() endif()
if (TARGET PkgConfig::GSTREAMER) if(TARGET PkgConfig::GSTREAMER)
target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER) target_link_libraries(nheko PRIVATE PkgConfig::GSTREAMER)
target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE) target_compile_definitions(nheko PRIVATE GSTREAMER_AVAILABLE)
endif() endif()
if (TARGET PkgConfig::XCB) if(TARGET PkgConfig::XCB)
target_link_libraries(nheko PRIVATE PkgConfig::XCB) target_link_libraries(nheko PRIVATE PkgConfig::XCB)
target_compile_definitions(nheko PRIVATE XCB_AVAILABLE) target_compile_definitions(nheko PRIVATE XCB_AVAILABLE)
endif() endif()
@ -910,12 +902,10 @@ if(MSVC)
target_link_libraries(nheko PRIVATE ntdll) target_link_libraries(nheko PRIVATE ntdll)
endif() endif()
if(QML_DEBUGGING) if(QML_DEBUGGING)
target_compile_definitions(nheko PRIVATE QML_DEBUGGING) target_compile_definitions(nheko PRIVATE QML_DEBUGGING)
endif() endif()
if(NOT MSVC AND NOT HAIKU) if(NOT MSVC AND NOT HAIKU)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD) if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR CI_BUILD)
target_compile_options(nheko PRIVATE "-Werror") target_compile_options(nheko PRIVATE "-Werror")
@ -951,21 +941,21 @@ if(UNIX AND NOT APPLE)
set(APPID "nheko") set(APPID "nheko")
endif() endif()
install (TARGETS nheko RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS nheko RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install (FILES "resources/nheko-16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-16.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/16x16/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-32.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/32x32/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-48.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/48x48/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-64.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/64x64/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-128.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/128x128/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-256.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/256x256/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko-512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "${APPID}.png") install(FILES "resources/nheko-512.png" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/512x512/apps" RENAME "${APPID}.png")
install (FILES "resources/nheko.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" RENAME "${APPID}.svg") install(FILES "resources/nheko.svg" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/scalable/apps" RENAME "${APPID}.svg")
install (FILES "resources/_nheko" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions") install(FILES "resources/_nheko" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions")
configure_file("resources/nheko.desktop.in" "resources/nheko.desktop" @ONLY) configure_file("resources/nheko.desktop.in" "resources/nheko.desktop" @ONLY)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/nheko.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" RENAME "${APPID}.desktop") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/nheko.desktop" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications" RENAME "${APPID}.desktop")
configure_file("resources/nheko.appdata.xml.in" "resources/nheko.appdata.xml" @ONLY) configure_file("resources/nheko.appdata.xml.in" "resources/nheko.appdata.xml" @ONLY)
install (FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/nheko.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" RENAME "${APPID}.appdata.xml") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/resources/nheko.appdata.xml" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" RENAME "${APPID}.appdata.xml")
if(NOT TARGET uninstall) if(NOT TARGET uninstall)
configure_file( configure_file(