Class: OsxCompiler

Inherits:
GccCompiler show all
Defined in:
lib/rakepp/osxcompiler.rb

Instance Attribute Summary

Attributes inherited from Compiler

#compileflags, #targetDir

Instance Method Summary collapse

Methods inherited from GccCompiler

#add_binary_lib_tasks, #add_exe_tasks, #add_framework_tasks, #add_lib_prefix, #add_lib_suffix, #add_object_tasks, #add_shared_lib_tasks, #add_source_lib_tasks, #add_transitive_library_prerequisites, #apply_task, #calc_dependencies, #compiler, #defines, #dep_missing?, #end_of_libs, #includes, #recreate_task, #start_of_libs

Methods inherited from Compiler

#add_tasks

Constructor Details

#initialize(defines, compileflags, architecture, gui = true, output_suffix = '') ⇒ OsxCompiler

Returns a new instance of OsxCompiler.



3
4
5
6
7
# File 'lib/rakepp/osxcompiler.rb', line 3

def initialize(defines, compileflags, architecture, gui=true, output_suffix='')
  super("osx#{output_suffix}", defines, "#{compileflags} -arch #{architecture}")
  @architecture = architecture
  @gui = gui
end

Instance Method Details

#add_lib(task, lib) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/rakepp/osxcompiler.rb', line 25

def add_lib(task, lib)
  if (lib.instance_of?(Framework)) then
    return " -framework #{lib.name}"
  else
    return super(task, lib)
  end
end

#do_additional_work_for_exe(artifact) ⇒ Object



33
34
35
36
37
# File 'lib/rakepp/osxcompiler.rb', line 33

def do_additional_work_for_exe(artifact)
  if @gui
    sh "/Developer/Tools/Rez -o #{artifact.outFile} appResources.r"
  end
end

#shared_extensionObject



21
22
23
# File 'lib/rakepp/osxcompiler.rb', line 21

def shared_extension()
  return 'so'
end

#start_of_shared_lib_command(libName, artifact) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/rakepp/osxcompiler.rb', line 13

def start_of_shared_lib_command(libName, artifact)
  name = artifact.options[:name]
  if name == nil
    name = File.basename(libName)
  end
  return "g++ -arch #{@architecture} -dynamiclib -install_name #{name}"
end

#start_of_source_lib_command(outname, artifact) ⇒ Object



9
10
11
# File 'lib/rakepp/osxcompiler.rb', line 9

def start_of_source_lib_command(outname, artifact)
  return "libtool -static -arch_only #{@architecture} -o #{outname}"
end