From 5d50d6bcdcaa364ecb40cd83ff1665b4340ca900 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 3 Jun 2025 15:50:13 +0100 Subject: [PATCH] CMake: Allow setting NSLocalNetworkUsageDescription on Apple platforms --- docs/CMake API.md | 12 +++++++++--- extras/Build/CMake/JUCEUtils.cmake | 4 ++++ extras/Build/juceaide/Main.cpp | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/docs/CMake API.md b/docs/CMake API.md index 689357acf6..6959794bc9 100644 --- a/docs/CMake API.md +++ b/docs/CMake API.md @@ -285,23 +285,29 @@ attributes directly to these creation functions, rather than adding them later. the target's `COMPANY_NAME` and the name of the CMake target. `MICROPHONE_PERMISSION_ENABLED` -- May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist. +- May be either TRUE or FALSE. Adds NSMicrophoneUsageDescription to an app's Info.plist. `MICROPHONE_PERMISSION_TEXT` - The text your app will display when it requests microphone permissions. `CAMERA_PERMISSION_ENABLED` -- May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist. +- May be either TRUE or FALSE. Adds NSCameraUsageDescription to an app's Info.plist. `CAMERA_PERMISSION_TEXT` - The text your app will display when it requests camera permissions. `BLUETOOTH_PERMISSION_ENABLED` -- May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist. +- May be either TRUE or FALSE. Adds NSBluetoothAlwaysUsageDescription to an app's Info.plist. `BLUETOOTH_PERMISSION_TEXT` - The text your app will display when it requests bluetooth permissions. +`LOCAL_NETWORK_PERMISSION_ENABLED` +- May be either TRUE or FALSE. Adds NSLocalNetworkUsageDescription to an app's Info.plist. + +`LOCAL_NETWORK_PERMISSION_TEXT` +- The text your app will display when it requests local network access permissions. + `SEND_APPLE_EVENTS_PERMISSION_ENABLED` - May be either TRUE or FALSE. Enable this to allow your app to send Apple events. diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 07dc5f2d19..308fe3e8ac 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -354,6 +354,8 @@ function(_juce_write_configure_time_info target) _juce_append_target_property(file_content CAMERA_PERMISSION_TEXT ${target} JUCE_CAMERA_PERMISSION_TEXT) _juce_append_target_property(file_content BLUETOOTH_PERMISSION_ENABLED ${target} JUCE_BLUETOOTH_PERMISSION_ENABLED) _juce_append_target_property(file_content BLUETOOTH_PERMISSION_TEXT ${target} JUCE_BLUETOOTH_PERMISSION_TEXT) + _juce_append_target_property(file_content LOCAL_NETWORK_PERMISSION_ENABLED ${target} JUCE_LOCAL_NETWORK_PERMISSION_ENABLED) + _juce_append_target_property(file_content LOCAL_NETWORK_PERMISSION_TEXT ${target} JUCE_LOCAL_NETWORK_PERMISSION_TEXT) _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_ENABLED ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_ENABLED) _juce_append_target_property(file_content SEND_APPLE_EVENTS_PERMISSION_TEXT ${target} JUCE_SEND_APPLE_EVENTS_PERMISSION_TEXT) _juce_append_target_property(file_content SHOULD_ADD_STORYBOARD ${target} JUCE_SHOULD_ADD_STORYBOARD) @@ -1969,6 +1971,8 @@ function(_juce_initialise_target target) SEND_APPLE_EVENTS_PERMISSION_TEXT BLUETOOTH_PERMISSION_ENABLED BLUETOOTH_PERMISSION_TEXT + LOCAL_NETWORK_PERMISSION_ENABLED + LOCAL_NETWORK_PERMISSION_TEXT FILE_SHARING_ENABLED # iOS only DOCUMENT_BROWSER_ENABLED # iOS only LAUNCH_STORYBOARD_FILE # iOS only diff --git a/extras/Build/juceaide/Main.cpp b/extras/Build/juceaide/Main.cpp index 2c4579efb3..e7eef131be 100644 --- a/extras/Build/juceaide/Main.cpp +++ b/extras/Build/juceaide/Main.cpp @@ -252,6 +252,8 @@ juce::build_tools::PlistOptions parsePlistOptions (const juce::File& file, updateField ("CAMERA_PERMISSION_TEXT", result.cameraPermissionText); updateField ("BLUETOOTH_PERMISSION_ENABLED", result.bluetoothPermissionEnabled); updateField ("BLUETOOTH_PERMISSION_TEXT", result.bluetoothPermissionText); + updateField ("LOCAL_NETWORK_PERMISSION_ENABLED", result.localNetworkPermissionEnabled); + updateField ("LOCAL_NETWORK_PERMISSION_TEXT", result.localNetworkPermissionText); updateField ("SEND_APPLE_EVENTS_PERMISSION_ENABLED", result.sendAppleEventsPermissionEnabled); updateField ("SEND_APPLE_EVENTS_PERMISSION_TEXT", result.sendAppleEventsPermissionText); updateField ("SHOULD_ADD_STORYBOARD", result.shouldAddStoryboardToProject); @@ -298,6 +300,8 @@ juce::build_tools::PlistOptions parsePlistOptions (const juce::File& file, "This app requires access to Bluetooth to function correctly."); setIfEmpty (result.sendAppleEventsPermissionText, "This app requires the ability to send Apple events to function correctly."); + setIfEmpty (result.localNetworkPermissionText, + "This app requires access to the local network to function correctly."); result.documentExtensions = result.documentExtensions.replace (";", ",");