aboutsummaryrefslogtreecommitdiff
path: root/jni-plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala
blob: 3f75585a38b45b4084126b73cd0474de4dc09a54 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package ch.jodersky.sbt.jni
package build

import java.io.File
import sbt._

object CMake extends BuildTool {

  val name = "CMake"

  def detect(baseDirectory: File) = baseDirectory.list().contains("CMakeLists.txt")

  object api extends ConfigureMakeInstall {

    override def configure(base: File, build: File, target: File) = {
      val targetPath = target.getAbsolutePath
      Process(
        //Disable producing versioned library files, not needed for fat jars.
        "cmake " +
          s"-DCMAKE_INSTALL_PREFIX:PATH=$targetPath " +
          s"-DLIB_INSTALL_DIR:PATH=$targetPath " +
          "-DENABLE_VERSIONED_LIB:BOOLEAN=OFF " +
          base.getAbsolutePath,
        build
      )
    }

  }

}