diff options
author | Jakob Odersky <jakob@odersky.com> | 2016-06-07 23:07:14 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2016-06-07 23:07:14 -0700 |
commit | ae27af9ec1448ff9eb8258965c3abf2f45dca54a (patch) | |
tree | 55cbd9090ee73a709850fcd5cfc96c5a03f506d0 /plugin | |
parent | e83013bc805f9ee3f9c9edfa838a41ba51fe8348 (diff) | |
parent | e9ae890252fb1924dd4bbe102336181108462858 (diff) | |
download | sbt-jni-ae27af9ec1448ff9eb8258965c3abf2f45dca54a.tar.gz sbt-jni-ae27af9ec1448ff9eb8258965c3abf2f45dca54a.tar.bz2 sbt-jni-ae27af9ec1448ff9eb8258965c3abf2f45dca54a.zip |
Merge pull request #8 from jodersky/cmake-release
Update parameters passed to CMake from sbt
Diffstat (limited to 'plugin')
5 files changed, 39 insertions, 103 deletions
diff --git a/plugin/src/main/resources/ch/jodersky/sbt/jni/templates/CMakeLists.txt b/plugin/src/main/resources/ch/jodersky/sbt/jni/templates/CMakeLists.txt index 8292064..c03234d 100644 --- a/plugin/src/main/resources/ch/jodersky/sbt/jni/templates/CMakeLists.txt +++ b/plugin/src/main/resources/ch/jodersky/sbt/jni/templates/CMakeLists.txt @@ -5,27 +5,15 @@ # add/modify/remove settings to build your specific library. # ################################################################ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.0) # Define project and related variables -# -project ({{project}}) - -# Set versions and library name # (required by sbt-jni) please use semantic versioning # -set (VERSION_MAJOR 0) -set (VERSION_MINOR 0) -set (VERSION_PATCH 0) -# (required by sbt-jni) major version will always be appended to library name -set (LIB_NAME ${CMAKE_PROJECT_NAME}${VERSION_MAJOR}) - -# Command-line options -# -# (set by sbt-jni) -set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (equivalent to Autoconf --libdir).") -# (set by sbt-jni) -set (LIB_ENABLE_MINOR_VERSIONS ON CACHE BOOLEAN "Build libraries with minor and patch versions appended.") +project ({{project}}) +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 0) +set(PROJECT_VERSION_PATCH 0) # Setup JNI find_package(JNI REQUIRED) @@ -38,24 +26,15 @@ include_directories(.) include_directories(include) include_directories(${JNI_INCLUDE_DIRS}) -# Setup main shared library +# Sources file(GLOB LIB_SRC "*.c" "*.cpp" ) -add_library(${LIB_NAME} SHARED ${LIB_SRC}) - -# By default, in a regular build, minor and patch versions are added to the generated files. -# When built through sbt-jni however, LIB_ENABLE_MINOR_VERSIONS is deactivated and only a -# major-versioned library file is built. -if (LIB_ENABLE_MINOR_VERSIONS) - set_target_properties( - ${LIB_NAME} - PROPERTIES - VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in library name - SOVERSION 0 - ) -endif() -# Installation targets -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +# Setup installation targets +# (required by sbt-jni) major version should always be appended to library name +# +set (LIB_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR}) +add_library(${LIB_NAME} SHARED ${LIB_SRC}) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION .) 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 index eb7be1e..99e3f5b 100644 --- a/plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala +++ b/plugin/src/main/scala/ch/jodersky/sbt/jni/build/CMake.scala @@ -23,8 +23,8 @@ object CMake extends BuildTool with ConfigureMakeInstall { // 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 " + + s"-DCMAKE_BUILD_TYPE=Release" + + s"-DSBT:BOOLEAN=true " + baseDirectory.getAbsolutePath, buildDirectory ) diff --git a/plugin/src/main/scala/ch/jodersky/sbt/jni/build/ConfigureMakeInstall.scala b/plugin/src/main/scala/ch/jodersky/sbt/jni/build/ConfigureMakeInstall.scala index 7bfedae..27550a8 100644 --- a/plugin/src/main/scala/ch/jodersky/sbt/jni/build/ConfigureMakeInstall.scala +++ b/plugin/src/main/scala/ch/jodersky/sbt/jni/build/ConfigureMakeInstall.scala @@ -19,7 +19,7 @@ trait ConfigureMakeInstall { self: BuildTool => def configure(targetDirectory: File): ProcessBuilder - def make(): ProcessBuilder = Process("make", buildDirectory) + def make(): ProcessBuilder = Process("make VERBOSE=1", buildDirectory) def install(): ProcessBuilder = Process("make install", buildDirectory) diff --git a/plugin/src/sbt-test/sbt-jni/multiclasses/native1/src/CMakeLists.txt b/plugin/src/sbt-test/sbt-jni/multiclasses/native1/src/CMakeLists.txt index 1539ec2..479b7c1 100644 --- a/plugin/src/sbt-test/sbt-jni/multiclasses/native1/src/CMakeLists.txt +++ b/plugin/src/sbt-test/sbt-jni/multiclasses/native1/src/CMakeLists.txt @@ -5,27 +5,15 @@ # add/modify/remove settings to build your specific library. # ################################################################ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.0) # Define project and related variables -# -project (demo) - -# Set versions and library name # (required by sbt-jni) please use semantic versioning # -set (VERSION_MAJOR 0) -set (VERSION_MINOR 0) -set (VERSION_PATCH 0) -# (required by sbt-jni) major version will always be appended to library name -set (LIB_NAME ${CMAKE_PROJECT_NAME}${VERSION_MAJOR}) - -# Command-line options -# -# (set by sbt-jni) -set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (equivalent to Autoconf --libdir).") -# (set by sbt-jni) -set (LIB_ENABLE_MINOR_VERSIONS ON CACHE BOOLEAN "Build libraries with minor and patch versions appended.") +project (demo) +set(PROJECT_VERSION_MAJOR 0) +set(PROJECT_VERSION_MINOR 0) +set(PROJECT_VERSION_PATCH 0) # Setup JNI find_package(JNI REQUIRED) @@ -38,24 +26,15 @@ include_directories(.) include_directories(../../core/target/native/include) include_directories(${JNI_INCLUDE_DIRS}) -# Setup main shared library +# Sources file(GLOB LIB_SRC "*.c" "*.cpp" ) -add_library(${LIB_NAME} SHARED ${LIB_SRC}) - -# By default, in a regular build, minor and patch versions are added to the generated files. -# When built through sbt-jni however, LIB_ENABLE_MINOR_VERSIONS is deactivated and only a -# major-versioned library file is built. -if (LIB_ENABLE_MINOR_VERSIONS) - set_target_properties( - ${LIB_NAME} - PROPERTIES - VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in library name - SOVERSION 0 - ) -endif() -# Installation targets -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +# Setup installation targets +# (required by sbt-jni) major version should always be appended to library name +# +set (LIB_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR}) +add_library(${LIB_NAME} SHARED ${LIB_SRC}) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION .) diff --git a/plugin/src/sbt-test/sbt-jni/multiclasses/native2/src/CMakeLists.txt b/plugin/src/sbt-test/sbt-jni/multiclasses/native2/src/CMakeLists.txt index feeab89..f5c508b 100644 --- a/plugin/src/sbt-test/sbt-jni/multiclasses/native2/src/CMakeLists.txt +++ b/plugin/src/sbt-test/sbt-jni/multiclasses/native2/src/CMakeLists.txt @@ -5,28 +5,15 @@ # add/modify/remove settings to build your specific library. # ################################################################ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8.0) # Define project and related variables -# -project (multiplier) - -# Set versions and library name # (required by sbt-jni) please use semantic versioning # -set (VERSION_MAJOR 1) -set (VERSION_MINOR 2) -set (VERSION_PATCH 3) -# (required by sbt-jni) major version will always be appended to library name -set (LIB_NAME ${CMAKE_PROJECT_NAME}${VERSION_MAJOR}) - -# Command-line options -# -# (set by sbt-jni) -set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (equivalent to Autoconf --libdir).") -# (set by sbt-jni) -set (LIB_ENABLE_MINOR_VERSIONS ON CACHE BOOLEAN "Build libraries with minor and patch versions appended.") - +project (multiplier) +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 2) +set(PROJECT_VERSION_PATCH 3) # Setup JNI find_package(JNI REQUIRED) if (JNI_FOUND) @@ -38,24 +25,15 @@ include_directories(.) include_directories(../../core/target/native/include) include_directories(${JNI_INCLUDE_DIRS}) -# Setup main shared library +# Sources file(GLOB LIB_SRC "*.c" "*.cpp" ) -add_library(${LIB_NAME} SHARED ${LIB_SRC}) - -# By default, in a regular build, minor and patch versions are added to the generated files. -# When built through sbt-jni however, LIB_ENABLE_MINOR_VERSIONS is deactivated and only a -# major-versioned library file is built. -if (LIB_ENABLE_MINOR_VERSIONS) - set_target_properties( - ${LIB_NAME} - PROPERTIES - VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in library name - SOVERSION 0 - ) -endif() -# Installation targets -install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR}) +# Setup installation targets +# (required by sbt-jni) major version should always be appended to library name +# +set (LIB_NAME ${PROJECT_NAME}${PROJECT_VERSION_MAJOR}) +add_library(${LIB_NAME} SHARED ${LIB_SRC}) +install(TARGETS ${LIB_NAME} LIBRARY DESTINATION .) |