Permalink
Browse files

Add attributes to specification for frameworks and header_search_paths.

  • Loading branch information...
1 parent 4403073 commit 419af92916abbaeb5e4ddf517881de56b1c67fb3 @alloy alloy committed Sep 11, 2011
Showing with 18 additions and 3 deletions.
  1. +17 −3 lib/cocoa_pods/specification.rb
  2. +1 −0 lib/cocoa_pods/xcode_project.rb
@@ -86,6 +86,14 @@ def xcconfig(path)
@xcconfig = path
end
+ def frameworks(*frameworks)
+ @frameworks = frameworks.map { |f| Pathname.new(f) }
+ end
+
+ def header_search_paths(*search_paths)
+ @header_search_paths = search_paths
+ end
+
# Not attributes
# Returns the specification for the pod that this pod's source is a part of.
@@ -113,7 +121,7 @@ def install_dependent_specifications!
def create_static_library!
puts "==> Creating static library"
- source_files = []
+ source_files, frameworks, header_search_paths = [], [], []
resolved_dependent_specification_sets.each do |set|
# In case the set is only part of other pods we don't need to build
# the pod itself.
@@ -125,15 +133,21 @@ def create_static_library!
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
source_files.concat(Dir.glob(pattern.to_s).map { |f| Pathname.new(f) })
end
+ if f = spec.read(:frameworks)
+ frameworks.concat(f)
+ end
+ if s = spec.read(:header_search_paths)
+ header_search_paths.concat(s)
+ end
end
project = XcodeProject.static_library
source_files.each do |file|
file = file.relative_path_from(config.project_pods_root)
project.add_source_file(file)
end
- project.add_framework(Pathname.new('usr/lib/libxml2.2.7.3.dylib'))
- project.add_header_search_paths(%w{ $(SDKROOT)/usr/include/libxml2 })
+ frameworks.each { |framework| project.add_framework(framework) }
+ project.add_header_search_paths(header_search_paths)
project.create_in(config.project_pods_root)
end
@@ -72,6 +72,7 @@ def add_framework(path)
def add_header_search_paths(paths)
objects_by_isa('XCBuildConfiguration').each do |uuid, object|
existing_paths = object['buildSettings']['HEADER_SEARCH_PATHS'] ||= []
+ p paths
existing_paths.concat(paths)
end
end

0 comments on commit 419af92

Please sign in to comment.