ARTEMIS-150 moving to cmake will fix nar/jar dependency issues and fix SBT

This commit is contained in:
Clebert Suconic 2015-07-15 20:29:07 -04:00
parent 3b69f5e372
commit e7bd2f9c45
6 changed files with 109 additions and 43 deletions

9
.gitignore vendored
View File

@ -9,3 +9,12 @@ ratReport.txt
.settings .settings
.checkstyle .checkstyle
.factorypath .factorypath
# for native build
**/CMakeCache.txt
**/CMakeFiles/
**/Makefile
**/cmake_install.cmake
# this file is generated
artemis-native/src/main/c/org_apache_activemq_artemis_core_libaio_Native.h

View File

@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SUBDIRS(src/main/c)

View File

@ -15,4 +15,5 @@
# specific language governing permissions and limitations # specific language governing permissions and limitations
# under the License. # under the License.
mvn install -Pnative-build cmake .
make

View File

@ -25,7 +25,7 @@
</parent> </parent>
<artifactId>artemis-native</artifactId> <artifactId>artemis-native</artifactId>
<packaging>${native-package-type}</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.activemq</groupId> <groupId>org.apache.activemq</groupId>
@ -86,49 +86,8 @@
</build> </build>
<profiles>
<profile>
<id>native-build</id>
<properties>
<native-package-type>nar</native-package-type>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.0.0</version>
<extensions>true</extensions>
<configuration>
<java>
<include>true</include>
</java>
<c>
<systemIncludePaths>
</systemIncludePaths>
</c>
<linker>
<sysLibs>
<sysLib>
<name>aio</name>
</sysLib>
</sysLibs>
</linker>
<libraries>
<library>
<type>jni</type>
<narSystemPackage>org.apache.activemq.artemis.core.libaio</narSystemPackage>
</library>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties> <properties>
<native-package-type>jar</native-package-type>
<activemq.basedir>${project.basedir}/..</activemq.basedir> <activemq.basedir>${project.basedir}/..</activemq.basedir>
</properties> </properties>

View File

@ -0,0 +1,79 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(artemis-native)
SET(${PROJECT_NAME}_MAJOR_VERSION 1)
SET(${PROJECT_NAME}_MINOR_VERSION 0)
SET(${PROJECT_NAME}_PATCH_LEVEL 0)
FIND_PACKAGE(Java)
FIND_PACKAGE(JNI)
if (JNI_FOUND)
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif()
# you may want to remove this next line for debugging
# -O3 would make inline debug hard
ADD_DEFINITIONS("-O3 -Wall")
#ADD_DEFINITIONS("-fdump-tree-all -Wall -pg -g -mstack-protector-guard=guard")
find_library(LIBAIO NAMES aio)
INCLUDE_DIRECTORIES(. ${JNI_INCLUDE_DIRS})
ADD_CUSTOM_COMMAND(
OUTPUT org_apache_activemq_artemis_core_libaio_Native.h
COMMAND javah -cp ../java/ org.apache.activemq.artemis.core.libaio.Native
DEPENDS ../java/org/apache/activemq/artemis/core/libaio/Native.java
)
ADD_LIBRARY(artemis-native SHARED
AIOController.cpp
AIOController.h
AIOException.h
AsyncFile.cpp
AsyncFile.h
CallbackAdapter.h
JAIODatatypes.h
JavaUtilities.cpp
JavaUtilities.h
JNI_AsynchronousFileImpl.cpp
JNICallbackAdapter.cpp
JNICallbackAdapter.h
LockClass.h
Version.h
org_apache_activemq_artemis_core_libaio_Native.h)
target_link_libraries(artemis-native aio)
set_target_properties(artemis-native PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ../../../bin)
# It is weird but this is how you are supposed to validate between 32 and 64 bits architecture
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set_target_properties(artemis-native PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ../../../bin
LIBRARY_OUTPUT_NAME artemis-native-64)
message("-- Setting up library as artemis-native-64 based on current architecture")
else()
set_target_properties(artemis-native PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ../../../bin
LIBRARY_OUTPUT_NAME artemis-native-32)
message("-- Setting up library as artemis-native-32 based on current architecture")
endif()