Skip to content

Commit

Permalink
fix apple macos pods
Browse files Browse the repository at this point in the history
  • Loading branch information
irov committed Jul 25, 2023
1 parent 2b0fb54 commit ef55ea3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmake/cocoapods_template.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ MACRO(MENGINE_GENERATE_COCOAPODS)
STRING(APPEND PODFILE_BUFFER "\n")

SET(PODS_END_PATCH)
file(STRINGS "Pods.patch" PODS_END_PATCH NEWLINE_CONSUME)

if(APPLE AND IOS)
file(STRINGS "iOSPods.patch" PODS_END_PATCH NEWLINE_CONSUME)
endif()

if(APPLE AND NOT IOS)
file(STRINGS "MacOSPods.patch" PODS_END_PATCH NEWLINE_CONSUME)
endif()

STRING(APPEND PODFILE_BUFFER ${PODS_END_PATCH})

Expand Down
36 changes: 36 additions & 0 deletions src/SDLApplication/MacOSPods.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
post_install do |installer|
work_dir = Dir.pwd
installer.aggregate_targets.each do |target|
if target.name != "Pods-SDLApplication"
next
end
target.user_build_configurations.each do |key, name|
xcconfig_path = "#{work_dir}/Pods/Target Support Files/#{target}/#{target}.#{name}.xcconfig"

build_settings = Hash[*File.read(xcconfig_path).lines.map{|x| x.split(/\s*=\s*/, 2)}.flatten]
build_settings['FRAMEWORK_SEARCH_PATHS'] = "#{build_settings['FRAMEWORK_SEARCH_PATHS'][0...-1]} ${PODS_CONFIGURATION_BUILD_DIR}\n"

File.open(xcconfig_path, "w") do |file|
build_settings.each do |key,value|
file.puts("#{key} = #{value}")
end
end

sh_path = "#{work_dir}/Pods/Target Support Files/#{target}/#{target}-frameworks.sh"

lines = File.read(sh_path)
lines = lines.gsub('install_framework "${BUILT_PRODUCTS_DIR}', 'install_framework "${PODS_CONFIGURATION_BUILD_DIR}')

File.open(sh_path, "w") do |file|
file << lines
end
end
end
installer.generated_projects.each do |project|
project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.13'
end
end
end
end
File renamed without changes.

0 comments on commit ef55ea3

Please sign in to comment.