Permalink
Browse files

Make symlinking headers work with specs which overwrite Spec#copy_hea…

…der_mapping.
  • Loading branch information...
1 parent fa69d83 commit 82a6c8fbce944031c63bf72177c1be62f46ac858 @kommen kommen committed Nov 24, 2011
Showing with 8 additions and 4 deletions.
  1. +6 −3 lib/cocoapods/installer.rb
  2. +1 −1 lib/cocoapods/specification.rb
  3. +1 −0 lib/cocoapods/xcodeproj_ext.rb
@@ -30,6 +30,7 @@ def xcconfig
@xcconfig ||= Xcodeproj::Config.new({
# In a workspace this is where the static library headers should be found.
'HEADER_SEARCH_PATHS' => '"Pods/Headers"',
+ 'ALWAYS_SEARCH_USER_PATHS' => 'YES',
# This makes categories from static libraries work, which many libraries
# require, so we add these by default.
'OTHER_LDFLAGS' => '-ObjC -all_load',
@@ -98,9 +99,11 @@ def install!
spec.copy_header_mappings.each do |header_dir, files|
target_dir = "#{headers_symlink_path_name}/#{header_dir}"
FileUtils.mkdir_p(target_dir)
- Dir.chdir(target_dir) do
- files.each do |file|
- FileUtils.ln_s("../../#{file}", file.basename)
+ target_dir_real_path = Pathname.new(target_dir).realpath
+ files.each do |file|
+ source = Pathname.new("Pods/#{file}").realpath.relative_path_from(target_dir_real_path)
+ Dir.chdir(target_dir) do
+ FileUtils.ln_sf(source, File.basename(file))
end
end
end
@@ -296,7 +296,7 @@ def copy_header_mappings
# methods.
def header_search_paths
dirs = [header_dir] + copy_header_mappings.keys
- dirs.map { |dir| %{"Pods/Headers/#{dir}"} }
+ dirs.map { |dir| %{"$(POD_SRCROOT)/Headers/#{dir}"} }
end
def to_s
@@ -99,6 +99,7 @@ def self.for_platform(platform)
def self.build_settings(platform, scheme)
settings = COMMON_BUILD_SETTINGS[:all].merge(COMMON_BUILD_SETTINGS[platform])
settings['COPY_PHASE_STRIP'] = scheme == :debug ? 'NO' : 'YES'
+ settings['POD_SRCROOT'] = '$(SRCROOT)'
if scheme == :debug
settings.merge!(COMMON_BUILD_SETTINGS[:debug])
settings['ONLY_ACTIVE_ARCH'] = 'YES' if platform == :osx

0 comments on commit 82a6c8f

Please sign in to comment.