rakepp 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ require 'rake/gempackagetask'
4
4
  desc "Default Task"
5
5
  task :default => :package
6
6
 
7
- PKG_VERSION = '0.1.2'
7
+ PKG_VERSION = '0.1.3'
8
8
  PKG_FILES = FileList[
9
9
  'lib/**/*.rb',
10
10
  '*.xml',
@@ -1,9 +1,11 @@
1
1
  class Compiler
2
2
  attr_reader :targetDir
3
+
3
4
  def initialize(targetDir, defines)
4
5
  @targetDir = targetDir
5
6
  @defines = defines
6
7
  end
8
+
7
9
  def addTasks(artifact)
8
10
  if (artifact.instance_of?(Exe)) then
9
11
  addExeTasks(artifact)
@@ -21,4 +23,6 @@ class Compiler
21
23
  raise "unknown type " + artifact.to_s
22
24
  end
23
25
  end
26
+
24
27
  end
28
+
@@ -38,12 +38,20 @@ class GccCompiler < Compiler
38
38
  All.addDepFile(depFile)
39
39
  end
40
40
 
41
+ def arch
42
+ if ARCH.length > 0
43
+ return "-arch #{ARCH}"
44
+ end
45
+ return ''
46
+ end
47
+
41
48
  def compiler(artifact)
49
+
42
50
  if ((artifact.source.fullPath.index(".cpp") != nil) ||
43
51
  (artifact.source.fullPath.index(".cxx") != nil)) then
44
- return "g++ -arch #{ARCH} #{OPTIMIZE} -Wall"
52
+ return "g++ #{arch} #{OPTIMIZE} -Wall"
45
53
  else
46
- return "gcc -arch #{ARCH} #{OPTIMIZE} -Wall"
54
+ return "gcc #{arch} #{OPTIMIZE} -Wall"
47
55
  end
48
56
  end
49
57
 
@@ -161,14 +169,16 @@ def addExeTasks(artifact)
161
169
  artifact.outFile = File.join(exesName, artifact.name + '.exe')
162
170
  desc "Create Exe #{artifact.outFile}"
163
171
  theTask = file artifact.outFile => objects do | task |
164
- command = "g++ -arch #{ARCH} -o #{artifact.outFile}"
172
+ command = "g++ #{arch} -o #{artifact.outFile}"
165
173
  objects.each do |o|
166
174
  command += " #{o}"
167
175
  end
168
176
 
177
+ command += " -Wl,--start-group "
169
178
  LibHelper.tr_libs(artifact.libs).each do |lib|
170
179
  command += addLib(task, lib)
171
180
  end
181
+ command += " -Wl,--end-group"
172
182
 
173
183
  sh command
174
184
  doAdditionalWorkForExe(artifact)
@@ -181,25 +191,33 @@ def addExeTasks(artifact)
181
191
  directory exesName
182
192
  end
183
193
 
184
- def doAdditionalWorkForExe(artifact)
185
- end
194
+ def doAdditionalWorkForExe(artifact)
195
+ end
196
+
197
+ def addTransitiveLibraryPrerequisites(theTask, artifact)
198
+ LibHelper.tr_libs(artifact.libs).each do |lib|
199
+ theTask.prerequisites << lib.outFile unless lib.kind_of?(BinaryLib)
200
+ end
201
+ end
202
+
203
+ def addLib(task, lib)
204
+ if (lib.instance_of?(BinaryLib)) then
205
+ return " -L#{lib.path||'/usr/lib'} -l#{lib.name} "
206
+ elsif (lib.instance_of?(SourceLib)) then
207
+ return "#{addLibPrefix(lib)} -L#{targetDir}/libs -l#{lib.name} #{addLibSuffix(lib)}"
208
+ elsif (lib.instance_of?(SharedLib)) then
209
+ return " #{targetDir}/libs/#{lib.name}.so "
210
+ else
211
+ raise "#{lib} not supported"
212
+ end
213
+ end
186
214
 
187
- def addTransitiveLibraryPrerequisites(theTask, artifact)
188
- LibHelper.tr_libs(artifact.libs).each do |lib|
189
- theTask.prerequisites << lib.outFile unless lib.kind_of?(BinaryLib)
215
+ def addLibPrefix(lib)
216
+ return ''
190
217
  end
191
- end
192
218
 
193
- def addLib(task, lib)
194
- if (lib.instance_of?(BinaryLib)) then
195
- return " -L#{lib.path||'/usr/lib'} -l#{lib.name} "
196
- elsif (lib.instance_of?(SourceLib)) then
197
- return " -L#{targetDir}/libs -l#{lib.name}"
198
- elsif (lib.instance_of?(SharedLib)) then
199
- return " #{targetDir}/libs/#{lib.name}.so "
200
- else
201
- raise "#{lib} not supported"
219
+ def addLibSuffix(lib)
220
+ return ''
202
221
  end
203
- end
204
222
 
205
223
  end
@@ -1,11 +1,32 @@
1
1
  class LinuxCompiler < GccCompiler
2
- def initialize(defines)
3
- super('linux', defines)
2
+
3
+ def initialize(defines, output_suffix='')
4
+ super("linux#{output_suffix}", defines)
4
5
  end
6
+
5
7
  def startOfSharedLibCommand(libName, artifact)
6
8
  return "g++ -shared"
7
9
  end
10
+
8
11
  def sharedExtension
9
12
  return 'so'
10
13
  end
14
+
15
+
16
+ def addLibPrefix(lib)
17
+ if lib.forceLib
18
+ return '-Wl,--whole-archive'
19
+ else
20
+ return ''
21
+ end
22
+ end
23
+
24
+ def addLibSuffix(lib)
25
+ if lib.forceLib
26
+ return '-Wl,--no-whole-archive'
27
+ else
28
+ return ''
29
+ end
30
+ end
31
+
11
32
  end
@@ -1,7 +1,7 @@
1
1
  class SourceLib
2
- attr_reader :name, :sources, :includes, :outFile, :libs, :privateDefines
2
+ attr_reader :name, :sources, :includes, :outFile, :libs, :privateDefines, :forceLib
3
3
  attr_writer :outFile, :privateDefines
4
- def initialize(compiler, base, name, sources, libs, includes, privateDefines=[])
4
+ def initialize(compiler, base, name, sources, libs, includes, privateDefines=[], forceLib=false)
5
5
  @name = name
6
6
  @sources = sources
7
7
  @libs = libs
@@ -13,6 +13,7 @@ class SourceLib
13
13
  end
14
14
  end
15
15
  @privateDefines = privateDefines
16
+ @forceLib = forceLib
16
17
  compiler.addTasks(self)
17
18
  end
18
19
 
data/lib/rakepp.rb CHANGED
@@ -1,14 +1,4 @@
1
1
  require 'rakepp/os'
2
-
3
- #OPTIMIZE = '-O3'
4
- #OPTIMIZE = ''
5
-
6
- #if OS.osx?
7
- # ARCH = '-arch i386 -O0 -gdwarf-2 -mfix-and-continue -fmessage-length=0'
8
- #else
9
- # ARCH = ''
10
- #end
11
-
12
2
  require 'rakepp/cleaner'
13
3
  require 'rakepp/all'
14
4
  require 'rakepp/compiler'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakepp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Koestlin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-26 00:00:00 +01:00
12
+ date: 2010-03-09 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.0.3
24
24
  version:
25
- description: Some more high level building blocks for cpp projects.
25
+ description: " Some more high level building blocks for cpp projects.\n"
26
26
  email: gizmoATflopcodeDOTcom
27
27
  executables: []
28
28
 
@@ -50,8 +50,10 @@ files:
50
50
  - lib/rakepp/sourcelib.rb
51
51
  - lib/rakepp.rb
52
52
  - Rakefile
53
- has_rdoc: false
53
+ has_rdoc: true
54
54
  homepage: http://www.flopcode.com
55
+ licenses: []
56
+
55
57
  post_install_message:
56
58
  rdoc_options: []
57
59
 
@@ -72,9 +74,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
74
  requirements: []
73
75
 
74
76
  rubyforge_project: rakepp
75
- rubygems_version: 1.3.1
77
+ rubygems_version: 1.3.5
76
78
  signing_key:
77
- specification_version: 2
79
+ specification_version: 3
78
80
  summary: Cpp Support for Rake.
79
81
  test_files: []
80
82