rakepp 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +7 -9
- data/lib/rakepp/all.rb +29 -0
- data/lib/rakepp/binarylib.rb +13 -0
- data/lib/rakepp/cleaner.rb +17 -0
- data/lib/rakepp/compiler.rb +24 -0
- data/lib/rakepp/exe.rb +5 -0
- data/lib/rakepp/files.rb +11 -0
- data/lib/rakepp/framework.rb +5 -0
- data/lib/rakepp/gcccompiler.rb +205 -0
- data/lib/rakepp/gccwin32compiler.rb +25 -0
- data/lib/rakepp/libhelper.rb +29 -0
- data/lib/rakepp/linuxcompiler.rb +11 -0
- data/lib/rakepp/objectfile.rb +14 -0
- data/lib/rakepp/os.rb +11 -0
- data/lib/rakepp/osxcompiler.rb +38 -0
- data/lib/rakepp/sharedlib.rb +9 -0
- data/lib/rakepp/sourcefile.rb +16 -0
- data/lib/rakepp/sourcelib.rb +30 -0
- data/lib/rakepp.rb +27 -9
- metadata +74 -56
- data/lib/rakepp/BinaryLib.rb +0 -21
- data/lib/rakepp/Compiler.rb +0 -12
- data/lib/rakepp/CompilerHelper.rb +0 -38
- data/lib/rakepp/DependencyHandler.rb +0 -37
- data/lib/rakepp/Exe.rb +0 -28
- data/lib/rakepp/Files.rb +0 -5
- data/lib/rakepp/Framework.rb +0 -23
- data/lib/rakepp/Gcc.rb +0 -115
- data/lib/rakepp/Lib.rb +0 -20
- data/lib/rakepp/LibHelper.rb +0 -46
- data/lib/rakepp/Msvt.rb +0 -80
- data/lib/rakepp/RakeHelper.rb +0 -82
- data/lib/rakepp/SourceLib.rb +0 -38
- data/lib/rakepp/Sources2Objects.rb +0 -35
- data/lib/rakepp/TaskDebug.rb +0 -18
- data/lib/rakepp/Tests.rb +0 -45
metadata
CHANGED
@@ -1,64 +1,82 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.8.10
|
3
|
-
specification_version: 1
|
4
2
|
name: rakepp
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date: 2006-01-23
|
8
|
-
summary: Cpp Support for Rake.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: gizmoATflopcodeDOTcom
|
12
|
-
homepage: "[http address which can't be saved due to external link blocker...]"
|
13
|
-
rubyforge_project: rakepp
|
14
|
-
description: Some more high level building blocks for cpp projects.
|
15
|
-
autorequire: rakepp
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: false
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
-
|
22
|
-
- ">"
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
version: 0.0.0
|
25
|
-
version:
|
4
|
+
version: 0.1.0
|
26
5
|
platform: ruby
|
27
6
|
authors:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
test_files: []
|
49
|
-
rdoc_options: []
|
50
|
-
extra_rdoc_files: []
|
7
|
+
- Christian Koestlin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-01-13 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: progressbar
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.3
|
24
|
+
version:
|
25
|
+
description: " Some more high level building blocks for cpp projects.\n"
|
26
|
+
email: gizmoATflopcodeDOTcom
|
51
27
|
executables: []
|
28
|
+
|
52
29
|
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files: []
|
32
|
+
|
33
|
+
files:
|
34
|
+
- lib/rakepp/all.rb
|
35
|
+
- lib/rakepp/binarylib.rb
|
36
|
+
- lib/rakepp/cleaner.rb
|
37
|
+
- lib/rakepp/compiler.rb
|
38
|
+
- lib/rakepp/exe.rb
|
39
|
+
- lib/rakepp/files.rb
|
40
|
+
- lib/rakepp/framework.rb
|
41
|
+
- lib/rakepp/gcccompiler.rb
|
42
|
+
- lib/rakepp/gccwin32compiler.rb
|
43
|
+
- lib/rakepp/libhelper.rb
|
44
|
+
- lib/rakepp/linuxcompiler.rb
|
45
|
+
- lib/rakepp/objectfile.rb
|
46
|
+
- lib/rakepp/os.rb
|
47
|
+
- lib/rakepp/osxcompiler.rb
|
48
|
+
- lib/rakepp/sharedlib.rb
|
49
|
+
- lib/rakepp/sourcefile.rb
|
50
|
+
- lib/rakepp/sourcelib.rb
|
51
|
+
- lib/rakepp.rb
|
52
|
+
- Rakefile
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://www.flopcode.com
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
53
74
|
requirements: []
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
version: 0.0.3
|
64
|
-
version:
|
75
|
+
|
76
|
+
rubyforge_project: rakepp
|
77
|
+
rubygems_version: 1.3.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Cpp Support for Rake.
|
81
|
+
test_files: []
|
82
|
+
|
data/lib/rakepp/BinaryLib.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'rakepp/Lib'
|
2
|
-
|
3
|
-
class BinaryLib < Lib
|
4
|
-
attr_reader :libs
|
5
|
-
|
6
|
-
def initialize(libName, includes, libs)
|
7
|
-
super(libName)
|
8
|
-
|
9
|
-
@artifact = nil
|
10
|
-
@includes = includes
|
11
|
-
libs.each do | lib |
|
12
|
-
@includes |= lib.includes
|
13
|
-
end
|
14
|
-
@libs = libs
|
15
|
-
end
|
16
|
-
|
17
|
-
def exeContribution
|
18
|
-
return @libName
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
data/lib/rakepp/Compiler.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#require 'rakepp/Msvt'
|
2
|
-
#require 'rakepp/Gcc'
|
3
|
-
|
4
|
-
class CompilerHelper
|
5
|
-
|
6
|
-
# def self.new(outputDir)
|
7
|
-
# defines = ['_LIB', 'DEBUG', '_COMMAND']
|
8
|
-
# defines += ['JAS_WIN_MSVC_BUILD', '_MBCS']
|
9
|
-
# defines += ['EXCLUDE_JPG_SUPPORT']
|
10
|
-
# defines += ['EXCLUDE_PGX_SUPPORT']
|
11
|
-
# defines += ['EXCLUDE_MIF_SUPPORT']
|
12
|
-
|
13
|
-
# defines += ['JPEG_SUPPORT']
|
14
|
-
|
15
|
-
# defines += ['HAVE_LIBPNG']
|
16
|
-
# defines += ['HAVE_LIBZ']
|
17
|
-
|
18
|
-
# if windows?
|
19
|
-
# defines += ['WIN32', '_WINDOWS']
|
20
|
-
# return Msvt.new(outputDir, defines, [])
|
21
|
-
# return Gcc.new(outputDir, defines, [])
|
22
|
-
# elsif osx?
|
23
|
-
# defines += ['WORDS_BIGENDIAN']
|
24
|
-
# defines += ['LINUX', 'OSX']
|
25
|
-
# else
|
26
|
-
# defines += ['LINUX']
|
27
|
-
# end
|
28
|
-
# return Gcc.new(outputDir, defines, [])
|
29
|
-
# end
|
30
|
-
|
31
|
-
def self.windows?
|
32
|
-
return RUBY_PLATFORM =~ /win32/i
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.osx?
|
36
|
-
return RUBY_PLATFORM.index('darwin') != nil
|
37
|
-
end
|
38
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class DependencyHandler
|
2
|
-
def DependencyHandler.setup(compiler)
|
3
|
-
|
4
|
-
depTask = task :dep do
|
5
|
-
compiler.calcDependencies
|
6
|
-
end
|
7
|
-
|
8
|
-
depFile = DependencyHandler.getDepFile(compiler)
|
9
|
-
if (File.exists?(depFile) == false) then
|
10
|
-
depTask.invoke
|
11
|
-
end
|
12
|
-
|
13
|
-
if (File.exists?(depFile)) then
|
14
|
-
dependencies = Marshal.load(File.open(depFile, 'rb'))
|
15
|
-
|
16
|
-
dependencies.each do | object, deps |
|
17
|
-
task = Rake::Task[object]
|
18
|
-
task.enhance(deps)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
def DependencyHandler.storeDependencies(compiler, allDependencies)
|
26
|
-
FileUtils.mkdir_p(compiler.outputDir)
|
27
|
-
File.open(DependencyHandler.getDepFile(compiler), 'wb') do | file |
|
28
|
-
Marshal.dump(allDependencies, file)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
def DependencyHandler.getDepFile(compiler)
|
34
|
-
return File.join(compiler.outputDir, 'dependencies')
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
data/lib/rakepp/Exe.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'rakepp/Sources2Objects'
|
2
|
-
|
3
|
-
class Exe
|
4
|
-
|
5
|
-
def Exe.new(compiler, name, sources, includes, libs, baseDir)
|
6
|
-
artifacts = Array.new
|
7
|
-
libs.each do | lib |
|
8
|
-
# puts "working on #{lib.libName}"
|
9
|
-
if (lib.artifact != nil) then
|
10
|
-
artifacts << lib.artifact
|
11
|
-
else
|
12
|
-
puts 'no artifact'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
files = Sources2Objects.do(compiler, name, baseDir, sources, includes, libs)
|
17
|
-
objects = files.values
|
18
|
-
|
19
|
-
exeName = File.join(compiler.outputDir, 'exes', "#{name}.exe")
|
20
|
-
res = file exeName => artifacts + objects do | task |
|
21
|
-
FileUtils.mkdir_p(File.dirname(task.name))
|
22
|
-
compiler.createExe(task.name, objects, libs)
|
23
|
-
end
|
24
|
-
return res
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
data/lib/rakepp/Files.rb
DELETED
data/lib/rakepp/Framework.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rakepp/Lib'
|
2
|
-
|
3
|
-
class Framework < Lib
|
4
|
-
|
5
|
-
attr_reader :libs
|
6
|
-
|
7
|
-
def initialize(frameworkName, libraries)
|
8
|
-
super(frameworkName)
|
9
|
-
# @frameworkName = frameworkName
|
10
|
-
@libs = libraries
|
11
|
-
@includes = Array.new
|
12
|
-
@artifact = nil#"Framework/#{frameworkName}"
|
13
|
-
end
|
14
|
-
|
15
|
-
# def libName()
|
16
|
-
# return @frameworkName
|
17
|
-
# end
|
18
|
-
|
19
|
-
def exeContribution
|
20
|
-
return "-framework #{@libName}"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/lib/rakepp/Gcc.rb
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require_gem 'progressbar'
|
3
|
-
|
4
|
-
require 'rakepp/Compiler'
|
5
|
-
|
6
|
-
class Gcc < Compiler
|
7
|
-
def initialize(outputDir, defines, includes)
|
8
|
-
super(outputDir)
|
9
|
-
@defines = defines
|
10
|
-
@includes = includes
|
11
|
-
end
|
12
|
-
|
13
|
-
def calcDependencies()
|
14
|
-
flags = "-MM"
|
15
|
-
flags = addDefines(flags, @defines)
|
16
|
-
|
17
|
-
allDependencies = Hash.new
|
18
|
-
progress = ProgressBar.new('calc deps', Sources2Objects.all.length)
|
19
|
-
Sources2Objects.all.each do | s |
|
20
|
-
addIncludes(flags, s.includes)
|
21
|
-
dependencies = `gcc #{flags} #{s.source}`.gsub(/\\\n/, '').split[1..-1]
|
22
|
-
allDependencies[s.object] = dependencies
|
23
|
-
progress.inc
|
24
|
-
end
|
25
|
-
progress.finish
|
26
|
-
|
27
|
-
DependencyHandler.storeDependencies(self, allDependencies)
|
28
|
-
end
|
29
|
-
|
30
|
-
def compile(src, obj, includes, libs)
|
31
|
-
raise 'includes == nil' if includes == nil
|
32
|
-
|
33
|
-
FileUtils.mkdir_p(File.dirname(obj))
|
34
|
-
|
35
|
-
flags = '-c -exceptions -Wall'
|
36
|
-
flags = addDefines(flags, @defines)
|
37
|
-
|
38
|
-
flags = addIncludes(flags, @includes)
|
39
|
-
flags = addIncludes(flags, includes)
|
40
|
-
# puts 'adding includes'
|
41
|
-
# libs.each do | lib |
|
42
|
-
# puts lib.libName
|
43
|
-
# end
|
44
|
-
|
45
|
-
flags = addIncludes(flags, LibHelper.getIncludes(libs))
|
46
|
-
puts flags
|
47
|
-
command = "gcc #{flags} -o #{obj} #{src}"
|
48
|
-
sh command
|
49
|
-
end
|
50
|
-
|
51
|
-
def addDefines(start, defines)
|
52
|
-
help = start
|
53
|
-
defines.each do | define |
|
54
|
-
newOne = " -D#{define}"
|
55
|
-
help << newOne unless help.include?(newOne)
|
56
|
-
end
|
57
|
-
return help
|
58
|
-
end
|
59
|
-
|
60
|
-
def addIncludes(start, includes)
|
61
|
-
help = start
|
62
|
-
includes.each do | include |
|
63
|
-
newOne = " -I#{include} "
|
64
|
-
help << newOne unless help.include?(newOne)
|
65
|
-
end
|
66
|
-
return help
|
67
|
-
end
|
68
|
-
|
69
|
-
def linkLib(objects, artifact, libName)
|
70
|
-
command = "ar -r #{artifact}"
|
71
|
-
objects.each do | o |
|
72
|
-
command += " #{o}"
|
73
|
-
end
|
74
|
-
sh command
|
75
|
-
end
|
76
|
-
|
77
|
-
def createExe(name, objects, libs)
|
78
|
-
flatLibs = LibHelper.getLibs(libs)
|
79
|
-
libArtifacts = Array.new
|
80
|
-
flatLibs.each do |l|
|
81
|
-
libArtifacts << l.artifact unless l.artifact == nil
|
82
|
-
end
|
83
|
-
exeTask = file name => libArtifacts + objects do | t |
|
84
|
-
command = "g++ -stdc++ -o #{name}"
|
85
|
-
|
86
|
-
objects.each do | o |
|
87
|
-
command += " #{o}"
|
88
|
-
end
|
89
|
-
|
90
|
-
flatLibs.each do | l |
|
91
|
-
if (l.instance_of?(SourceLib))
|
92
|
-
libAndPath = l.exeContribution
|
93
|
-
path = libAndPath[0...libAndPath.rindex('/')]
|
94
|
-
lib = l.libName
|
95
|
-
command += " -L#{path} -l#{lib}"
|
96
|
-
elsif (l.instance_of?(Framework))
|
97
|
-
command += " #{l.exeContribution}"
|
98
|
-
else
|
99
|
-
command += " -l#{l.exeContribution}"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
sh command
|
104
|
-
|
105
|
-
if (CompilerHelper.osx?())
|
106
|
-
sh "/Developer/Tools/Rez -o #{name} appResources.r"
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
def getSourceLibArtifact(lib)
|
112
|
-
return File.join(@outputDir, 'libs', "lib#{lib.libName}.a")
|
113
|
-
end
|
114
|
-
|
115
|
-
end
|
data/lib/rakepp/Lib.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
class Lib
|
2
|
-
attr_reader :artifact, :includes
|
3
|
-
|
4
|
-
def initialize(libName)
|
5
|
-
# puts "creating lib with name #{libName}"
|
6
|
-
@libName = libName
|
7
|
-
end
|
8
|
-
|
9
|
-
def path
|
10
|
-
return LibHelper.path(@artifact)
|
11
|
-
end
|
12
|
-
|
13
|
-
def libName
|
14
|
-
@libName#raise 'not imlpemented exception'
|
15
|
-
end
|
16
|
-
|
17
|
-
def exeContribution
|
18
|
-
return artifact
|
19
|
-
end
|
20
|
-
end
|
data/lib/rakepp/LibHelper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
class LibHelper
|
2
|
-
# adds the element to the end of the lib
|
3
|
-
def self.addUnique(res, lib)
|
4
|
-
res.delete(lib)
|
5
|
-
res.push(lib)
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.getLibs(libs)
|
9
|
-
res = Array.new
|
10
|
-
libs.each do | lib |
|
11
|
-
self.addUnique(res, lib)
|
12
|
-
self.getLibs(lib.libs).each do | lib |
|
13
|
-
self.addUnique(res, lib)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
return res
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.getIncludes(libs)
|
20
|
-
res = Array.new
|
21
|
-
|
22
|
-
libs.each do | lib |
|
23
|
-
res |= [lib.includes] if lib.includes.size > 0
|
24
|
-
res += LibHelper.getIncludes(lib.libs)
|
25
|
-
end
|
26
|
-
return res
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
def self.getArtifacts(libs)
|
31
|
-
res = Array.new
|
32
|
-
libs.each do |l|
|
33
|
-
res.push(l.artifact) unless l.artifact == nil
|
34
|
-
end
|
35
|
-
return res
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.libName(artifactPath)
|
39
|
-
return artifactPath[artifactPath.rindex('/')+1...artifactPath.size]
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.path(artifactPath)
|
43
|
-
return artifactPath[0...artifactPath.rindex('/')]
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
data/lib/rakepp/Msvt.rb
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'rakepp/Compiler'
|
2
|
-
require 'rakepp/LibHelper'
|
3
|
-
|
4
|
-
class Msvt < Compiler
|
5
|
-
def initialize(baseDir, defines, includes)
|
6
|
-
super(baseDir)
|
7
|
-
@defines = defines + ['MSVT']
|
8
|
-
@includes = includes
|
9
|
-
end
|
10
|
-
|
11
|
-
def calcDependencies()
|
12
|
-
# dont know how to do this
|
13
|
-
end
|
14
|
-
|
15
|
-
def compile(src, obj, includes, libs)
|
16
|
-
raise 'includes == nil' if includes == nil
|
17
|
-
flags = '/GR /EHsc /MT /nologo /Zi /EHsc /c /FD /Y-'
|
18
|
-
FileUtils.mkdir_p(File.dirname(obj))
|
19
|
-
|
20
|
-
@defines.each do | define |
|
21
|
-
flags << " /D \"#{define}\""
|
22
|
-
end
|
23
|
-
|
24
|
-
flags = addIncludes(flags, @includes)
|
25
|
-
flags = addIncludes(flags, includes)
|
26
|
-
flags = addIncludes(flags, LibHelper.getIncludes(libs))
|
27
|
-
|
28
|
-
command = "cl #{flags} /Fo#{obj} #{src}"
|
29
|
-
sh command
|
30
|
-
end
|
31
|
-
|
32
|
-
def addIncludes(start, includes)
|
33
|
-
help = start
|
34
|
-
includes.each do | include |
|
35
|
-
help << " /I#{include}"
|
36
|
-
end
|
37
|
-
return help
|
38
|
-
end
|
39
|
-
|
40
|
-
def linkLib(objects, artifact, libName)
|
41
|
-
command = "link -lib /out:#{artifact}"
|
42
|
-
objects.each do | o |
|
43
|
-
command += " #{o}"
|
44
|
-
end
|
45
|
-
command += " /machine:i386"
|
46
|
-
sh command
|
47
|
-
end
|
48
|
-
|
49
|
-
def createExe(name, objects, libs)
|
50
|
-
flatLibs = LibHelper.getLibs(libs)
|
51
|
-
exeTask = file name => flatLibs.collect {| l | l.artifact} + objects do | t |
|
52
|
-
command = "link /NODEFAULTLIB libcpmt.lib kernel32.lib libcmt.lib mscoree.lib oldnames.lib user32.lib"
|
53
|
-
|
54
|
-
flatLibs.each do | l |
|
55
|
-
if (l.instance_of?(SourceLib))
|
56
|
-
libAndPath = l.exeContribution
|
57
|
-
idx = libAndPath.rindex('/')
|
58
|
-
path = libAndPath[0...idx]
|
59
|
-
lib = libAndPath[idx+1..-1]
|
60
|
-
command += " /LIBPATH:#{path} #{lib}"
|
61
|
-
else
|
62
|
-
command += " #{l.exeContribution}.lib"
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
command += " /out:#{name}"
|
68
|
-
objects.each do | o |
|
69
|
-
command += " #{o}"
|
70
|
-
end
|
71
|
-
sh command
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def getSourceLibArtifact(lib)
|
76
|
-
return File.join(@outputDir, 'libs', "#{lib.libName}.lib")
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
end
|
data/lib/rakepp/RakeHelper.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
class RakeHelper
|
2
|
-
|
3
|
-
@@TARGET = 'release/'
|
4
|
-
|
5
|
-
def self.to_o(s)
|
6
|
-
# nach letztem punkt suchen und dann wort ende
|
7
|
-
return s.sub(/\.[^.]+$/, '.o')
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.get_source_files(base, lib, ending)
|
11
|
-
return Dir["#{base}#{lib}/**/*#{ending}"]
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.remove_from_front(stuff, s)
|
15
|
-
idx = s.index(stuff)
|
16
|
-
if (idx == nil) then
|
17
|
-
raise 'matching front not found'
|
18
|
-
elsif (idx != 0) then
|
19
|
-
raise 'match not found at front'
|
20
|
-
else
|
21
|
-
return s.slice(stuff.length..-1)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.get_pairs(base, lib, ending) s
|
26
|
-
sources = get_source_files(base, lib, ending)
|
27
|
-
pairs = Hash.new
|
28
|
-
sources.each do | file |
|
29
|
-
pairs[file] = @@TARGET + RakeHelper::remove_from_front(base, RakeHelper::to_o(file))
|
30
|
-
end
|
31
|
-
return pairs
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.create_compile_tasks(base, lib, ending, compiler, defines, includes)
|
35
|
-
# puts 'create_compile_tasks'
|
36
|
-
pairs = RakeHelper.get_pairs(base, lib, ending)
|
37
|
-
|
38
|
-
pairs.each do |src, obj|
|
39
|
-
file obj => [src] do |task|
|
40
|
-
compiler.compile(src, task.name, defines, includes)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.lib(libName, baseDir, includes, compiler, &proc)
|
46
|
-
globber = "#{baseDir}/#{libName}/**/*.cpp"
|
47
|
-
srcFiles = Dir[globber].reject do | f |
|
48
|
-
proc.call f
|
49
|
-
end
|
50
|
-
|
51
|
-
cAndOFiles = Hash.new
|
52
|
-
srcFiles.each do | cFile |
|
53
|
-
objectFile = RakeHelper::to_o(cFile)
|
54
|
-
outFile = RakeHelper::remove_from_front(baseDir, objectFile)
|
55
|
-
outFile = @@TARGET + outFile
|
56
|
-
cAndOFiles[cFile] = outFile
|
57
|
-
file outFile => [cFile] do | task |
|
58
|
-
compiler.compile(cFile, task.name)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
# file "#{libName}" => cAndOFiles.values do | task |
|
62
|
-
# puts task
|
63
|
-
# end
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.includeCleaner(s)
|
67
|
-
parts = s.split(File::SEPARATOR)
|
68
|
-
if (parts.length > 1)
|
69
|
-
if (parts[-1] == '..')
|
70
|
-
if (parts[-2] != '..')
|
71
|
-
parts = parts[0...-2]
|
72
|
-
end
|
73
|
-
elsif (parts[-1] == '.')
|
74
|
-
parts = parts[0...-1]
|
75
|
-
end
|
76
|
-
end
|
77
|
-
res = File.join(parts)
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
|
82
|
-
|
data/lib/rakepp/SourceLib.rb
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'rakepp/Lib'
|
2
|
-
require 'rakepp/LibHelper'
|
3
|
-
require 'rakepp/Sources2Objects'
|
4
|
-
|
5
|
-
class SourceLib < Lib
|
6
|
-
attr_accessor :libs
|
7
|
-
|
8
|
-
def self.getBaseDir(libName)
|
9
|
-
return File.join('..', libName)
|
10
|
-
end
|
11
|
-
|
12
|
-
def initialize(compiler, libName, includes, sources, libs, baseDir=nil)
|
13
|
-
super(libName)
|
14
|
-
|
15
|
-
if baseDir != nil then
|
16
|
-
@baseDir = baseDir
|
17
|
-
else
|
18
|
-
@baseDir = SourceLib.getBaseDir(libName)
|
19
|
-
end
|
20
|
-
|
21
|
-
@artifact = compiler.getSourceLibArtifact(self)
|
22
|
-
@includes = includes.collect do |i|
|
23
|
-
res = File.join(@baseDir, i)
|
24
|
-
RakeHelper.includeCleaner(res)
|
25
|
-
end
|
26
|
-
@libs = libs
|
27
|
-
files = Sources2Objects.do(compiler, libName, @baseDir, sources, @includes, libs)
|
28
|
-
file @artifact => files.values + LibHelper.getArtifacts(libs) do | task |
|
29
|
-
FileUtils.mkdir_p(File.dirname(task.name))
|
30
|
-
compiler.linkLib(files.values, task.name, @libName)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def baseDir
|
35
|
-
return @baseDir
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|