rakish 0.9.01.beta → 0.9.11.beta
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/doc/ChangeLog.txt +50 -0
- data/lib/rakish/ArchiveBuilder.rb +1 -3
- data/lib/rakish/BuildConfig.rb +15 -9
- data/lib/rakish/CppProjects.rb +183 -97
- data/lib/rakish/JavaProjects.rb +130 -33
- data/lib/rakish/PlatformTools.rb +13 -13
- data/lib/rakish/Rakish.rb +167 -64
- data/lib/rakish/RakishProject.rb +66 -51
- data/lib/rakish/RaspberiPiCppTools.rb +327 -0
- data/lib/rakish/VcprojBuilder.rb +21 -11
- data/lib/rakish/WindowsCppTools.rb +270 -176
- data.tar.gz.sig +0 -0
- metadata +42 -43
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a76add697656e40d4a07ed495c25dc8e89015582873066c66b86904e18c8c46b
|
|
4
|
+
data.tar.gz: 1f3077d8a0246a0ed4ac0bac085443fa05ccb0b93b1cab753ea58fdf16674995
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: fc547a117eaa7e5935ce84498c9bd5bddc73b55002cbba772995386c58f46cfd2d6a81f815396fbdd72d5f7b689edb52c88a0d50ed0f52e42d8c542acc34dbc9
|
|
7
|
+
data.tar.gz: 77b12ea0587eac95bc51c7562d6b1fa82a20ab4c00be7023b0140608c99360f459ee4347fdd46e7491d13d1965e1ffc3df7cade5072dd3afc240bc786def4850
|
checksums.yaml.gz.sig
ADDED
|
Binary file
|
data/doc/ChangeLog.txt
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
0.9.10.beta
|
|
4
|
+
|
|
5
|
+
- definiteitely some bugfixes in the heat of getting projects to build.
|
|
6
|
+
|
|
7
|
+
- Some cleanup on the CppProjects module
|
|
8
|
+
|
|
9
|
+
- Added RaspberiPiCppTools for building C,C++ code on the Raspberi Pi.
|
|
10
|
+
|
|
11
|
+
- Added rakish Rakish::SearchPath to facilitate finding executables in the current PATH or items in the classpath
|
|
12
|
+
or other paths.
|
|
13
|
+
|
|
14
|
+
- Added BuildConfig#findInPath to Rakish::ProjectConfig
|
|
15
|
+
|
|
16
|
+
- Added experimental "createArgs" to Rake::Task to allow setting named values in a Task at "define_task" time.
|
|
17
|
+
Since the added args can not be the same as the task name, using a prefix on the keys of '@' or '$' is a good way
|
|
18
|
+
of preventing conflicts as these are not typically used as task names. This feature requires ruby 1.9.x+ to work.
|
|
19
|
+
|
|
20
|
+
examples:
|
|
21
|
+
|
|
22
|
+
task :withCreateArgs, :arg0=>'val0', :arg1=>val1 ... do end
|
|
23
|
+
task :withCreateArgs=>[ :deps ], :arg0=>'val0', :arg1=>val1 ... do end
|
|
24
|
+
task :withCreateArgs, [ :commandLineArg, ... ], :arg0=>'val0', :arg1=>val1 ... do end
|
|
25
|
+
task :withCreateArgs, [ :commandLineArg, ... ]=>[ :deps ], :arg0=>'val0', :arg1=>val1 ... do end
|
|
26
|
+
|
|
27
|
+
removed the "Task#data" method as the "Task#createArgs" now substitutes and this was only used in one place in the
|
|
28
|
+
windows C compiler tools manifest builder task.
|
|
29
|
+
|
|
30
|
+
- Added Rakish::FileSetTask to check timestamps on a collection of files specified with wildcards but not have them
|
|
31
|
+
added as prerequisites. The wildcards are evaluated the first time the timestamp is checked which is when a task with
|
|
32
|
+
a dependency on it checks it's dependencies. The wildcards are specified at instantiation time.
|
|
33
|
+
|
|
34
|
+
This to handle executing a task if any of the files found have been touched.
|
|
35
|
+
|
|
36
|
+
- Added fileset_task convenience method ro Rakish::Utils
|
|
37
|
+
|
|
38
|
+
0.9.11.beta
|
|
39
|
+
|
|
40
|
+
- Buyers remorse on createArgs it now uses only one named argument :$@
|
|
41
|
+
This makes life a lot simpler and more future proof in case later versions of rake use
|
|
42
|
+
additional named aruments
|
|
43
|
+
|
|
44
|
+
examples:
|
|
45
|
+
|
|
46
|
+
task :withCreateArgs, :$@=>{ :arg0=>'val0', :arg1=>val1 ...} do end
|
|
47
|
+
task :withCreateArgs=>[ :deps ], :$@=>{ :arg0=>'val0', :arg1=>val1 ...} do end
|
|
48
|
+
task :withCreateArgs, [ :commandLineArg, ... ], :$@=>{ :arg0=>'val0', :arg1=>val1 ...} do end
|
|
49
|
+
task :withCreateArgs, [ :commandLineArg, ... ]=>[ :deps ], :$@=>{ :arg0=>'val0', :arg1=>val1 ...} do end
|
|
50
|
+
|
|
@@ -100,7 +100,7 @@ module Rakish
|
|
|
100
100
|
def addZipContents(archivePath,*filters)
|
|
101
101
|
|
|
102
102
|
if(filters.length < 1)
|
|
103
|
-
filters=['
|
|
103
|
+
filters=['**/*'];
|
|
104
104
|
end
|
|
105
105
|
entry = {};
|
|
106
106
|
entry[:destDir]=('.');
|
|
@@ -111,7 +111,6 @@ module Rakish
|
|
|
111
111
|
|
|
112
112
|
def loadTempDir(dir) # :nodoc: TODO "the "####" and '#' flag thing is messy maybe :type in entry ??
|
|
113
113
|
|
|
114
|
-
|
|
115
114
|
archiveContents_.each do |entry|
|
|
116
115
|
|
|
117
116
|
# copy or extract all the files for the jar to a temporary folder
|
|
@@ -131,7 +130,6 @@ module Rakish
|
|
|
131
130
|
# but not "a/foo" or "a/b/foo"
|
|
132
131
|
|
|
133
132
|
cmd = "\"#{unzipPath}\" -q \"#{spl[0]}\" \"#{entry[:files].join("\" \"")}\" -x \"META-INF/*\" -d \"#{dir}\"";
|
|
134
|
-
|
|
135
133
|
execLogged(cmd, :verbose=>verbose?);
|
|
136
134
|
|
|
137
135
|
else
|
data/lib/rakish/BuildConfig.rb
CHANGED
|
@@ -71,8 +71,8 @@ module BuildConfigModule
|
|
|
71
71
|
# pointing to the actual libraries if not there ( windows DLL libs )
|
|
72
72
|
attr_property :nativeLibDir
|
|
73
73
|
|
|
74
|
-
# folder to output native object and intermediate files to
|
|
75
|
-
attr_property :
|
|
74
|
+
# folder to output native object and intermediate files to for this module
|
|
75
|
+
attr_property :moduleObjDir
|
|
76
76
|
|
|
77
77
|
# folder to output native binary dll and so files to
|
|
78
78
|
attr_property :binDir
|
|
@@ -92,10 +92,10 @@ module BuildConfigModule
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
# folder to output native executable and dll files to.
|
|
95
|
-
# defaults to (buildDir)/bin
|
|
95
|
+
# defaults to (buildDir)/bin/(nativeConfigName)
|
|
96
96
|
def binDir
|
|
97
|
-
@binDir||=getAnyAbove(:binDir)||"#{buildDir()}/bin";
|
|
98
|
-
|
|
97
|
+
@binDir||=getAnyAbove(:binDir)||"#{buildDir()}/bin/#{nativeConfigName}";
|
|
98
|
+
end
|
|
99
99
|
|
|
100
100
|
# folder to output native library files and link references to.
|
|
101
101
|
# defaults to (buildDir)/lib
|
|
@@ -106,8 +106,8 @@ module BuildConfigModule
|
|
|
106
106
|
# folder to output native intermedite and object files to.
|
|
107
107
|
# config defaults to (buildDir)/obj
|
|
108
108
|
# in a project module defaults to the value set in th (configValue)/(moduleName)
|
|
109
|
-
def
|
|
110
|
-
@
|
|
109
|
+
def moduleObjDir
|
|
110
|
+
@moduleObjDir||=getAnyAbove(:moduleObjDir)||"#{buildDir()}/obj";
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
# suffix to add to native output files
|
|
@@ -116,6 +116,13 @@ module BuildConfigModule
|
|
|
116
116
|
@nativeOutputSuffix||=nativeConfigName();
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
+
# temporary include directory built for compiling
|
|
120
|
+
# where generated include files or links to the project sources
|
|
121
|
+
# are created
|
|
122
|
+
def buildIncludeDir
|
|
123
|
+
@buildIncludeDir ||= getInherited(:buildIncludeDir)||"#{@buildDir}/include"
|
|
124
|
+
end
|
|
125
|
+
|
|
119
126
|
attr_accessor :verbose
|
|
120
127
|
|
|
121
128
|
def verbose?
|
|
@@ -200,12 +207,11 @@ class GlobalConfig < BuildConfig
|
|
|
200
207
|
|
|
201
208
|
# set defaults if not set above
|
|
202
209
|
@nativeLibDir ||= "#{@buildDir}/lib"
|
|
203
|
-
@binDir ||= "#{@buildDir}/bin"
|
|
204
|
-
@INCDIR ||= "#{@buildDir}/include"
|
|
205
210
|
|
|
206
211
|
# get config from command line
|
|
207
212
|
cfg.nativeConfigName ||= ENV['nativeConfigName'];
|
|
208
213
|
cfg.nativeConfigName ||= defaultConfig
|
|
214
|
+
binDir();
|
|
209
215
|
|
|
210
216
|
end
|
|
211
217
|
|
data/lib/rakish/CppProjects.rb
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
myPath = File.dirname(File.expand_path(__FILE__));
|
|
2
2
|
require "#{myPath}/RakishProject.rb"
|
|
3
3
|
|
|
4
|
+
include Rake::DSL
|
|
5
|
+
|
|
4
6
|
module Rakish
|
|
5
7
|
|
|
6
8
|
# :nodoc: legacy only looked at in the
|
|
@@ -14,54 +16,36 @@ module CTools
|
|
|
14
16
|
include Rakish::Logger
|
|
15
17
|
include Rakish::Util
|
|
16
18
|
|
|
17
|
-
VALID_PLATFORMS = {
|
|
18
|
-
:Win32 => {
|
|
19
|
-
:module => "#{Rakish::MAKEDIR}/WindowsCppTools.rb",
|
|
20
|
-
},
|
|
21
|
-
:Win64 => {
|
|
22
|
-
:module => "#{Rakish::MAKEDIR}/WindowsCppTools.rb",
|
|
23
|
-
},
|
|
24
|
-
:iOS => {
|
|
25
|
-
:module => "#{Rakish::MAKEDIR}/IOSCTools.rb",
|
|
26
|
-
},
|
|
27
|
-
:Linux32 => {
|
|
28
|
-
:module => "#{Rakish::MAKEDIR}/GCCCTools.rb",
|
|
29
|
-
},
|
|
30
|
-
:Linux64 => {
|
|
31
|
-
:module => "#{Rakish::MAKEDIR}/GCCCTools.rb",
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
|
|
35
19
|
# parses and validates an unknown string configuration name
|
|
36
20
|
# of the format [TargetPlatform]-[Compiler]-(items specific to compiler type)
|
|
37
21
|
# and loads if possible an instance of a set of configured "CTools"
|
|
38
22
|
# for the specified "nativeConfigName" configuration.
|
|
39
|
-
def self.loadConfiguredTools(strCfg)
|
|
40
|
-
|
|
41
|
-
splitcfgs = strCfg.split('-');
|
|
42
|
-
platform = VALID_PLATFORMS[splitcfgs[0].to_sym];
|
|
43
|
-
|
|
44
|
-
unless platform
|
|
45
|
-
raise InvalidConfigError.new(strCfg, "unrecognized platform \"#{splitcfgs[0]}\"");
|
|
46
|
-
end
|
|
47
|
-
factory = LoadableModule.load(platform[:module]);
|
|
48
|
-
factory.getConfiguredTools(splitcfgs,strCfg);
|
|
49
23
|
|
|
24
|
+
def self.loadToolchain(moduleName,configName,args={})
|
|
25
|
+
begin
|
|
26
|
+
require moduleName;
|
|
27
|
+
moduleName = moduleName.pathmap('%n');
|
|
28
|
+
mod = Rakish.const_get(moduleName.to_s);
|
|
29
|
+
mod.getConfiguredTools(configName,args);
|
|
30
|
+
rescue
|
|
31
|
+
log.debug("unrecognized toolchain module \"#{moduleName}\"");
|
|
32
|
+
end
|
|
50
33
|
end
|
|
51
34
|
|
|
52
|
-
def writeLinkref(cfg,baseName,targetName)
|
|
53
|
-
|
|
35
|
+
def writeLinkref(cfg,baseName,targetName)
|
|
54
36
|
defpath = "#{cfg.nativeLibDir}/#{baseName}-#{cfg.nativeConfigName}.linkref"
|
|
55
|
-
|
|
37
|
+
reltarget = getRelativePath(targetName,cfg.nativeLibDir);
|
|
56
38
|
File.open(defpath,'w') do |f|
|
|
57
39
|
f.puts("libs = [\'#{reltarget}\']")
|
|
58
40
|
end
|
|
59
41
|
end
|
|
60
42
|
|
|
61
43
|
# real bodge for now need to clean this up somehow.
|
|
62
|
-
def loadLinkref(libdir,
|
|
63
|
-
|
|
64
|
-
|
|
44
|
+
def loadLinkref(libdir,config,cfgName,baseName)
|
|
45
|
+
# log.debug("load linkref for #{baseName} from #{libdir} there ? #{File.directory?(libdir)}");
|
|
46
|
+
|
|
47
|
+
cd libdir, :verbose=>false do
|
|
48
|
+
libdef = File.expand_path("#{baseName}-#{cfgName}.linkref");
|
|
65
49
|
begin
|
|
66
50
|
libpaths=nil
|
|
67
51
|
libs=nil
|
|
@@ -78,7 +62,7 @@ module CTools
|
|
|
78
62
|
end
|
|
79
63
|
return({libpaths: libpaths, libs: libs});
|
|
80
64
|
rescue => e
|
|
81
|
-
log.debug("failed to load #{libdef} #{e}");
|
|
65
|
+
log.debug("#{config.projectFile},failed to load #{libdef} #{e}");
|
|
82
66
|
end
|
|
83
67
|
{}
|
|
84
68
|
end
|
|
@@ -106,16 +90,18 @@ module CTools
|
|
|
106
90
|
end
|
|
107
91
|
|
|
108
92
|
# only touch file if new file differs from old one
|
|
109
|
-
|
|
93
|
+
|
|
94
|
+
if(!File.exists?(outName) || textFilesDiffer(outName,tempfile))
|
|
110
95
|
# @#$#@$#@ messed up. set time of new file ahead by one second.
|
|
111
96
|
# seems rake time resolution is low enough that the comparison often says
|
|
112
97
|
# times are equal between depends files and depends.rb.
|
|
113
|
-
mv(tempfile, outName, :force=>true);
|
|
98
|
+
FileUtils.mv(tempfile, outName, :force=>true);
|
|
114
99
|
time = Time.at(Time.new.to_f + 1.0);
|
|
115
100
|
File.utime(time,time,outName);
|
|
101
|
+
task.config.dependencyFilesUpdated = true;
|
|
116
102
|
else
|
|
117
|
-
rm(tempfile, :force=>true);
|
|
118
|
-
end
|
|
103
|
+
FileUtils.rm(tempfile, :force=>true);
|
|
104
|
+
end
|
|
119
105
|
end
|
|
120
106
|
|
|
121
107
|
|
|
@@ -163,7 +149,7 @@ module CTools
|
|
|
163
149
|
def createCompileTasks(files,cfg)
|
|
164
150
|
# format object files name
|
|
165
151
|
|
|
166
|
-
mapstr = "#{cfg.
|
|
152
|
+
mapstr = "#{cfg.moduleConfiguredObjDir()}/%n#{objExt()}";
|
|
167
153
|
|
|
168
154
|
objs=FileList[];
|
|
169
155
|
files.each do |source|
|
|
@@ -175,33 +161,34 @@ module CTools
|
|
|
175
161
|
end
|
|
176
162
|
|
|
177
163
|
def initCompileTask(cfg)
|
|
178
|
-
cfg.project.addCleanFiles("#{cfg.
|
|
164
|
+
cfg.project.addCleanFiles("#{cfg.moduleConfiguredObjDir()}/*#{objExt()}");
|
|
179
165
|
Rake::Task.define_task :compile => [:includes,
|
|
180
|
-
cfg.
|
|
166
|
+
cfg.moduleConfiguredObjDir(),
|
|
181
167
|
:depends]
|
|
182
168
|
end
|
|
183
169
|
|
|
184
|
-
|
|
170
|
+
def initDependsTask(cfg) # :nodoc:
|
|
185
171
|
|
|
186
172
|
# create dependencies file by concatenating all .raked files
|
|
187
|
-
tsk = file "#{cfg.
|
|
188
|
-
cd(cfg.
|
|
173
|
+
tsk = file "#{cfg.moduleConfiguredObjDir()}/depends.rb" => [ :includes, cfg.moduleConfiguredObjDir() ] do |t|
|
|
174
|
+
cd(cfg.moduleConfiguredObjDir(),:verbose=>false) do
|
|
189
175
|
File.open('depends.rb','w') do |out|
|
|
190
176
|
out.puts("# puts \"loading #{t.name}\"");
|
|
191
177
|
end
|
|
192
178
|
t.prerequisites.each do |dep|
|
|
193
179
|
next unless (dep.pathmap('%x') == '.raked')
|
|
194
|
-
|
|
180
|
+
next unless (File.exists?(dep))
|
|
181
|
+
system "cat \'#{dep}\' >> depends.rb"
|
|
195
182
|
end
|
|
196
183
|
end
|
|
197
184
|
end
|
|
198
185
|
# build and import the consolidated dependencies file
|
|
199
|
-
task :depends => [ "#{cfg.
|
|
200
|
-
load("#{cfg.
|
|
186
|
+
task :depends => [ "#{cfg.moduleConfiguredObjDir()}/depends.rb" ] do |t|
|
|
187
|
+
load("#{cfg.moduleConfiguredObjDir()}/depends.rb")
|
|
201
188
|
end
|
|
202
189
|
task :cleandepends do
|
|
203
|
-
depname = "#{cfg.
|
|
204
|
-
deleteFiles("#{cfg.
|
|
190
|
+
depname = "#{cfg.moduleConfiguredObjDir()}/depends.rb";
|
|
191
|
+
deleteFiles("#{cfg.moduleConfiguredObjDir()}/*.raked");
|
|
205
192
|
|
|
206
193
|
# if there is no task defined for the 'raked' file then create a dummy
|
|
207
194
|
# that dos nothing so the prerequisites resolve - this is the case where the
|
|
@@ -237,6 +224,10 @@ module CppProjectConfig
|
|
|
237
224
|
attr_reader :targetType
|
|
238
225
|
attr_reader :thirdPartyLibs
|
|
239
226
|
|
|
227
|
+
def cpp
|
|
228
|
+
self
|
|
229
|
+
end
|
|
230
|
+
|
|
240
231
|
# attr_reader :cflags had this in old one for added VC flags.
|
|
241
232
|
|
|
242
233
|
addInitBlock do |pnt,opts|
|
|
@@ -251,12 +242,34 @@ module CppProjectConfig
|
|
|
251
242
|
end
|
|
252
243
|
end
|
|
253
244
|
|
|
245
|
+
# set toolchain for a cpp configuration
|
|
246
|
+
# if ther is only one non hash argument and it is a module the module is used as a pre-loaded toolchain
|
|
247
|
+
# otherwise the first argument is considered a module name of the tools module to load
|
|
248
|
+
# the second argument is the configuration name assigned to it, and subsequent hash argument are the
|
|
249
|
+
# initialization arguments for creating the toolchain instance.
|
|
250
|
+
#
|
|
251
|
+
def setToolchain(ctools,*args)
|
|
252
|
+
if(ctools.is_a?(CTools))
|
|
253
|
+
@ctools = ctools;
|
|
254
|
+
else
|
|
255
|
+
configName = args[0];
|
|
256
|
+
hash = args.last;
|
|
257
|
+
hash = {} unless hash.is_a?(Hash)
|
|
258
|
+
@ctools = CTools.loadToolchain(ctools,configName,hash);
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
# temporary include directory built for compiling
|
|
263
|
+
# where generated include files or links to the project sources
|
|
264
|
+
# are created
|
|
254
265
|
def INCDIR
|
|
255
266
|
@INCDIR||=getAnyAbove(:INCDIR)||"#{buildDir()}/include";
|
|
256
267
|
end
|
|
268
|
+
|
|
257
269
|
def binDir
|
|
258
|
-
@binDir||=getAnyAbove(:binDir)||"#{buildDir()}/bin";
|
|
270
|
+
@binDir||=(getAnyAbove(:binDir)||"#{buildDir()}/bin/#{nativeConfigName}");
|
|
259
271
|
end
|
|
272
|
+
|
|
260
273
|
def nativeLibDir
|
|
261
274
|
@nativeLibDir||=getAnyAbove(:nativeLibDir)||"#{buildDir()}/lib";
|
|
262
275
|
end
|
|
@@ -348,6 +361,7 @@ module CppProjectConfig
|
|
|
348
361
|
|
|
349
362
|
end
|
|
350
363
|
|
|
364
|
+
|
|
351
365
|
module CppProjectModule
|
|
352
366
|
include CppProjectConfig
|
|
353
367
|
|
|
@@ -358,6 +372,15 @@ module CppProjectModule
|
|
|
358
372
|
@cppCompileTaskInitialized = false;
|
|
359
373
|
end
|
|
360
374
|
|
|
375
|
+
def addCFlags(flags)
|
|
376
|
+
@cflags||=[];
|
|
377
|
+
@cflags << flags;
|
|
378
|
+
end
|
|
379
|
+
|
|
380
|
+
def cflags
|
|
381
|
+
@cflags||[];
|
|
382
|
+
end
|
|
383
|
+
|
|
361
384
|
VCProjBuildAction_ = lambda do |t|
|
|
362
385
|
require "#{Rakish::MAKEDIR}/VcprojBuilder.rb"
|
|
363
386
|
VcprojBuilder.onVcprojTask(t.config);
|
|
@@ -370,9 +393,9 @@ module CppProjectModule
|
|
|
370
393
|
|
|
371
394
|
LinkIncludeAction_ = lambda do |t|
|
|
372
395
|
config = t.config;
|
|
373
|
-
|
|
396
|
+
if(config.verbose?)
|
|
374
397
|
puts "generating #{t.name} from #{t.source}"
|
|
375
|
-
|
|
398
|
+
end
|
|
376
399
|
|
|
377
400
|
destfile = t.name;
|
|
378
401
|
srcpath = config.getRelativePath(t.source,File.dirname(t.name));
|
|
@@ -383,23 +406,47 @@ module CppProjectModule
|
|
|
383
406
|
end
|
|
384
407
|
end
|
|
385
408
|
|
|
409
|
+
def outputsNativeLibrary
|
|
410
|
+
true
|
|
411
|
+
end
|
|
412
|
+
|
|
386
413
|
# called after initializers on all projects and before rake
|
|
387
414
|
# starts executing tasks
|
|
388
415
|
|
|
389
416
|
def doCppPreBuild()
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
417
|
+
addIncludePaths( [ moduleConfiguredObjDir(),buildIncludeDir() ] );
|
|
418
|
+
@cppBuildConfig = resolveConfiguration(nativeConfigName());
|
|
419
|
+
resolveConfiguredTasks();
|
|
420
|
+
if(@projectId)
|
|
421
|
+
ensureDirectoryTask(vcprojDir);
|
|
422
|
+
tsk = task :vcproj=>[vcprojDir], &VCProjBuildAction_;
|
|
423
|
+
tsk.config = self;
|
|
424
|
+
export(:vcproj);
|
|
425
|
+
tsk = task :vcprojclean, &VCProjCleanAction_;
|
|
426
|
+
tsk.config = self;
|
|
427
|
+
export(:vcprojclean);
|
|
428
|
+
end
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
def self.doUpdateDepends(t)
|
|
432
|
+
cfg = t.config;
|
|
433
|
+
tools = cfg.ctools
|
|
434
|
+
objs = t.sources;
|
|
435
|
+
cd(cfg.moduleConfiguredObjDir(),:verbose=>false) do
|
|
436
|
+
File.open('depends.rb','w') do |out|
|
|
437
|
+
out.puts("# puts \"loading #{t.name}\"");
|
|
438
|
+
end
|
|
439
|
+
objs.each do |obj|
|
|
440
|
+
raked = obj.pathmap('%n.raked');
|
|
441
|
+
if(File.exists?(raked))
|
|
442
|
+
system "cat \'#{raked}\' >> depends.rb"
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
UpdateDependsAction_ = lambda do |t|
|
|
449
|
+
doUpdateDepends(t) if(t.config.dependencyFilesUpdated)
|
|
403
450
|
end
|
|
404
451
|
|
|
405
452
|
def resolveConfiguredTasks()
|
|
@@ -409,13 +456,19 @@ module CppProjectModule
|
|
|
409
456
|
|
|
410
457
|
objs = tools.createCompileTasks(getSourceFiles(),cfg);
|
|
411
458
|
|
|
412
|
-
unless
|
|
459
|
+
unless compileTsk = Rake.application.lookup("#{@myNamespace}:compile") && @cppCompileTaskInitialized
|
|
413
460
|
cppCompileTaskInitialized = true;
|
|
414
|
-
|
|
461
|
+
compileTsk = tools.initCompileTask(self);
|
|
415
462
|
end
|
|
416
|
-
|
|
463
|
+
compileTsk.enhance(objs)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
updateDepTsk = Rake::Task.define_unique_task &UpdateDependsAction_;
|
|
467
|
+
updateDepTsk.config = cfg;
|
|
468
|
+
updateDepTsk.sources = objs;
|
|
469
|
+
compileTsk.enhance(updateDepTsk);
|
|
417
470
|
|
|
418
|
-
|
|
471
|
+
unless tsk = Rake.application.lookup("#{@moduleObjDir}/depends.rb")
|
|
419
472
|
tsk = tools.initDependsTask(self)
|
|
420
473
|
end
|
|
421
474
|
|
|
@@ -427,15 +480,15 @@ module CppProjectModule
|
|
|
427
480
|
tsk.enhance(raked);
|
|
428
481
|
|
|
429
482
|
@objs = objs;
|
|
430
|
-
ensureDirectoryTask(
|
|
483
|
+
ensureDirectoryTask(moduleConfiguredObjDir());
|
|
431
484
|
|
|
432
485
|
## link tasks
|
|
433
|
-
tsk = tools.createLinkTask(objs
|
|
486
|
+
tsk = tools.createLinkTask(objs,@cppBuildConfig);
|
|
434
487
|
if(tsk)
|
|
435
|
-
|
|
488
|
+
outdir = tsk[:linkTask].name.pathmap('%d');
|
|
489
|
+
ensureDirectoryTask(outdir);
|
|
436
490
|
ensureDirectoryTask(cfg.binDir);
|
|
437
|
-
|
|
438
|
-
task :build => [ :compile, cfg.nativeLibDir, cfg.binDir, tsk ].flatten
|
|
491
|
+
task :build => [ :compile, outdir, cfg.binDir, tsk[:setupTasks], tsk[:linkTask] ].flatten
|
|
439
492
|
|
|
440
493
|
end
|
|
441
494
|
|
|
@@ -447,7 +500,7 @@ module CppProjectModule
|
|
|
447
500
|
# Also adds removal of output files or links to task ':cleanincludes'
|
|
448
501
|
#
|
|
449
502
|
# <b>named args:</b>
|
|
450
|
-
# :destdir => destination directory to place output files, defaults to
|
|
503
|
+
# :destdir => destination directory to place output files, defaults to buildIncludeDir/myPackage
|
|
451
504
|
#
|
|
452
505
|
def addPublicIncludes(*args)
|
|
453
506
|
|
|
@@ -458,7 +511,7 @@ module CppProjectModule
|
|
|
458
511
|
unless(destdir = opts[:destdir])
|
|
459
512
|
destdir = myPackage;
|
|
460
513
|
end
|
|
461
|
-
destdir = File.join(
|
|
514
|
+
destdir = File.join(buildIncludeDir(),destdir || '');
|
|
462
515
|
ensureDirectoryTask(destdir);
|
|
463
516
|
flist = createCopyTasks(destdir,files,:config => self,&LinkIncludeAction_)
|
|
464
517
|
task :includes => flist
|
|
@@ -495,13 +548,12 @@ module CppProjectModule
|
|
|
495
548
|
end
|
|
496
549
|
|
|
497
550
|
|
|
498
|
-
# define a configurator
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
def setupCppConfig(args={}, &b)
|
|
551
|
+
# define a configurator for the linker configuration
|
|
552
|
+
def setupLinkConfig(args={}, &b)
|
|
502
553
|
@targetType = args[:targetType];
|
|
503
554
|
@cppConfigurator_ = b;
|
|
504
555
|
end
|
|
556
|
+
alias :setupCppConfig :setupLinkConfig
|
|
505
557
|
|
|
506
558
|
class TargetConfig < BuildConfig
|
|
507
559
|
include CppProjectConfig
|
|
@@ -511,6 +563,7 @@ module CppProjectModule
|
|
|
511
563
|
attr_reader :libpaths
|
|
512
564
|
attr_reader :libs
|
|
513
565
|
attr_accessor :targetName
|
|
566
|
+
attr_accessor :dependencyFilesUpdated
|
|
514
567
|
|
|
515
568
|
def initialize(pnt, cfgName, tools)
|
|
516
569
|
super(pnt);
|
|
@@ -519,6 +572,7 @@ module CppProjectModule
|
|
|
519
572
|
@configName = cfgName;
|
|
520
573
|
@ctools = tools;
|
|
521
574
|
@targetBaseName = pnt.moduleName;
|
|
575
|
+
# @manifestFile = pnt.manifestFile;
|
|
522
576
|
tools.ensureConfigOptions(self);
|
|
523
577
|
end
|
|
524
578
|
|
|
@@ -534,28 +588,51 @@ module CppProjectModule
|
|
|
534
588
|
end
|
|
535
589
|
|
|
536
590
|
def targetName
|
|
537
|
-
@targetName||="#{targetBaseName}
|
|
591
|
+
@targetName||="#{targetBaseName}";
|
|
538
592
|
end
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
593
|
+
|
|
594
|
+
# get list of libraries built by and exported by dependency projects
|
|
595
|
+
# in dependency order from most dependent to least, and follow with
|
|
596
|
+
# libraries added in the current project
|
|
597
|
+
# TODO: dependency order not proper id it needs to sort them by "registration order"
|
|
598
|
+
def getOrderedLibs
|
|
599
|
+
|
|
600
|
+
libs=[]
|
|
601
|
+
libs << @libs;
|
|
602
|
+
|
|
603
|
+
project.dependencies.reverse_each do |dep|
|
|
604
|
+
if(defined? dep.outputsNativeLibrary)
|
|
605
|
+
if(dep.nativeLibDir)
|
|
606
|
+
ldef = ctools.loadLinkref(dep.nativeLibDir,self,configName,dep.moduleName);
|
|
607
|
+
if(ldef != nil)
|
|
608
|
+
deflibs = ldef[:libs];
|
|
609
|
+
libs += deflibs if deflibs;
|
|
610
|
+
end
|
|
549
611
|
end
|
|
550
612
|
end
|
|
551
613
|
end
|
|
552
|
-
|
|
614
|
+
|
|
615
|
+
# add user specified lobraries after all dependency libraries.
|
|
616
|
+
|
|
617
|
+
if(thirdPartyLibs)
|
|
553
618
|
thirdPartyLibs.flatten.each do |tpl|
|
|
554
|
-
|
|
619
|
+
libpath = NIL;
|
|
620
|
+
if(File.path_is_absolute?(tpl))
|
|
621
|
+
libpath = tpl.pathmap('%d');
|
|
622
|
+
tpl = tpl.pathmap('%f');
|
|
623
|
+
else
|
|
624
|
+
puts("adding lib #{tpl}");
|
|
625
|
+
libpath = "#{thirdPartyPath}/lib";
|
|
626
|
+
unless(File.directory?(libpath))
|
|
627
|
+
libs << tpl;
|
|
628
|
+
next;
|
|
629
|
+
end
|
|
630
|
+
end
|
|
631
|
+
ldef = ctools.loadLinkref(libpath,self,configName,tpl);
|
|
555
632
|
if(ldef != nil)
|
|
556
633
|
deflibs = ldef[:libs];
|
|
557
634
|
libs += deflibs if deflibs;
|
|
558
|
-
|
|
635
|
+
end
|
|
559
636
|
end
|
|
560
637
|
end
|
|
561
638
|
libs
|
|
@@ -564,6 +641,14 @@ module CppProjectModule
|
|
|
564
641
|
def objectFiles
|
|
565
642
|
[]
|
|
566
643
|
end
|
|
644
|
+
|
|
645
|
+
def setManifest(file)
|
|
646
|
+
@manifestFile = File.expand_path(file);
|
|
647
|
+
end
|
|
648
|
+
def manifestFile
|
|
649
|
+
@manifestFile
|
|
650
|
+
end
|
|
651
|
+
|
|
567
652
|
end
|
|
568
653
|
|
|
569
654
|
# for a specifc named configuraton, resolves the configration and loads it with the
|
|
@@ -574,8 +659,7 @@ module CppProjectModule
|
|
|
574
659
|
if(ret = (@resolvedConfigs||={})[config])
|
|
575
660
|
return ret;
|
|
576
661
|
end
|
|
577
|
-
|
|
578
|
-
tools = CTools.loadConfiguredTools(config);
|
|
662
|
+
tools = ctools;
|
|
579
663
|
ret = @resolvedConfigs[config] = TargetConfig.new(self,config,tools);
|
|
580
664
|
|
|
581
665
|
if(defined? @cppConfigurator_)
|
|
@@ -588,8 +672,10 @@ end
|
|
|
588
672
|
|
|
589
673
|
class BuildConfig
|
|
590
674
|
# ensure added global project task dependencies
|
|
675
|
+
task :clean
|
|
591
676
|
task :autogen => [ :cleandepends, :includes, :vcproj ];
|
|
592
677
|
task :cleanautogen => [ :cleanincludes, :cleandepends, :vcprojclean ];
|
|
678
|
+
task :cleanAll => [ :clean, :cleanautogen ];
|
|
593
679
|
task :compile => [ :includes ];
|
|
594
680
|
task :depends => [ :includes ];
|
|
595
681
|
task :build => [ :compile ];
|