diff options
author | Stephen D. Huston <shuston@apache.org> | 2009-04-21 18:50:37 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2009-04-21 18:50:37 +0000 |
commit | 4d6c269955192397eee9bad593032b51990a40e9 (patch) | |
tree | e516a45ef26767dec47bdd225d394b65b0eac5b5 | |
parent | f77ffd76359a57218e0b808325e42fcefded97fa (diff) | |
download | qpid-python-4d6c269955192397eee9bad593032b51990a40e9.tar.gz |
Initial Linux cmake integration
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/cmake@767249 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | qpid/cpp/src/CMakeLists.txt | 102 | ||||
-rw-r--r-- | qpid/cpp/src/cluster.cmake | 119 | ||||
-rw-r--r-- | qpid/cpp/src/config.h.in | 74 | ||||
-rw-r--r-- | qpid/cpp/src/posix/QpiddBroker.cpp | 4 | ||||
-rw-r--r-- | qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp | 10 | ||||
-rw-r--r-- | qpid/cpp/src/rdma.cmake | 94 | ||||
-rw-r--r-- | qpid/cpp/src/ssl.cmake | 97 |
7 files changed, 451 insertions, 49 deletions
diff --git a/qpid/cpp/src/CMakeLists.txt b/qpid/cpp/src/CMakeLists.txt index 6cb1fbe52a..91b98c65c4 100644 --- a/qpid/cpp/src/CMakeLists.txt +++ b/qpid/cpp/src/CMakeLists.txt @@ -17,12 +17,13 @@ # under the License. # +include(CheckFunctionExists) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(CheckSymbolExists) include(FindBoost) include(FindDoxygen) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) - set (CMAKE_VERBOSE_MAKEFILE ON) # for dubugging # check if we generate source as part of the build @@ -73,8 +74,6 @@ if (EXISTS ${AMQP_SPEC}) if (${spec_file} IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/managementgen.cmake) message(STATUS "${spec_file} is newer") set(regen_mgmt ON) - else (${spec_file} IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/managementgen.cmake) - message(STATUS "${spec_file} is not newer") endif (${spec_file} IS_NEWER_THAN ${CMAKE_CURRENT_SOURCE_DIR}/managementgen.cmake) endforeach (spec_file ${mgmt_specs}) if (regen_mgmt) @@ -145,7 +144,7 @@ if (ENABLE_WARNINGS AND CMAKE_COMPILER_IS_GNUCXX) endif (ENABLE_WARNINGS AND CMAKE_COMPILER_IS_GNUCXX) # Expand a bit from the basic Find_Boost; be specific about what's needed. -find_package(Boost 1.34 REQUIRED +find_package(Boost 1.33 REQUIRED COMPONENTS date_time program_options thread unit_test_framework) if(NOT Boost_FOUND) message(FATAL_ERROR "Boost C++ libraries not found. Please install or try setting BOOST_ROOT") @@ -162,6 +161,80 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) link_directories( ${Boost_LIBRARY_DIRS} ) +CHECK_LIBRARY_EXISTS (rt clock_gettime "" CLOCK_GETTIME_IN_RT) +if (NOT CLOCK_GETTIME_IN_RT) + CHECK_FUNCTION_EXISTS (clock_gettime QPID_HAS_CLOCK_GETTIME) +else (NOT CLOCK_GETTIME_IN_RT) + set(CMAKE_REQUIRED_LIBS ${CMAKE_REQUIRED_LIBS} rt) + set(QPID_HAS_CLOCK_GETTIME YES CACHE BOOL "Platform has clock_gettime") +endif (NOT CLOCK_GETTIME_IN_RT) + +# See if Cyrus SASL is desired and available +option(QPID_HAS_SASL "Build with Cyrus SASL support" ON) +if (QPID_HAS_SASL) + CHECK_LIBRARY_EXISTS (sasl2 sasl_checkpass "" HAVE_SASL2) + CHECK_INCLUDE_FILES (sasl/sasl.h HAVE_SASL_H) + if (NOT HAVE_SASL2) + message(FATAL_ERROR "Cyrus SASL support requested but libsasl2 not found") + endif (NOT HAVE_SASL2) + if (NOT HAVE_SASL_H) + message(FATAL_ERROR "Cyrus SASL support requested but sasl.h not found") + endif (NOT HAVE_SASL_H) + + set(BROKER_SASL_NAME "qpidd" CACHE STRING "SASL app name for the qpid broker") + set(qpidcommon_sasl_source + qpid/sys/cyrus/CyrusSecurityLayer.h + qpid/sys/cyrus/CyrusSecurityLayer.cpp + ) + set(qpidcommon_sasl_lib sasl2) + +endif (QPID_HAS_SASL) + +# See if XML Exchange is desired and prerequisites are available +if (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (xml_default OFF) +else (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (xml_default ON) +endif (CMAKE_SYSTEM_NAME STREQUAL Windows) + +option(QPID_HAS_XML "Build with XML Exchange" ${xml_default}) +if (QPID_HAS_XML) + CHECK_LIBRARY_EXISTS (xerces-c _init "" HAVE_XERCES) + CHECK_INCLUDE_FILES (xercesc/framework/MemBufInputSource.hpp HAVE_XERCES_H) + CHECK_INCLUDE_FILES (xqilla/xqilla-simple.hpp HAVE_XQILLA_H) + if (NOT HAVE_XERCES) + message(FATAL_ERROR "XML Exchange support requested but xerces-c library not found") + endif (NOT HAVE_XERCES) + if (NOT HAVE_XERCES_H) + message(FATAL_ERROR "XML Exchange support requested but Xerces-C headers not found") + endif (NOT HAVE_XERCES_H) + if (NOT HAVE_XQILLA_H) + message(FATAL_ERROR "XML Exchange support requested but XQilla headers not found") + endif (NOT HAVE_XQILLA_H) + + add_library (xml SHARED + qpid/xml/XmlExchange.cpp + qpid/xml/XmlExchange.h + qpid/xml/XmlExchangePlugin.cpp) + target_link_libraries (xml xerces-c xqilla qpidbroker) + set_target_properties (xml PROPERTIES + VERSION ${qpidc_version} + LINK_FLAGS -no-undefined) +endif (QPID_HAS_XML) + +# Check for optional cluster support requirements +include (cluster.cmake) + +# Check for optional RDMA support requirements +include (rdma.cmake) + +# Check for optional SSL support requirements +include (ssl.cmake) + +# Check for syslog capabilities not present on all systems +check_symbol_exists (LOG_AUTHPRIV "sys/syslog.h" HAVE_LOG_AUTHPRIV) +check_symbol_exists (LOG_FTP "sys/syslog.h" HAVE_LOG_FTP) + if (CMAKE_SYSTEM_NAME STREQUAL Windows) if (MSVC) add_definitions( @@ -213,6 +286,8 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) # major difference is the poller module. if (CMAKE_SYSTEM_NAME STREQUAL Linux) set (qpid_poller_module qpid/sys/epoll/EpollPoller.cpp) + add_definitions(-pthread) + set (CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} -pthread) endif (CMAKE_SYSTEM_NAME STREQUAL Linux) if (CMAKE_SYSTEM_NAME STREQUAL SunOS) set (qpid_poller_module qpid/sys/solaris/ECFPoller.cpp) @@ -237,6 +312,9 @@ else (CMAKE_SYSTEM_NAME STREQUAL Windows) ${qpid_poller_module} ) set (libqpidcommon_platform_LIBS + boost_program_options + boost_filesystem + uuid ${CMAKE_DL_LIBS} ) @@ -260,6 +338,7 @@ endif (CMAKE_SYSTEM_NAME STREQUAL Windows) set (libqpidcommon_SOURCES ${rgen_framing_srcs} ${libqpidcommon_platform_SOURCES} + ${qpidcommon_sasl_source} qpid/assert.cpp qpid/Address.cpp qpid/DataDir.cpp @@ -314,7 +393,12 @@ set (libqpidcommon_SOURCES qpid/sys/Timer.cpp ) add_library (qpidcommon SHARED ${libqpidcommon_SOURCES}) -target_link_libraries (qpidcommon ${libqpidcommon_platform_LIBS}) +if (CLOCK_GETTIME_IN_RT) + set (libqpidcommon_platform_LIBS ${libqpidcommon_platform_LIBS} rt) +endif (CLOCK_GETTIME_IN_RT) +target_link_libraries (qpidcommon + ${libqpidcommon_platform_LIBS} + ${qpidcommon_sasl_lib}) set_target_properties (qpidcommon PROPERTIES VERSION ${qpidc_version}) @@ -443,4 +527,6 @@ target_link_libraries (qpidd qpidbroker qpidcommon) # add_subdirectory(tests) -message (STATUS end) +# Now create the config file from all the info learned above. +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/qpid/cpp/src/cluster.cmake b/qpid/cpp/src/cluster.cmake new file mode 100644 index 0000000000..5d7c4380b6 --- /dev/null +++ b/qpid/cpp/src/cluster.cmake @@ -0,0 +1,119 @@ +# +# 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. +# +# +# Cluster library CMake fragment, to be included in CMakeLists.txt +# + +# Optional cluster support. Requires CPG; if building it, can optionally +# include CMAN support as well. + +include(CheckIncludeFiles) +include(CheckLibraryExists) + +if (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (cluster_default OFF) +else (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (cluster_default ON) +endif (CMAKE_SYSTEM_NAME STREQUAL Windows) + +option(BUILD_CPG "Build with CPG support for clustering" ${cluster_default}) +if (BUILD_CPG) + CHECK_LIBRARY_EXISTS (cpg cpg_local_get + "-L/usr/lib/openais -L/usr/lib64/openais -L/usr/lib/corosync -L/usr/lib64/corosync" + HAVE_LIBCPG) + CHECK_INCLUDE_FILES (openais/cpg.h HAVE_OPENAIS_CPG_H) + CHECK_INCLUDE_FILES (corosync/cpg.h HAVE_COROSYNC_CPG_H) + if (NOT HAVE_LIBCPG) + message(FATAL_ERROR "libcpg not found, install openais-devel or corosync-devel") + endif (NOT HAVE_LIBCPG) + if (NOT HAVE_OPENAIS_CPG_H AND NOT HAVE_COROSYNC_CPG_H) + message(FATAL_ERROR "cpg.h not found, install openais-devel or corosync-devel") + endif (NOT HAVE_OPENAIS_CPG_H AND NOT HAVE_COROSYNC_CPG_H) + + option(CPG_INCLUDE_CMAN "Include libcman quorum service integration" ON) + if (CPG_INCLUDE_CMAN) + CHECK_LIBRARY_EXISTS (cman cman_is_quorate "" HAVE_LIBCMAN) + CHECK_INCLUDE_FILES (libcman.h HAVE_LIBCMAN_H) + if (NOT HAVE_LIBCMAN) + message(FATAL_ERROR "libcman not found, install cman-devel or cmanlib-devel") + endif (NOT HAVE_LIBCMAN) + if (NOT HAVE_LIBCMAN_H) + message(FATAL_ERROR "libcman.h not found, install cman-devel or cmanlib-devel") + endif (NOT HAVE_LIBCMAN_H) + + set (CMAN_SOURCES qpid/cluster/Quorum_cman.h qpid/cluster/Quorum_cman.cpp) + set (CMAN_LIB cman) + else (CPG_INCLUDE_CMAN) + set (CMAN_SOURCES qpid/cluster/Quorum_null.h) + endif (CPG_INCLUDE_CMAN) + + set (cluster_SOURCES + ${CMAN_SOURCES} + qpid/cluster/Cluster.cpp + qpid/cluster/Cluster.h + qpid/cluster/Decoder.cpp + qpid/cluster/Decoder.h + qpid/cluster/PollableQueue.h + qpid/cluster/ClusterMap.cpp + qpid/cluster/ClusterMap.h + qpid/cluster/ClusterPlugin.cpp + qpid/cluster/ClusterSettings.h + qpid/cluster/Connection.cpp + qpid/cluster/Connection.h + qpid/cluster/ConnectionCodec.cpp + qpid/cluster/ConnectionCodec.h + qpid/cluster/Cpg.cpp + qpid/cluster/Cpg.h + qpid/cluster/Dispatchable.h + qpid/cluster/UpdateClient.cpp + qpid/cluster/UpdateClient.h + qpid/cluster/Event.cpp + qpid/cluster/Event.h + qpid/cluster/EventFrame.h + qpid/cluster/EventFrame.cpp + qpid/cluster/ExpiryPolicy.h + qpid/cluster/ExpiryPolicy.cpp + qpid/cluster/FailoverExchange.cpp + qpid/cluster/FailoverExchange.h + qpid/cluster/UpdateExchange.h + qpid/cluster/LockedConnectionMap.h + qpid/cluster/Multicaster.cpp + qpid/cluster/Multicaster.h + qpid/cluster/McastFrameHandler.h + qpid/cluster/NoOpConnectionOutputHandler.h + qpid/cluster/OutputInterceptor.cpp + qpid/cluster/OutputInterceptor.h + qpid/cluster/PollerDispatch.cpp + qpid/cluster/PollerDispatch.h + qpid/cluster/ProxyInputHandler.h + qpid/cluster/Quorum.h + qpid/cluster/WriteEstimate.cpp + qpid/cluster/WriteEstimate.h + qpid/cluster/types.h + ) + + add_library (cluster SHARED ${cluster_SOURCES}) + target_link_libraries (cluster cpg ${CMAN_LIB} qpidbroker qpidclient) +#cluster_la_LDFLAGS = $(PLUGINLDFLAGS) + set_target_properties (cluster PROPERTIES VERSION ${qpidc_version}) + +endif (BUILD_CPG) + +# Distribute all sources. +#EXTRA_DIST += qpid/cluster/Quorum_cman.h qpid/cluster/Quorum_cman.cpp qpid/cluster/Quorum_null.h diff --git a/qpid/cpp/src/config.h.in b/qpid/cpp/src/config.h.in index 79943376d8..9ce1f5a188 100644 --- a/qpid/cpp/src/config.h.in +++ b/qpid/cpp/src/config.h.in @@ -1,33 +1,41 @@ -/*
- *
- * Copyright (c) 2006 The Apache Software Foundation
- *
- * Licensed 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.
- *
- */
-
-/*
- * This file is automatically generated and will be overwritten by the
- * next CMake invocation.
- */
-
-#ifndef QPID_CONFIG_H
-#define QPID_CONFIG_H
-
-#cmakedefine QPIDC_CONF_FILE "${QPIDC_CONF_FILE}"
-#cmakedefine QPIDD_CONF_FILE "${QPIDD_CONF_FILE}"
-
-#cmakedefine QPIDC_MODULE_DIR "${QPIDC_MODULE_DIR}"
-#cmakedefine QPIDD_MODULE_DIR "${QPIDD_MODULE_DIR}"
-
-#endif /* QPID_CONFIG_H */
+/* + * + * Copyright (c) 2006 The Apache Software Foundation + * + * Licensed 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. + * + */ + +/* + * This file is automatically generated and will be overwritten by the + * next CMake invocation. + */ + +#ifndef QPID_CONFIG_H +#define QPID_CONFIG_H + +#cmakedefine QPIDC_CONF_FILE "${QPIDC_CONF_FILE}" +#cmakedefine QPIDD_CONF_FILE "${QPIDD_CONF_FILE}" + +#cmakedefine QPIDC_MODULE_DIR "${QPIDC_MODULE_DIR}" +#cmakedefine QPIDD_MODULE_DIR "${QPIDD_MODULE_DIR}" + +#cmakedefine QPID_HAS_CLOCK_GETTIME + +#cmakedefine QPID_HAS_SASL +#cmakedefine BROKER_SASL_NAME "${BROKER_SASL_NAME}" + +#cmakedefine HAVE_LOG_AUTHPRIV +#cmakedefine HAVE_LOG_FTP + +#endif /* QPID_CONFIG_H */ diff --git a/qpid/cpp/src/posix/QpiddBroker.cpp b/qpid/cpp/src/posix/QpiddBroker.cpp index 13440a2ee3..aa934571be 100644 --- a/qpid/cpp/src/posix/QpiddBroker.cpp +++ b/qpid/cpp/src/posix/QpiddBroker.cpp @@ -90,8 +90,8 @@ struct QpiddPosixOptions : public QpiddOptionsPrivate { QpiddOptions::QpiddOptions(const char* argv0) : qpid::Options("Options"), - common("", CONF_FILE), - module(MODULE_DIR), + common("", QPIDD_CONF_FILE), + module(QPIDD_MODULE_DIR), log(argv0) { add(common); diff --git a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp index edc66444ec..6334b1d8d7 100644 --- a/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp +++ b/qpid/cpp/src/qpid/broker/SaslAuthenticator.cpp @@ -19,16 +19,14 @@ * */ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif +#include "config.h" #include "Connection.h" #include "qpid/log/Statement.h" #include "qpid/framing/reply_exceptions.h" #include <boost/format.hpp> -#if HAVE_SASL +#ifdef QPID_HAS_SASL #include <sasl/sasl.h> #include "qpid/sys/cyrus/CyrusSecurityLayer.h" using qpid::sys::cyrus::CyrusSecurityLayer; @@ -57,7 +55,7 @@ public: std::auto_ptr<SecurityLayer> getSecurityLayer(uint16_t maxFrameSize); }; -#if HAVE_SASL +#ifdef QPID_HAS_SASL class CyrusAuthenticator : public SaslAuthenticator { @@ -181,7 +179,7 @@ std::auto_ptr<SecurityLayer> NullAuthenticator::getSecurityLayer(uint16_t) } -#if HAVE_SASL +#ifdef QPID_HAS_SASL CyrusAuthenticator::CyrusAuthenticator(Connection& c, bool _encrypt) : diff --git a/qpid/cpp/src/rdma.cmake b/qpid/cpp/src/rdma.cmake new file mode 100644 index 0000000000..6ad9c81f23 --- /dev/null +++ b/qpid/cpp/src/rdma.cmake @@ -0,0 +1,94 @@ +# +# 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. +# +# +# RDMA (Remote DMA) wrapper CMake fragment, to be included in CMakeLists.txt +# + +# Optional RDMA support. Requires ibverbs and rdma_cm. + +include(CheckIncludeFiles) +include(CheckLibraryExists) + +option(BUILD_RDMA "Build with support for Remote DMA protocols" OFF) +if (BUILD_RDMA) + CHECK_LIBRARY_EXISTS (ibverbs ibv_create_qp "" HAVE_IBVERBS) + CHECK_LIBRARY_EXISTS (rdmacm rdma_create_id "" HAVE_RDMACM) + CHECK_INCLUDE_FILES (infiniband/verbs.h HAVE_IBVERBS_H) + CHECK_INCLUDE_FILES (rdma/rdma_cma.h HAVE_RDMACM_H) + if (NOT HAVE_IBVERBS) + message(FATAL_ERROR "libibverbs not found, required for RDMA support") + endif (NOT HAVE_IBVERBS) + if (NOT HAVE_RDMACM) + message(FATAL_ERROR "librdmacm not found, required for RDMA support") + endif (NOT HAVE_RDMACM) + if (NOT HAVE_IBVERBS_H) + message(FATAL_ERROR "ibverbs headers not found, required for RDMA support") + endif (NOT HAVE_IBVERBS_H) + if (NOT HAVE_RDMACM_H) + message(FATAL_ERROR "rdmacm headers not found, required for RDMA support") + endif (NOT HAVE_RDMACM_H) + + set (rdma_SOURCES + qpid/sys/rdma/rdma_exception.h + qpid/sys/rdma/rdma_factories.cpp + qpid/sys/rdma/rdma_factories.h + qpid/sys/rdma/RdmaIO.cpp + qpid/sys/rdma/RdmaIO.h + qpid/sys/rdma/rdma_wrap.cpp + qpid/sys/rdma/rdma_wrap.h + ) + + add_library (rdmawrap SHARED ${rdma_SOURCES}) + target_link_libraries (rdmawrap qpidcommon rdmacm ibverbs) + set_target_properties (rdmawrap PROPERTIES VERSION ${qpidc_version}) + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(rdmawrap PROPERTIES + COMPILE_FLAGS -Wno-missing-field-initializers + LINK_FLAGS -no-undefined) + endif (CMAKE_COMPILER_IS_GNUCXX) + + add_library (rdma SHARED qpid/sys/RdmaIOPlugin.cpp) + target_link_libraries (rdma qpidbroker rdmawrap) + set_target_properties (rdma PROPERTIES VERSION ${qpidc_version}) + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(rdmawrap PROPERTIES + COMPILE_FLAGS -Wno-missing-field-initializers + LINK_FLAGS -no-undefined) + endif (CMAKE_COMPILER_IS_GNUCXX) + + add_library (rdmaconnector SHARED qpid/client/RdmaConnector.cpp) + target_link_libraries (rdmaconnector qpidclient rdmawrap) + set_target_properties (rdmaconnector PROPERTIES VERSION ${qpidc_version}) + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(rdmaconnector PROPERTIES + COMPILE_FLAGS -Wno-missing-field-initializers + LINK_FLAGS -no-undefined) + endif (CMAKE_COMPILER_IS_GNUCXX) + + # RDMA test/sample programs + add_executable (RdmaServer qpid/sys/rdma/RdmaServer.cpp) + target_link_libraries (RdmaServer rdmawrap qpidcommon) + add_executable (RdmaClient qpid/sys/rdma/RdmaClient.cpp) + target_link_libraries (RdmaClient rdmawrap qpidcommon) + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(RdmaClient PROPERTIES + COMPILE_FLAGS -Wno-missing-field-initializers) + endif (CMAKE_COMPILER_IS_GNUCXX) + +endif (BUILD_RDMA) diff --git a/qpid/cpp/src/ssl.cmake b/qpid/cpp/src/ssl.cmake new file mode 100644 index 0000000000..d7b18d3a27 --- /dev/null +++ b/qpid/cpp/src/ssl.cmake @@ -0,0 +1,97 @@ +# +# 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. +# +# +# SSL/TLS CMake fragment, to be included in CMakeLists.txt +# + +# Optional SSL/TLS support. Requires Netscape Portable Runtime on Linux. + +include(FindPkgConfig) + +if (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (ssl_default OFF) +else (CMAKE_SYSTEM_NAME STREQUAL Windows) + set (ssl_default ON) +endif (CMAKE_SYSTEM_NAME STREQUAL Windows) + +option(BUILD_SSL "Build with support for SSL" ${ssl_default}) +if (BUILD_SSL) + find_program (NSPR_CONFIG nspr-config) + if (NSPR_CONFIG STREQUAL NSPR_CONFIG-NOTFOUND) + message(FATAL_ERROR "libnspr not found, required for SSL support") + endif (NSPR_CONFIG STREQUAL NSPR_CONFIG-NOTFOUND) + find_program (NSS_CONFIG nss-config) + if (NSS_CONFIG STREQUAL NSS_CONFIG-NOTFOUND) + message(FATAL_ERROR "libnss not found, required for SSL support") + endif (NSS_CONFIG STREQUAL NSS_CONFIG-NOTFOUND) + # Output from nss/snpr-config ends with newline, so strip it + execute_process (COMMAND ${NSPR_CONFIG} --cflags + OUTPUT_VARIABLE get_flags) + string (STRIP ${get_flags} NSPR_CFLAGS) + execute_process (COMMAND ${NSPR_CONFIG} --libs + OUTPUT_VARIABLE get_flags) + string (STRIP ${get_flags} NSPR_LIBS) + execute_process (COMMAND ${NSS_CONFIG} --cflags + OUTPUT_VARIABLE get_flags) + string (STRIP ${get_flags} NSS_CFLAGS) + execute_process (COMMAND ${NSS_CONFIG} --libs + OUTPUT_VARIABLE get_flags) + string (STRIP ${get_flags} NSS_LIBS) + + set (sslcommon_SOURCES + qpid/sys/ssl/check.h + qpid/sys/ssl/check.cpp + qpid/sys/ssl/util.h + qpid/sys/ssl/util.cpp + qpid/sys/ssl/SslSocket.h + qpid/sys/ssl/SslSocket.cpp + qpid/sys/ssl/SslIo.h + qpid/sys/ssl/SslIo.cpp + ) + + add_library (sslcommon SHARED ${sslcommon_SOURCES}) + target_link_libraries (sslcommon qpidcommon nss3 ssl3 nspr4) + set_target_properties (sslcommon PROPERTIES + VERSION ${qpidc_version} + COMPILE_FLAGS "${NSPR_CFLAGS} ${NSS_CFLAGS}") + + set (ssl_SOURCES + qpid/sys/SslPlugin.cpp + qpid/sys/ssl/SslHandler.h + qpid/sys/ssl/SslHandler.cpp + ) + add_library (ssl SHARED ${ssl_SOURCES}) + target_link_libraries (ssl qpidbroker sslcommon) + set_target_properties (ssl PROPERTIES + VERSION ${qpidc_version} + COMPILE_FLAGS "${NSPR_CFLAGS} ${NSS_CFLAGS}") + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(ssl PROPERTIES + LINK_FLAGS -no-undefined) + endif (CMAKE_COMPILER_IS_GNUCXX) + + add_library (sslconnector SHARED qpid/client/SslConnector.cpp) + target_link_libraries (sslconnector qpidclient sslcommon) + set_target_properties (sslconnector PROPERTIES VERSION ${qpidc_version}) + if (CMAKE_COMPILER_IS_GNUCXX) + set_target_properties(sslconnector PROPERTIES + LINK_FLAGS -no-undefined) + endif (CMAKE_COMPILER_IS_GNUCXX) + +endif (BUILD_SSL) |