This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ef92062   Fix: set visibility,exclude-libs options to CMAKE_CXX_FLAGS 
(#1997)
ef92062 is described below

commit ef92062fa05cc125f7399a1ab5506606a035278e
Author: hrsakai <[email protected]>
AuthorDate: Fri Jun 22 01:36:11 2018 +0900

     Fix: set visibility,exclude-libs options to CMAKE_CXX_FLAGS (#1997)
    
    * Fix: set visibility,exclude-libs options to CMAKE_CXX_FLAGS
    
    * Add GCC visibility push(default) for unit test
    
    * Fix undefined reference to auth plugin methods
    
    * Build _pulsar.so without exclude-libs
---
 pulsar-client-cpp/CMakeLists.txt                   | 12 +++++++----
 pulsar-client-cpp/lib/BoostHash.h                  |  3 ++-
 pulsar-client-cpp/lib/CMakeLists.txt               |  8 +++-----
 pulsar-client-cpp/lib/JavaStringHash.h             |  3 ++-
 pulsar-client-cpp/lib/Murmur3_32Hash.h             |  2 ++
 pulsar-client-cpp/lib/RoundRobinMessageRouter.h    |  2 ++
 .../lib/SinglePartitionMessageRouter.h             |  2 ++
 pulsar-client-cpp/lib/TopicMetadataImpl.h          |  4 +++-
 pulsar-client-cpp/lib/auth/CMakeLists.txt          | 23 ----------------------
 pulsar-client-cpp/lib/auth/athenz/CMakeLists.txt   | 20 -------------------
 pulsar-client-cpp/python/CMakeLists.txt            |  4 +++-
 11 files changed, 27 insertions(+), 56 deletions(-)

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index eafc720..04a23d1 100644
--- a/pulsar-client-cpp/CMakeLists.txt
+++ b/pulsar-client-cpp/CMakeLists.txt
@@ -44,10 +44,6 @@ endif(NOT CXX_STANDARD)
 
 set(CMAKE_CXX_FLAGS " -msse4.2 -mpclmul -Wno-deprecated-declarations 
${CXX_STANDARD} ${CMAKE_CXX_FLAGS}")
 
-if (!APPLE)
-    # Hide all non-exported symbols to avoid conflicts
-    set(CMAKE_CXX_FLAGS " -fvisibility=hidden -Wl,--exclude-libs,ALL 
${CMAKE_CXX_FLAGS}")
-endif ()
 
 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
 
@@ -164,6 +160,14 @@ else (NOT JSON_INCLUDE_PATH)
     set(JSON_INCLUDE_PATH ${JSON_INCLUDE_PATH}/jsoncpp/)
 endif (NOT JSON_INCLUDE_PATH)
 
+if (NOT APPLE)
+    # we don't set options below to build _pulsar.so
+    set(CMAKE_CXX_FLAGS_PYTHON "${CMAKE_CXX_FLAGS}")
+    # Hide all non-exported symbols to avoid conflicts
+    set(CMAKE_CXX_FLAGS " -fvisibility=hidden -Wl,--exclude-libs,ALL 
${CMAKE_CXX_FLAGS}")
+endif ()
+
+
 set(ADDITIONAL_LIBRARIES $ENV{PULSAR_ADDITIONAL_LIBRARIES})
 link_directories( $ENV{PULSAR_ADDITIONAL_LIBRARY_PATH} )
 
diff --git a/pulsar-client-cpp/lib/BoostHash.h 
b/pulsar-client-cpp/lib/BoostHash.h
index e5911fe..dfe388b 100644
--- a/pulsar-client-cpp/lib/BoostHash.h
+++ b/pulsar-client-cpp/lib/BoostHash.h
@@ -25,6 +25,7 @@
 #include <string>
 #include <boost/functional/hash.hpp>
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 class BoostHash : public Hash {
    public:
@@ -35,5 +36,5 @@ class BoostHash : public Hash {
     boost::hash<std::string> hash;
 };
 }  // namespace pulsar
-
+#pragma GCC visibility pop
 #endif /* BOOST_HASH_HPP_ */
diff --git a/pulsar-client-cpp/lib/CMakeLists.txt 
b/pulsar-client-cpp/lib/CMakeLists.txt
index 1d3862b..5b2dbf9 100644
--- a/pulsar-client-cpp/lib/CMakeLists.txt
+++ b/pulsar-client-cpp/lib/CMakeLists.txt
@@ -17,7 +17,7 @@
 # under the License.
 #
 
-file(GLOB PULSAR_SOURCES *.cc lz4/*.c checksum/*.cc stats/*.cc c/*.cc)
+file(GLOB PULSAR_SOURCES *.cc lz4/*.c checksum/*.cc stats/*.cc c/*.cc 
auth/*.cc auth/athenz/*.cc)
 
 execute_process(COMMAND cat ../pom.xml COMMAND xmllint --format - COMMAND sed 
"s/xmlns=\".*\"//g" COMMAND xmllint --stream --pattern /project/version --debug 
- COMMAND grep -A 2 "matches pattern" COMMAND grep text COMMAND sed "s/.* [0-9] 
//g" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE PV)
 set (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -D_PULSAR_VERSION_=\\\"${PV}\\\"")
@@ -42,8 +42,6 @@ endif(NOT LIBRARY_VERSION)
 set_target_properties(pulsarStatic PROPERTIES OUTPUT_NAME ${LIB_NAME} VERSION 
${LIBRARY_VERSION})
 set_target_properties(pulsarShared PROPERTIES OUTPUT_NAME ${LIB_NAME} VERSION 
${LIBRARY_VERSION})
 
-add_subdirectory(auth)
-
-target_link_libraries(pulsarStatic ${COMMON_LIBS} authTls authAthenz 
ztsClientStatic)
-target_link_libraries(pulsarShared ${COMMON_LIBS} authTls authAthenz 
ztsClientStatic)
+target_link_libraries(pulsarStatic ${COMMON_LIBS})
+target_link_libraries(pulsarShared ${COMMON_LIBS})
 
diff --git a/pulsar-client-cpp/lib/JavaStringHash.h 
b/pulsar-client-cpp/lib/JavaStringHash.h
index 3b01aa8..72fe090 100644
--- a/pulsar-client-cpp/lib/JavaStringHash.h
+++ b/pulsar-client-cpp/lib/JavaStringHash.h
@@ -25,6 +25,7 @@
 #include <string>
 #include <boost/functional/hash.hpp>
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 class JavaStringHash : public Hash {
    public:
@@ -32,5 +33,5 @@ class JavaStringHash : public Hash {
     int32_t makeHash(const std::string &key);
 };
 }  // namespace pulsar
-
+#pragma GCC visibility pop
 #endif /* JAVA_DEFAULT_HASH_HPP_ */
diff --git a/pulsar-client-cpp/lib/Murmur3_32Hash.h 
b/pulsar-client-cpp/lib/Murmur3_32Hash.h
index 7d67e30..e781bca 100644
--- a/pulsar-client-cpp/lib/Murmur3_32Hash.h
+++ b/pulsar-client-cpp/lib/Murmur3_32Hash.h
@@ -29,6 +29,7 @@
 #include <cstdint>
 #include <string>
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 
 class Murmur3_32Hash : public Hash {
@@ -47,5 +48,6 @@ class Murmur3_32Hash : public Hash {
     uint32_t makeHash(const void* key, const int64_t len);
 };
 }  // namespace pulsar
+#pragma GCC visibility pop
 
 #endif /* MURMUR3_32_HASH_HPP_ */
diff --git a/pulsar-client-cpp/lib/RoundRobinMessageRouter.h 
b/pulsar-client-cpp/lib/RoundRobinMessageRouter.h
index 57c27b4..7c6f23c 100644
--- a/pulsar-client-cpp/lib/RoundRobinMessageRouter.h
+++ b/pulsar-client-cpp/lib/RoundRobinMessageRouter.h
@@ -26,6 +26,7 @@
 #include "Hash.h"
 #include "MessageRouterBase.h"
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 class RoundRobinMessageRouter : public MessageRouterBase {
    public:
@@ -39,4 +40,5 @@ class RoundRobinMessageRouter : public MessageRouterBase {
 };
 typedef boost::unique_lock<boost::mutex> Lock;
 }  // namespace pulsar
+#pragma GCC visibility pop
 #endif  // PULSAR_RR_MESSAGE_ROUTER_HEADER_
diff --git a/pulsar-client-cpp/lib/SinglePartitionMessageRouter.h 
b/pulsar-client-cpp/lib/SinglePartitionMessageRouter.h
index 409d31a..2025e73 100644
--- a/pulsar-client-cpp/lib/SinglePartitionMessageRouter.h
+++ b/pulsar-client-cpp/lib/SinglePartitionMessageRouter.h
@@ -25,6 +25,7 @@
 #include <pulsar/TopicMetadata.h>
 #include "MessageRouterBase.h"
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 
 class SinglePartitionMessageRouter : public MessageRouterBase {
@@ -39,4 +40,5 @@ class SinglePartitionMessageRouter : public MessageRouterBase 
{
 };
 
 }  // namespace pulsar
+#pragma GCC visibility pop
 #endif  // PULSAR_SINGLE_PARTITION_MESSAGE_ROUTER_HEADER_
diff --git a/pulsar-client-cpp/lib/TopicMetadataImpl.h 
b/pulsar-client-cpp/lib/TopicMetadataImpl.h
index af0988b..44c052e 100644
--- a/pulsar-client-cpp/lib/TopicMetadataImpl.h
+++ b/pulsar-client-cpp/lib/TopicMetadataImpl.h
@@ -21,6 +21,7 @@
 
 #include <pulsar/TopicMetadata.h>
 
+#pragma GCC visibility push(default)
 namespace pulsar {
 class TopicMetadataImpl : public TopicMetadata {
    public:
@@ -31,5 +32,6 @@ class TopicMetadataImpl : public TopicMetadata {
     int numPartitions_;
 };
 }  // namespace pulsar
+#pragma GCC visibility pop
 
-#endif /* TOPIC_METADATA_IMPL_HPP_ */
\ No newline at end of file
+#endif /* TOPIC_METADATA_IMPL_HPP_ */
diff --git a/pulsar-client-cpp/lib/auth/CMakeLists.txt 
b/pulsar-client-cpp/lib/auth/CMakeLists.txt
deleted file mode 100644
index 1fbf92f..0000000
--- a/pulsar-client-cpp/lib/auth/CMakeLists.txt
+++ /dev/null
@@ -1,23 +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.
-#
-
-add_library(authTls STATIC AuthTls.cc)
-add_library(authAthenz STATIC AuthAthenz.cc)
-
-add_subdirectory(athenz)
diff --git a/pulsar-client-cpp/lib/auth/athenz/CMakeLists.txt 
b/pulsar-client-cpp/lib/auth/athenz/CMakeLists.txt
deleted file mode 100644
index a2335cc..0000000
--- a/pulsar-client-cpp/lib/auth/athenz/CMakeLists.txt
+++ /dev/null
@@ -1,20 +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.
-#
-
-add_library(ztsClientStatic STATIC ZTSClient.cc)
diff --git a/pulsar-client-cpp/python/CMakeLists.txt 
b/pulsar-client-cpp/python/CMakeLists.txt
index 9a79ea3..c44d0bf 100644
--- a/pulsar-client-cpp/python/CMakeLists.txt
+++ b/pulsar-client-cpp/python/CMakeLists.txt
@@ -26,11 +26,13 @@ ADD_LIBRARY(_pulsar SHARED src/pulsar.cc src/producer.cc 
src/consumer.cc
 SET(CMAKE_SHARED_LIBRARY_PREFIX )
 SET(CMAKE_SHARED_LIBRARY_SUFFIX .so)
 
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_PYTHON}")
+
 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
   set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS 
"${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")
 endif()
 
-set(PYTHON_WRAPPER_LIBS ${Boost_PYTHON_LIBRARY} ${Boost_PYTHON3_LIBRARY} 
authTls authAthenz)
+set(PYTHON_WRAPPER_LIBS ${Boost_PYTHON_LIBRARY} ${Boost_PYTHON3_LIBRARY})
 
 if (APPLE)
     target_link_libraries(_pulsar -Wl,-all_load pulsarStatic 
${PYTHON_WRAPPER_LIBS})

Reply via email to