aboutsummaryrefslogtreecommitdiff
path: root/flow-native/src/CMakeLists.txt
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2016-03-07 19:08:16 -0800
committerJakob Odersky <jakob@odersky.com>2016-03-07 19:59:24 -0800
commit39a07083956ea5f5e8eebbd67aa6b31aec4f2d52 (patch)
treed9f4536772763097906aede0e3b86c081786c6bc /flow-native/src/CMakeLists.txt
parent901eaa3dd48ea8ab692d060ec6245c61a65fd902 (diff)
downloadakka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.tar.gz
akka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.tar.bz2
akka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.zip
Transition from Autotools to CMake
Diffstat (limited to 'flow-native/src/CMakeLists.txt')
-rw-r--r--flow-native/src/CMakeLists.txt45
1 files changed, 45 insertions, 0 deletions
diff --git a/flow-native/src/CMakeLists.txt b/flow-native/src/CMakeLists.txt
new file mode 100644
index 0000000..7f6cbd7
--- /dev/null
+++ b/flow-native/src/CMakeLists.txt
@@ -0,0 +1,45 @@
+cmake_minimum_required(VERSION 2.6)
+
+# Define project and related variables
+#
+project (flow)
+
+# Set versions and library name
+# Note: major version will be appended to library name
+#
+set (VERSION_MAJOR 3)
+set (VERSION_MINOR 0)
+set (VERSION_PATCH 1)
+set (LIB_NAME flow${VERSION_MAJOR})
+
+# Command-line options
+#
+# required by sbt-jni to install binaries to correct places
+set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (Autoconf equivalent to --libdir).")
+# required by sbt-jni to disable versioned libraries
+set (ENABLE_VERSIONED_LIB ON CACHE BOOLEAN "Generate versioned library files and symlinks.")
+
+# Setup JNI
+find_package(JNI REQUIRED)
+if (JNI_FOUND)
+ message (STATUS "JNI include directories: ${JNI_INCLUDE_DIRS}")
+endif()
+
+# Include directories
+include_directories(include)
+include_directories(${JNI_INCLUDE_DIRS})
+
+# Setup main shared library
+# Note: major version is appended to library name
+add_library(${LIB_NAME} SHARED flow_jni.c platform/posix/flow.c)
+if (ENABLE_VERSIONED_LIB)
+ set_target_properties(
+ ${LIB_NAME}
+ PROPERTIES
+ VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in name
+ SOVERSION 0
+ )
+endif()
+
+# Installation targets
+install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR})