Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions ReactNativeEnrichedMarkdown.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,55 @@ Pod::Spec.new do |s|
s.platforms = { :ios => min_ios_version_supported, :osx => '14.0' }
s.source = { :git => "https://github.com/software-mansion-labs/react-native-enriched-markdown.git", :tag => "#{s.version}" }

s.source_files = "ios/**/*.{h,m,mm,cpp}", "cpp/md4c/*.{c,h}", "cpp/parser/*.{hpp,cpp}"
s.private_header_files = "ios/**/*.h"
s.private_header_files = "ios/**/*.h", "cpp/**/*.{h,hpp}"

# To disable LaTeX math rendering (iosMath, supported on iOS and macOS), add ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0' to your Podfile.
# To disable LaTeX math rendering (RaTeX, iOS only), add ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0' to your Podfile.
# When math is enabled, consumers must use `use_frameworks! :linkage => :dynamic` (required for SPM interop).
enable_math = ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] != '0'

s.source_files = "ios/**/*.{h,m,mm,cpp,swift}", "cpp/md4c/*.{c,h}", "cpp/parser/*.{hpp,cpp}"
unless enable_math
s.exclude_files = "ios/math/**/*.swift"
end

preprocessor_defs = '$(inherited) MD4C_USE_UTF8=1'
if enable_math
preprocessor_defs += ' ENRICHED_MARKDOWN_MATH=1'
s.dependency 'iosMath', '~> 0.9'
if defined?(:spm_dependency)
spm_dependency(s,
url: 'https://github.com/erweixin/RaTeX.git',
requirement: {kind: 'upToNextMajorVersion', minimumVersion: '0.1.9'},
products: ['RaTeX']
)
end
end

s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)/cpp/md4c" "$(PODS_TARGET_SRCROOT)/cpp/parser" "$(PODS_TARGET_SRCROOT)/ios/internals" "$(PODS_TARGET_SRCROOT)/ios/input/internals"',
'GCC_PREPROCESSOR_DEFINITIONS' => preprocessor_defs,
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17'
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17',
'DEFINES_MODULE' => 'YES'
}

if enable_math
# React Native's spm_dependency generates a module.modulemap at
# ${BUILT_PRODUCTS_DIR}/include/ that re-declares RaTeXFFI, but the RaTeX
# XCFramework already ships its own definition. Strip the duplicate to
# prevent "redefinition of module 'RaTeXFFI'" during compilation.
s.script_phases = [
{
name: 'Fix RaTeXFFI Module Redefinition',
script: <<~'SCRIPT',
# The shared module.modulemap lives in the platform build-products dir,
# one level above the per-target BUILT_PRODUCTS_DIR that CocoaPods sets.
MODULEMAP="${BUILT_PRODUCTS_DIR}/../include/module.modulemap"
[ -f "$MODULEMAP" ] || exit 0
sed -i '' -E '/^(framework )?module RaTeXFFI /,/^\}/d' "$MODULEMAP"
SCRIPT
execution_position: :before_compile
}
]
end

install_modules_dependencies(s)
end
7 changes: 2 additions & 5 deletions apps/example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GEM
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.3.3)
connection_pool (3.0.2)
connection_pool (2.5.5)
drb (2.2.3)
escape (0.0.4)
ethon (0.15.0)
Expand All @@ -78,16 +78,13 @@ GEM
concurrent-ruby (~> 1.0)
json (2.18.1)
logger (1.7.0)
minitest (6.0.2)
drb (~> 2.0)
prism (~> 1.5)
minitest (5.27.0)
molinillo (0.8.0)
mutex_m (0.3.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.1.3)
prism (1.9.0)
public_suffix (4.0.7)
rexml (3.4.4)
ruby-macho (2.5.1)
Expand Down
38 changes: 34 additions & 4 deletions apps/example/ios/EnrichedMarkdownExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
029E4BE967864F599BC07069 /* Montserrat-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EFDFCE7DCD1A46B5B744D7EE /* Montserrat-Regular.ttf */; };
0C80B921A6F3F58F76C31292 /* libPods-EnrichedMarkdownExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-EnrichedMarkdownExample.a */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
597CBD3D53AB4507A479C53A /* Montserrat-SemiBold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = EFA8D1CE74004DB3BF0ABC53 /* Montserrat-SemiBold.ttf */; };
62AB1D56FF474B6E8985F1AC /* Montserrat-Italic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B24805265C44464B924D7791 /* Montserrat-Italic.ttf */; };
Expand All @@ -18,6 +17,7 @@
97BABF0A6D86D894F56D1968 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
9BFD46416F6C43EFBD2EE56C /* Montserrat-Medium.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9BC709807BEE4A948F59B9EF /* Montserrat-Medium.ttf */; };
9E6DECF91246407194021F8B /* CourierPrime-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = D495169E422740CF87E4E8EB /* CourierPrime-Regular.ttf */; };
E7CFEFA7191154F26DE45D8A /* Pods_EnrichedMarkdownExample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D4495EFE2AD655EE812CB3F /* Pods_EnrichedMarkdownExample.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -28,7 +28,7 @@
3B4392A12AC88292D35C810B /* Pods-EnrichedMarkdownExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EnrichedMarkdownExample.debug.xcconfig"; path = "Target Support Files/Pods-EnrichedMarkdownExample/Pods-EnrichedMarkdownExample.debug.xcconfig"; sourceTree = "<group>"; };
431C95EEA90C4B3995118D3D /* Montserrat-Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Montserrat-Bold.ttf"; path = "../assets/fonts/Montserrat-Bold.ttf"; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-EnrichedMarkdownExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EnrichedMarkdownExample.release.xcconfig"; path = "Target Support Files/Pods-EnrichedMarkdownExample/Pods-EnrichedMarkdownExample.release.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-EnrichedMarkdownExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-EnrichedMarkdownExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5D4495EFE2AD655EE812CB3F /* Pods_EnrichedMarkdownExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_EnrichedMarkdownExample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = EnrichedMarkdownExample/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = EnrichedMarkdownExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
9BC709807BEE4A948F59B9EF /* Montserrat-Medium.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = undefined; includeInIndex = 0; lastKnownFileType = unknown; name = "Montserrat-Medium.ttf"; path = "../assets/fonts/Montserrat-Medium.ttf"; sourceTree = "<group>"; };
Expand All @@ -44,7 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0C80B921A6F3F58F76C31292 /* libPods-EnrichedMarkdownExample.a in Frameworks */,
E7CFEFA7191154F26DE45D8A /* Pods_EnrichedMarkdownExample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -67,7 +67,7 @@
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-EnrichedMarkdownExample.a */,
5D4495EFE2AD655EE812CB3F /* Pods_EnrichedMarkdownExample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -393,6 +393,21 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/ReactCommon",
"${PODS_ROOT}/ReactCommon/react/nativemodule/core",
"${PODS_ROOT}/React-runtimeexecutor",
"${PODS_ROOT}/React-runtimeexecutor/platform/ios",
"${PODS_ROOT}/ReactCommon-Samples",
"${PODS_ROOT}/ReactCommon-Samples/platform/ios",
"${PODS_ROOT}/React-Fabric/react/renderer/components/view/platform/cxx",
"${PODS_ROOT}/React-NativeModulesApple",
"${PODS_ROOT}/React-graphics",
"${PODS_ROOT}/React-graphics/react/renderer/graphics/platform/ios",
"${PODS_ROOT}/React-featureflags",
"${PODS_ROOT}/React-renderercss",
);
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
Expand Down Expand Up @@ -468,6 +483,21 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"${PODS_ROOT}/ReactCommon",
"${PODS_ROOT}/ReactCommon/react/nativemodule/core",
"${PODS_ROOT}/React-runtimeexecutor",
"${PODS_ROOT}/React-runtimeexecutor/platform/ios",
"${PODS_ROOT}/ReactCommon-Samples",
"${PODS_ROOT}/ReactCommon-Samples/platform/ios",
"${PODS_ROOT}/React-Fabric/react/renderer/components/view/platform/cxx",
"${PODS_ROOT}/React-NativeModulesApple",
"${PODS_ROOT}/React-graphics",
"${PODS_ROOT}/React-graphics/react/renderer/graphics/platform/ios",
"${PODS_ROOT}/React-featureflags",
"${PODS_ROOT}/React-renderercss",
);
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions apps/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
ENV['RCT_NEW_ARCH_ENABLED'] = '1'

# Set to '0' to disable LaTeX math rendering and remove the iosMath dependency (~2.5 MB savings).
#ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0'
# LaTeX math rendering (RaTeX). Set to '0' to disable and remove the dependency.
# When enabled, dynamic frameworks are required for SPM interop.
# ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] = '0'
ENV['USE_FRAMEWORKS'] = 'dynamic' if ENV['ENRICHED_MARKDOWN_ENABLE_MATH'] != '0'

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
Expand Down
Loading
Loading