diff options
Diffstat (limited to 'plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala')
-rw-r--r-- | plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala b/plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala new file mode 100644 index 0000000..eb7be1e --- /dev/null +++ b/plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala @@ -0,0 +1,33 @@ +package ch.jodersky.sbt.jni +package build + +import sbt._ + +object CMake extends BuildTool with ConfigureMakeInstall { + + override val name = "CMake" + + override def detect(baseDirectory: File) = baseDirectory.list().contains("CMakeLists.txt") + + override protected def templateMappings = Seq( + "/ch/jodersky/sbt/jni/templates/CMakeLists.txt" -> "CMakeLists.txt" + ) + + override def getInstance(baseDir: File, buildDir: File, logger: Logger) = new Instance { + + override def log = logger + override def baseDirectory = baseDir + override def buildDirectory = buildDir + + override def configure(target: File) = Process( + // disable producing versioned library files, not needed for fat jars + "cmake " + + s"-DCMAKE_INSTALL_PREFIX:PATH=${target.getAbsolutePath} " + + s"-DLIB_INSTALL_DIR:PATH=${target.getAbsolutePath} " + + "-DLIB_ENABLE_MINOR_VERSIONS:BOOLEAN=OFF " + + baseDirectory.getAbsolutePath, + buildDirectory + ) + } + +} |