cmake_minimum_required(VERSION 3.22)
set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "macOS architectures")  # must come before project()
project(MOBILESERVICESDEMO VERSION 0.0.1)

file(REAL_PATH "~/JUCE" JUCE_DIR EXPAND_TILDE)   # JUCE cloned to ~/JUCE; or use find_package (JUCE CONFIG REQUIRED)
add_subdirectory(${JUCE_DIR} JUCE)

juce_add_gui_app(MobileServicesDemo PRODUCT_NAME "Mobile Services Demo"
    NEEDS_STORE_KIT TRUE            # links StoreKit and enables juce::InAppPurchases on Apple platforms
    PUSH_NOTIFICATIONS_ENABLED TRUE)   # adds the push-notification entitlement on Apple platforms

target_sources(MobileServicesDemo PRIVATE Main.cpp MainComponent.cpp)

target_compile_definitions(MobileServicesDemo PRIVATE
    JUCE_WEB_BROWSER=0
    JUCE_USE_CURL=0
    JUCE_PUSH_NOTIFICATIONS=1   # use the real juce::PushNotifications, not the no-op stub
    JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:MobileServicesDemo,JUCE_PRODUCT_NAME>"
    JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:MobileServicesDemo,JUCE_VERSION>")

target_link_libraries(MobileServicesDemo
    PRIVATE juce::juce_gui_extra
            juce::juce_product_unlocking
            juce::juce_analytics
    PUBLIC  juce::juce_recommended_config_flags
            juce::juce_recommended_warning_flags)
