discord-awesomeaudio/CMakeLists.txt

101 lines
3.5 KiB
CMake
Raw Permalink Normal View History

2022-07-07 07:11:51 -04:00
cmake_minimum_required(VERSION 3.0)
project(discord-screenaudio)
2022-07-28 11:34:54 -04:00
include(version.cmake)
determine_version("${CMAKE_CURRENT_SOURCE_DIR}" DISCORD_SCEENAUDIO)
add_definitions( -DDISCORD_SCEENAUDIO_VERSION_FULL="${DISCORD_SCEENAUDIO_VERSION_FULL}" )
2022-07-07 07:11:51 -04:00
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
2022-07-09 16:07:14 -04:00
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
2022-07-28 12:23:26 -04:00
string(TIMESTAMP TIMESTAMP %s)
2022-07-07 07:11:51 -04:00
# set(CMAKE_AUTOUIC ON)
2022-12-27 13:00:10 -05:00
find_package(Qt5 COMPONENTS Widgets)
if (Qt5_FOUND)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets WebEngineWidgets)
2022-07-07 07:11:51 -04:00
2022-12-27 13:00:10 -05:00
find_package(KF5Notifications)
if(KF5Notifications_FOUND)
add_definitions( -DKNOTIFICATIONS )
endif()
2022-07-29 10:08:19 -04:00
2022-12-27 13:00:10 -05:00
find_package(KF5XmlGui)
if(KF5XmlGui_FOUND)
add_definitions( -DKXMLGUI )
endif()
2022-10-10 15:50:26 -04:00
2022-12-27 13:00:10 -05:00
find_package(KF5GlobalAccel)
if(KF5GlobalAccel_FOUND)
add_definitions( -DKGLOBALACCEL )
endif()
else()
message(WARNING "Qt 5 was not found on your system and Qt 6 will be used. You will not be able to use any features using KDE Frameworks.")
find_package(Qt6 CONFIG REQUIRED COMPONENTS Widgets WebEngineWidgets)
2022-10-10 15:50:26 -04:00
endif()
2022-07-07 07:11:51 -04:00
set(discord-screenaudio_SRC
src/main.cpp
src/mainwindow.cpp
src/virtmic.cpp
2022-07-09 16:07:14 -04:00
src/discordpage.cpp
src/streamdialog.cpp
2022-08-02 06:41:32 -04:00
src/log.cpp
src/userscript.cpp
src/centralwidget.cpp
src/localserver.cpp
src/centralwidget.h
src/discordpage.h
src/localserver.h
src/log.h
src/mainwindow.h
src/streamdialog.h
src/userscript.h
src/virtmic.h
2022-07-07 07:11:51 -04:00
resources.qrc
)
# Adapted from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Updating submodules")
2022-07-26 10:53:13 -04:00
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive --checkout
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
2022-07-26 10:53:13 -04:00
message(FATAL_ERROR "`git submodule update --init --recursive --checkout` failed with ${GIT_SUBMOD_RESULT}, please provide the submodules manually")
endif()
endif()
endif()
if(NOT EXISTS "${PROJECT_SOURCE_DIR}/submodules/rohrkabel/CMakeLists.txt")
message(FATAL_ERROR "Rohrkabel was not found since you are not in a Git checkout or have GIT_SUBMODULE disabled. Please provide rohrkabel manually to `./submodules/rohrkabel`.")
endif()
add_subdirectory(submodules/rohrkabel)
2022-07-07 07:11:51 -04:00
add_executable(discord-screenaudio ${discord-screenaudio_SRC})
2022-12-27 13:00:10 -05:00
target_link_libraries(discord-screenaudio Qt::Widgets Qt::WebEngineWidgets rohrkabel)
2022-07-29 10:31:04 -04:00
if(KF5Notifications_FOUND)
2022-07-29 10:31:04 -04:00
target_link_libraries(discord-screenaudio KF5::Notifications)
install(FILES assets/discord-screenaudio.notifyrc DESTINATION ${CMAKE_INSTALL_PREFIX}/share/knotifications5)
endif()
2022-10-10 15:50:26 -04:00
if(KF5XmlGui_FOUND)
target_link_libraries(discord-screenaudio KF5::XmlGui)
endif()
if(KF5GlobalAccel_FOUND)
target_link_libraries(discord-screenaudio KF5::GlobalAccel)
endif()
2022-07-07 07:11:51 -04:00
install(TARGETS discord-screenaudio DESTINATION bin)
2022-07-28 11:34:54 -04:00
install(FILES assets/de.shorsh.discord-screenaudio.png DESTINATION ${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/256x256/apps)
2022-07-28 10:39:02 -04:00
install(PROGRAMS assets/de.shorsh.discord-screenaudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
2022-07-28 11:34:54 -04:00
configure_file(assets/de.shorsh.discord-screenaudio.metainfo.xml.in de.shorsh.discord-screenaudio.metainfo.xml)
install(FILES ${CMAKE_BINARY_DIR}/de.shorsh.discord-screenaudio.metainfo.xml DESTINATION ${CMAKE_INSTALL_PREFIX}/share/metainfo)