aboutsummaryrefslogtreecommitdiff
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
parent901eaa3dd48ea8ab692d060ec6245c61a65fd902 (diff)
downloadakka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.tar.gz
akka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.tar.bz2
akka-serial-39a07083956ea5f5e8eebbd67aa6b31aec4f2d52.zip
Transition from Autotools to CMake
-rw-r--r--flow-core/build.sbt2
-rw-r--r--flow-native/src/.gitignore28
-rw-r--r--flow-native/src/CMakeLists.txt45
-rw-r--r--flow-native/src/Makefile.am4
-rwxr-xr-xflow-native/src/bootstrap3
-rw-r--r--flow-native/src/configure.ac48
-rw-r--r--flow-native/src/flow_jni.c (renamed from flow-native/src/src/flow_jni.c)0
-rw-r--r--flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h (renamed from flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h)0
-rw-r--r--flow-native/src/include/flow.h (renamed from flow-native/src/src/flow.h)0
-rw-r--r--flow-native/src/m4/ax_jni_include_dir.m4124
-rw-r--r--flow-native/src/platform/posix/flow.c (renamed from flow-native/src/src/platform/posix/flow.c)0
-rw-r--r--flow-native/src/platform/windows/README (renamed from flow-native/src/src/platform/windows/README)0
-rw-r--r--flow-native/src/platform/windows/flow.c.disabled (renamed from flow-native/src/src/platform/windows/flow.c.disabled)0
-rw-r--r--flow-native/src/readme.md2
-rw-r--r--flow-native/src/src/Makefile.am9
15 files changed, 51 insertions, 214 deletions
diff --git a/flow-core/build.sbt b/flow-core/build.sbt
index 445b7cc..7a29d1e 100644
--- a/flow-core/build.sbt
+++ b/flow-core/build.sbt
@@ -9,4 +9,4 @@ compileOrder in Compile := CompileOrder.Mixed
enablePlugins(JniLoading)
-target in javah in Compile := (baseDirectory in ThisBuild).value / "flow-native" / "src" / "src"
+target in javah in Compile := (baseDirectory in ThisBuild).value / "flow-native" / "src" / "include"
diff --git a/flow-native/src/.gitignore b/flow-native/src/.gitignore
index e50ccf1..e259f31 100644
--- a/flow-native/src/.gitignore
+++ b/flow-native/src/.gitignore
@@ -1,31 +1,11 @@
-# Autotools
-/autom4te.cache
-/libtool
-/aclocal.m4
-/config.sub
-/config.log
-/config.guess
-/config.status
-/config.h.in
-/config.h
-/configure
-/depcomp
-/install-sh
-/ltmain.sh
-/missing
-/stamp-h1
-/compile
-/m4/*
-!/m4/ax_jni_include_dir.m4
-Makefile.in
+# CMake
+CMakeFiles/
+CMakeCache.txt
+cmake_install.cmake
Makefile
# Binary files
-.deps
-.libs
*.o
-*.la
-*.lo
*.so*
*.dylib
*.a
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})
diff --git a/flow-native/src/Makefile.am b/flow-native/src/Makefile.am
deleted file mode 100644
index e06bd75..0000000
--- a/flow-native/src/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-ACLOCAL_AMFLAGS = -I m4
-
-SUBDIRS = src \ No newline at end of file
diff --git a/flow-native/src/bootstrap b/flow-native/src/bootstrap
deleted file mode 100755
index d4d064f..0000000
--- a/flow-native/src/bootstrap
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-autoreconf -vfi \ No newline at end of file
diff --git a/flow-native/src/configure.ac b/flow-native/src/configure.ac
deleted file mode 100644
index 1b622c4..0000000
--- a/flow-native/src/configure.ac
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.68])
-AC_INIT(flow, [3.0.1], [jodersky@gmail.com])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CONFIG_SRCDIR([src/flow_jni.c])
-
-AM_INIT_AUTOMAKE
-
-AC_CONFIG_HEADERS([config.h])
-
-# Checks for programs.
-AC_PROG_CC
-
-# Checks for libraries.
-
-# Checks for header files.
-AC_CHECK_HEADERS([fcntl.h stddef.h stdlib.h sys/file.h termios.h unistd.h])
-#AC_CHECK_HEADERS([jni.h],,AC_MSG_WARN(No jni.h found. Is a JDK installed?))
-
-LT_INIT([disable-static])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-AC_C_INLINE
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_FUNC_MALLOC
-AC_CHECK_FUNCS([select])
-
-AX_JNI_INCLUDE_DIR
-for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
-do
- CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
-done
-
-AC_ARG_ENABLE([versioned-lib],
- [AS_HELP_STRING([--disable-versioned-lib], [Disable producing versioned library files.])],
- [:],
- [enable_versioned_lib=yes])
-
-AM_CONDITIONAL([ENABLE_VERSIONED_LIB], [test "$enable_versioned_lib" = "yes"])
-
-AC_CONFIG_FILES([Makefile])
-AC_CONFIG_FILES([src/Makefile])
-AC_OUTPUT
diff --git a/flow-native/src/src/flow_jni.c b/flow-native/src/flow_jni.c
index 8ec2aed..8ec2aed 100644
--- a/flow-native/src/src/flow_jni.c
+++ b/flow-native/src/flow_jni.c
diff --git a/flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h b/flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h
index 04364fb..04364fb 100644
--- a/flow-native/src/src/com_github_jodersky_flow_internal_NativeSerial.h
+++ b/flow-native/src/include/com_github_jodersky_flow_internal_NativeSerial.h
diff --git a/flow-native/src/src/flow.h b/flow-native/src/include/flow.h
index 44e2a47..44e2a47 100644
--- a/flow-native/src/src/flow.h
+++ b/flow-native/src/include/flow.h
diff --git a/flow-native/src/m4/ax_jni_include_dir.m4 b/flow-native/src/m4/ax_jni_include_dir.m4
deleted file mode 100644
index 159e4a1..0000000
--- a/flow-native/src/m4/ax_jni_include_dir.m4
+++ /dev/null
@@ -1,124 +0,0 @@
-# ===========================================================================
-# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html
-# ===========================================================================
-a#
-# SYNOPSIS
-#
-# AX_JNI_INCLUDE_DIR
-#
-# DESCRIPTION
-#
-# AX_JNI_INCLUDE_DIR finds include directories needed for compiling
-# programs using the JNI interface.
-#
-# JNI include directories are usually in the Java distribution. This is
-# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in
-# that order. When this macro completes, a list of directories is left in
-# the variable JNI_INCLUDE_DIRS.
-#
-# Example usage follows:
-#
-# AX_JNI_INCLUDE_DIR
-#
-# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
-# do
-# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR"
-# done
-#
-# If you want to force a specific compiler:
-#
-# - at the configure.in level, set JAVAC=yourcompiler before calling
-# AX_JNI_INCLUDE_DIR
-#
-# - at the configure level, setenv JAVAC
-#
-# Note: This macro can work with the autoconf M4 macros for Java programs.
-# This particular macro is not part of the original set of macros.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Don Anderson <dda@sleepycat.com>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 10
-
-AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR])
-AC_DEFUN([AX_JNI_INCLUDE_DIR],[
-
-JNI_INCLUDE_DIRS=""
-
-if test "x$JAVA_HOME" != x; then
- _JTOPDIR="$JAVA_HOME"
-else
- if test "x$JAVAC" = x; then
- JAVAC=javac
- fi
- AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no])
- if test "x$_ACJNI_JAVAC" = xno; then
- AC_MSG_ERROR([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME])
- fi
- _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC")
- _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'`
-fi
-
-_JINC="$_JTOPDIR/include"
-
-_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR])
-_AS_ECHO_LOG([_JINC=$_JINC])
-
-# On Mac OS X 10.6.4, jni.h is a symlink:
-# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h
-# -> ../../CurrentJDK/Headers/jni.h.
-AC_CHECK_FILE([$_JINC/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"],
- [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'`
- AC_CHECK_FILE([$_JTOPDIR/include/jni.h],
- [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"],
- AC_MSG_ERROR([cannot find JDK header files]))
- ])
-
-# get the likely subdirectories for system specific java includes
-case "$host_os" in
-bsdi*) _JNI_INC_SUBDIRS="bsdos";;
-freebsd*) _JNI_INC_SUBDIRS="freebsd";;
-linux*) _JNI_INC_SUBDIRS="linux genunix";;
-osf*) _JNI_INC_SUBDIRS="alpha";;
-solaris*) _JNI_INC_SUBDIRS="solaris";;
-mingw*) _JNI_INC_SUBDIRS="win32";;
-cygwin*) _JNI_INC_SUBDIRS="win32";;
-darwin*) _JNI_INC_SUBDIRS="darwin";;
-*) _JNI_INC_SUBDIRS="genunix";;
-esac
-
-# add any subdirectories that are present
-for JINCSUBDIR in $_JNI_INC_SUBDIRS
-do
- if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then
- JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR"
- fi
-done
-])
-
-# _ACJNI_FOLLOW_SYMLINKS <path>
-# Follows symbolic links on <path>,
-# finally setting variable _ACJNI_FOLLOWED
-# ----------------------------------------
-AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[
-# find the include directory relative to the javac executable
-_cur="$1"
-while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
- AC_MSG_CHECKING([symlink for $_cur])
- _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
- case "$_slink" in
- /*) _cur="$_slink";;
- # 'X' avoids triggering unwanted echo options.
- *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";;
- esac
- AC_MSG_RESULT([$_cur])
-done
-_ACJNI_FOLLOWED="$_cur"
-])# _ACJNI
diff --git a/flow-native/src/src/platform/posix/flow.c b/flow-native/src/platform/posix/flow.c
index a2a239c..a2a239c 100644
--- a/flow-native/src/src/platform/posix/flow.c
+++ b/flow-native/src/platform/posix/flow.c
diff --git a/flow-native/src/src/platform/windows/README b/flow-native/src/platform/windows/README
index 3d24410..3d24410 100644
--- a/flow-native/src/src/platform/windows/README
+++ b/flow-native/src/platform/windows/README
diff --git a/flow-native/src/src/platform/windows/flow.c.disabled b/flow-native/src/platform/windows/flow.c.disabled
index 86a267c..86a267c 100644
--- a/flow-native/src/src/platform/windows/flow.c.disabled
+++ b/flow-native/src/platform/windows/flow.c.disabled
diff --git a/flow-native/src/readme.md b/flow-native/src/readme.md
index 4bee987..84306fe 100644
--- a/flow-native/src/readme.md
+++ b/flow-native/src/readme.md
@@ -1,3 +1,3 @@
# Native backend for flow
-Refer to Documentation/building.md for information on how to build.
+Refer to [developer.md](../../site/jekyll/documentation/developer.md) for information on how to build.
diff --git a/flow-native/src/src/Makefile.am b/flow-native/src/src/Makefile.am
deleted file mode 100644
index 9fefbd1..0000000
--- a/flow-native/src/src/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-lib_LTLIBRARIES = libflow3.la
-
-libflow3_la_SOURCES = flow_jni.c platform/posix/flow.c flow.h com_github_jodersky_flow_internal_NativeSerial.h
-
-if ENABLE_VERSIONED_LIB
-libflow3_la_LDFLAGS = -version-info 0:1:0
-else
-libflow3_la_LDFLAGS = -avoid-version
-endif \ No newline at end of file