Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: compile with cmake #436

Draft
wants to merge 32 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
60be21e
compile with cmake
jmlich Dec 13, 2024
e054ab5
Build with ubuntu touch
jmlich Dec 25, 2024
debfaf5
Make sure ubuntu touch is using qmls from qrc
jmlich Dec 25, 2024
b346ef2
Try to fix spec file
jmlich Dec 25, 2024
1aac7c5
fix lib+mlite
jmlich Dec 25, 2024
11537b2
update qble
jmlich Dec 25, 2024
408052d
update to current libwatchfish
jmlich Dec 26, 2024
810b8f1
Install daemon translations
jmlich Dec 28, 2024
0d44379
Make sure to resolve relative path for translations
jmlich Dec 28, 2024
c23a306
Update spec
jmlich Dec 28, 2024
a1b2b02
Update build for SFOS
jmlich Dec 28, 2024
25887c6
Install icons
jmlich Dec 29, 2024
4d105b8
Merge remote-tracking branch 'origin/master' into cmake
jmlich Dec 29, 2024
de3ee39
install icon
jmlich Dec 30, 2024
d62a5ac
Enable sailfish os modules
jmlich Dec 31, 2024
4e944c6
Add ninja, update cmake
jmlich Dec 31, 2024
d3744f0
%install
jmlich Dec 31, 2024
09a3ee0
build of sailfish os rpm
jmlich Dec 31, 2024
b814bfb
Use qmls from qrc
jmlich Jan 1, 2025
aae28a2
ninja is used to compile
jmlich Jan 1, 2025
db81b32
Disable systemd. feature summary
jmlich Jan 1, 2025
646e39c
Test icons
jmlich Jan 4, 2025
d7cd621
Remove unused icons
jmlich Jan 4, 2025
30ef1ae
add all files into qrc
jmlich Jan 4, 2025
99d6d65
fix uuitk styler icon paths
jmlich Jan 4, 2025
dc4941f
Update icon paths
jmlich Jan 4, 2025
0afbdda
QtCreatorDeployment.txt for ui
jmlich Jan 4, 2025
d931b34
Remove unused and broken icon
jmlich Jan 4, 2025
3c5b1b1
SailfishOS translation dir
jmlich Jan 4, 2025
6a176e3
SailfishOS fix paths
jmlich Jan 4, 2025
e1f9ce4
load chirp other way around
jmlich Jan 4, 2025
20278d4
Update documentation for cmake
jmlich Jan 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sailfishos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
cp -r /share/* . ;
sb2 -t SailfishOS-$OS_VERSION-${{ matrix.arch }} -R zypper --non-interactive ar --no-gpgcheck https://repo.sailfishos.org/obs/sailfishos:/chum/4.6_${{ matrix.arch }}/ sailfishos_chum ;
sb2 -t SailfishOS-$OS_VERSION-${{ matrix.arch }} -R zypper --non-interactive refresh ;
sb2 -t SailfishOS-$OS_VERSION-${{ matrix.arch }} -R zypper --non-interactive in -y mpris-qt5-devel libkf5archive-devel kcoreaddons-devel kdb-devel libKDb3-3 mkcal-qt5-devel libicu-devel pulseaudio-devel;
sb2 -t SailfishOS-$OS_VERSION-${{ matrix.arch }} -R zypper --non-interactive in -y mpris-qt5-devel libkf5archive-devel kcoreaddons-devel kdb-devel libKDb3-3 mkcal-qt5-devel libicu-devel pulseaudio-devel ninja;
mb2 -t SailfishOS-$OS_VERSION-${{ matrix.arch }} build ;
sudo cp -r RPMS/*.rpm /share/output"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ harbour-amazfish.pro.user*
.clickable/
3rdparty/
build/
CMakeLists.txt.*
47 changes: 47 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
cmake_minimum_required(VERSION 3.16)

project(harbour-amazfish LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

include(GNUInstallDirs)
include(FeatureSummary)

find_package(Qt5 COMPONENTS Core Gui Quick Sql DBus LinguistTools REQUIRED)

if(NOT DEFINED FLAVOR)
message(FATAL_ERROR "Please specify the platform using -DFLAVOR=platform as a CMake option. Supported platforms: kirigami, silica, qtcontrols, uuitk.")
elseif(FLAVOR STREQUAL "silica")
add_definitions(-DMER_EDITION_SAILFISH)
add_definitions(-DKF5CALENDARCORE) ### FIME I don't know why this doesn't work with libwatchfish

include(FindPkgConfig)
pkg_search_module(SAILFISH sailfishapp REQUIRED)
elseif(FLAVOR STREQUAL "kirigami")
add_definitions(-Dflavor_kirigami)
elseif(FLAVOR STREQUAL "qtcontrols")
add_definitions(-Dflavor_qtcontrols)
elseif(FLAVOR STREQUAL "uuitk")
add_definitions(-DUUITK_EDITION)
add_subdirectory(click)
else()
message(FATAL_ERROR "Unsupported platform '${FLAVOR}'. Supported platforms: kirigami, silica, qtcontrols, uuitk.")
endif()

add_subdirectory(qble)
add_subdirectory(lib)
add_subdirectory(daemon)
add_subdirectory(ui)

feature_summary(WHAT ALL)
36 changes: 36 additions & 0 deletions click/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_MULTIARCH
OUTPUT_VARIABLE ARCH_TRIPLET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")

set(PROJECT_NAME "harbour-amazfish")
set(FULL_PROJECT_NAME "uk.co.piggz.amazfish")
set(DATA_DIR /)
set(DESKTOP_FILE_NAME ${PROJECT_NAME}-ui.desktop)

# This command figures out the minimum SDK framework for use in the manifest
# file via the environment variable provided by Clickable or sets a default value otherwise.
if(DEFINED ENV{SDK_FRAMEWORK})
set(CLICK_FRAMEWORK "$ENV{SDK_FRAMEWORK}")
else()
set(CLICK_FRAMEWORK "ubuntu-sdk-20.04")
endif()

# This figures out the target architecture for use in the manifest file.
if(DEFINED ENV{ARCH})
set(CLICK_ARCH "$ENV{ARCH}")
else()
execute_process(
COMMAND dpkg-architecture -qDEB_HOST_ARCH
OUTPUT_VARIABLE CLICK_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()

configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX})
install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR})
install(FILES ${DESKTOP_FILE_NAME} DESTINATION ${DATA_DIR})
install(FILES ./run.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ DESTINATION ${CMAKE_INSTALL_BINDIR})
4 changes: 2 additions & 2 deletions click/harbour-amazfish-ui.desktop
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Icon=harbour-amazfish-ui.png
Exec=run.sh
Icon=share/icons/hicolor/172x172/apps/harbour-amazfish-ui.png
Exec=./bin/run.sh
Name=Amazfish
X-Ubuntu-Touch=true
X-Ubuntu-Splash-Color=#F5F5F5
11 changes: 5 additions & 6 deletions clickable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ prebuild: git submodule update --init
kill: harbour-amazfish
ignore_review_errors: true

builder: qmake
builder: cmake
build_args:
- FLAVOR=uuitk
- CONFIG+=click
- INCLUDEPATH+=${QTMPRIS_LIB_INSTALL_DIR}/usr/include/${ARCH_TRIPLET}/qt5/MprisQt
- INCLUDEPATH+=${QTMPRIS_LIB_INSTALL_DIR}/usr/include/${ARCH_TRIPLET}/qt5
- LIBS+=-L${QTMPRIS_LIB_INSTALL_DIR}/usr/lib/${ARCH_TRIPLET}
- -DFLAVOR=uuitk
- -DCMAKE_CXX_FLAGS=-I${QTMPRIS_LIB_INSTALL_DIR}/usr/include/${ARCH_TRIPLET}/qt5/\ -I${QTMPRIS_LIB_INSTALL_DIR}/usr/include/${ARCH_TRIPLET}/qt5/MprisQt
- -DCMAKE_EXE_LINKER_FLAGS=-L${QTMPRIS_LIB_INSTALL_DIR}/usr/lib/${ARCH_TRIPLET}/
env_vars:
PKG_CONFIG_PATH: ${QTMPRIS_LIB_INSTALL_DIR}/usr/lib/${ARCH_TRIPLET}/pkgconfig:${NEMO_QML_PLUGIN_DBUS_LIB_INSTALL_DIR}/usr/lib/${ARCH_TRIPLET}/pkgconfig

dependencies_target:
- libkdb3-driver-sqlite
- qml-module-org-kde-bluezqt
Expand Down
267 changes: 267 additions & 0 deletions daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
set(SOURCES
./src/activitycoordinate.cpp
./src/activitykind.cpp
./src/activitysample.cpp
./src/activitysummary.cpp
./src/bipactivitydetailparser.cpp
./src/bipbatteryinfo.cpp
./src/dbushrm.cpp
./src/devicefactory.cpp
./src/deviceinterface.cpp
./src/devices/abstractdevice.cpp
./src/devices/abstractfirmwareinfo.cpp
./src/devices/asteroidosdevice.cpp
./src/devices/banglejsdevice.cpp
./src/devices/bipdevice.cpp
./src/devices/bipfirmwareinfo.cpp
./src/devices/biplitedevice.cpp
./src/devices/biplitefirmwareinfo.cpp
./src/devices/bipsdevice.cpp
./src/devices/gtr2device.cpp
./src/devices/gtr2firmwareinfo.cpp
./src/devices/gtrdevice.cpp
./src/devices/gtrfirmwareinfo.cpp
./src/devices/gts2device.cpp
./src/devices/gts2firmwareinfo.cpp
./src/devices/gtsdevice.cpp
./src/devices/gtsfirmwareinfo.cpp
./src/devices/huamidevice.cpp
./src/devices/huamifirmwareinfo.cpp
./src/devices/infinitimefirmwareinfo.cpp
./src/devices/neodevice.cpp
./src/devices/neofirmwareinfo.cpp
./src/devices/pinetimejfdevice.cpp
./src/harbour-amazfish-daemon.cpp
./src/huamiweathercondition.cpp
./src/navigationinterface.cpp
./src/operations/abstractfetchoperation.cpp
./src/operations/abstractoperation.cpp
./src/operations/activityfetchoperation.cpp
./src/operations/adafruitblefsoperation.cpp
./src/operations/adafruitblefsworker.cpp
./src/operations/dfuoperation.cpp
./src/operations/dfuworker.cpp
./src/operations/huamiupdatefirmwareoperation2020.cpp
./src/operations/logfetchoperation.cpp
./src/operations/sportsdetailoperation.cpp
./src/operations/sportssummaryoperation.cpp
./src/operations/updatefirmwareoperation.cpp
./src/operations/updatefirmwareoperationnew.cpp
./src/qaesencryption.cpp
./src/realtimeactivitysample.cpp
./src/services/adafruitblefsservice.cpp
./src/services/alertnotificationservice.cpp
./src/services/asteroidmediaservice.cpp
./src/services/asteroidnotificationservice.cpp
./src/services/asteroidscreenshotservice.cpp
./src/services/asteroidtimeservice.cpp
./src/services/asteroidweatherservice.cpp
./src/services/batteryservice.cpp
./src/services/bipfirmwareservice.cpp
./src/services/currenttimeservice.cpp
./src/services/deviceinfoservice.cpp
./src/services/dfuservice.cpp
./src/services/hrmservice.cpp
./src/services/immediatealertservice.cpp
./src/services/infinitimemotionservice.cpp
./src/services/infinitimenavservice.cpp
#./src/services/infinitimeresourceservice.cpp
./src/services/infinitimeweatherservice.cpp
./src/services/miband2service.cpp
./src/services/mibandservice.cpp
./src/services/pinetimemusicservice.cpp
./src/services/pinetimesimpleweatherservice.cpp
./src/services/uartservice.cpp
./src/transliterator.cpp
./src/typeconversion.cpp
)

set(HEADERS
./src/activitycoordinate.h
./src/activitykind.h
./src/activitysample.h
./src/activitysummary.h
./src/bipactivitydetailparser.h
./src/bipbatteryinfo.h
./src/codec.h
./src/dbushrm.h
./src/devicefactory.h
./src/deviceinterface.h
./src/devices/abstractdevice.h
./src/devices/abstractfirmwareinfo.h
./src/devices/asteroidosdevice.h
./src/devices/banglejsdevice.h
./src/devices/bipdevice.h
./src/devices/bipfirmwareinfo.h
./src/devices/biplitedevice.h
./src/devices/biplitefirmwareinfo.h
./src/devices/bipsdevice.h
./src/devices/gtr2device.h
./src/devices/gtr2firmwareinfo.h
./src/devices/gtrdevice.h
./src/devices/gtrfirmwareinfo.h
./src/devices/gts2device.h
./src/devices/gts2firmwareinfo.h
./src/devices/gtsdevice.h
./src/devices/gtsfirmwareinfo.h
./src/devices/huamidevice.h
./src/devices/huamifirmwareinfo.h
./src/devices/infinitimefirmwareinfo.h
./src/devices/neodevice.h
./src/devices/neofirmwareinfo.h
./src/devices/pinetimejfdevice.h
./src/huamiweathercondition.h
./src/navigationinterface.h
./src/operations/abstractfetchoperation.h
./src/operations/abstractoperation.h
./src/operations/activityfetchoperation.h
./src/operations/adafruitblefsoperation.h
./src/operations/adafruitblefsworker.h
./src/operations/dfuoperation.h
./src/operations/dfuworker.h
./src/operations/huamiupdatefirmwareoperation2020.h
./src/operations/logfetchoperation.h
./src/operations/sportsdetailoperation.h
./src/operations/sportssummaryoperation.h
./src/operations/updatefirmwareoperation.h
./src/operations/updatefirmwareoperationnew.h
./src/qaesencryption.h
./src/realtimeactivitysample.h
./src/services/adafruitblefsservice.h
./src/services/alertnotificationservice.h
./src/services/asteroidmediaservice.h
./src/services/asteroidnotificationservice.h
./src/services/asteroidscreenshotservice.h
./src/services/asteroidtimeservice.h
./src/services/asteroidweatherservice.h
./src/services/batteryservice.h
./src/services/bipfirmwareservice.h
./src/services/currenttimeservice.h
./src/services/deviceinfoservice.h
./src/services/dfuservice.h
./src/services/hrmservice.h
./src/services/immediatealertservice.h
./src/services/infinitimemotionservice.h
./src/services/infinitimenavservice.h
#./src/services/infinitimeresourceservice.h
./src/services/infinitimeweatherservice.h
./src/services/miband2service.h
./src/services/mibandservice.h
./src/services/pinetimemusicservice.h
./src/services/pinetimesimpleweatherservice.h
./src/services/uartservice.h
./src/transliterator.h
./src/typeconversion.h
)

add_executable(harbour-amazfishd ${SOURCES} ${HEADERS})

find_package(PkgConfig REQUIRED)
find_package(Qt5 COMPONENTS Gui Widgets Positioning Network REQUIRED)
find_package(KF5Archive REQUIRED)
find_package(ZLIB REQUIRED)
find_package(ICU REQUIRED COMPONENTS uc i18n data)
find_package(KDb REQUIRED)

if(FLAVOR STREQUAL "silica")
set(WATCHFISH_FEATURES "notificationmonitor;music;calendar;voicecall")

# message(SailfishOS daemon build)
# LIBS += -lkeepalive -lpulse-simple
# CONFIG += sailfishapp
# CONFIG += link_pkgconfig
# PKGCONFIG += mlite5 libpulse
# WATCHFISH_FEATURES += music \
# voicecall \
# notificationmonitor \
# calendar


pkg_check_modules(PULSE REQUIRED libpulse)
target_include_directories(harbour-amazfishd PUBLIC ${PULSE_INCLUDE_DIRS})
target_link_libraries(harbour-amazfishd PUBLIC ${PULSE_LIBRARIES} pulse-simple)

pkg_check_modules(MLITE5 REQUIRED mlite5)
target_include_directories(harbour-amazfishd PUBLIC ${MLITE5_INCLUDE_DIRS})
target_link_libraries(harbour-amazfishd PUBLIC ${MLITE5_LIBRARIES})

target_link_libraries(harbour-amazfishd PUBLIC keepalive)

elseif(FLAVOR STREQUAL "uuitk")
set(WATCHFISH_FEATURES "notificationmonitor;music;calendar;voicecall")

pkg_check_modules(PULSE REQUIRED libpulse)
target_include_directories(harbour-amazfishd PUBLIC ${PULSE_INCLUDE_DIRS})
target_link_libraries(harbour-amazfishd PUBLIC ${PULSE_LIBRARIES} pulse-simple)


else()
set(WATCHFISH_FEATURES "notificationmonitor;music;calendar")
endif()

add_subdirectory(libwatchfish)



install(TARGETS harbour-amazfishd RUNTIME
DESTINATION ${CMAKE_INSTALL_BINDIR})

target_include_directories(harbour-amazfishd PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/devices
${CMAKE_CURRENT_SOURCE_DIR}/src/operations
${CMAKE_CURRENT_SOURCE_DIR}/src/services
${CMAKE_CURRENT_SOURCE_DIR}/..
)

target_compile_definitions(harbour-amazfishd
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)

target_link_libraries(harbour-amazfishd
PRIVATE
libwatchfish libamazfish qble
Qt5::Gui Qt5::Widgets Qt5::Core Qt5::Positioning Qt5::Network
KF5::Archive
ZLIB::ZLIB
ICU::uc ICU::i18n ICU::data
KDb
)


## translations
file(GLOB TS_FILES translations/*.ts)

# TODO check if translation path is correct on all platforms
if(FLAVOR STREQUAL "uuitk")
add_definitions(-DTRANSLATION_FOLDER="../share/harbour-amazfishd/translations")
elseif(FLAVOR STREQUAL "silica")
add_definitions(-DTRANSLATION_FOLDER="/usr/share/harbour-amazfishd/translations")
else()
add_definitions(-DTRANSLATION_FOLDER=".")
endif()

QT5_ADD_TRANSLATION(QM_FILES ${TS_FILES})
add_custom_target(daemon_translations DEPENDS ${QM_FILES})
add_dependencies(harbour-amazfishd daemon_translations)

QT5_CREATE_TRANSLATION(QT_FILES "${CMAKE_SOURCE_DIR}"
OPTIONS "-no-obsolete")

install(FILES ${QM_FILES}
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/harbour-amazfishd/translations")

install(FILES "chirp.raw"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/harbour-amazfishd/")

install(FILES "harbour-amazfishd.privileges"
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/mapplauncherd/privileges.d/")

if(FLAVOR STREQUAL "silica")
configure_file(harbour-amazfish-sailfish.service.in
${CMAKE_CURRENT_BINARY_DIR}/harbour-amazfish.service)
else()
configure_file(harbour-amazfish.service.in
${CMAKE_CURRENT_BINARY_DIR}/harbour-amazfish.service)
endif()
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/harbour-amazfish.service
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/user)
Loading
Loading