From 228bcfb685c81e2aff56a22eb6fbd8aa7e11cd33 Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Sun, 25 Oct 2020 19:58:02 +0100 Subject: [PATCH] Switched to a sane build system (CMake) --- CMakeLists.txt | 21 +++++ cmake/FindSailfishApp.cmake | 39 +++++++++ core/CMakeLists.txt | 42 ++++++++++ core/core.pro | 34 -------- core/defines.pri | 2 - .../{ => JellyfinQt}/credentialmanager.h | 0 core/include/JellyfinQt/jellyfin.h | 16 ++++ .../{ => JellyfinQt}/jellyfinapiclient.h | 0 .../{ => JellyfinQt}/jellyfinapimodel.h | 24 ++---- .../{ => JellyfinQt}/jellyfindeviceprofile.h | 0 core/include/{ => JellyfinQt}/jellyfinitem.h | 0 .../jellyfinplaybackmanager.h | 0 .../{ => JellyfinQt}/jellyfinwebsocket.h | 0 core/include/{ => JellyfinQt}/jsonhelper.h | 0 .../{ => JellyfinQt}/serverdiscoverymodel.h | 0 core/include/jellyfin.h | 16 ---- core/src/credentialmanager.cpp | 2 +- core/src/jellyfin.cpp | 20 ++++- core/src/jellyfinapiclient.cpp | 2 +- core/src/jellyfinapimodel.cpp | 25 +++++- core/src/jellyfindeviceprofile.cpp | 2 +- core/src/jellyfinitem.cpp | 2 +- core/src/jellyfinplaybackmanager.cpp | 2 +- core/src/jellyfinwebsocket.cpp | 2 +- core/src/jsonhelper.cpp | 20 ++++- core/src/serverdiscoverymodel.cpp | 2 +- desktop/desktop.pro | 14 ---- harbour-sailfin.pri | 7 -- harbour-sailfin.pro | 28 ------- {desktop => qtquick}/.qmake.stash | 0 qtquick/CMakeLists.txt | 47 +++++++++++ {desktop => qtquick}/src/main.cpp | 2 + rpm/harbour-sailfin.yaml | 8 +- sailfish/CMakeLists.txt | 37 +++++++++ sailfish/sailfish.pro | 79 ------------------- sailfish/src/harbour-sailfin.cpp | 2 +- 36 files changed, 286 insertions(+), 211 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 cmake/FindSailfishApp.cmake create mode 100644 core/CMakeLists.txt delete mode 100644 core/core.pro delete mode 100644 core/defines.pri rename core/include/{ => JellyfinQt}/credentialmanager.h (100%) create mode 100644 core/include/JellyfinQt/jellyfin.h rename core/include/{ => JellyfinQt}/jellyfinapiclient.h (100%) rename core/include/{ => JellyfinQt}/jellyfinapimodel.h (89%) rename core/include/{ => JellyfinQt}/jellyfindeviceprofile.h (100%) rename core/include/{ => JellyfinQt}/jellyfinitem.h (100%) rename core/include/{ => JellyfinQt}/jellyfinplaybackmanager.h (100%) rename core/include/{ => JellyfinQt}/jellyfinwebsocket.h (100%) rename core/include/{ => JellyfinQt}/jsonhelper.h (100%) rename core/include/{ => JellyfinQt}/serverdiscoverymodel.h (100%) delete mode 100644 core/include/jellyfin.h delete mode 100644 desktop/desktop.pro delete mode 100644 harbour-sailfin.pri delete mode 100644 harbour-sailfin.pro rename {desktop => qtquick}/.qmake.stash (100%) create mode 100644 qtquick/CMakeLists.txt rename {desktop => qtquick}/src/main.cpp (67%) create mode 100644 sailfish/CMakeLists.txt delete mode 100644 sailfish/sailfish.pro diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1b3f5b4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.11) +project(harbour-sailfin) +set (CMAKE_CXX_STANDARD 17) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") +set(CMAKE_AUTOMOC ON) + +# Options +option(SAILFISHOS "Build SailfishOS version of application") +option(PLATFORM_QTQUICK "Build QtQuick version of application") + +if(SAILFISHOS) + # Hardcode this less? + set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/share/harbour-sailfin/lib") +endif() + +add_subdirectory(core) +if(SAILFISHOS) + add_subdirectory(sailfish) +else() + add_subdirectory(qtquick) +endif() diff --git a/cmake/FindSailfishApp.cmake b/cmake/FindSailfishApp.cmake new file mode 100644 index 0000000..fc97bd0 --- /dev/null +++ b/cmake/FindSailfishApp.cmake @@ -0,0 +1,39 @@ +# - Try to find libsailfishapp +# Once done this will define +# SailfishApp_FOUND - System has libsailfishapp +# SailfishApp_INCLUDE_DIRS - The libsailfishapp include directories +# SailfishApp_LIBRARIES - The libraries needed to use libsailfishapp +# SailfishApp_DEFINITIONS - Compiler switches required for using libsailfishapp + +find_package(PkgConfig) +pkg_check_modules(PC_SailfishApp QUIET sailfishapp) +set(SailfishApp_DEFINITIONS ${PC_SailfishApp_CFLAGS_OTHER}) + +find_path(SailfishApp_INCLUDE_DIR sailfishapp.h + HINTS ${PC_SailfishApp_INCLUDEDIR} ${PC_SailfishApp_INCLUDE_DIRS} + PATH_SUFFIXES sailfishapp ) + +find_library(SailfishApp_LIBRARY NAMES sailfishapp libsailfishapp + HINTS ${PC_SailfishApp_LIBDIR} ${PC_SailfishApp_LIBRARY_DIRS} ) + +include(FindPackageHandleStandardArgs) +# handle the QUIETLY and REQUIRED arguments and set LIBSailfishApp_FOUND to TRUE +# if all listed variables are TRUE +set(SailfishApp_VERSION ${PC_SAILFISHAPP_VERSION}) +find_package_handle_standard_args(SailfishApp + FOUND_VAR SailfishApp_FOUND + REQUIRED_VARS + SailfishApp_LIBRARY + SailfishApp_INCLUDE_DIR + VERSION_VAR SailfishApp_VERSION) + +if(SailfishApp_FOUND AND NOT TARGET Foo::Foo) + add_library(SailfishApp::SailfishApp UNKNOWN IMPORTED) + set_target_properties(SailfishApp::SailfishApp PROPERTIES + IMPORTED_LOCATION "${SailfishApp_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_SailfishApp_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${SailfishApp_INCLUDE_DIR}" + ) +endif() + +mark_as_advanced(SailfishApp_INCLUDE_DIR SailfishApp_LIBRARY ) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 0000000..df5c8c0 --- /dev/null +++ b/core/CMakeLists.txt @@ -0,0 +1,42 @@ +project(jellyfin-qt) +find_package(Qt5 5.6 COMPONENTS Multimedia Network Qml WebSockets REQUIRED) +include(GNUInstallDirs) + +set(jellyfin-qt_SOURCES + src/credentialmanager.cpp + src/jellyfin.cpp + src/jellyfinapiclient.cpp + src/jellyfinapimodel.cpp + src/jellyfindeviceprofile.cpp + src/jellyfinitem.cpp + src/jellyfinplaybackmanager.cpp + src/jellyfinwebsocket.cpp + src/jsonhelper.cpp + src/serverdiscoverymodel.cpp) + +set(jellyfin-qt_HEADERS + include/JellyfinQt/credentialmanager.h + include/JellyfinQt/jellyfin.h + include/JellyfinQt/jellyfinapiclient.h + include/JellyfinQt/jellyfinapimodel.h + include/JellyfinQt/jellyfindeviceprofile.h + include/JellyfinQt/jellyfinitem.h + include/JellyfinQt/jellyfinplaybackmanager.h + include/JellyfinQt/jellyfinwebsocket.h + include/JellyfinQt/jsonhelper.h + include/JellyfinQt/serverdiscoverymodel.h) + +add_definitions(-DSAILFIN_VERSION=\"${SAILFIN_VERSION}\") +add_library(jellyfin-qt ${jellyfin-qt_SOURCES} ${jellyfin-qt_HEADERS}) +target_include_directories(jellyfin-qt + PUBLIC "include" +) +target_link_libraries(jellyfin-qt PUBLIC Qt5::Core Qt5::Multimedia Qt5::Network Qt5::Qml Qt5::WebSockets) +set_target_properties(jellyfin-qt PROPERTIES CXX_VISIBILITY_PRESET default) +install(TARGETS jellyfin-qt + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + +export(TARGETS jellyfin-qt FILE JellyfinQtConfig.cmake) diff --git a/core/core.pro b/core/core.pro deleted file mode 100644 index 50e52b0..0000000 --- a/core/core.pro +++ /dev/null @@ -1,34 +0,0 @@ -TEMPLATE = lib -QT += qml multimedia network websockets - -include(defines.pri) -include(../harbour-sailfin.pri) - -SOURCES += \ - src/credentialmanager.cpp \ - src/jellyfin.cpp \ - src/jellyfinapiclient.cpp \ - src/jellyfinapimodel.cpp \ - src/jellyfindeviceprofile.cpp \ - src/jellyfinitem.cpp \ - src/jellyfinplaybackmanager.cpp \ - src/jellyfinwebsocket.cpp \ - src/jsonhelper.cpp \ - src/serverdiscoverymodel.cpp - -HEADERS += \ - include/credentialmanager.h \ - include/jellyfin.h \ - include/jellyfinapiclient.h \ - include/jellyfinapimodel.h \ - include/jellyfindeviceprofile.h \ - include/jellyfinitem.h \ - include/jellyfinplaybackmanager.h \ - include/jellyfinwebsocket.h \ - include/jsonhelper.h \ - include/serverdiscoverymodel.h - -VERSION = $$SAILFIN_VERSION - -TARGET = jellyfin-qt -DESTDIR = lib diff --git a/core/defines.pri b/core/defines.pri deleted file mode 100644 index 0ac4f26..0000000 --- a/core/defines.pri +++ /dev/null @@ -1,2 +0,0 @@ -message(Including $$_FILE_ from $$IN_PWD) -INCLUDEPATH += $$IN_PWD/include diff --git a/core/include/credentialmanager.h b/core/include/JellyfinQt/credentialmanager.h similarity index 100% rename from core/include/credentialmanager.h rename to core/include/JellyfinQt/credentialmanager.h diff --git a/core/include/JellyfinQt/jellyfin.h b/core/include/JellyfinQt/jellyfin.h new file mode 100644 index 0000000..3a1e36e --- /dev/null +++ b/core/include/JellyfinQt/jellyfin.h @@ -0,0 +1,16 @@ +#ifndef JELLYFIN_H +#define JELLYFIN_H + +#include + +#include "JellyfinQt/jellyfinapiclient.h" +#include "JellyfinQt/jellyfinapimodel.h" +#include "JellyfinQt/jellyfinitem.h" +#include "JellyfinQt/serverdiscoverymodel.h" +#include "JellyfinQt/jellyfinplaybackmanager.h" + +namespace Jellyfin { +void registerTypes(); +} + +#endif // JELLYFIN_H diff --git a/core/include/jellyfinapiclient.h b/core/include/JellyfinQt/jellyfinapiclient.h similarity index 100% rename from core/include/jellyfinapiclient.h rename to core/include/JellyfinQt/jellyfinapiclient.h diff --git a/core/include/jellyfinapimodel.h b/core/include/JellyfinQt/jellyfinapimodel.h similarity index 89% rename from core/include/jellyfinapimodel.h rename to core/include/JellyfinQt/jellyfinapimodel.h index 1541524..dc36589 100644 --- a/core/include/jellyfinapimodel.h +++ b/core/include/JellyfinQt/jellyfinapimodel.h @@ -251,8 +251,7 @@ private: */ class PublicUserModel : public ApiModel { public: - explicit PublicUserModel (QObject *parent = nullptr) - : ApiModel ("/users/public", false, false, parent) { } + explicit PublicUserModel (QObject *parent = nullptr); }; /** @@ -270,44 +269,37 @@ public slots: class UserViewModel : public ApiModel { public: - explicit UserViewModel (QObject *parent = nullptr) - : ApiModel ("/Users/{{user}}/Views", true, false, parent) {} + explicit UserViewModel (QObject *parent = nullptr); }; class UserItemModel : public ItemModel { public: - explicit UserItemModel (QObject *parent = nullptr) - : ItemModel ("/Users/{{user}}/Items", true, false, parent) {} + explicit UserItemModel (QObject *parent = nullptr); }; class UserItemResumeModel : public ItemModel { public: - explicit UserItemResumeModel (QObject *parent = nullptr) - : ItemModel ("/Users/{{user}}/Items/Resume", true, false, parent) {} + explicit UserItemResumeModel (QObject *parent = nullptr); }; class UserItemLatestModel : public ItemModel { public: - explicit UserItemLatestModel (QObject *parent = nullptr) - : ItemModel ("/Users/{{user}}/Items/Latest", false, false, parent) {} + explicit UserItemLatestModel (QObject *parent = nullptr); }; class ShowNextUpModel : public ItemModel { public: - explicit ShowNextUpModel (QObject *parent = nullptr) - : ItemModel("/Shows/NextUp", true, true, parent) {} + explicit ShowNextUpModel (QObject *parent = nullptr); }; class ShowSeasonsModel : public ItemModel { public: - explicit ShowSeasonsModel (QObject *parent = nullptr) - : ItemModel ("/Shows/{{show}}/Seasons", true, true, parent) {} + explicit ShowSeasonsModel (QObject *parent = nullptr); }; class ShowEpisodesModel : public ItemModel { public: - explicit ShowEpisodesModel (QObject *parent = nullptr) - : ItemModel ("/Shows/{{show}}/Episodes", true, true, parent) {} + explicit ShowEpisodesModel (QObject *parent = nullptr); }; diff --git a/core/include/jellyfindeviceprofile.h b/core/include/JellyfinQt/jellyfindeviceprofile.h similarity index 100% rename from core/include/jellyfindeviceprofile.h rename to core/include/JellyfinQt/jellyfindeviceprofile.h diff --git a/core/include/jellyfinitem.h b/core/include/JellyfinQt/jellyfinitem.h similarity index 100% rename from core/include/jellyfinitem.h rename to core/include/JellyfinQt/jellyfinitem.h diff --git a/core/include/jellyfinplaybackmanager.h b/core/include/JellyfinQt/jellyfinplaybackmanager.h similarity index 100% rename from core/include/jellyfinplaybackmanager.h rename to core/include/JellyfinQt/jellyfinplaybackmanager.h diff --git a/core/include/jellyfinwebsocket.h b/core/include/JellyfinQt/jellyfinwebsocket.h similarity index 100% rename from core/include/jellyfinwebsocket.h rename to core/include/JellyfinQt/jellyfinwebsocket.h diff --git a/core/include/jsonhelper.h b/core/include/JellyfinQt/jsonhelper.h similarity index 100% rename from core/include/jsonhelper.h rename to core/include/JellyfinQt/jsonhelper.h diff --git a/core/include/serverdiscoverymodel.h b/core/include/JellyfinQt/serverdiscoverymodel.h similarity index 100% rename from core/include/serverdiscoverymodel.h rename to core/include/JellyfinQt/serverdiscoverymodel.h diff --git a/core/include/jellyfin.h b/core/include/jellyfin.h deleted file mode 100644 index ccfed30..0000000 --- a/core/include/jellyfin.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef JELLYFIN_H -#define JELLYFIN_H - -#include - -#include "jellyfinapiclient.h" -#include "jellyfinapimodel.h" -#include "jellyfinitem.h" -#include "serverdiscoverymodel.h" -#include "jellyfinplaybackmanager.h" - -namespace Jellyfin { -void registerTypes(); -} - -#endif // JELLYFIN_H diff --git a/core/src/credentialmanager.cpp b/core/src/credentialmanager.cpp index f64292f..3a469cb 100644 --- a/core/src/credentialmanager.cpp +++ b/core/src/credentialmanager.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "credentialmanager.h" +#include "JellyfinQt/credentialmanager.h" CredentialsManager * CredentialsManager::newInstance(QObject *parent) { return new FallbackCredentialsManager(parent); diff --git a/core/src/jellyfin.cpp b/core/src/jellyfin.cpp index a26e86c..e9049bc 100644 --- a/core/src/jellyfin.cpp +++ b/core/src/jellyfin.cpp @@ -1,4 +1,22 @@ -#include "jellyfin.h" +/* +Sailfin: a Jellyfin client written using Qt +Copyright (C) 2020 Chris Josten + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include "JellyfinQt/jellyfin.h" namespace Jellyfin { void registerTypes() { diff --git a/core/src/jellyfinapiclient.cpp b/core/src/jellyfinapiclient.cpp index d993600..f9e5322 100644 --- a/core/src/jellyfinapiclient.cpp +++ b/core/src/jellyfinapiclient.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfinapiclient.h" +#include "JellyfinQt/jellyfinapiclient.h" namespace Jellyfin { diff --git a/core/src/jellyfinapimodel.cpp b/core/src/jellyfinapimodel.cpp index e93c2d8..9aef149 100644 --- a/core/src/jellyfinapimodel.cpp +++ b/core/src/jellyfinapimodel.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfinapimodel.h" +#include "JellyfinQt/jellyfinapimodel.h" namespace Jellyfin { ApiModel::ApiModel(QString path, bool hasRecordResponse, bool addUserId, QObject *parent) @@ -240,6 +240,29 @@ void ItemModel::onUserDataChanged(const QString &itemId, QSharedPointer(URI, 1, 0, "ApiModel", "Is enum and base class"); diff --git a/core/src/jellyfindeviceprofile.cpp b/core/src/jellyfindeviceprofile.cpp index 6ee8527..1dca3fd 100644 --- a/core/src/jellyfindeviceprofile.cpp +++ b/core/src/jellyfindeviceprofile.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfindeviceprofile.h" +#include "JellyfinQt/jellyfindeviceprofile.h" namespace Jellyfin { diff --git a/core/src/jellyfinitem.cpp b/core/src/jellyfinitem.cpp index 8eab9f0..08bf5c5 100644 --- a/core/src/jellyfinitem.cpp +++ b/core/src/jellyfinitem.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfinitem.h" +#include "JellyfinQt/jellyfinitem.h" namespace Jellyfin { const QRegularExpression JsonSerializable::m_listExpression = QRegularExpression("^QList<\\s*([a-zA-Z0-9]*)\\s*\\*?\\s*>$"); diff --git a/core/src/jellyfinplaybackmanager.cpp b/core/src/jellyfinplaybackmanager.cpp index 8347c44..2e852fe 100644 --- a/core/src/jellyfinplaybackmanager.cpp +++ b/core/src/jellyfinplaybackmanager.cpp @@ -17,7 +17,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfinplaybackmanager.h" +#include "JellyfinQt/jellyfinplaybackmanager.h" namespace Jellyfin { diff --git a/core/src/jellyfinwebsocket.cpp b/core/src/jellyfinwebsocket.cpp index 940a377..f931782 100644 --- a/core/src/jellyfinwebsocket.cpp +++ b/core/src/jellyfinwebsocket.cpp @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "jellyfinwebsocket.h" +#include "JellyfinQt/jellyfinwebsocket.h" namespace Jellyfin { WebSocket::WebSocket(ApiClient *client) diff --git a/core/src/jsonhelper.cpp b/core/src/jsonhelper.cpp index 60f29a6..7a6c7d8 100644 --- a/core/src/jsonhelper.cpp +++ b/core/src/jsonhelper.cpp @@ -1,4 +1,22 @@ -#include "jsonhelper.h" +/* +Sailfin: a Jellyfin client written using Qt +Copyright (C) 2020 Chris Josten + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ +#include "JellyfinQt/jsonhelper.h" namespace Jellyfin { diff --git a/core/src/serverdiscoverymodel.cpp b/core/src/serverdiscoverymodel.cpp index ead644a..daa21bf 100644 --- a/core/src/serverdiscoverymodel.cpp +++ b/core/src/serverdiscoverymodel.cpp @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "serverdiscoverymodel.h" +#include "JellyfinQt/serverdiscoverymodel.h" namespace Jellyfin { ServerDiscoveryModel::ServerDiscoveryModel(QObject *parent) diff --git a/desktop/desktop.pro b/desktop/desktop.pro deleted file mode 100644 index 941e384..0000000 --- a/desktop/desktop.pro +++ /dev/null @@ -1,14 +0,0 @@ -TEMPLATE = app - -SOURCES += \ - src/main.cpp - -include(../harbour-sailfin.pri) - -# Include our library - -LIBS += -L$$OUT_PWD/../core/lib -ljellyfin-qt -core.files += ../core/lib -core.path = /usr/share/$${TARGET} - -INSTALLS += core diff --git a/harbour-sailfin.pri b/harbour-sailfin.pri deleted file mode 100644 index f414e4a..0000000 --- a/harbour-sailfin.pri +++ /dev/null @@ -1,7 +0,0 @@ -!defined(SAILFIN_VERSION, var) { - SAILFIN_VERSION = "0.0.0-unknown" -} -QMAKE_CXXFLAGS += -std=c++17 - -# Help, something keeps eating my quotes and backslashes -DEFINES += "SAILFIN_VERSION=\"\\\"$$SAILFIN_VERSION\\\"\"" diff --git a/harbour-sailfin.pro b/harbour-sailfin.pro deleted file mode 100644 index 3578948..0000000 --- a/harbour-sailfin.pro +++ /dev/null @@ -1,28 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS = core - -core.subdir = core - -defined(OS_SAILFISHOS, var){ - SUBDIRS += sailfish - sailfish.subdir = sailfish - sailfish.depends = core -} -defined(OS_DESKTOP, var) { - SUBDIRS += desktop - desktop.subdir = desktop - desktop.depends = core -} - -message($$SUBDIRS) - -# German translation is enabled as an example. If you aren't -# planning to localize your app, remember to comment out the -# following TRANSLATIONS line. And also do not forget to -# modify the localized app name in the the .desktop file. -# TRANSLATIONS += \ - -DISTFILES += \ - sailfish/qml/pages/itemdetails/PhotoPage.qml - - diff --git a/desktop/.qmake.stash b/qtquick/.qmake.stash similarity index 100% rename from desktop/.qmake.stash rename to qtquick/.qmake.stash diff --git a/qtquick/CMakeLists.txt b/qtquick/CMakeLists.txt new file mode 100644 index 0000000..5658d95 --- /dev/null +++ b/qtquick/CMakeLists.txt @@ -0,0 +1,47 @@ +find_package(Qt5 COMPONENTS Gui Qml Quick) +set(sailfin_SOURCES + src/main.cpp) + +set(sailfin_QML_SOURCES + qml/Constants.qml + qml/Utils.js + qml/components/GlassyBackground.qml + qml/components/IconListItem.qml + qml/components/LibraryItemDelegate.qml + qml/components/MoreSection.qml + qml/components/PlainLabel.qml + qml/components/PlayToolbar.qml + qml/components/RemoteImage.qml + qml/components/Shim.qml + qml/components/UserGridDelegate.qml + qml/components/VideoPlayer.qml + qml/components/VideoTrackSelector.qml + qml/components/itemdetails/SeasonDetails.qml + qml/components/videoplayer/VideoError.qml + qml/components/videoplayer/VideoHud.qml + qml/cover/CoverPage.qml + qml/cover/PosterCover.qml + qml/cover/VideoCover.qml + qml/pages/LegalPage.qml + qml/pages/MainPage.qml + qml/pages/AboutPage.qml + qml/harbour-sailfin.qml + qml/pages/SettingsPage.qml + qml/pages/VideoPage.qml + qml/pages/itemdetails/BaseDetailPage.qml + qml/pages/itemdetails/CollectionPage.qml + qml/pages/itemdetails/EpisodePage.qml + qml/pages/itemdetails/FilmPage.qml + qml/pages/itemdetails/MusicAlbumPage.qml + qml/pages/itemdetails/SeasonPage.qml + qml/pages/itemdetails/SeriesPage.qml + qml/pages/itemdetails/UnsupportedPage.qml + qml/pages/itemdetails/VideoPage.qml + qml/pages/setup/AddServerConnectingPage.qml + qml/pages/setup/LoginDialog.qml + qml/qmldir) + +add_custom_target(harbour-sailfin-qml ${sailfin_QML_SOURCES}) + +add_executable(sailfin ${sailfin_SOURCES}) +target_link_libraries(sailfin PUBLIC Qt5::Gui Qt5::Qml Qt5::Quick jellyfin-qt) diff --git a/desktop/src/main.cpp b/qtquick/src/main.cpp similarity index 67% rename from desktop/src/main.cpp rename to qtquick/src/main.cpp index 77b8e94..84e0c9a 100644 --- a/desktop/src/main.cpp +++ b/qtquick/src/main.cpp @@ -1,7 +1,9 @@ #include +#include int main(int argc, char** argv) { QGuiApplication app(argc, argv); + Jellyfin::registerTypes(); return app.exec(); } diff --git a/rpm/harbour-sailfin.yaml b/rpm/harbour-sailfin.yaml index f932926..e92e5d7 100644 --- a/rpm/harbour-sailfin.yaml +++ b/rpm/harbour-sailfin.yaml @@ -12,7 +12,7 @@ Sources: - '%{name}-%{version}.tar.bz2' Description: | Play video's and music from your Jellyfin media player on your Sailfish device -Builder: qmake5 +Builder: cmake # This section specifies build dependencies that are resolved using pkgconfig. # This is the preferred way of specifying build dependencies for your package. @@ -43,9 +43,9 @@ Macros: - '__provides_exclude_from; ^%{_datadir}/.*$' - '__requires_exclude; ^libjellyfin-qt.*$' -QMakeOptions: - - OS_SAILFISHOS=1 - - SAILFIN_VERSION='%{version}-%{release}' +ConfigOptions: + - -DSAILFISHOS=1 + - -DSAILFIN_VERSION='%{version}-%{release}' # For more information about yaml and what's supported in Sailfish OS # build system, please see https://wiki.merproject.org/wiki/Spectacle diff --git a/sailfish/CMakeLists.txt b/sailfish/CMakeLists.txt new file mode 100644 index 0000000..99a86b6 --- /dev/null +++ b/sailfish/CMakeLists.txt @@ -0,0 +1,37 @@ +project(harbour-sailfin-sailfish) + +# find_library(SAILFISH sailfishapp 1.0 REQUIRED) +find_package(Qt5 COMPONENTS Gui Qml Quick) +find_package(SailfishApp 1.0 REQUIRED) + +set(harbour-sailfin_SOURCES + src/harbour-sailfin.cpp) + +add_executable(harbour-sailfin ${harbour-sailfin_SOURCES}) +target_link_libraries(harbour-sailfin PRIVATE Qt5::Gui Qt5::Qml Qt5::Quick SailfishApp::SailfishApp jellyfin-qt) + +install(TARGETS harbour-sailfin + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + +install(DIRECTORY qml + DESTINATION share/harbour-sailfin +) +install(DIRECTORY translations + DESTINATION share/harbour-sailfin + FILES_MATCHING PATTERN "*.qm" +) +install(FILES harbour-sailfin.desktop + DESTINATION share/applications +) +install(FILES icons/86x86/harbour-sailfin.png + DESTINATION share/icons/hicolor/86x86/apps +) +install(FILES icons/108x108/harbour-sailfin.png + DESTINATION share/icons/hicolor/108x108/apps +) +install(FILES icons/128x128/harbour-sailfin.png + DESTINATION share/icons/hicolor/128x128/apps +) +install(FILES icons/172x172/harbour-sailfin.png + DESTINATION share/icons/hicolor/172x172/apps +) diff --git a/sailfish/sailfish.pro b/sailfish/sailfish.pro deleted file mode 100644 index 7a4119e..0000000 --- a/sailfish/sailfish.pro +++ /dev/null @@ -1,79 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = harbour-sailfin - -#INCLUDEPATH += ../core/include -#DEPENDPATH += ../core -#LIBS += -Lcore -lcore -include(../core/defines.pri) -include(../harbour-sailfin.pri) - -# include our shared library and install it - -LIBS += -L$$OUT_PWD/../core/lib -ljellyfin-qt -core.files += ../core/lib -core.path = /usr/share/$${TARGET} - -INSTALLS += core - -# Other configuration - -CONFIG += sailfishapp # c++17 - -DISTFILES += \ - qml/Constants.qml \ - qml/Utils.js \ - qml/components/GlassyBackground.qml \ - qml/components/IconListItem.qml \ - qml/components/LibraryItemDelegate.qml \ - qml/components/MoreSection.qml \ - qml/components/PlainLabel.qml \ - qml/components/PlayToolbar.qml \ - qml/components/RemoteImage.qml \ - qml/components/Shim.qml \ - qml/components/UserGridDelegate.qml \ - qml/components/VideoPlayer.qml \ - qml/components/VideoTrackSelector.qml \ - qml/components/itemdetails/SeasonDetails.qml \ - qml/components/videoplayer/VideoError.qml \ - qml/components/videoplayer/VideoHud.qml \ - qml/cover/CoverPage.qml \ - qml/cover/PosterCover.qml \ - qml/cover/VideoCover.qml \ - qml/pages/LegalPage.qml \ - qml/pages/MainPage.qml \ - qml/pages/AboutPage.qml \ - qml/harbour-sailfin.qml \ - qml/pages/SettingsPage.qml \ - qml/pages/VideoPage.qml \ - qml/pages/itemdetails/BaseDetailPage.qml \ - qml/pages/itemdetails/CollectionPage.qml \ - qml/pages/itemdetails/EpisodePage.qml \ - qml/pages/itemdetails/FilmPage.qml \ - qml/pages/itemdetails/MusicAlbumPage.qml \ - qml/pages/itemdetails/SeasonPage.qml \ - qml/pages/itemdetails/SeriesPage.qml \ - qml/pages/itemdetails/UnsupportedPage.qml \ - qml/pages/itemdetails/VideoPage.qml \ - qml/pages/setup/AddServerConnectingPage.qml \ - qml/pages/setup/LoginDialog.qml \ - qml/qmldir - -SOURCES += \ - src/harbour-sailfin.cpp - -SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 - -# to disable building translations every time, comment out the -# following CONFIG line -CONFIG += sailfishapp_i18n diff --git a/sailfish/src/harbour-sailfin.cpp b/sailfish/src/harbour-sailfin.cpp index 7b0d1b3..9f96537 100644 --- a/sailfish/src/harbour-sailfin.cpp +++ b/sailfish/src/harbour-sailfin.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include -#include +#include int main(int argc, char *argv[]) { // SailfishApp::main() will display "qml/harbour-sailfin.qml", if you need more