require "json" package = JSON.parse(File.read(File.join(__dir__, "package.json"))) Pod::Spec.new do |s| s.name = "NitroThor" s.version = package["version"] s.summary = package["description"] s.homepage = package["homepage"] s.license = package["license"] s.authors = package["author"] s.platforms = { :ios => min_ios_version_supported, :visionos => 1.0 } s.source = { :git => "https://github.com/mrousavy/nitro.git", :tag => "#{s.version}" } s.source_files = [ # Implementation (Swift) "ios/**/*.{swift}", # Autolinking/Registration + ThorVG bridge (Objective-C / Objective-C++) "ios/**/*.{h,m,mm}", # Our C++ render core (top-level cpp/ only — NOT the vendored thorvg/ tree) "cpp/*.{hpp,cpp}", # --- ThorVG v1.0.6: CPU (software) engine only --- "cpp/thorvg/src/common/*.cpp", "cpp/thorvg/src/renderer/*.cpp", "cpp/thorvg/src/renderer/cpu_engine/*.cpp", # The raw (in-memory) loader is included unconditionally by tvgLoaderMgr.cpp. "cpp/thorvg/src/loaders/raw/*.cpp", ] # Keep the rest of the vendored ThorVG tree on disk (headers are found via # HEADER_SEARCH_PATHS) but don't let CocoaPods strip it for the dev pod. s.preserve_paths = "cpp/thorvg/**/*", "cpp/thorvg-config/**/*" s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => [ "\"$(PODS_TARGET_SRCROOT)/cpp\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg-config\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg/inc\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg/src/common\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg/src/renderer\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg/src/renderer/cpu_engine\"", "\"$(PODS_TARGET_SRCROOT)/cpp/thorvg/src/loaders/raw\"", ].join(" "), # ThorVG is C++14; Nitro requires C++20. C++20 compiles the ThorVG sources fine. "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", # Silence ThorVG's internal warnings so they don't fail the build. "GCC_WARN_INHIBIT_ALL_WARNINGS" => "YES", # Build the ThorVG software rasterizer optimized in EVERY configuration, # including Debug. Otherwise a dev/simulator build compiles it at -O0 and the # per-frame rasterization is many times slower than it needs to be. This pod # is a graphics engine, not app logic, so we never want it un-optimized. # (-O3 also auto-vectorizes the blend/fill loops on arm64, which an A/B on # Android showed is as fast as ThorVG's explicit NEON path — so we don't # define THORVG_NEON_VECTOR_SUPPORT here either.) "GCC_OPTIMIZATION_LEVEL" => "3", # `#include "config.h"` is generic and collides with other libs (e.g. glog) # on the RN pod header path. -iquote is searched before -I for quote-includes, # so our ThorVG config.h wins. (A copy also lives in thorvg/src/common/.) "OTHER_CPLUSPLUSFLAGS" => "$(inherited) -iquote \"$(PODS_TARGET_SRCROOT)/cpp/thorvg-config\" -fno-math-errno", } # Expose the Obj-C bridge header to this pod's own Swift. Nitro's # add_nitrogen_files sets `public_header_files` (which would otherwise make # everything else private), and it appends to whatever we set here first. s.public_header_files = "ios/ThorRenderBridge.h" load 'nitrogen/generated/ios/NitroThor+autolinking.rb' add_nitrogen_files(s) s.dependency 'React-jsi' s.dependency 'React-callinvoker' install_modules_dependencies(s) end