shithub: h264bsd

ref: a79788d2867014d90423ca7c51590e37b7f2f4a0
dir: /js/Rakefile/

View raw version

rule '.o' => ['.c'] do |t|
  sh "emcc #{t.source} -c -g4 -O0 -D_ASSERT_USED -D_DEBUG_PRINT -D_ERROR_PRINT -o #{t.name}"
end

o_files = FileList["../src/*.c"].gsub(/c$/, 'o')

export_functions = [
	"_h264bsdAlloc",
	"_h264bsdFree",
	"_h264bsdInit",
	"_h264bsdDecode",
	"_h264bsdShutdown",
	"_h264bsdNextOutputPicture",
	"_h264bsdNextOutputPictureARGB",
	"_h264bsdPicWidth",
	"_h264bsdPicHeight",
	"_h264bsdCroppingParams",
	"_h264bsdCheckValidParamSets",
	"_h264bsdConvertToARGB",
]

file "h264bsd_asm.js" => o_files do
	sh "emcc #{o_files.join(' ')} -s TOTAL_MEMORY=268435456 -s EXPORTED_FUNCTIONS='[\"#{export_functions.join('", "')}\"]' -g4  -O0 -D_ASSERT_USED -D_DEBUG_PRINT -D_ERROR_PRINT -o h264bsd_asm.js"
end

task :clean do
	o_files.each{|o| FileUtils.rm_f(o)}
	FileUtils.rm_f("h264bsd_asm.js")
end

task :default => ["h264bsd_asm.js"]