nobody at rubyforge.org
2006-Oct-21 19:17 UTC
[Wxruby-development] [702] trunk/wxruby2: Additions to allow faster compiling via a Makefile on dual-processor
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type"
content="text/html; charset=utf-8" /><style
type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:'':'';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family:
verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;
font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding:
6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid;
padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family:
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch
.binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[702] trunk/wxruby2: Additions to allow faster compiling via a
Makefile on dual-processor</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>702</dd>
<dt>Author</dt> <dd>brokentoy</dd>
<dt>Date</dt> <dd>2006-10-21 15:17:56 -0400 (Sat, 21 Oct
2006)</dd>
</dl>
<h3>Log Message</h3>
<pre>Additions to allow faster compiling via a Makefile on dual-processor
systems (Sean Long)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a
href="#trunkwxruby2rakerakewxrb">trunk/wxruby2/rake/rakewx.rb</a></li>
<li><a
href="#trunkwxruby2rakefile">trunk/wxruby2/rakefile</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwxruby2rakerakewxrb"></a>
<div class="modfile"><h4>Modified:
trunk/wxruby2/rake/rakewx.rb (701 => 702)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/rake/rakewx.rb        2006-10-21
15:23:14 UTC (rev 701)
+++
trunk/wxruby2/rake/rakewx.rb        2006-10-21
19:17:56 UTC (rev 702)
</span><span class="lines">@@ -367,3 +367,37 @@
</span><span class="cx"> create_link_task
</span><span class="cx">
        create_install_task
</span><span class="cx"> end
</span><ins>+
+def create_makefile
+ if ($mswin)
+ out_arg = "/Fo"
+ else
+ out_arg = "-o "
+ end
+
+ object_rules = ""
+
+ all_obj_files_and_extra_obj = all_obj_files + $extra_objs.split(''
'')
+ all_obj_files_and_extra_obj.each do |o|
+ obj_no_dir = o.sub(''obj/'','''')
+ rule = "#{o}:
src/#{obj_no_dir.sub(''.o'',''.cpp'')}\n\t#{$cpp}
-c #{$verbose_flag} #{$cppflags} #{out_arg}$@ $^\n\n"
+ object_rules << rule
+ end
+
+file_data =
+%{#This is generated by rake do not edit by hand!
+
+OBJ = #{all_obj_files_and_extra_obj.join('' '')}
+
+rakemake: $(OBJ)
+
+#{object_rules}
+}
+
+ file = File.new("makefile","w+")
+ file.write(file_data)
+end
+
+def run_makefile(num_threads=1)
+ system("make -j #{num_threads.to_i}")
+end
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwxruby2rakefile"></a>
<div class="modfile"><h4>Modified: trunk/wxruby2/rakefile
(701 => 702)</h4>
<pre class="diff"><span>
<span class="info">---
trunk/wxruby2/rakefile        2006-10-21
15:23:14 UTC (rev 701)
+++
trunk/wxruby2/rakefile        2006-10-21
19:17:56 UTC (rev 702)
</span><span class="lines">@@ -101,6 +101,13 @@
</span><span class="cx"> delete_files_in($obj_dir)
</span><span class="cx"> #force_rmdir($obj_dir)
</span><span class="cx"> end
</span><ins>+
+        desc
"Experimental generation of Makefile so can use multiprocessors to compile
faster!"
+        task
:make =>
[:swig,:rake_make,:link]                
+        task
:rake_make do
+                create_makefile
+                run_makefile(2)                
+        end
</ins><span class="cx">
</span><span class="cx"> rescue Exception => e
</span><span class="cx"> puts(e.message)
</span></span></pre>
</div>
</div>
</body>
</html>
Possibly Parallel Threads
- [719] trunk/wxruby2: Hide unsupported PrinterDC class on GTK (Alex Fenton)
- [713] trunk/wxruby2: Patch for rake install, added rake uninstall
- [1021] trunk/wxruby2/rake/rakewx.rb: Memory mgmt: don''t run fixdeleting anymore
- [1003] trunk/wxruby2: Create correct WXWIDGETS_VERSION string constant instead of hardcoding
- [1127] trunk/wxruby2: Move shared C++ GC functions into separate file included into wx.i
