You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2016/02/23 06:39:10 UTC
[1/4] qpid-proton git commit: PROTON-1144: Fixed some socket level
issues: - Fixed very strange unecessary lookup of protocol "tcp" - Fixed
accepting IPv6 addresses (would have been truncated before)
Repository: qpid-proton
Updated Branches:
refs/heads/master b7175ee04 -> 26553f012
PROTON-1144: Fixed some socket level issues:
- Fixed very strange unecessary lookup of protocol "tcp"
- Fixed accepting IPv6 addresses (would have been truncated before)
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a22e6c77
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a22e6c77
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a22e6c77
Branch: refs/heads/master
Commit: a22e6c77d8f7a14abe97f344e25282ebced128cd
Parents: b7175ee
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri Feb 19 13:45:48 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 23 00:35:52 2016 -0500
----------------------------------------------------------------------
proton-c/bindings/cpp/src/posix/io.cpp | 3 +--
proton-c/bindings/cpp/src/windows/io.cpp | 3 +--
proton-c/src/posix/io.c | 27 ++++++++-------------------
proton-c/src/windows/io.c | 17 ++++++-----------
4 files changed, 16 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a22e6c77/proton-c/bindings/cpp/src/posix/io.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/posix/io.cpp b/proton-c/bindings/cpp/src/posix/io.cpp
index 0f7a3f9..6da2887 100644
--- a/proton-c/bindings/cpp/src/posix/io.cpp
+++ b/proton-c/bindings/cpp/src/posix/io.cpp
@@ -155,8 +155,7 @@ listener::listener(const std::string& host, const std::string &port) : socket_(I
listener::~listener() { ::close(socket_); }
descriptor listener::accept(std::string& host_str, std::string& port_str) {
- struct sockaddr_in addr;
- ::memset(&addr, 0, sizeof(addr));
+ struct sockaddr_storage addr;
socklen_t size = sizeof(addr);
int fd = check(::accept(socket_, (struct sockaddr *)&addr, &size), "accept: ");
char host[NI_MAXHOST], port[NI_MAXSERV];
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a22e6c77/proton-c/bindings/cpp/src/windows/io.cpp
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/src/windows/io.cpp b/proton-c/bindings/cpp/src/windows/io.cpp
index 9273f19..1bdccef 100644
--- a/proton-c/bindings/cpp/src/windows/io.cpp
+++ b/proton-c/bindings/cpp/src/windows/io.cpp
@@ -182,8 +182,7 @@ listener::listener(const std::string& host, const std::string &port) : socket_(I
listener::~listener() { ::closesocket(socket_); }
descriptor listener::accept(std::string& host_str, std::string& port_str) {
- struct sockaddr_in addr;
- ::memset(&addr, 0, sizeof(addr));
+ struct sockaddr_storage addr;
socklen_t size = sizeof(addr);
int fd = check(::accept(socket_, (struct sockaddr *)&addr, &size), "accept: ");
char host[NI_MAXHOST], port[NI_MAXSERV];
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a22e6c77/proton-c/src/posix/io.c
----------------------------------------------------------------------
diff --git a/proton-c/src/posix/io.c b/proton-c/src/posix/io.c
index fe0bf73..510cdf6 100644
--- a/proton-c/src/posix/io.c
+++ b/proton-c/src/posix/io.c
@@ -28,7 +28,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
@@ -122,7 +121,7 @@ static void pn_configure_sock(pn_io_t *io, pn_socket_t sock) {
}
}
-static inline int pn_create_socket(int af);
+static inline int pn_create_socket(int af, int protocol);
pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port)
{
@@ -133,7 +132,7 @@ pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port)
return PN_INVALID_SOCKET;
}
- pn_socket_t sock = pn_create_socket(addr->ai_family);
+ pn_socket_t sock = pn_create_socket(addr->ai_family, addr->ai_protocol);
if (sock == PN_INVALID_SOCKET) {
freeaddrinfo(addr);
pn_i_error_from_errno(io->error, "pn_create_socket");
@@ -175,7 +174,7 @@ pn_socket_t pn_connect(pn_io_t *io, const char *host, const char *port)
return PN_INVALID_SOCKET;
}
- pn_socket_t sock = pn_create_socket(addr->ai_family);
+ pn_socket_t sock = pn_create_socket(addr->ai_family, addr->ai_protocol);
if (sock == PN_INVALID_SOCKET) {
pn_i_error_from_errno(io->error, "pn_create_socket");
freeaddrinfo(addr);
@@ -200,8 +199,7 @@ pn_socket_t pn_connect(pn_io_t *io, const char *host, const char *port)
pn_socket_t pn_accept(pn_io_t *io, pn_socket_t socket, char *name, size_t size)
{
- struct sockaddr_in addr = {0};
- addr.sin_family = AF_UNSPEC;
+ struct sockaddr_storage addr;
socklen_t addrlen = sizeof(addr);
pn_socket_t sock = accept(socket, (struct sockaddr *) &addr, &addrlen);
if (sock == PN_INVALID_SOCKET) {
@@ -231,12 +229,8 @@ ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t len) {
return count;
}
-static inline int pn_create_socket(int af) {
- struct protoent * pe_tcp = getprotobyname("tcp");
- if (pe_tcp == NULL) {
- return -1;
- }
- return socket(af, SOCK_STREAM, pe_tcp->p_proto);
+static inline int pn_create_socket(int af, int protocol) {
+ return socket(af, SOCK_STREAM, protocol);
}
#elif defined(SO_NOSIGPIPE)
ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size) {
@@ -246,14 +240,9 @@ ssize_t pn_send(pn_io_t *io, pn_socket_t socket, const void *buf, size_t size) {
return count;
}
-static inline int pn_create_socket(int af) {
- struct protoent * pe_tcp;
+static inline int pn_create_socket(int af, int protocol) {
int sock;
- pe_tcp = getprotobyname("tcp");
- if (pe_tcp == NULL) {
- return -1;
- }
- sock = socket(af, SOCK_STREAM, pe_tcp->p_proto);
+ sock = socket(af, SOCK_STREAM, protocol);
if (sock == -1) return sock;
int optval = 1;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a22e6c77/proton-c/src/windows/io.c
----------------------------------------------------------------------
diff --git a/proton-c/src/windows/io.c b/proton-c/src/windows/io.c
index 261a56f..7ff928d 100644
--- a/proton-c/src/windows/io.c
+++ b/proton-c/src/windows/io.c
@@ -169,7 +169,7 @@ static void pn_configure_sock(pn_io_t *io, pn_socket_t sock) {
}
}
-static inline pn_socket_t pni_create_socket(int domain);
+static inline pn_socket_t pni_create_socket(int domain, int protocol);
static const char *amqp_service(const char *port) {
// Help older Windows to know about amqp[s] ports
@@ -189,7 +189,7 @@ pn_socket_t pn_listen(pn_io_t *io, const char *host, const char *port)
return INVALID_SOCKET;
}
- pn_socket_t sock = pni_create_socket(addr->ai_family);
+ pn_socket_t sock = pni_create_socket(addr->ai_family, addr->ai_protocol);
if (sock == INVALID_SOCKET) {
pni_win32_error(io->error, "pni_create_socket", WSAGetLastError());
return INVALID_SOCKET;
@@ -243,7 +243,7 @@ pn_socket_t pn_connect(pn_io_t *io, const char *hostarg, const char *port)
return INVALID_SOCKET;
}
- pn_socket_t sock = pni_create_socket(addr->ai_family);
+ pn_socket_t sock = pni_create_socket(addr->ai_family, addr->ai_protocol);
if (sock == INVALID_SOCKET) {
pni_win32_error(io->error, "proton pni_create_socket", WSAGetLastError());
freeaddrinfo(addr);
@@ -272,8 +272,7 @@ pn_socket_t pn_connect(pn_io_t *io, const char *hostarg, const char *port)
pn_socket_t pn_accept(pn_io_t *io, pn_socket_t listen_sock, char *name, size_t size)
{
- struct sockaddr_in addr = {0};
- addr.sin_family = AF_INET;
+ struct sockaddr_storage addr;
socklen_t addrlen = sizeof(addr);
iocpdesc_t *listend = pni_iocpdesc_map_get(io->iocp, listen_sock);
pn_socket_t accept_sock;
@@ -309,12 +308,8 @@ pn_socket_t pn_accept(pn_io_t *io, pn_socket_t listen_sock, char *name, size_t s
}
}
-static inline pn_socket_t pni_create_socket(int domain) {
- struct protoent * pe_tcp = getprotobyname("tcp");
- if (pe_tcp == NULL) {
- return -1;
- }
- return socket(domain, SOCK_STREAM, pe_tcp->p_proto);
+static inline pn_socket_t pni_create_socket(int domain, int protocol) {
+ return socket(domain, SOCK_STREAM, protocol);
}
ssize_t pn_send(pn_io_t *io, pn_socket_t sockfd, const void *buf, size_t len) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[2/4] qpid-proton git commit: PROTON-1142: Remove proton-dump
Posted by as...@apache.org.
PROTON-1142: Remove proton-dump
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/1bfc05e4
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/1bfc05e4
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/1bfc05e4
Branch: refs/heads/master
Commit: 1bfc05e4c15ae4c39ebcb807b95a0cd987f90a8f
Parents: a22e6c7
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri Feb 19 16:34:03 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 23 00:36:10 2016 -0500
----------------------------------------------------------------------
proton-c/CMakeLists.txt | 24 +-----
proton-c/docs/man/CMakeLists.txt | 22 ------
proton-c/docs/man/proton-dump.1 | 12 ---
proton-c/src/proton-dump.c | 144 ----------------------------------
4 files changed, 1 insertion(+), 201 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 862a520..f10aa5b 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -290,7 +290,6 @@ pn_absolute_install_dir(INCLUDEDIR ${INCLUDE_INSTALL_DIR} ${CMAKE_INSTALL_PREFIX
add_subdirectory(bindings)
add_subdirectory(docs/api)
-add_subdirectory(docs/man)
add_subdirectory(../tests/tools/apps/c ../tests/tools/apps/c)
set (qpid-proton-platform
@@ -424,23 +423,6 @@ if (MSVC)
include(WindowsC99CheckDef)
endif(MSVC)
-add_executable (
- proton-dump
- src/proton-dump.c
- # Internal dependencies
- src/buffer.c
- src/util.c
- src/framing/framing.c
- )
-target_link_libraries (proton-dump qpid-proton)
-
-set_target_properties (
- proton-dump
- PROPERTIES
- COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_PLATFORM_FLAGS}"
- LINK_FLAGS "${LTO}"
- )
-
macro(pn_c_files)
foreach (src_file ${ARGN})
if (${src_file} MATCHES "^.*[.]c$")
@@ -452,13 +434,9 @@ macro(pn_c_files)
endforeach (src_file)
endmacro(pn_c_files)
-pn_c_files (${qpid-proton-core} ${qpid-proton-platform} src/proton-dump.c)
+pn_c_files (${qpid-proton-core} ${qpid-proton-platform})
# Install executables and libraries
-install (TARGETS proton-dump
- RUNTIME DESTINATION bin
- ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
- LIBRARY DESTINATION ${LIB_INSTALL_DIR})
install (TARGETS qpid-proton
EXPORT proton
RUNTIME DESTINATION bin
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/docs/man/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/docs/man/CMakeLists.txt b/proton-c/docs/man/CMakeLists.txt
deleted file mode 100644
index 764b845..0000000
--- a/proton-c/docs/man/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-INSTALL (FILES proton-dump.1
- DESTINATION ${MAN_INSTALL_DIR}/man1)
-
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/docs/man/proton-dump.1
----------------------------------------------------------------------
diff --git a/proton-c/docs/man/proton-dump.1 b/proton-c/docs/man/proton-dump.1
deleted file mode 100644
index 8af73ad..0000000
--- a/proton-c/docs/man/proton-dump.1
+++ /dev/null
@@ -1,12 +0,0 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.44.1.
-.TH USAGE: "1" "August 2014" "Usage: proton-dump [FILE1] [FILEn] ..." "User Commands"
-.SH NAME
-proton-dump - display the contents of an AMQP dump file containing frame data
-.SH SYNOPSIS
-.B proton-dump
-[\fIFILE1\fR] [\fIFILEn\fR] ...
-.SH DESCRIPTION
-Displays the content of an AMQP dump file containing frame data.
-.TP
-[FILEn]
-Dump file to be displayed.
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/1bfc05e4/proton-c/src/proton-dump.c
----------------------------------------------------------------------
diff --git a/proton-c/src/proton-dump.c b/proton-c/src/proton-dump.c
deleted file mode 100644
index 0da65eb..0000000
--- a/proton-c/src/proton-dump.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-#include <stdio.h>
-#include <proton/codec.h>
-#include <proton/error.h>
-#include "buffer.h"
-#include "framing/framing.h"
-#include "util.h"
-
-void fatal_error(const char *msg, const char *arg, int err)
-{
- fprintf(stderr, msg, arg);
- fflush(stderr);
- errno = err;
- perror(" , exiting");
- exit(1);
-}
-
-int dump(const char *file)
-{
- FILE *in = fopen(file, "r");
- if (!in) fatal_error("proton-dump: dump: opening %s", file, errno);
-
- pn_buffer_t *buf = pn_buffer(1024);
- pn_data_t *data = pn_data(16);
- bool header = false;
-
- char bytes[1024];
- size_t n;
- while ((n = fread(bytes, 1, 1024, in))) {
- int err = pn_buffer_append(buf, bytes, n);
- if (err) return err;
-
- while (true) {
- pn_bytes_t available = pn_buffer_bytes(buf);
- if (!available.size) break;
-
- if (!header) {
- header = true;
- while (available.size >= 8) {
- pn_bytes_t b = pn_buffer_bytes(buf);
- if (b.start[0] == 'A' &&
- b.start[1] == 'M' &&
- b.start[2] == 'Q' &&
- b.start[3] == 'P') {
- fprintf(stdout, "AMQP Header: ");
- pn_fprint_data(stdout, b.start, 8);
- fprintf(stdout, "\n");
-
- pn_buffer_trim(buf, 8, 0);
- available = pn_buffer_bytes(buf);
- } else {
- break;
- }
- }
- }
- if (available.size < 8)
- break;
-
- pn_frame_t frame;
- ssize_t consumed = pn_read_frame(&frame, available.start, available.size, 0);
- if (consumed > 0) {
- pn_data_clear(data);
- ssize_t dsize = pn_data_decode(data, frame.payload, frame.size);
- if (dsize < 0) {
- fprintf(stderr, "Error decoding frame: %s\n", pn_code(err));
- pn_fprint_data(stderr, frame.payload, frame.size);
- fprintf(stderr, "\n");
- return err;
- } else {
- pn_data_print(data);
- printf("\n");
- }
- pn_buffer_trim(buf, consumed, 0);
- } else if (consumed < 0) {
- fprintf(stderr, "Error decoding frame: invalid frame format\n");
- return -1;
- } else {
- break;
- }
- }
- }
-
- if (ferror(in)) fatal_error("proton-dump: dump: reading %s", file, errno);
- if (pn_buffer_size(buf) > 0) {
- fprintf(stderr, "Trailing data: ");
- pn_bytes_t b = pn_buffer_bytes(buf);
- pn_fprint_data(stderr, b.start, b.size);
- fprintf(stderr, "\n");
- }
-
- fclose(in);
-
- return 0;
-}
-
-void usage(char* prog) {
- printf("Usage: %s [FILE1] [FILEn] ...\n", prog);
- printf("Displays the content of an AMQP dump file containing frame data.\n");
- printf("\n [FILEn] Dump file to be displayed.\n\n");
-}
-
-int main(int argc, char **argv)
-{
- if(argc == 1) {
- usage(argv[0]);
- return 0;
- }
-
- // There are no actual options for proton-dump so just scan for anything
- // starting with '-' and print the usage message if we find something.
- for (int c = 1; c < argc; c++) {
- if (*argv[c]=='-') {
- usage(argv[0]);
- return 1;
- }
- }
-
- for (int i = 1; i < argc; i++) {
- int err = dump(argv[i]);
- if (err) return err;
- }
-
- return 0;
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[4/4] qpid-proton git commit: PROTON-1143: CMake minimum version now
2.8.7 - Remove some old cruft
Posted by as...@apache.org.
PROTON-1143: CMake minimum version now 2.8.7
- Remove some old cruft
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/36059eba
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/36059eba
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/36059eba
Branch: refs/heads/master
Commit: 36059eba2cfe0135dacd8dbd11371f041239fdc9
Parents: 1bfc05e
Author: Andrew Stitcher <as...@apache.org>
Authored: Fri Feb 19 16:27:22 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 23 00:36:10 2016 -0500
----------------------------------------------------------------------
CMakeLists.txt | 2 +-
proton-c/CMakeLists.txt | 64 +++++++++-----------------
proton-c/bindings/cpp/docs/CMakeLists.txt | 2 +-
proton-c/bindings/python/CMakeLists.txt | 4 +-
proton-c/docs/api/CMakeLists.txt | 2 +-
5 files changed, 26 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36059eba/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5ef9f56..02bd134 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@
# specific language governing permissions and limitations
# under the License.
#
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required (VERSION 2.8.7)
project (Proton C)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36059eba/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index f10aa5b..0f60ce0 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -23,31 +23,12 @@ include(CheckSymbolExists)
include(soversion.cmake)
-if(WIN32 AND NOT CYGWIN)
- # linking against Windows native libraries, including mingw
- set (PN_WINAPI TRUE)
- set (PLATFORM_LIBS ws2_32 Rpcrt4)
- list(APPEND PLATFORM_DEFINITIONS "PN_WINAPI")
-endif(WIN32 AND NOT CYGWIN)
-
-# Can't use ${CMAKE_VERSION) as it is not available in all versions of cmake 2.6
-if ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.0")
- # OPTIONAL does not exist in install before 2.8 so always make docs and install
- set (OPTIONAL_ARG "")
- add_custom_target(docs ALL)
- # There are bugs in the OpenSSL detection that mean -lcrypto is missed from the link line
- # so turn off unknown symbol warnings
- set (NOENABLE_UNDEFINED_ERROR ON)
- set (OLD_ADD_TEST_COMMAND ON)
-else()
- set (OPTIONAL_ARG OPTIONAL)
- add_custom_target(docs)
-endif()
+add_custom_target(docs)
add_custom_target(doc DEPENDS docs)
# Set the default SSL/TLS implementation
find_package(OpenSSL)
-find_package (PythonInterp REQUIRED)
+find_package(PythonInterp REQUIRED)
find_package(SWIG)
# FindSwig.cmake "forgets" make its outputs advanced like a good citizen
mark_as_advanced(SWIG_DIR SWIG_EXECUTABLE SWIG_VERSION)
@@ -62,6 +43,11 @@ mark_as_advanced(CYRUS_SASL_LIBRARY CYRUS_SASL_INCLUDE_DIR)
find_program(SASLPASSWD_EXE saslpasswd2 DOC "Program used to make SASL user db for testing")
mark_as_advanced(SASLPASSWD_EXE)
+if(WIN32 AND NOT CYGWIN)
+ # linking against Windows native libraries, including mingw
+ set (PN_WINAPI TRUE)
+endif(WIN32 AND NOT CYGWIN)
+
set(ssl_impl, none)
if(PN_WINAPI)
set(ssl_impl schannel)
@@ -184,6 +170,11 @@ else (C99_ATOLL)
endif (WINAPI_ATOI64)
endif (C99_ATOLL)
+if (PN_WINAPI)
+ set (PLATFORM_LIBS ws2_32 Rpcrt4)
+ list(APPEND PLATFORM_DEFINITIONS "PN_WINAPI")
+endif (PN_WINAPI)
+
# Try to keep any platform specific overrides together here:
# MacOS has a bunch of differences in build tools and process and so we have to turn some things
@@ -520,28 +511,15 @@ if (BUILD_PYTHON)
set (py_pythonpath ${py_root} ${py_src} ${py_bin} ${py_dll} $ENV{PYTHONPATH})
to_native_path ("${py_pythonpath}" py_pythonpath)
- if (NOT OLD_ADD_TEST_COMMAND)
- to_native_path ("${py_path}" py_path)
- add_test (NAME python-test
- COMMAND ${env_py}
- "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}"
- "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
- "SASLPASSWD=${SASLPASSWD_EXE}"
- ${VALGRIND_ENV}
- ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
- set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
- else (NOT OLD_ADD_TEST_COMMAND)
- list (APPEND py_path "${Proton_BINARY_DIR}/tests/tools/apps/c")
- to_native_path ("${py_path}" py_path)
- add_test (python-test
- ${env_py}
- "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}"
- "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
- "SASLPASSWD=${SASLPASSWD_EXE}"
- ${VALGRIND_ENV}
- ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
- set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
- endif (NOT OLD_ADD_TEST_COMMAND)
+ to_native_path ("${py_path}" py_path)
+ add_test (NAME python-test
+ COMMAND ${env_py}
+ "PATH=${py_path}" "PYTHONPATH=${py_pythonpath}" "PKG_CONFIG_PATH=${pn_c_root}"
+ "CLASSPATH=${CMAKE_BINARY_DIR}/proton-j/proton-j.jar"
+ "SASLPASSWD=${SASLPASSWD_EXE}"
+ ${VALGRIND_ENV}
+ ${PYTHON_EXECUTABLE} "${py_root}/proton-test")
+ set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
# Eventually, we'll get rid of this check when other
# platforms will be supported. Since `setup.py` will skip
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36059eba/proton-c/bindings/cpp/docs/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/docs/CMakeLists.txt b/proton-c/bindings/cpp/docs/CMakeLists.txt
index 94b9f0b..cf7876e 100644
--- a/proton-c/bindings/cpp/docs/CMakeLists.txt
+++ b/proton-c/bindings/cpp/docs/CMakeLists.txt
@@ -30,7 +30,7 @@ if (DOXYGEN_FOUND)
install (DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
DESTINATION "${PROTON_SHARE}/docs/api-cpp"
COMPONENT documentation
- ${OPTIONAL_ARG})
+ OPTIONAL)
endif (DOXYGEN_FOUND)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36059eba/proton-c/bindings/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/python/CMakeLists.txt b/proton-c/bindings/python/CMakeLists.txt
index d16caad..7da9247 100644
--- a/proton-c/bindings/python/CMakeLists.txt
+++ b/proton-c/bindings/python/CMakeLists.txt
@@ -92,7 +92,7 @@ if (EPYDOC_EXE)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
DESTINATION "${PROTON_SHARE}/docs/api-py"
COMPONENT documentation
- ${OPTIONAL_ARG})
+ OPTIONAL)
endif (EPYDOC_EXE)
find_program(SPHINX_EXE sphinx-build)
@@ -105,7 +105,7 @@ if (SPHINX_EXE)
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/tutorial/"
DESTINATION "${PROTON_SHARE}/docs/tutorial-py"
COMPONENT documentation
- ${OPTIONAL_ARG})
+ OPTIONAL)
endif (SPHINX_EXE)
install(FILES ${CPROTON_ARTIFACTS}
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/36059eba/proton-c/docs/api/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/docs/api/CMakeLists.txt b/proton-c/docs/api/CMakeLists.txt
index 566ce2f..7756e48 100644
--- a/proton-c/docs/api/CMakeLists.txt
+++ b/proton-c/docs/api/CMakeLists.txt
@@ -28,7 +28,7 @@ if (DOXYGEN_FOUND)
install (DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
DESTINATION "${PROTON_SHARE}/docs/api-c"
COMPONENT documentation
- ${OPTIONAL_ARG})
+ OPTIONAL)
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES html)
endif (DOXYGEN_FOUND)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
[3/4] qpid-proton git commit: PROTON-1143: Simplified some of the
CMake system with 2.8.7 features
Posted by as...@apache.org.
PROTON-1143: Simplified some of the CMake system with 2.8.7 features
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/26553f01
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/26553f01
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/26553f01
Branch: refs/heads/master
Commit: 26553f0123bed0cd5997eafc516a0116552da9d5
Parents: 36059eb
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Feb 22 14:39:07 2016 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Feb 23 00:36:10 2016 -0500
----------------------------------------------------------------------
proton-c/CMakeLists.txt | 42 +++++++++-----------
proton-c/bindings/cpp/CMakeLists.txt | 17 ++++----
.../cpp/ProtonCppConfigVersion.cmake.in | 30 --------------
proton-c/src/ProtonConfigVersion.cmake.in | 30 --------------
proton-c/src/tests/CMakeLists.txt | 4 +-
5 files changed, 29 insertions(+), 94 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 0f60ce0..6e755a9 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -336,9 +336,9 @@ set (qpid-proton-core
src/messenger/store.c
src/messenger/transform.c
src/selectable.c
+ )
- src/config.h
-
+set (qpid-proton-extra-deps
${CMAKE_CURRENT_BINARY_DIR}/src/encodings.h
${CMAKE_CURRENT_BINARY_DIR}/src/protocol.h
)
@@ -391,12 +391,20 @@ set_source_files_properties (
COMPILE_DEFINITIONS "${PLATFORM_DEFINITIONS}"
)
+if (BUILD_WITH_CXX)
+ set_source_files_properties (
+ ${qpid-proton-core} ${qpid-proton-platform}
+ PROPERTIES LANGUAGE CXX
+ )
+endif (BUILD_WITH_CXX)
+
add_library (
qpid-proton SHARED
${qpid-proton-core}
${qpid-proton-platform}
${qpid-proton-include}
+ ${qpid-proton-extra-deps}
)
target_link_libraries (qpid-proton ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS})
@@ -414,19 +422,6 @@ if (MSVC)
include(WindowsC99CheckDef)
endif(MSVC)
-macro(pn_c_files)
- foreach (src_file ${ARGN})
- if (${src_file} MATCHES "^.*[.]c$")
- if (BUILD_WITH_CXX)
- # tell CMake to use C++ for proton source files ending in ".c"
- set_source_files_properties (${src_file} PROPERTIES LANGUAGE CXX)
- endif (BUILD_WITH_CXX)
- endif (${src_file} MATCHES "^.*[.]c$")
- endforeach (src_file)
-endmacro(pn_c_files)
-
-pn_c_files (${qpid-proton-core} ${qpid-proton-platform})
-
# Install executables and libraries
install (TARGETS qpid-proton
EXPORT proton
@@ -436,13 +431,9 @@ install (TARGETS qpid-proton
# Install windows qpid-proton pdb files
if (MSVC)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/qpid-proton${CMAKE_DEBUG_POSTFIX}.pdb
+ install(FILES $<TARGET_PDB_FILE:qpid-proton>
DESTINATION bin
- CONFIGURATIONS Debug
- OPTIONAL)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/qpid-proton.pdb
- DESTINATION bin
- CONFIGURATIONS RelWithDebInfo
+ CONFIGURATIONS RelWithDebInfo Debug
OPTIONAL)
endif (MSVC)
@@ -468,12 +459,15 @@ set(PROTONLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_SHARED_LIBRARY_SU
set(PROTONLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif ()
+include(WriteBasicConfigVersionFile)
+
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/ProtonConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ProtonConfig.cmake @ONLY)
-configure_file(
- ${CMAKE_CURRENT_SOURCE_DIR}/src/ProtonConfigVersion.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake @ONLY)
+write_basic_config_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake
+ VERSION ${PN_VERSION}
+ COMPATIBILITY AnyNewerVersion)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/ProtonConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ProtonConfigVersion.cmake
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index 7c1c41d..86788a8 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -105,13 +105,9 @@ install(TARGETS qpid-proton-cpp
# Install windows qpid-proton-cpp pdb files
if (MSVC)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/qpid-proton${CMAKE_DEBUG_POSTFIX}.pdb
+ install(FILES $<TARGET_PDB_FILE:qpid-proton-cpp>
DESTINATION bin
- CONFIGURATIONS Debug
- OPTIONAL)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/qpid-proton.pdb
- DESTINATION bin
- CONFIGURATIONS RelWithDebInfo
+ CONFIGURATIONS RelWithDebInfo Debug
OPTIONAL)
endif (MSVC)
@@ -138,12 +134,15 @@ set(PROTONCPPLIB ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_SHARED_LIB
set(PROTONCPPLIBDEBUG ${CMAKE_SHARED_LIBRARY_PREFIX}qpid-proton-cpp${CMAKE_DEBUG_POSTFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
endif ()
+include(WriteBasicConfigVersionFile)
+
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)
+write_basic_config_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
+ VERSION ${PN_VERSION}
+ COMPATIBILITY AnyNewerVersion)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/ProtonCppConfigVersion.cmake
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/26553f01/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
deleted file mode 100644
index d40f5c3..0000000
--- a/proton-c/bindings/cpp/ProtonCppConfigVersion.cmake.in
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/26553f01/proton-c/src/ProtonConfigVersion.cmake.in
----------------------------------------------------------------------
diff --git a/proton-c/src/ProtonConfigVersion.cmake.in b/proton-c/src/ProtonConfigVersion.cmake.in
deleted file mode 100644
index d40f5c3..0000000
--- a/proton-c/src/ProtonConfigVersion.cmake.in
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/26553f01/proton-c/src/tests/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/src/tests/CMakeLists.txt b/proton-c/src/tests/CMakeLists.txt
index 29e3cf6..3ea8bcf 100644
--- a/proton-c/src/tests/CMakeLists.txt
+++ b/proton-c/src/tests/CMakeLists.txt
@@ -27,7 +27,9 @@ endif ()
macro (pn_add_c_test test file)
add_executable (${test} ${file})
target_link_libraries (${test} qpid-proton)
- pn_c_files (${file})
+ if (BUILD_WITH_CXX)
+ set_source_files_properties (${file} PROPERTIES LANGUAGE CXX)
+ endif (BUILD_WITH_CXX)
if (CMAKE_SYSTEM_NAME STREQUAL Windows)
add_test (NAME ${test}
COMMAND ${env_py}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org