Mercurial > minori
changeset 248:cf47a8f687c0
cmake: remove cmake
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Wed, 24 Jan 2024 20:18:14 -0500 |
parents | 1ae4d8b28a5c |
children | 6b2441c776dd |
files | CMakeLists.txt |
diffstat | 1 files changed, 0 insertions(+), 223 deletions(-) [+] |
line wrap: on
line diff
--- a/CMakeLists.txt Wed Jan 24 20:15:35 2024 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -cmake_minimum_required(VERSION 3.18) -project(minori LANGUAGES CXX VERSION 0.1.0) - -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") - -option(BUILD_SHARED_LIBS "Build using shared libraries" ON) -option(USE_QT6 "Force build with Qt 6" OFF) -option(USE_QT5 "Force build with Qt 5" OFF) -option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF) - -add_subdirectory(dep/anitomy) -add_subdirectory(dep/animia) -add_subdirectory(dep/pugixml) - -# Fix for mingw64 -list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") - -if(USE_QT6) - set(QT_VERSION_MAJOR 6) -elseif(USE_QT5) - set(QT_VERSION_MAJOR 5) -else() - find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) -endif() - -find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) - -find_package(CURL REQUIRED) - -set(LIBRARIES - ${CURL_LIBRARIES} - ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES} - anitomy - animia - pugixml -) - -# We need Cocoa for some OS X stuff -if(APPLE) - find_library(FOUNDATION_LIBRARY Foundation) - find_library(APPKIT_LIBRARY AppKit) - list(APPEND LIBRARIES ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) -endif() - -set(SRC_FILES - # Main entrypoint - src/main.cc - - # Core files and datatype declarations... - src/core/anime.cc - src/core/anime_db.cc - src/core/config.cc - src/core/date.cc - src/core/filesystem.cc - src/core/http.cc - src/core/json.cc - src/core/strings.cc - src/core/time.cc - - # Main window - src/gui/window.cc - src/gui/theme.cc - src/gui/locale.cc - - # Main window pages - src/gui/pages/anime_list.cc - src/gui/pages/now_playing.cc - src/gui/pages/statistics.cc - src/gui/pages/search.cc - src/gui/pages/seasons.cc - src/gui/pages/torrents.cc - src/gui/pages/history.cc - - # Custom widgets - src/gui/widgets/anime_info.cc - src/gui/widgets/poster.cc - src/gui/widgets/clickable_label.cc - src/gui/widgets/sidebar.cc - src/gui/widgets/text.cc - src/gui/widgets/optional_date.cc - - # Dialogs - src/gui/dialog/about.cc - src/gui/dialog/information.cc - src/gui/dialog/settings.cc - src/gui/dialog/settings/application.cc - src/gui/dialog/settings/services.cc - src/gui/dialog/settings/torrents.cc - src/gui/dialog/settings/recognition.cc - src/gui/dialog/settings/library.cc - - # Translate - src/gui/translate/anime.cc - src/gui/translate/anilist.cc - src/gui/translate/config.cc - - # Services (only AniList for now) - src/services/services.cc - src/services/anilist.cc - - # Library - src/library/library.cc - - # Tracking - src/track/media.cc - - # Qt resources - rc/icons.qrc - rc/dark.qrc - rc/player_data.qrc -) - -set(INCLUDE - include - dep/pugixml/src - dep/animia/include - dep/anitomy - dep -) - -set(TS_FILES - rc/locale/en_GB.ts - rc/locale/es.ts -) - -set(DEFINES) - -set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") - -if(UPDATE_TRANSLATIONS) - cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") -endif() -cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) -list(APPEND SRC_FILES ${QM_FILES}) - -function(qt_create_resource_file outfile) - set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") - get_filename_component(DIR ${outfile} DIRECTORY) - foreach (qm ${ARGN}) - file(RELATIVE_PATH name ${DIR} ${qm}) - string(APPEND QRC "\t\t<file>${name}</file>\n") - endforeach() - string(APPEND QRC "\t</qresource>\n</RCC>\n") - file(WRITE ${outfile} ${QRC}) -endfunction() - -qt_create_resource_file("${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc" ${QM_FILES}) -list(APPEND SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") - -# This is also used in the Win32 rc file -set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") - -if(APPLE) # Mac OS X (or OS X (or macOS)) - set(MACOSX_BUNDLE_BUNDLE_NAME "Minori") - set(MACOSX_BUNDLE_BUNDLE_VERSION ${minori_VERSION}) - set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) Paper 2023") - set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.eu.us.paper.minori") - set(MACOSX_BUNDLE_INFO_STRING ${RC_INFO_STRING}) - set(MACOSX_BUNDLE_ICON_FILE rc/osx/favicon.icns) - set(app_icon_osx "${CMAKE_CURRENT_SOURCE_DIR}/rc/osx/favicon.icns") - set_source_files_properties(${app_icon_osx} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") - - list(APPEND SRC_FILES - src/sys/osx/dark_theme.cc - src/sys/osx/filesystem.cc - ${app_icon_osx} - ) - list(APPEND DEFINES MACOSX) -elseif(WIN32) # Windows - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/rc/win32/version.rc.in - ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc - @ONLY - ) - list(APPEND SRC_FILES - src/sys/win32/dark_theme.cc - rc/win32/resource.rc - ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc - ) - list(APPEND DEFINES WIN32) -else() - if(LINUX) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/rc/linux/Minori.desktop.in - ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.desktop - @ONLY - ) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/rc/favicon256.png - ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.png - COPYONLY - ) - endif() - - find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(GLIB gio-2.0 glib-2.0) - if (GLIB_FOUND) - list(APPEND SRC_FILES src/sys/glib/dark_theme.cc) - list(APPEND INCLUDE ${GLIB_INCLUDE_DIRS}) - list(APPEND LIBRARIES ${GLIB_LINK_LIBRARIES}) - list(APPEND DEFINES GLIB) - endif() - endif() -endif() - -add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) -set_property(TARGET minori PROPERTY CXX_STANDARD 17) -set_property(TARGET minori PROPERTY AUTOMOC ON) -set_property(TARGET minori PROPERTY AUTORCC ON) - -target_include_directories(minori PRIVATE ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PUBLIC ${INCLUDE}) -target_link_libraries(minori PRIVATE ${LIBRARIES}) -target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) -target_compile_definitions(minori PRIVATE ${DEFINES}) - -if(APPLE) - set_target_properties(minori PROPERTIES MACOSX_BUNDLE TRUE) -elseif(WIN32) - install(FILES $<TARGET_RUNTIME_DLLS:minori> TYPE BIN) -endif()