From 727e50cae16a9887a6b2ff7a564c1818eedf59a0 Mon Sep 17 00:00:00 2001 From: Chris Josten Date: Mon, 26 Oct 2020 00:14:46 +0100 Subject: [PATCH] Updated build system to fix issues - Application could not be launched by the invoker because of some missing compiler flags (-rdynamic -pie) - Private libraries were not found due to incorrect rpath being set - Moved the qml list of files for sailfish from qtquick to sailfish (Stupid mistake I made because my editor doesn't really differentiate between different files with the same name in different folders) --- CMakeLists.txt | 1 + core/CMakeLists.txt | 2 +- qtquick/.qmake.stash | 21 ------------- qtquick/CMakeLists.txt | 66 +++++++++++++++------------------------- rpm/harbour-sailfin.yaml | 1 + sailfish/CMakeLists.txt | 46 +++++++++++++++++++++++++++- 6 files changed, 73 insertions(+), 64 deletions(-) delete mode 100644 qtquick/.qmake.stash diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b3f5b4..3223568 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,7 @@ project(harbour-sailfin) set (CMAKE_CXX_STANDARD 17) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CMAKE_AUTOMOC ON) +cmake_policy(SET CMP0048 NEW) # Options option(SAILFISHOS "Build SailfishOS version of application") diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index df5c8c0..fd696ba 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -1,4 +1,4 @@ -project(jellyfin-qt) +project(jellyfin-qt VERSION 0.1.0) find_package(Qt5 5.6 COMPONENTS Multimedia Network Qml WebSockets REQUIRED) include(GNUInstallDirs) diff --git a/qtquick/.qmake.stash b/qtquick/.qmake.stash deleted file mode 100644 index febeb7a..0000000 --- a/qtquick/.qmake.stash +++ /dev/null @@ -1,21 +0,0 @@ -QMAKE_CXX.QT_COMPILER_STDCXX = 201402L -QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 10 -QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2 -QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0 -QMAKE_CXX.COMPILER_MACROS = \ - QT_COMPILER_STDCXX \ - QMAKE_GCC_MAJOR_VERSION \ - QMAKE_GCC_MINOR_VERSION \ - QMAKE_GCC_PATCH_VERSION -QMAKE_CXX.INCDIRS = \ - /usr/include/c++/10.2.0 \ - /usr/include/c++/10.2.0/x86_64-pc-linux-gnu \ - /usr/include/c++/10.2.0/backward \ - /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include \ - /usr/local/include \ - /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/include-fixed \ - /usr/include -QMAKE_CXX.LIBDIRS = \ - /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0 \ - /usr/lib \ - /lib diff --git a/qtquick/CMakeLists.txt b/qtquick/CMakeLists.txt index 5658d95..67f7cee 100644 --- a/qtquick/CMakeLists.txt +++ b/qtquick/CMakeLists.txt @@ -2,46 +2,30 @@ 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) + +install(TARGETS harbour-sailfin + RUNTIME DESTINATION bin +) + +install(DIRECTORY translations + DESTINATION share/harbour-sailfin + FILES_MATCHING PATTERN "*.qm" +) + +# Tell Qt Creator where the application executable(s) would be located on the +# device. +# +# It is not necessary to list other deployables than executables (runtime +# targets) here. The deployment process of Sailfish OS projects is opaque to +# Qt Creator and the information contained in QtCreatorDeployment.txt is only +# used to locate the executable associated with the active run configuration +# on the device in order to run it. +# +# Search the Qt Creator Manual to learn about the QtCreatorDeployment.txt file +# format. +file(WRITE "${CMAKE_BINARY_DIR}/QtCreatorDeployment.txt" + "${CMAKE_INSTALL_PREFIX} + ${CMAKE_BINARY_DIR}/harbour-sailfin:bin +") diff --git a/rpm/harbour-sailfin.yaml b/rpm/harbour-sailfin.yaml index e92e5d7..ce5e129 100644 --- a/rpm/harbour-sailfin.yaml +++ b/rpm/harbour-sailfin.yaml @@ -44,6 +44,7 @@ Macros: - '__requires_exclude; ^libjellyfin-qt.*$' ConfigOptions: + - -DCMAKE_BUILD_TYPE=Release - -DSAILFISHOS=1 - -DSAILFIN_VERSION='%{version}-%{release}' diff --git a/sailfish/CMakeLists.txt b/sailfish/CMakeLists.txt index 99a86b6..d606834 100644 --- a/sailfish/CMakeLists.txt +++ b/sailfish/CMakeLists.txt @@ -7,8 +7,52 @@ find_package(SailfishApp 1.0 REQUIRED) set(harbour-sailfin_SOURCES src/harbour-sailfin.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_executable(harbour-sailfin ${harbour-sailfin_SOURCES}) -target_link_libraries(harbour-sailfin PRIVATE Qt5::Gui Qt5::Qml Qt5::Quick SailfishApp::SailfishApp jellyfin-qt) +target_link_libraries(harbour-sailfin PRIVATE Qt5::Gui Qt5::Qml Qt5::Quick SailfishApp::SailfishApp + # Note: this may break when the compiler changes. -rdynamic and -pie seem to be needed for the + # invoker/booster to work + jellyfin-qt "-Wl,-rpath,${CMAKE_INSTALL_LIBDIR} -rdynamic -pie") + +add_custom_target(harbour-sailfin-qml ${sailfin_QML_SOURCES}) install(TARGETS harbour-sailfin RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})