You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2015/10/23 16:36:05 UTC

[03/50] [abbrv] qpid-proton git commit: NO-JIRA: Make the C++ examples have self contained build.

NO-JIRA: Make the C++ examples have self contained build.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/fe0817e2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/fe0817e2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/fe0817e2

Branch: refs/heads/go1
Commit: fe0817e2a98183dc298d757692667b12f36a8dda
Parents: 43c5cff
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Sep 30 14:30:16 2015 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Sep 30 14:30:16 2015 -0400

----------------------------------------------------------------------
 examples/CMakeLists.txt                         |  2 +
 examples/ProtonCppConfig.cmake                  | 23 ++++++
 examples/cpp/CMakeLists.txt                     |  8 +--
 proton-c/CMakeLists.txt                         | 10 +--
 proton-c/bindings/cpp/CMakeLists.txt            | 73 ++++++++++++++------
 proton-c/bindings/cpp/ProtonCppConfig.cmake.in  | 30 ++++++++
 .../cpp/ProtonCppConfigVersion.cmake.in         | 30 ++++++++
 proton-c/bindings/cpp/libqpid-proton-cpp.pc.in  | 30 ++++++++
 8 files changed, 173 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index c4c4058..99e8315 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -18,6 +18,8 @@
 #
 
 set (Proton_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set (ProtonCpp_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+
 add_subdirectory(c)
 add_subdirectory(go)
 if (BUILD_CPP)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/examples/ProtonCppConfig.cmake
----------------------------------------------------------------------
diff --git a/examples/ProtonCppConfig.cmake b/examples/ProtonCppConfig.cmake
new file mode 100644
index 0000000..d3a7813
--- /dev/null
+++ b/examples/ProtonCppConfig.cmake
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+
+set (ProtonCpp_VERSION       ${PN_VERSION})
+set (ProtonCpp_INCLUDE_DIRS  ${CMAKE_SOURCE_DIR}/proton-c/include ${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include)
+set (ProtonCpp_LIBRARIES     qpid-proton-cpp)
+set (ProtonCpp_FOUND True)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/examples/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt
index 1ac1b1e..34edb83 100644
--- a/examples/cpp/CMakeLists.txt
+++ b/examples/cpp/CMakeLists.txt
@@ -17,11 +17,9 @@
 # under the License.
 #
 
-include(${CMAKE_SOURCE_DIR}/cpp.cmake) # Compiler checks
+find_package(ProtonCpp REQUIRED)
 
-include_directories(
-  "${CMAKE_SOURCE_DIR}/proton-c/include"
-  "${CMAKE_SOURCE_DIR}/proton-c/bindings/cpp/include")
+include_directories(${ProtonCpp_INCLUDE_DIRS})
 
 foreach(example
     broker
@@ -39,7 +37,7 @@ foreach(example
     recurring_timer
     encode_decode)
   add_executable(${example} ${example}.cpp)
-  target_link_libraries(${example} qpid-proton-cpp)
+  target_link_libraries(${example} ${ProtonCpp_LIBRARIES})
   set_source_files_properties(${example}.cpp PROPERTIES COMPILE_FLAGS "${CXX_WARNING_FLAGS}")
 endforeach()
 

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 0d9cf85..6a35170 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -269,6 +269,11 @@ macro (pn_absolute_install_dir NAME VALUE PREFIX)
   get_filename_component(${NAME} ${${NAME}} ABSOLUTE)
 endmacro()
 
+pn_absolute_install_dir(PREFIX "." ${CMAKE_INSTALL_PREFIX})
+pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX})
+pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
+pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
+
 add_subdirectory(bindings)
 add_subdirectory(docs/api)
 add_subdirectory(docs/man)
@@ -457,11 +462,6 @@ install (FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/proton)
 install (FILES  ${CMAKE_CURRENT_BINARY_DIR}/include/proton/version.h
          DESTINATION ${INCLUDE_INSTALL_DIR}/proton)
 
-pn_absolute_install_dir(PREFIX "." ${CMAKE_INSTALL_PREFIX})
-pn_absolute_install_dir(EXEC_PREFIX "." ${CMAKE_INSTALL_PREFIX})
-pn_absolute_install_dir(LIBDIR ${LIB_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
-pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX})
-
 # Pkg config file
 configure_file(
   ${CMAKE_CURRENT_SOURCE_DIR}/src/libqpid-proton.pc.in

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 868bbb9..45e47b2 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -88,27 +88,6 @@ set_target_properties (
   LINK_FLAGS "${CATCH_UNDEFINED}"
   )
 
-## Test
-if (ENABLE_VALGRIND AND VALGRIND_EXE)
-  set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=1 --quiet --leak-check=full --trace-children=yes)
-endif ()
-
-macro(add_cpp_test test)
-  add_executable (${test} src/${test}.cpp)
-  target_link_libraries (${test} qpid-proton qpid-proton-cpp)
-  if (CMAKE_SYSTEM_NAME STREQUAL Windows)
-    add_test (NAME cpp_${test}
-      COMMAND ${env_py}
-      "PATH=$<TARGET_FILE_DIR:qpid-proton>"
-      $<TARGET_FILE:${test}> ${ARGN})
-  else ()
-    add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test} ${ARGN})
-  endif ()
-endmacro(add_cpp_test)
-
-add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
-add_cpp_test(conversion_test ${CMAKE_SOURCE_DIR}/tests)
-
 ## Install
 
 install(TARGETS qpid-proton-cpp
@@ -129,8 +108,56 @@ if (MSVC)
 endif (MSVC)
 
 # Install header files
-file(GLOB headers "include/proton/cpp/*.h")
-install (FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/proton/cpp)
+file(GLOB headers "include/proton/*.hpp")
+install (FILES ${headers} DESTINATION ${INCLUDE_INSTALL_DIR}/proton)
 
 add_subdirectory(docs)
 add_subdirectory(${CMAKE_SOURCE_DIR}/tests/tools/apps/cpp ${CMAKE_BINARY_DIR}/tests/tools/apps/cpp)
+
+# Pkg config file
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/libqpid-proton-cpp.pc.in
+  ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton-cpp.pc @ONLY)
+install (FILES 
+  ${CMAKE_CURRENT_BINARY_DIR}/libqpid-proton-cpp.pc
+  DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+if (DEFINED CMAKE_IMPORT_LIBRARY_PREFIX)
+set(PROTONCPPLIB ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_IMPORT_LIBRARY_SUFFIX})
+set(PROTONCPPLIBDEBUG ${CMAKE_IMPORT_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
+else ()
+set(PROTONCPPLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_SHARED_LIBRARY_SUFFIX})
+set(PROTONCPPLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
+endif ()
+
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfig.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake @ONLY)
+configure_file(
+  ${CMAKE_CURRENT_SOURCE_DIR}/ProtonCppConfigVersion.cmake.in
+  ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake @ONLY)
+install (FILES
+  ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
+  DESTINATION ${LIB_INSTALL_DIR}/cmake/ProtonCpp)
+
+## Test
+if (ENABLE_VALGRIND AND VALGRIND_EXE)
+  set(memcheck-cmd ${VALGRIND_EXE} --error-exitcode=1 --quiet --leak-check=full --trace-children=yes)
+endif ()
+
+macro(add_cpp_test test)
+  add_executable (${test} src/${test}.cpp)
+  target_link_libraries (${test} qpid-proton qpid-proton-cpp)
+  if (CMAKE_SYSTEM_NAME STREQUAL Windows)
+    add_test (NAME cpp_${test}
+      COMMAND ${env_py}
+      "PATH=$<TARGET_FILE_DIR:qpid-proton>"
+      $<TARGET_FILE:${test}> ${ARGN})
+  else ()
+    add_test (NAME cpp_${test} COMMAND ${memcheck-cmd} ${CMAKE_CURRENT_BINARY_DIR}/${test} ${ARGN})
+  endif ()
+endmacro(add_cpp_test)
+
+add_cpp_test(interop_test ${CMAKE_SOURCE_DIR}/tests)
+add_cpp_test(conversion_test ${CMAKE_SOURCE_DIR}/tests)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/proton-c/bindings/cpp/ProtonCppConfig.cmake.in
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/ProtonCppConfig.cmake.in b/proton-c/bindings/cpp/ProtonCppConfig.cmake.in
new file mode 100644
index 0000000..0068067
--- /dev/null
+++ b/proton-c/bindings/cpp/ProtonCppConfig.cmake.in
@@ -0,0 +1,30 @@
+#
+# 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.
+#
+
+# Name: Proton
+# Description: Qpid Proton C library
+# Version: @PN_VERSION@
+# URL: http://qpid.apache.org/proton/
+
+set (ProtonCpp_VERSION       @PN_VERSION@)
+
+set (ProtonCpp_INCLUDE_DIRS  @INCLUDEDIR@)
+set (ProtonCpp_LIBRARIES     optimized @LIBDIR@/@PROTONCPPLIB@ debug @LIBDIR@/@PROTONCPPLIBDEBUG@)
+
+set (ProtonCpp_FOUND True)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in b/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in
new file mode 100644
index 0000000..d40f5c3
--- /dev/null
+++ b/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in
@@ -0,0 +1,30 @@
+# This is a basic version file for the Config-mode of find_package().
+# It is used by write_basic_package_version_file() as input file for configure_file()
+# to create a version-file which can be installed along a config.cmake file.
+#
+# The created file sets PACKAGE_VERSION_EXACT if the current version string and
+# the requested version string are exactly the same and it sets
+# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
+
+set(PACKAGE_VERSION "@PN_VERSION@")
+
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" )
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()
+
+# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
+if("${CMAKE_SIZEOF_VOID_P}"  STREQUAL ""  OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
+   return()
+endif()
+
+# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
+if(NOT "${CMAKE_SIZEOF_VOID_P}"  STREQUAL  "@CMAKE_SIZEOF_VOID_P@")
+   math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8")
+   set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
+   set(PACKAGE_VERSION_UNSUITABLE TRUE)
+endif()

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/fe0817e2/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in b/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in
new file mode 100644
index 0000000..4b556f4
--- /dev/null
+++ b/proton-c/bindings/cpp/libqpid-proton-cpp.pc.in
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: Proton C++
+Description: Qpid Proton C++ library
+Version: @PN_VERSION@
+URL: http://qpid.apache.org/proton/
+Libs: -L${libdir} -lqpid-proton-cpp
+Cflags: -I${includedir}


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