move sources to src/; add Moc builder

This commit is contained in:
josh committed 2015-03-25 19:32:00 -04:00
1 parent ca753a42fe
commit 64e3d89818
6 files changed
+75 -25

No files matched your search

+15 -1
View File
@@ -1,5 +1,19 @@
class Moc < Rscons::Builder
def run(target, sources, cache, env, vars)
command = %W[moc -o #{target} #{sources.first}]
standard_build("Moc #{target}", target, command, sources, env, cache)
end
end
Rscons::Environment.new do |env|
sources = Dir["**/*.cc"]
env.add_builder(Moc.new)
sources = Dir["src/*.cc"]
env.build_dir("src", "build")
Dir["src/**/*.h"].each do |h_file|
moc_fname = env.get_build_fname(h_file, "_moc.cc")
env.Moc(moc_fname, h_file)
sources << moc_fname
end
env.parse_flags!("!pkg-config --cflags --libs Qt5Core Qt5Gui Qt5Widgets")
env.parse_flags!("-fPIE")
env.Program("app", sources)