Skip to content

Commit

Permalink
compile with cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlich committed Dec 24, 2024
1 parent 0665a8d commit 60be21e
Show file tree
Hide file tree
Showing 12 changed files with 657 additions and 57 deletions.
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.*
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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)
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)
235 changes: 235 additions & 0 deletions daemon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@

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
)


set(WATCHFISH_FEATURES "notificationmonitor;walltime;music;calendar;voicecall;volume")

if(FLAVOR STREQUAL "silica")

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

elseif(FLAVOR STREQUAL "uuitk")

# DEFINES += UUITK_EDITION
# LIBS += -lpulse-simple
# PKGCONFIG += libpulse
# WATCHFISH_FEATURES += music \
# voicecall \
# notificationmonitor \
# calendar

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

add_subdirectory(libwatchfish)

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)

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

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-amazfish/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)
33 changes: 33 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
cmake_minimum_required(VERSION 3.16)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_library(libamazfish STATIC)

find_package(Qt5 REQUIRED COMPONENTS Core DBus Xml)

target_include_directories(libamazfish PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(libamazfish PUBLIC Qt5::Core Qt5::DBus Qt5::Xml)

set(SOURCES
./src/amazfish.cpp
./src/amazfishconfig.cpp
./src/weather/city.cpp
./src/weather/citymanager.cpp
./src/weather/citysearchmodel.cpp
./src/weather/currentweather.cpp
)

set(HEADERS
./src/weather/apikey.h
./src/weather/city.h
./src/weather/citymanager.h
./src/weather/citysearchmodel.h
./src/weather/currentweather.h
./src/amazfish.h
./src/amazfishconfig.h
)

target_sources(libamazfish PUBLIC ${SOURCES} ${HEADERS})

Loading

0 comments on commit 60be21e

Please sign in to comment.