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
8js_engine = ENV['USE_HERMES'] == "0" ?
9  :jsc :
10  :hermes
11
12package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
13version = package['version']
14
15
16
17folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
18folly_version = '2021.07.22.00'
19boost_compiler_flags = '-Wno-documentation'
20
21# using jsc to expose jsi.h
22js_engine = :jsc
23Pod::Spec.new do |s|
24  s.name                   = "ABI48_0_0React-jsi"
25  s.version                = version
26  s.summary                = "JavaScript Interface layer for React Native"
27  s.homepage               = "https://reactnative.dev/"
28  s.license                = package["license"]
29  s.author                 = "Facebook, Inc. and its affiliates"
30  s.platforms              = { :ios => "12.4" }
31  s.source                 = { :path => "." }
32
33  s.header_dir    = "ABI48_0_0jsi"
34  s.compiler_flags         = folly_compiler_flags + ' ' + boost_compiler_flags
35  s.pod_target_xcconfig    = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\"" }
36
37  s.dependency "boost", "1.76.0"
38  s.dependency "DoubleConversion"
39  s.dependency "RCT-Folly", folly_version
40  s.dependency "glog"
41
42  if js_engine == :jsc
43    s.source_files  = "**/*.{cpp,h}"
44    s.exclude_files = [
45                        "jsi/jsilib-posix.cpp",
46                        "jsi/jsilib-windows.cpp",
47                        "**/test/*"
48                      ]
49
50  elsif js_engine == :hermes
51    # JSI is provided by hermes-engine when Hermes is enabled
52    # Just need to provide JSIDynamic in this case.
53    s.source_files = "jsi/JSIDynamic.{cpp,h}"
54    s.dependency "ABI48_0_0hermes-engine"
55  end
56end
57