diff --git a/apps/fabric-example/ios/FabricExample.xcodeproj/project.pbxproj b/apps/fabric-example/ios/FabricExample.xcodeproj/project.pbxproj index 99e0b5354..59c4dbe36 100644 --- a/apps/fabric-example/ios/FabricExample.xcodeproj/project.pbxproj +++ b/apps/fabric-example/ios/FabricExample.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 0C80B921A6F3F58F76C31292 /* libPods-FabricExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-FabricExample.a */; }; + 074F12222894472419223AD0 /* libPods-FabricExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1242ABEEEDE16C844BC490A9 /* libPods-FabricExample.a */; }; 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; }; 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; @@ -15,15 +15,15 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1242ABEEEDE16C844BC490A9 /* libPods-FabricExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FabricExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07F961A680F5B00A75B9A /* FabricExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FabricExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = FabricExample/Images.xcassets; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = FabricExample/Info.plist; sourceTree = ""; }; 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = FabricExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; - 3B4392A12AC88292D35C810B /* Pods-FabricExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FabricExample.debug.xcconfig"; path = "Target Support Files/Pods-FabricExample/Pods-FabricExample.debug.xcconfig"; sourceTree = ""; }; - 5709B34CF0A7D63546082F79 /* Pods-FabricExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FabricExample.release.xcconfig"; path = "Target Support Files/Pods-FabricExample/Pods-FabricExample.release.xcconfig"; sourceTree = ""; }; - 5DCACB8F33CDC322A6C60F78 /* libPods-FabricExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-FabricExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3F8730B47DA01BE6267C3980 /* Pods-FabricExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FabricExample.release.xcconfig"; path = "Target Support Files/Pods-FabricExample/Pods-FabricExample.release.xcconfig"; sourceTree = ""; }; 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = FabricExample/AppDelegate.swift; sourceTree = ""; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = FabricExample/LaunchScreen.storyboard; sourceTree = ""; }; + BC5E8CFC282892630066DDA2 /* Pods-FabricExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FabricExample.debug.xcconfig"; path = "Target Support Files/Pods-FabricExample/Pods-FabricExample.debug.xcconfig"; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -32,7 +32,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0C80B921A6F3F58F76C31292 /* libPods-FabricExample.a in Frameworks */, + 074F12222894472419223AD0 /* libPods-FabricExample.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -55,7 +55,7 @@ isa = PBXGroup; children = ( ED297162215061F000B7C4FE /* JavaScriptCore.framework */, - 5DCACB8F33CDC322A6C60F78 /* libPods-FabricExample.a */, + 1242ABEEEDE16C844BC490A9 /* libPods-FabricExample.a */, ); name = Frameworks; sourceTree = ""; @@ -92,8 +92,8 @@ BBD78D7AC51CEA395F1C20DB /* Pods */ = { isa = PBXGroup; children = ( - 3B4392A12AC88292D35C810B /* Pods-FabricExample.debug.xcconfig */, - 5709B34CF0A7D63546082F79 /* Pods-FabricExample.release.xcconfig */, + BC5E8CFC282892630066DDA2 /* Pods-FabricExample.debug.xcconfig */, + 3F8730B47DA01BE6267C3980 /* Pods-FabricExample.release.xcconfig */, ); path = Pods; sourceTree = ""; @@ -105,13 +105,13 @@ isa = PBXNativeTarget; buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "FabricExample" */; buildPhases = ( - C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, + 913629BAA15CF058F9B3200C /* [CP] Check Pods Manifest.lock */, 13B07F871A680F5B00A75B9A /* Sources */, 13B07F8C1A680F5B00A75B9A /* Frameworks */, 13B07F8E1A680F5B00A75B9A /* Resources */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, - 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, - E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, + 1EB008383D61027425A38005 /* [CP] Embed Pods Frameworks */, + 640DA81675C7F86B3A7B040E /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -183,7 +183,7 @@ shellPath = /bin/sh; shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; }; - 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { + 1EB008383D61027425A38005 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -200,43 +200,43 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { + 640DA81675C7F86B3A7B040E /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; + name = "[CP] Copy Pods Resources"; outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-FabricExample-checkManifestLockResult.txt", + "${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources.sh\"\n"; showEnvVarsInLog = 0; }; - E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { + 913629BAA15CF058F9B3200C /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources-${CONFIGURATION}-input-files.xcfilelist", ); - name = "[CP] Copy Pods Resources"; + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources-${CONFIGURATION}-output-files.xcfilelist", + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-FabricExample-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FabricExample/Pods-FabricExample-resources.sh\"\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -255,7 +255,7 @@ /* Begin XCBuildConfiguration section */ 13B07F941A680F5B00A75B9A /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-FabricExample.debug.xcconfig */; + baseConfigurationReference = BC5E8CFC282892630066DDA2 /* Pods-FabricExample.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -284,7 +284,7 @@ }; 13B07F951A680F5B00A75B9A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-FabricExample.release.xcconfig */; + baseConfigurationReference = 3F8730B47DA01BE6267C3980 /* Pods-FabricExample.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; @@ -358,6 +358,19 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core", + "${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers/platform/ios", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios", + "${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx", + "${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios", + ); IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, @@ -432,6 +445,19 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core", + "${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers/platform/ios", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios", + "${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx", + "${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers", + "${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios", + ); IPHONEOS_DEPLOYMENT_TARGET = 15.1; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, diff --git a/apps/fabric-example/ios/Podfile.lock b/apps/fabric-example/ios/Podfile.lock index 9a386a86d..1112dd384 100644 --- a/apps/fabric-example/ios/Podfile.lock +++ b/apps/fabric-example/ios/Podfile.lock @@ -3360,7 +3360,7 @@ SPEC CHECKSUMS: ReactAppDependencyProvider: 0eb286cc274abb059ee601b862ebddac2e681d01 ReactCodegen: b8e56b780fffe6edd6405be0af4a1e3049a937f7 ReactCommon: ac934cb340aee91282ecd6f273a26d24d4c55cae - RNAudioAPI: c7dc7b491a0e4b23535a55fd9b4a00d0f803f4bb + RNAudioAPI: 05b3e78da312dd4f5b42fae8a4b1652911db84a3 RNGestureHandler: cd4be101cfa17ea6bbd438710caa02e286a84381 RNReanimated: 132940c4c15ca2757f4f7d1fd7c9c3c01dbc4689 RNScreens: ffbb0296608eb3560de641a711bbdb663ed1f6b4 diff --git a/packages/react-native-audio-api/RNAudioAPI.podspec b/packages/react-native-audio-api/RNAudioAPI.podspec index 5cfe758ce..dc82493ba 100644 --- a/packages/react-native-audio-api/RNAudioAPI.podspec +++ b/packages/react-native-audio-api/RNAudioAPI.podspec @@ -2,15 +2,17 @@ require "json" require_relative './scripts/rnaa_utils' package_json = JSON.parse(File.read(File.join(__dir__, "package.json"))) +$config = find_config() $new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' $RN_AUDIO_API_FFMPEG_DISABLED = ENV['DISABLE_AUDIOAPI_FFMPEG'].nil? ? false : ENV['DISABLE_AUDIOAPI_FFMPEG'] == '1' # false by default -folly_flags = "-DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32" fabric_flags = $new_arch_enabled ? '-DRCT_NEW_ARCH_ENABLED' : '' version_flag = "-DAUDIOAPI_VERSION=#{package_json['version']}" +ios_min_version = '14.0' -worklets_preprocessor_flag = check_if_worklets_enabled() ? '-DRN_AUDIO_API_ENABLE_WORKLETS=1' : '' +worklets_enabled = $config[:worklets_enabled] +worklets_preprocessor_flag = worklets_enabled ? '-DRN_AUDIO_API_ENABLE_WORKLETS=1' : '' ffmpeg_flag = $RN_AUDIO_API_FFMPEG_DISABLED ? '-DRN_AUDIO_API_FFMPEG_DISABLED=1' : '' Pod::Spec.new do |s| @@ -20,10 +22,13 @@ Pod::Spec.new do |s| s.homepage = package_json["homepage"] s.license = package_json["license"] s.authors = package_json["author"] - - s.platforms = { :ios => min_ios_version_supported } + s.platforms = { :ios => ios_min_version } s.source = { :git => "https://github.com/software-mansion/react-native-audio-api.git", :tag => "#{s.version}" } + if worklets_enabled + s.dependency 'RNWorklets' + end + s.subspec "audioapi" do |ss| ss.source_files = "common/cpp/audioapi/**/*.{cpp,c,h,hpp}" ss.exclude_files = $RN_AUDIO_API_FFMPEG_DISABLED ? ["common/cpp/audioapi/libs/ffmpeg/**"] : [] @@ -46,8 +51,6 @@ Pod::Spec.new do |s| s.ios.frameworks = 'CoreFoundation', 'CoreAudio', 'AudioToolbox', 'Accelerate', 'MediaPlayer', 'AVFoundation' - s.compiler_flags = "#{folly_flags}" - s.prepare_command = <<-CMD chmod +x scripts/download-prebuilt-binaries.sh scripts/download-prebuilt-binaries.sh ios @@ -66,41 +69,50 @@ Pod::Spec.new do |s| 'common/cpp/audioapi/external/ffmpeg_ios/libavutil.xcframework', 'common/cpp/audioapi/external/ffmpeg_ios/libswresample.xcframework' ] -s.pod_target_xcconfig = { - "USE_HEADERMAP" => "YES", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", - "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) HAVE_ACCELERATE=1', - "HEADER_SEARCH_PATHS" => %W[ - $(PODS_TARGET_SRCROOT)/common/cpp - $(PODS_TARGET_SRCROOT)/ios - $(PODS_ROOT)/Headers/Public/RNWorklets - $(PODS_ROOT)/Headers/Private/React-Core - $(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include - $(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include/opus - $(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include/vorbis - ].concat($RN_AUDIO_API_FFMPEG_DISABLED ? [] : ["$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/ffmpeg_include"]).join(" "), - 'OTHER_CFLAGS' => "$(inherited) #{folly_flags} #{fabric_flags} #{version_flag} #{worklets_preprocessor_flag} #{ffmpeg_flag}", - 'OTHER_CPLUSPLUSFLAGS' => "$(inherited) #{folly_flags} #{fabric_flags} #{version_flag} #{worklets_preprocessor_flag} #{ffmpeg_flag}", -} - -s.user_target_xcconfig = { - 'OTHER_LDFLAGS' => %W[ - $(inherited) - -force_load #{lib_dir}/libopusfile.a - -force_load #{lib_dir}/libopus.a - -force_load #{lib_dir}/libogg.a - -force_load #{lib_dir}/libvorbis.a - -force_load #{lib_dir}/libvorbisenc.a - -force_load #{lib_dir}/libvorbisfile.a - -force_load #{lib_dir}/libssl.a - -force_load #{lib_dir}/libcrypto.a - ].join(" "), - 'HEADER_SEARCH_PATHS' => %W[ - $(inherited) - $(PODS_ROOT)/Headers/Public/RNAudioAPI - $(PODS_TARGET_SRCROOT)/common/cpp - ].join(' ') -} + + s.pod_target_xcconfig = { + "USE_HEADERMAP" => "YES", + "DEFINES_MODULE" => "YES", + "HEADER_SEARCH_PATHS" => [ + '"$(PODS_TARGET_SRCROOT)/ReactCommon"', + '"$(PODS_TARGET_SRCROOT)/common/cpp"', + '"$(PODS_TARGET_SRCROOT)/ios"', + '"$(PODS_ROOT)/Headers/Private/React-Core"', + '"$(PODS_ROOT)/Headers/Public/RNWorklets"', + "\"$(PODS_ROOT)/#{$config[:react_native_common_dir]}\"", + "\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include\"", + "\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include/opus\"", + "\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include/vorbis\"", + ].concat($RN_AUDIO_API_FFMPEG_DISABLED ? [] : ["\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/ffmpeg_include\""]) + .concat(worklets_enabled ? [ + "\"$(PODS_ROOT)/#{$config[:dynamic_frameworks_worklets_dir]}/apple\"", + "\"$(PODS_ROOT)/#{$config[:dynamic_frameworks_worklets_dir]}/Common/cpp\"" + ] : []) + .join(' '), + "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", + "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) HAVE_ACCELERATE=1', + 'OTHER_CFLAGS' => "$(inherited) #{fabric_flags} #{version_flag} #{worklets_preprocessor_flag} #{ffmpeg_flag}", + 'OTHER_CPLUSPLUSFLAGS' => "$(inherited) #{fabric_flags} #{version_flag} #{worklets_preprocessor_flag} #{ffmpeg_flag}", + } + + s.user_target_xcconfig = { + "HEADER_SEARCH_PATHS" => [ + "\"$(PODS_ROOT)/#{$config[:dynamic_frameworks_audio_api_dir]}/ios\"", + "\"$(PODS_ROOT)/#{$config[:dynamic_frameworks_audio_api_dir]}/common/cpp\"", + ].join(' '), + 'OTHER_LDFLAGS' => %W[ + $(inherited) + -force_load #{lib_dir}/libopusfile.a + -force_load #{lib_dir}/libopus.a + -force_load #{lib_dir}/libogg.a + -force_load #{lib_dir}/libvorbis.a + -force_load #{lib_dir}/libvorbisenc.a + -force_load #{lib_dir}/libvorbisfile.a + -force_load #{lib_dir}/libssl.a + -force_load #{lib_dir}/libcrypto.a + ].join(" "), + } + # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. install_modules_dependencies(s) diff --git a/packages/react-native-audio-api/scripts/rnaa_utils.rb b/packages/react-native-audio-api/scripts/rnaa_utils.rb index c909460b6..fc1506891 100644 --- a/packages/react-native-audio-api/scripts/rnaa_utils.rb +++ b/packages/react-native-audio-api/scripts/rnaa_utils.rb @@ -6,3 +6,51 @@ def check_if_worklets_enabled() end true end + +def try_to_parse_react_native_package_json(node_modules_dir) + react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json') + if !File.exist?(react_native_package_json_path) + return nil + end + return JSON.parse(File.read(react_native_package_json_path)) +end + +def find_config() + result = { + :react_native_common_dir => nil, + :dynamic_frameworks_audio_api_dir => nil, + :dynamic_frameworks_worklets_dir => nil, + :worklets_enabled => check_if_worklets_enabled() + } + + react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..') + react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir) + + if react_native_json == nil + # user configuration, just in case + node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"] + react_native_json = try_to_parse_react_native_package_json(node_modules_dir) + end + + if react_native_json == nil + raise '[AudioAPI] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="" && pod install`.' + end + + pods_root = Pod::Config.instance.project_pods_root + react_native_common_dir_absolute = File.join(react_native_node_modules_dir, 'react-native', 'ReactCommon') + react_native_common_dir_relative = Pathname.new(react_native_common_dir_absolute).relative_path_from(pods_root).to_s + result[:react_native_common_dir] = react_native_common_dir_relative + + react_native_audio_api_dir_absolute = File.join(__dir__, '..') + react_native_audio_api_dir_relative = Pathname.new(react_native_audio_api_dir_absolute).relative_path_from(pods_root).to_s + result[:dynamic_frameworks_audio_api_dir] = react_native_audio_api_dir_relative + + if result[:worklets_enabled] == true + react_native_worklets_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native-worklets/package.json')"`), '..') + react_native_worklets_dir_absolute = File.join(react_native_worklets_node_modules_dir, 'react-native-worklets') + react_native_worklets_dir_relative = Pathname.new(react_native_worklets_dir_absolute).relative_path_from(pods_root).to_s + result[:dynamic_frameworks_worklets_dir] = react_native_worklets_dir_relative + end + + return result +end