You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2013/01/28 15:20:50 UTC

svn commit: r1439419 - in /qpid/proton/branches/jni-binding: ./ cmake/ cmake/Modules/ proton-c/ proton-c/bindings/ proton-c/bindings/java/ proton-c/cmake/Modules/ proton-c/docs/api/ tests/

Author: kwall
Date: Mon Jan 28 14:20:49 2013
New Revision: 1439419

URL: http://svn.apache.org/viewvc?rev=1439419&view=rev
Log:
PROTON-194: Introduce CMakeLists.txt at the top level. modified FindJava to work properly on cmake 2.6, allowing us to remove some workarounds from other cmake files

Added:
    qpid/proton/branches/jni-binding/CMakeLists.txt
    qpid/proton/branches/jni-binding/cmake/
    qpid/proton/branches/jni-binding/cmake/Modules/
    qpid/proton/branches/jni-binding/cmake/Modules/FindJava.cmake
      - copied, changed from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/FindJava.cmake
    qpid/proton/branches/jni-binding/cmake/Modules/README
    qpid/proton/branches/jni-binding/cmake/Modules/UseJava.cmake
      - copied, changed from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJava.cmake
    qpid/proton/branches/jni-binding/cmake/Modules/UseJavaClassFilelist.cmake
      - copied, changed from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaClassFilelist.cmake
    qpid/proton/branches/jni-binding/cmake/Modules/UseJavaSymlinks.cmake
      - copied, changed from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaSymlinks.cmake
Removed:
    qpid/proton/branches/jni-binding/proton-c/cmake/Modules/FindJava.cmake
    qpid/proton/branches/jni-binding/proton-c/cmake/Modules/README
    qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJava.cmake
    qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaClassFilelist.cmake
    qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaSymlinks.cmake
Modified:
    qpid/proton/branches/jni-binding/proton-c/CMakeLists.txt
    qpid/proton/branches/jni-binding/proton-c/bindings/CMakeLists.txt
    qpid/proton/branches/jni-binding/proton-c/bindings/java/CMakeLists.txt
    qpid/proton/branches/jni-binding/proton-c/docs/api/user.doxygen.in
    qpid/proton/branches/jni-binding/tests/pom.xml

Added: qpid/proton/branches/jni-binding/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/CMakeLists.txt?rev=1439419&view=auto
==============================================================================
--- qpid/proton/branches/jni-binding/CMakeLists.txt (added)
+++ qpid/proton/branches/jni-binding/CMakeLists.txt Mon Jan 28 14:20:49 2013
@@ -0,0 +1,46 @@
+#
+# 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)
+
+include(CheckLibraryExists)
+include(CheckSymbolExists)
+
+project (Proton)
+
+set (PN_VERSION_MAJOR 0)
+set (PN_VERSION_MINOR 3)
+set (PN_VERSION "${PN_VERSION_MAJOR}.${PN_VERSION_MINOR}")
+
+# Used to allow the building of the Java bindings when CMAKE_VERSION < 2.6.8
+if ( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
+  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
+endif ()
+
+find_package( Java )
+if (JAVA_FOUND)
+  message("Java version: ${Java_VERSION}. javac is at: ${Java_JAVAC_EXECUTABLE}")
+endif()
+
+add_subdirectory(proton-c)
+
+if (JAVA_FOUND)
+  add_subdirectory(proton-j/proton-api)
+endif ()
+
+

Copied: qpid/proton/branches/jni-binding/cmake/Modules/FindJava.cmake (from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/FindJava.cmake)
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/cmake/Modules/FindJava.cmake?p2=qpid/proton/branches/jni-binding/cmake/Modules/FindJava.cmake&p1=qpid/proton/branches/jni-binding/proton-c/cmake/Modules/FindJava.cmake&r1=1438610&r2=1439419&rev=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/proton-c/cmake/Modules/FindJava.cmake (original)
+++ qpid/proton/branches/jni-binding/cmake/Modules/FindJava.cmake Mon Jan 28 14:20:49 2013
@@ -162,6 +162,11 @@ find_program(Java_JAVADOC_EXECUTABLE
 #include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 include(FindPackageHandleStandardArgs)
 if(Java_FIND_COMPONENTS)
+
+  # Apache Qpid Proton doesn't support this because of find_package_handle_standard_args
+  # differences (see comment below)
+  message(FATAL_ERROR "Apache Qpid Proton FindJava does not support Java_FIND_COMPONENTS")
+
   foreach(component ${Java_FIND_COMPONENTS})
     # User just want to execute some Java byte-compiled
     if(component STREQUAL "Runtime")
@@ -182,10 +187,14 @@ if(Java_FIND_COMPONENTS)
   endforeach()
 else()
   # Check for everything
-  find_package_handle_standard_args(Java
-    REQUIRED_VARS Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
+
+  # Apache Qpid Proton local change: the line below has been tweaked because
+  # the signature of find_package_handle_standard_args in cmake 2.6 lacks the
+  # REQUIRED_VARS and VERSION_VAR parameters, and specifies the error message differently.
+
+  find_package_handle_standard_args(Java DEFAULT_MSG
+                  Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE
                   Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE
-    VERSION_VAR Java_VERSION
     )
 endif()
 

Added: qpid/proton/branches/jni-binding/cmake/Modules/README
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/cmake/Modules/README?rev=1439419&view=auto
==============================================================================
--- qpid/proton/branches/jni-binding/cmake/Modules/README (added)
+++ qpid/proton/branches/jni-binding/cmake/Modules/README Mon Jan 28 14:20:49 2013
@@ -0,0 +1,4 @@
+This is Andreas Schneider's CMake Java Support.  We have our own local copy merely
+to allow us to build the Java bindings with older versions of cmake (<2.8.6). Local modifications
+are commented with "Apache Qpid Proton...".
+If cmake 2.8.6 is in use, these files will not be used.

Copied: qpid/proton/branches/jni-binding/cmake/Modules/UseJava.cmake (from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJava.cmake)
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/cmake/Modules/UseJava.cmake?p2=qpid/proton/branches/jni-binding/cmake/Modules/UseJava.cmake&p1=qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJava.cmake&r1=1438610&r2=1439419&rev=1439419&view=diff
==============================================================================
    (empty)

Copied: qpid/proton/branches/jni-binding/cmake/Modules/UseJavaClassFilelist.cmake (from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaClassFilelist.cmake)
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/cmake/Modules/UseJavaClassFilelist.cmake?p2=qpid/proton/branches/jni-binding/cmake/Modules/UseJavaClassFilelist.cmake&p1=qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaClassFilelist.cmake&r1=1438610&r2=1439419&rev=1439419&view=diff
==============================================================================
    (empty)

Copied: qpid/proton/branches/jni-binding/cmake/Modules/UseJavaSymlinks.cmake (from r1438610, qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaSymlinks.cmake)
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/cmake/Modules/UseJavaSymlinks.cmake?p2=qpid/proton/branches/jni-binding/cmake/Modules/UseJavaSymlinks.cmake&p1=qpid/proton/branches/jni-binding/proton-c/cmake/Modules/UseJavaSymlinks.cmake&r1=1438610&r2=1439419&rev=1439419&view=diff
==============================================================================
    (empty)

Modified: qpid/proton/branches/jni-binding/proton-c/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/proton-c/CMakeLists.txt?rev=1439419&r1=1439418&r2=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/proton-c/CMakeLists.txt (original)
+++ qpid/proton/branches/jni-binding/proton-c/CMakeLists.txt Mon Jan 28 14:20:49 2013
@@ -75,12 +75,6 @@ else()
     add_custom_target(docs)
 endif()
 
-# Used to allow the building of the Java bindings when CMAKE_VERSION < 2.6.8
-if ( ${CMAKE_VERSION} VERSION_LESS "2.8.6" )
-  set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
-endif ()
-
-
 # Set the default SSL/TLS implementation
 find_package(OpenSSL)
 
@@ -91,23 +85,23 @@ endif(OPENSSL_FOUND)
 set(SSL_IMPL ${ssl_impl} CACHE STRING "Library to use for SSL/TLS support. Valid values: 'none','openssl'")
 
 configure_file (
-  "${PROJECT_SOURCE_DIR}/pn_config.h.in"
-  "${PROJECT_BINARY_DIR}/pn_config.h"
+  "${CMAKE_CURRENT_SOURCE_DIR}/pn_config.h.in"
+  "${CMAKE_CURRENT_BINARY_DIR}/pn_config.h"
 )
 
-include_directories ("${PROJECT_BINARY_DIR}")
-include_directories ("${PROJECT_SOURCE_DIR}/include")
+include_directories ("${CMAKE_CURRENT_BINARY_DIR}")
+include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/include")
 
 add_custom_command (
-  OUTPUT ${PROJECT_BINARY_DIR}/encodings.h
-  COMMAND python ${PROJECT_SOURCE_DIR}/env.py PYTHONPATH=${PROJECT_SOURCE_DIR} python ${PROJECT_SOURCE_DIR}/src/codec/encodings.h.py > ${PROJECT_BINARY_DIR}/encodings.h
-  DEPENDS ${PROJECT_SOURCE_DIR}/src/codec/encodings.h.py
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
+  COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/env.py PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR} python ${CMAKE_CURRENT_SOURCE_DIR}/src/codec/encodings.h.py > ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/codec/encodings.h.py
 )
 
 add_custom_command (
-  OUTPUT ${PROJECT_BINARY_DIR}/protocol.h
-  COMMAND python ${PROJECT_SOURCE_DIR}/env.py PYTHONPATH=${PROJECT_SOURCE_DIR} python ${PROJECT_SOURCE_DIR}/src/protocol.h.py > ${PROJECT_BINARY_DIR}/protocol.h
-  DEPENDS ${PROJECT_SOURCE_DIR}/src/protocol.h.py
+  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
+  COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/env.py PYTHONPATH=${CMAKE_CURRENT_SOURCE_DIR} python ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol.h.py > ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
+  DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/protocol.h.py
 )
 
 # Select driver
@@ -251,8 +245,8 @@ set (qpid-proton-core
 
   src/messenger.c
 
-  ${PROJECT_BINARY_DIR}/encodings.h
-  ${PROJECT_BINARY_DIR}/protocol.h
+  ${CMAKE_CURRENT_BINARY_DIR}/encodings.h
+  ${CMAKE_CURRENT_BINARY_DIR}/protocol.h
 )
 
 set_source_files_properties (
@@ -317,7 +311,7 @@ get_filename_component (EXEC_PREFIX ${CM
 get_filename_component (LIBDIR ${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR} ABSOLUTE)
 get_filename_component (INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR} ABSOLUTE)
 
-configure_file(${PROJECT_SOURCE_DIR}/src/libqpid-proton.pc.in
-         ${PROJECT_BINARY_DIR}/libqpid-proton.pc @ONLY)
-install (FILES ${PROJECT_BINARY_DIR}/libqpid-proton.pc
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/libqpid-proton.pc.in
+         ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton.pc @ONLY)
+install (FILES ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton.pc
          DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)

Modified: qpid/proton/branches/jni-binding/proton-c/bindings/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/proton-c/bindings/CMakeLists.txt?rev=1439419&r1=1439418&r2=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/proton-c/bindings/CMakeLists.txt (original)
+++ qpid/proton/branches/jni-binding/proton-c/bindings/CMakeLists.txt Mon Jan 28 14:20:49 2013
@@ -58,11 +58,7 @@ if (PERLLIBS_FOUND)
   set (DEFAULT_PERL ON)
 endif (PERLLIBS_FOUND)
 
-# Prerequisites for Java
-find_package( Java )
-# we have to check two variables below because older versions of cmake (such as v2.6)
-# include FindJava.cmake and FindJNI.cmake modules that don't set XXX_FOUND
-if (JAVA_FOUND OR JAVA_RUNTIME)
+if (JAVA_FOUND)
   find_package( JNI )
   if (JNI_FOUND OR JNI_LIBRARIES)
     set (DEFAULT_JAVA ON)

Modified: qpid/proton/branches/jni-binding/proton-c/bindings/java/CMakeLists.txt
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/proton-c/bindings/java/CMakeLists.txt?rev=1439419&r1=1439418&r2=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/proton-c/bindings/java/CMakeLists.txt (original)
+++ qpid/proton/branches/jni-binding/proton-c/bindings/java/CMakeLists.txt Mon Jan 28 14:20:49 2013
@@ -22,13 +22,10 @@ include(UseJava)
 
 project (Proton-JNI Java)
 
-add_subdirectory(api)
-
 SET(CMAKE_SWIG_FLAGS -package org.apache.qpid.proton.jni)
 SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/jni/src/main/java/org/apache/qpid/proton/jni)
 
-message( "JNI_LIBRARIES" ${JNI_LIBRARIES} )
-message( "JAVA_AWT_LIBRARY" ${JAVA_AWT_LIBRARY} )
+message( "PHDEBUG JNI_LIBRARIES: ${JNI_LIBRARIES}" )
 
 
 swig_add_module(proton-swig java java.i)
@@ -48,15 +45,13 @@ set(CMAKE_JAVA_TARGET_VERSION ${PN_VERSI
 file(GLOB_RECURSE THUNKING_SOURCES_ABS "jni/src/main/java/*.java")
 
 # TODO: Why do we need to explicitly set the classpath?  Why is the fact that we depend on
-# protonapi not sufficient?
-set(CMAKE_JAVA_INCLUDE_PATH ${CMAKE_CURRENT_BINARY_DIR}/api/proton-api-${PN_VERSION}.jar)
+# proton-api not sufficient?
+set(CMAKE_JAVA_INCLUDE_PATH ${CMAKE_BINARY_DIR}/proton-j/proton-api/proton-api-${PN_VERSION}.jar)
+
 
 # TODO: We are relying on shell expansion to find the swig generated sources. Surely there is a better way?
 add_jar(proton-jni ${CMAKE_SWIG_OUTDIR}/*.java ${THUNKING_SOURCES_ABS})
 
-message("CMAKE_CURRENT_BINARY_DIR " ${CMAKE_CURRENT_BINARY_DIR})
-message("CMAKE_JAVA_CLASS_OUTPUT_PATH" ${CMAKE_JAVA_CLASS_OUTPUT_PATH})
-
 # We need to rebuild the JAR to a) include the resources b) include the 'structural' directory entries that are
 # excluded by Cmake's add_jar command.  The latter is required by Google Reflections.
 add_custom_command(TARGET proton-jni POST_BUILD

Modified: qpid/proton/branches/jni-binding/proton-c/docs/api/user.doxygen.in
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/proton-c/docs/api/user.doxygen.in?rev=1439419&r1=1439418&r2=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/proton-c/docs/api/user.doxygen.in (original)
+++ qpid/proton/branches/jni-binding/proton-c/docs/api/user.doxygen.in Mon Jan 28 14:20:49 2013
@@ -648,7 +648,8 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT = @CMAKE_SOURCE_DIR@/include
+# PHTODO avoid relative path
+INPUT = @CMAKE_SOURCE_DIR@/proton-c/include
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

Modified: qpid/proton/branches/jni-binding/tests/pom.xml
URL: http://svn.apache.org/viewvc/qpid/proton/branches/jni-binding/tests/pom.xml?rev=1439419&r1=1439418&r2=1439419&view=diff
==============================================================================
--- qpid/proton/branches/jni-binding/tests/pom.xml (original)
+++ qpid/proton/branches/jni-binding/tests/pom.xml Mon Jan 28 14:20:49 2013
@@ -94,7 +94,7 @@ To override this, run Maven like so: &qu
       <properties>
         <!-- Uses the JNI jar and the native libraries, neither of which are built by Maven,
              therefore their location needs to be set explicitly in the following properties. -->
-        <proton-c-build-dir>${basedir}/../proton-c/build</proton-c-build-dir>
+        <proton-c-build-dir>${basedir}/../build/proton-c</proton-c-build-dir>
         <jni-native-path>${proton-c-build-dir}:${proton-c-build-dir}/bindings/java</jni-native-path>
         <jni-jar>${proton-c-build-dir}/bindings/java/proton-jni.jar</jni-jar>
       </properties>



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org