On Wednesday, June 4, 2014 11:51:11 AM UTC-4, Rendaw wrote:
Of course, you'd have to fill in the blanks with your own compile
statement. The loop could be nicer, with a goto-continue or something, or
you could wrap tup.glob in a function to add filtering. Also, the natural
analogue to bang-rules are functions.
If you have other Lua questions I'd be glad to help (if I can).
Rendaw,
Thanks for your offer to help. I've been trying to migrate my rules over
from the legacy rule system to the lua parser. Basically, my directory
structure is fairly structured - a simplified example is as follows:
src/
main/
main.cc
libs/
core/
test/
Test.file1.cc
Test.file2.cc
file1.cc
file2.cc
parser/
test/
Test.file3.cc
file3.cc
test/
test.main.cc
In the interest of trying to keep things simple, I figured I could create
a single Tupdefault.lua file that would apply for the whole libs/ directory
structure. I've put the contents of my Tuprules.lua and Tupdefault.lua
right here: http://pastebin.com/8hM1CXnJ
Essentially, what I'm doing is building a list of sources, building on the
code sample that you provided me:
sources = {}
objects = {}
test_src = {}
test_obj = {}
for index, filename in ipairs(tup.glob('*.cc')) do
if not string.find(filename, 'flycheck_') then
if not string.find(filename, 'Test%.') then
sources += filename
objects += string.gsub(filename,'%.cc$','.o')
else
test_src += filename
test_obj += string.gsub(filename, '%.cc$', '.o')
end
end
end
compile (sources)
compile (test_src)
if (#sources) then
static_libs += archive (objects)
shared_libs += make_shared (objects)
end
if (#test_src) then
test_objects += objects
end
As you'll see, I'm trying to make a list of the object files, by replacing
the .cc extension with .o, and then pass that table to the archive and
make_shared functions.
However, I'm having troubles with this code- the latest issue that I've
been having (I've made minor tweaks over the whole day) is that the archive
function is not working, and the rule is trying to create the file
liblibs.a with no sources.
I hope that the above is somewhat clear. I'm sorry if I'm troubling you
with really basic mistakes here, but I really have no real experience with
Lua and have been trying to figure things out from the Tup examples and the
Lua reference guide.
Thanks and regards,
Shmuel
--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.