Skip to content

Instantly share code, notes, and snippets.

@freekh
Created December 3, 2013 13:11
Show Gist options
  • Save freekh/7768904 to your computer and use it in GitHub Desktop.
Save freekh/7768904 to your computer and use it in GitHub Desktop.
Emscripten 002
import sbt._
import sbt.Keys._
import java.io.File
import play.Keys._
import play.PlayExceptions._
import play.PlaySourceGenerators
object EmscriptenKeys {
val eccFiles = taskKey[PathFinder]("C/C++ files to be compiled")
val eccCompiler = settingKey[String]("Path to Emscripten compiler")
}
object EmscriptenSettings {
import EmscriptenKeys._
val settings = Seq(
eccCompiler := "emcc",
eccFiles <<= (sourceDirectory in Compile) map ( _ ** "*.cpp" ),
resourceGenerators in Compile <+= (eccFiles, eccCompiler, resourceManaged) map { (files, eccCompilerString, resourceManaged) =>
println("Compile: " + files.get.mkString(",") + " with " + eccCompilerString + " output directory: " + (resourceManaged / "main" / "public"))
Seq.empty[File]
}
)
}
object EmscriptenPlugin extends Plugin {
import EmscriptenKeys._
override lazy val projectSettings: Seq[Setting[_]] = EmscriptenSettings.settings
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment