2022-10-05 14:02:46 +08:00
|
|
|
cmake_minimum_required(VERSION 3.12)
|
2020-04-06 15:15:13 +08:00
|
|
|
|
|
|
|
project(pineapple-music LANGUAGES CXX)
|
|
|
|
|
2020-04-08 18:16:45 +08:00
|
|
|
include (GNUInstallDirs)
|
2024-09-22 14:27:53 +08:00
|
|
|
include (FeatureSummary)
|
2020-04-08 18:16:45 +08:00
|
|
|
|
2020-04-06 15:15:13 +08:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
|
2022-10-05 14:02:46 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2020-04-06 15:15:13 +08:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2024-09-22 14:27:53 +08:00
|
|
|
find_package(Qt6 6.6 COMPONENTS Widgets Multimedia Network LinguistTools REQUIRED)
|
|
|
|
find_package(uchardet)
|
2020-04-19 18:22:21 +08:00
|
|
|
find_package(PkgConfig)
|
|
|
|
|
2020-05-27 12:50:49 +08:00
|
|
|
if (PKG_CONFIG_FOUND)
|
2023-07-05 23:38:22 +08:00
|
|
|
pkg_check_modules(TagLib taglib IMPORTED_TARGET)
|
2020-05-27 12:50:49 +08:00
|
|
|
endif ()
|
2020-04-06 15:15:13 +08:00
|
|
|
|
2020-06-04 23:54:34 +08:00
|
|
|
set (PMUSIC_CPP_FILES
|
|
|
|
main.cpp
|
|
|
|
mainwindow.cpp
|
|
|
|
seekableslider.cpp
|
2024-09-06 00:17:39 +08:00
|
|
|
playlistmanager.cpp
|
2020-06-04 23:54:34 +08:00
|
|
|
singleapplicationmanager.cpp
|
2024-09-20 20:59:40 +08:00
|
|
|
lrcbar.cpp
|
|
|
|
lyricsmanager.cpp
|
2020-06-04 23:54:34 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set (PMUSIC_HEADER_FILES
|
|
|
|
mainwindow.h
|
|
|
|
seekableslider.h
|
2024-09-06 00:17:39 +08:00
|
|
|
playlistmanager.h
|
2020-06-04 23:54:34 +08:00
|
|
|
singleapplicationmanager.h
|
2024-09-20 20:59:40 +08:00
|
|
|
lrcbar.h
|
|
|
|
lyricsmanager.h
|
2020-06-04 23:54:34 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
set (PMUSIC_UI_FILES
|
|
|
|
mainwindow.ui
|
|
|
|
)
|
|
|
|
|
2020-04-08 18:16:45 +08:00
|
|
|
set (EXE_NAME pmusic)
|
|
|
|
|
2020-06-04 23:54:34 +08:00
|
|
|
# Translation
|
|
|
|
file (GLOB PMUSIC_TS_FILES languages/*.ts)
|
|
|
|
set (PMUSIC_CPP_FILES_FOR_I18N ${PMUSIC_CPP_FILES} ${PMUSIC_UI_FILES})
|
|
|
|
|
2024-09-08 15:36:28 +08:00
|
|
|
add_executable(${EXE_NAME} WIN32
|
2020-06-04 23:54:34 +08:00
|
|
|
${PMUSIC_HEADER_FILES}
|
|
|
|
${PMUSIC_CPP_FILES}
|
|
|
|
${PMUSIC_UI_FILES}
|
|
|
|
resources.qrc
|
2024-09-07 12:14:54 +08:00
|
|
|
)
|
2020-06-04 23:54:34 +08:00
|
|
|
|
2024-09-07 12:14:54 +08:00
|
|
|
qt_add_translations(${EXE_NAME}
|
|
|
|
TS_FILES
|
|
|
|
${PMUSIC_TS_FILES}
|
2020-04-06 15:15:13 +08:00
|
|
|
)
|
|
|
|
|
2024-09-08 15:36:28 +08:00
|
|
|
if (WIN32)
|
|
|
|
target_sources(${EXE_NAME} PRIVATE assets/pineapple-music.rc)
|
|
|
|
endif ()
|
|
|
|
|
2020-05-27 12:50:49 +08:00
|
|
|
if (NOT TagLib_FOUND)
|
2024-09-23 19:48:26 +08:00
|
|
|
target_compile_definitions(${EXE_NAME} PRIVATE NO_TAGLIB=1)
|
2023-07-05 23:38:22 +08:00
|
|
|
else ()
|
|
|
|
target_link_libraries(${EXE_NAME} PRIVATE PkgConfig::TagLib)
|
2020-05-27 12:50:49 +08:00
|
|
|
endif ()
|
|
|
|
|
2024-09-22 14:27:53 +08:00
|
|
|
if (NOT uchardet_FOUND)
|
2024-09-23 19:48:26 +08:00
|
|
|
target_compile_definitions(${EXE_NAME} PRIVATE NO_UCHARDET=1)
|
2024-09-22 14:27:53 +08:00
|
|
|
else ()
|
|
|
|
target_link_libraries (${EXE_NAME} PRIVATE uchardet::libuchardet)
|
|
|
|
endif ()
|
|
|
|
|
2023-07-05 23:38:22 +08:00
|
|
|
target_link_libraries(${EXE_NAME} PRIVATE Qt::Widgets Qt::Multimedia Qt::Network)
|
2020-04-11 23:16:24 +08:00
|
|
|
|
2020-04-08 18:16:45 +08:00
|
|
|
# Install settings
|
|
|
|
if (WIN32)
|
|
|
|
# FIXME: try to avoid install to a "bin" subfolder under windows...
|
|
|
|
# when fixed, don't forget to update the CI config file...
|
|
|
|
elseif (UNIX)
|
|
|
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
|
|
|
set(CMAKE_INSTALL_PREFIX /usr)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# install icon
|
2024-09-08 00:34:45 +08:00
|
|
|
install(
|
2020-04-08 18:16:45 +08:00
|
|
|
FILES icons/app-icon.svg
|
|
|
|
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps"
|
2024-09-08 00:34:45 +08:00
|
|
|
RENAME net.blumia.pineapple-music.svg
|
2020-04-08 18:16:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# install shortcut
|
2024-09-08 00:34:45 +08:00
|
|
|
install(
|
|
|
|
FILES dist/net.blumia.pineapple-music.desktop
|
2020-04-08 18:16:45 +08:00
|
|
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set (INSTALL_TARGETS_DEFAULT_ARGS
|
2023-07-05 23:38:22 +08:00
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Devel
|
2020-04-08 18:16:45 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
install (
|
|
|
|
TARGETS ${EXE_NAME}
|
|
|
|
${INSTALL_TARGETS_DEFAULT_ARGS}
|
|
|
|
)
|
2024-09-22 14:27:53 +08:00
|
|
|
|
|
|
|
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|