1# Copyright (c) Meta Platforms, Inc. and affiliates.
2#
3# This source code is licensed under the MIT license found in the
4# LICENSE file in the root directory of this source tree.
5
6require "json"
7
8package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
9version = package['version']
10
11
12
13folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-gnu-zero-variadic-macro-arguments'
14folly_version = '2021.07.22.00'
15boost_compiler_flags = '-Wno-documentation'
16using_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == "1"
17Pod::Spec.new do |s|
18  s.name                   = "ABI49_0_0ReactCommon"
19  s.module_name            = "ABI49_0_0ReactCommon"
20  s.version                = version
21  s.summary                = "-"  # TODO
22  s.homepage               = "https://reactnative.dev/"
23  s.license                = package["license"]
24  s.author                 = "Meta Platforms, Inc. and its affiliates"
25  s.platforms              = { :ios => "12.4" }
26  s.source                 = { :path => "." }
27  s.header_dir             = "ABI49_0_0ReactCommon" # Use global header_dir for all subspecs for use_frameworks! compatibility
28  s.compiler_flags         = folly_compiler_flags + ' ' + boost_compiler_flags
29  s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/ABI49_0_0React-Core\"",
30                               "USE_HEADERMAP" => "YES", "DEFINES_MODULE" => "YES",
31                               "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
32                               "GCC_WARN_PEDANTIC" => "YES" }
33  if ENV['USE_FRAMEWORKS']
34    s.header_mappings_dir     = File.absolute_path("./")
35  end
36
37  # TODO (T48588859): Restructure this target to align with dir structure: "react/nativemodule/..."
38  # Note: Update this only when ready to minimize breaking changes.
39  s.subspec "turbomodule" do |ss|
40    ss.dependency "ABI49_0_0React-callinvoker", version
41    ss.dependency "ABI49_0_0React-perflogger", version
42    ss.dependency "ABI49_0_0React-cxxreact", version
43    ss.dependency "ABI49_0_0React-jsi", version
44    ss.dependency "RCT-Folly", folly_version
45    s.dependency "ABI49_0_0React-logger", version
46    ss.dependency "DoubleConversion"
47    ss.dependency "glog"
48    if using_hermes
49      ss.dependency "ABI49_0_0hermes-engine"
50    end
51
52    ss.subspec "bridging" do |sss|
53      sss.dependency           "ABI49_0_0React-jsi", version
54      sss.source_files         = "react/bridging/**/*.{cpp,h}"
55      sss.exclude_files        = "react/bridging/tests"
56      sss.header_dir           = "ABI49_0_0react/bridging"
57      sss.pod_target_xcconfig  = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" }
58      if using_hermes
59        sss.dependency "ABI49_0_0hermes-engine"
60      end
61    end
62
63    ss.subspec "core" do |sss|
64      sss.source_files = "react/nativemodule/core/ReactCommon/**/*.{cpp,h}"
65    end
66  end
67end
68