merlimat closed pull request #1997:  Fix: set visibility,exclude-libs options 
to CMAKE_CXX_FLAGS
URL: https://github.com/apache/incubator-pulsar/pull/1997
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-client-cpp/CMakeLists.txt b/pulsar-client-cpp/CMakeLists.txt
index eafc7207f1..04a23d1abb 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 e5911fef64..dfe388b56b 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 1d3862b21f..5b2dbf9139 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 3b01aa8055..72fe090419 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 7d67e301cd..e781bca358 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 57c27b4db6..7c6f23c14b 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 409d31a8ad..2025e734f5 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 af0988bcbe..44c052ea8b 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 1fbf92f00b..0000000000
--- 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 a2335cc057..0000000000
--- 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 9a79ea3060..c44d0bf851 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})


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to