## SPDX-FileCopyrightText: 2025-2026 Open Mobile Platform LLC <community@omp.ru>
## SPDX-License-Identifier: BSD-3-Clause

# CMAKE_SYSTEM_PROCESSOR - CPU architecture name (armv7l, aarch64, x86_64)
# CMAKE_BUILD_TYPE       - Build mode (debug, profile, release)
# PSDK_VERSION           - Build psdk exact version
# PSDK_MAJOR             - Build psdk major version

cmake_minimum_required(VERSION 3.10)

set(PROJECT_NAME push_aurora)
set(PLUGIN_NAME  push_aurora_platform_plugin)

project(${PROJECT_NAME} LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wno-psabi")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

find_package(aurora_libspdlog REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core DBus)

pkg_check_modules(AURORAAPP REQUIRED IMPORTED_TARGET auroraapp)
pkg_check_modules(PushClient REQUIRED IMPORTED_TARGET pushclient)
pkg_check_modules(NemoNotifications REQUIRED IMPORTED_TARGET nemonotifications-qt5)


set(PLUGIN_FILES
  common_types.h
  notification_tap_handler_service.cpp
  notification_tap_handler_service.h
  plugin_controller.cpp
  plugin_controller.h
  push_host_handlers.cpp
  push_host_handlers.h
  push_plugin.cpp
  push_plugin.h
)

# These files are auto generated, so this warning should be omittied
set(PIGEON_FILES
  pigeon/push_api.g.h
  pigeon/push_api.g.cpp
)
set_source_files_properties(${PIGEON_FILES} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)

add_library(${PLUGIN_NAME} SHARED
    ${PIGEON_FILES}
    ${PLUGIN_FILES}
)

include(AuroraClientWrapper)
ADD_CLIENT_WRAPPER_SOURCE(${PLUGIN_NAME})

set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden AUTOMOC ON)

target_link_libraries(${PLUGIN_NAME} PUBLIC aurora_libspdlog::aurora_libspdlog)
target_link_libraries(${PLUGIN_NAME} PUBLIC PkgConfig::NemoNotifications)
target_link_libraries(${PLUGIN_NAME} PUBLIC PkgConfig::PushClient)
target_link_libraries(${PLUGIN_NAME} PUBLIC PkgConfig::AURORAAPP)
target_link_libraries(${PLUGIN_NAME} PUBLIC Qt5::Core Qt5::DBus)

target_include_directories(${PLUGIN_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(${PLUGIN_NAME} PRIVATE PUSH_AURORA_PLUGIN_IMPL)
