[OSX] Add external_frameworks config variable.

Fixes http://hipbyte.myjetbrains.com/youtrack/issue/RM-254
This commit is contained in:
Eloy Durán
2014-01-15 13:20:56 +01:00
committed by Watson
parent 349f95e7b8
commit 46cc8ba2df
2 changed files with 18 additions and 11 deletions

View File

@@ -56,7 +56,7 @@ module Motion; module Project;
build_dir = File.join(config.versionized_build_dir(platform))
App.info 'Build', build_dir
# Prepare the list of BridgeSupport files needed.
# Prepare the list of BridgeSupport files needed.
bs_files = config.bridgesupport_files
# Build vendor libraries.
@@ -73,10 +73,11 @@ module Motion; module Project;
exit 1
end
# Prepare embedded frameworks BridgeSupport files (OSX-only).
embedded_frameworks = (config.respond_to?(:embedded_frameworks) ? config.embedded_frameworks.map { |x| File.expand_path(x) } : [])
unless embedded_frameworks.empty?
embedded_frameworks.each do |path|
# Prepare embedded and external frameworks BridgeSupport files (OSX-only).
if config.is_a?(OSXConfig)
embedded_frameworks = config.embedded_frameworks.map { |x| File.expand_path(x) }
external_frameworks = config.external_frameworks.map { |x| File.expand_path(x) }
(embedded_frameworks + external_frameworks).each do |path|
headers = Dir.glob(File.join(path, 'Headers/**/*.h'))
bs_file = File.join(Builder.common_build_dir, File.expand_path(path) + '.bridgesupport')
if !File.exist?(bs_file) or File.mtime(path) > File.mtime(bs_file)
@@ -85,6 +86,8 @@ module Motion; module Project;
end
bs_files << bs_file
end
else
embedded_frameworks = external_frameworks = []
end
# Build object files.
@@ -284,8 +287,8 @@ EOS
or File.mtime(librubymotion) > File.mtime(main_exec)
App.info 'Link', main_exec
objs_list = objs.map { |path, _| path }.unshift(init_o, main_o, *config.frameworks_stubs_objects(platform)).map { |x| "\"#{x}\"" }.join(' ')
framework_search_paths = (config.framework_search_paths + embedded_frameworks.map { |x| File.dirname(x) }).uniq.map { |x| "-F#{File.expand_path(x)}" }.join(' ')
frameworks = (config.frameworks_dependencies + embedded_frameworks.map { |x| File.basename(x, '.framework') }).map { |x| "-framework #{x}" }.join(' ')
framework_search_paths = (config.framework_search_paths + (embedded_frameworks + external_frameworks).map { |x| File.dirname(x) }).uniq.map { |x| "-F#{File.expand_path(x)}" }.join(' ')
frameworks = (config.frameworks_dependencies + (embedded_frameworks + external_frameworks).map { |x| File.basename(x, '.framework') }).map { |x| "-framework #{x}" }.join(' ')
weak_frameworks = config.weak_frameworks.map { |x| "-weak_framework #{x}" }.join(' ')
vendor_libs = config.vendor_projects.inject([]) do |libs, vendor_project|
libs << vendor_project.libs.map { |x|

View File

@@ -29,7 +29,8 @@ module Motion; module Project;
class OSXConfig < XcodeConfig
register :osx
variable :icon, :copyright, :category, :embedded_frameworks,
variable :icon, :copyright, :category,
:embedded_frameworks, :external_frameworks,
:codesign_for_development, :codesign_for_release,
:eval_support
@@ -40,6 +41,7 @@ module Motion; module Project;
@category = 'utilities'
@frameworks = ['AppKit', 'Foundation', 'CoreGraphics']
@embedded_frameworks = []
@external_frameworks = []
@codesign_for_development = false
@codesign_for_release = true
@eval_support = false
@@ -51,9 +53,11 @@ module Motion; module Project;
def device_family; 'mac'; end
def validate
# Embedded frameworks.
if !(embedded_frameworks.is_a?(Array) and embedded_frameworks.all? { |x| File.exist?(x) and File.extname(x) == '.framework' })
App.fail "app.embedded_frameworks should be an array of framework paths"
%w{ embedded_frameworks external_frameworks }.each do |attr|
value = send(attr)
if !(value.is_a?(Array) and value.all? { |x| File.exist?(x) and File.extname(x) == '.framework' })
App.fail "app.#{attr} should be an array of framework paths"
end
end
super