diff --git a/CMakeLists.txt b/CMakeLists.txt index 4bb693281..572e4e0ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,7 +172,6 @@ else() if(CSP_BUILD_NO_CXX_ABI) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0") endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") if (COVERAGE) # TODO windows add_compile_options(--coverage) diff --git a/cpp/csp/adapters/kafka/CMakeLists.txt b/cpp/csp/adapters/kafka/CMakeLists.txt index 1bf0ae402..7abf877bc 100644 --- a/cpp/csp/adapters/kafka/CMakeLists.txt +++ b/cpp/csp/adapters/kafka/CMakeLists.txt @@ -18,7 +18,7 @@ set(KAFKA_SOURCE_FILES ) add_library(csp_kafka_adapter STATIC ${KAFKA_SOURCE_FILES}) -set_target_properties(csp_kafka_adapter PROPERTIES PUBLIC_HEADER "${KAFKA_HEADER_FILES}") +set_target_properties(csp_kafka_adapter PROPERTIES PUBLIC_HEADER "${KAFKA_HEADER_FILES}" CXX_VISIBILITY_PRESET hidden) find_package(DepsKafkaAdapter REQUIRED) diff --git a/cpp/csp/adapters/parquet/CMakeLists.txt b/cpp/csp/adapters/parquet/CMakeLists.txt index 76b11d7db..15b3c6d00 100644 --- a/cpp/csp/adapters/parquet/CMakeLists.txt +++ b/cpp/csp/adapters/parquet/CMakeLists.txt @@ -40,7 +40,7 @@ set(PARQUET_SOURCE_FILES ) add_library(csp_parquet_adapter STATIC ${PARQUET_SOURCE_FILES}) -set_target_properties(csp_parquet_adapter PROPERTIES PUBLIC_HEADER "${PARQUET_HEADER_FILES}") +set_target_properties(csp_parquet_adapter PROPERTIES PUBLIC_HEADER "${PARQUET_HEADER_FILES}" CXX_VISIBILITY_PRESET hidden) target_include_directories(csp_parquet_adapter PRIVATE ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR}) find_package(Arrow REQUIRED) @@ -73,7 +73,6 @@ else() endif() endif() -target_compile_options(csp_parquet_adapter PRIVATE "-fvisibility=default") target_link_libraries(csp_parquet_adapter PRIVATE csp_adapter_utils thrift::thrift lz4::lz4 utf8proc::utf8proc ${BROTLI_STATIC_LIB} ${ARROW_PACKAGES_TO_LINK}) install(TARGETS csp_parquet_adapter diff --git a/cpp/csp/adapters/utils/CMakeLists.txt b/cpp/csp/adapters/utils/CMakeLists.txt index 217b011d4..555adc8e8 100644 --- a/cpp/csp/adapters/utils/CMakeLists.txt +++ b/cpp/csp/adapters/utils/CMakeLists.txt @@ -22,7 +22,7 @@ set(ADAPTER_UTILS_FILES ) add_library(csp_adapter_utils STATIC ${ADAPTER_UTILS_FILES}) -set_target_properties(csp_adapter_utils PROPERTIES PUBLIC_HEADER "${ADAPTER_UTILS_PUBLIC_HEADERS}") +set_target_properties(csp_adapter_utils PROPERTIES PUBLIC_HEADER "${ADAPTER_UTILS_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) find_package(Protobuf REQUIRED) target_link_libraries(csp_adapter_utils PRIVATE protobuf::libprotoc protobuf::libprotobuf protobuf::libprotobuf-lite) diff --git a/cpp/csp/adapters/websocket/CMakeLists.txt b/cpp/csp/adapters/websocket/CMakeLists.txt index 402d01b69..e4513d351 100644 --- a/cpp/csp/adapters/websocket/CMakeLists.txt +++ b/cpp/csp/adapters/websocket/CMakeLists.txt @@ -20,7 +20,7 @@ set(WS_CLIENT_SOURCE_FILES ) add_library(csp_websocket_client_adapter STATIC ${WS_CLIENT_SOURCE_FILES}) -set_target_properties(csp_websocket_client_adapter PROPERTIES PUBLIC_HEADER "${WS_CLIENT_SOURCE_FILES}") +set_target_properties(csp_websocket_client_adapter PROPERTIES PUBLIC_HEADER "${WS_CLIENT_SOURCE_FILES}" CXX_VISIBILITY_PRESET hidden) find_package(Boost REQUIRED) find_package(OpenSSL REQUIRED) diff --git a/cpp/csp/core/CMakeLists.txt b/cpp/csp/core/CMakeLists.txt index 592ca9b60..39389df92 100644 --- a/cpp/csp/core/CMakeLists.txt +++ b/cpp/csp/core/CMakeLists.txt @@ -26,7 +26,7 @@ set(CORE_SOURCE_FILES configure_file(Config.h.in ${CMAKE_CURRENT_BINARY_DIR}/cpp/csp/core/Config.h) add_library(csp_core STATIC ${CORE_SOURCE_FILES}) -set_target_properties(csp_core PROPERTIES PUBLIC_HEADER "${CORE_PUBLIC_HEADERS}") +set_target_properties(csp_core PROPERTIES PUBLIC_HEADER "${CORE_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) install(TARGETS csp_core PUBLIC_HEADER DESTINATION include/csp/core diff --git a/cpp/csp/cppnodes/CMakeLists.txt b/cpp/csp/cppnodes/CMakeLists.txt index 10af9fee6..05919b20a 100644 --- a/cpp/csp/cppnodes/CMakeLists.txt +++ b/cpp/csp/cppnodes/CMakeLists.txt @@ -1,14 +1,17 @@ add_library(baselibimpl STATIC baselibimpl.cpp) +set_target_properties(baselibimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(baselibimpl csp_core csp_engine) add_library(basketlibimpl STATIC basketlibimpl.cpp) +set_target_properties(basketlibimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(basketlibimpl baselibimpl csp_core csp_engine) add_library(mathimpl STATIC mathimpl.cpp) +set_target_properties(mathimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(mathimpl csp_core csp_engine) add_library(statsimpl STATIC statsimpl.cpp) -set_target_properties(statsimpl PROPERTIES PUBLIC_HEADER statsimpl.h) +set_target_properties(statsimpl PROPERTIES PUBLIC_HEADER statsimpl.h CXX_VISIBILITY_PRESET hidden) target_link_libraries(statsimpl baselibimpl csp_core csp_engine) install(TARGETS baselibimpl basketlibimpl mathimpl statsimpl diff --git a/cpp/csp/engine/CMakeLists.txt b/cpp/csp/engine/CMakeLists.txt index ce035b691..870190901 100644 --- a/cpp/csp/engine/CMakeLists.txt +++ b/cpp/csp/engine/CMakeLists.txt @@ -84,10 +84,10 @@ set(ENGINE_SOURCE_FILES ) add_library(csp_types STATIC ${CSP_TYPES_SOURCE_FILES}) -set_target_properties(csp_types PROPERTIES PUBLIC_HEADER "${CSP_TYPES_PUBLIC_HEADERS}") +set_target_properties(csp_types PROPERTIES PUBLIC_HEADER "${CSP_TYPES_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) add_library(csp_engine STATIC ${ENGINE_SOURCE_FILES}) -set_target_properties(csp_engine PROPERTIES PUBLIC_HEADER "${ENGINE_PUBLIC_HEADERS}") +set_target_properties(csp_engine PROPERTIES PUBLIC_HEADER "${ENGINE_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) target_link_libraries(csp_engine csp_core csp_types) install(FILES ${CSP_TYPES_PUBLIC_HEADERS} ${ENGINE_PUBLIC_HEADERS} DESTINATION include/csp/engine) diff --git a/cpp/csp/python/CMakeLists.txt b/cpp/csp/python/CMakeLists.txt index d5f863e1a..de927a227 100644 --- a/cpp/csp/python/CMakeLists.txt +++ b/cpp/csp/python/CMakeLists.txt @@ -10,7 +10,7 @@ set(CSPTYPESIMPL_PUBLIC_HEADERS PyStructFastList_impl.h VectorWrapper.h ) -add_library(csptypesimpl +add_library(csptypesimpl SHARED csptypesimpl.cpp CspTypeFactory.cpp PyCspEnum.cpp @@ -19,7 +19,7 @@ add_library(csptypesimpl PyStructToJson.cpp PyStructToDict.cpp) -set_target_properties(csptypesimpl PROPERTIES PUBLIC_HEADER "${CSPTYPESIMPL_PUBLIC_HEADERS}") +set_target_properties(csptypesimpl PROPERTIES PUBLIC_HEADER "${CSPTYPESIMPL_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) target_compile_definitions(csptypesimpl PUBLIC RAPIDJSON_HAS_STDSTRING=1) target_link_libraries(csptypesimpl csp_core csp_types) target_compile_definitions(csptypesimpl PRIVATE CSPTYPESIMPL_EXPORTS=1) @@ -82,7 +82,7 @@ add_library(cspimpl SHARED PyConstants.cpp ${CSPIMPL_PUBLIC_HEADERS}) -set_target_properties(cspimpl PROPERTIES PUBLIC_HEADER "${CSPIMPL_PUBLIC_HEADERS}") +set_target_properties(cspimpl PROPERTIES PUBLIC_HEADER "${CSPIMPL_PUBLIC_HEADERS}" CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspimpl csptypesimpl csp_core csp_engine ) @@ -92,6 +92,7 @@ target_compile_definitions(cspimpl PRIVATE CSPIMPL_EXPORTS=1) ## Baselib c++ module add_library(cspbaselibimpl SHARED cspbaselibimpl.cpp) +set_target_properties(cspbaselibimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspbaselibimpl cspimpl baselibimpl) # Include exprtk include directory for exprtk node @@ -99,23 +100,29 @@ target_include_directories(cspbaselibimpl PRIVATE ${EXPRTK_INCLUDE_DIRS}) ## Basketlib c++ module add_library(cspbasketlibimpl SHARED cspbasketlibimpl.cpp) +set_target_properties(cspbasketlibimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspbasketlibimpl cspimpl basketlibimpl) ## Math c++ module add_library(cspmathimpl SHARED cspmathimpl.cpp) +set_target_properties(cspmathimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspmathimpl cspimpl mathimpl) ## Stats c++ module add_library(cspstatsimpl SHARED cspstatsimpl.cpp) +set_target_properties(cspstatsimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspstatsimpl cspimpl statsimpl) ## Testlib c++ module add_library(csptestlibimpl SHARED csptestlibimpl.cpp) +set_target_properties(csptestlibimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(csptestlibimpl cspimpl) ## NumPy stats c++ module add_library(npstatsimpl STATIC npstatsimpl.cpp) add_library(cspnpstatsimpl SHARED cspnpstatsimpl.cpp) +set_target_properties(npstatsimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) +set_target_properties(cspnpstatsimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(cspnpstatsimpl cspimpl npstatsimpl) target_include_directories(npstatsimpl PRIVATE ${NUMPY_INCLUDE_DIRS}) target_include_directories(cspnpstatsimpl PRIVATE ${NUMPY_INCLUDE_DIRS}) diff --git a/cpp/csp/python/adapters/CMakeLists.txt b/cpp/csp/python/adapters/CMakeLists.txt index 9f7f7c976..ecf3cce0c 100644 --- a/cpp/csp/python/adapters/CMakeLists.txt +++ b/cpp/csp/python/adapters/CMakeLists.txt @@ -1,7 +1,7 @@ - if(CSP_BUILD_KAFKA_ADAPTER) add_library(kafkaadapterimpl SHARED kafkaadapterimpl.cpp) target_link_libraries(kafkaadapterimpl csp_core csp_engine cspimpl csp_kafka_adapter) + set_target_properties(kafkaadapterimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) install(TARGETS kafkaadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR}) endif() @@ -28,15 +28,20 @@ if(CSP_BUILD_PARQUET_ADAPTER) ${VENDORED_PYARROW_ROOT}/arrow/python/serialize.cc ${VENDORED_PYARROW_ROOT}/arrow/python/csv.cc ${VENDORED_PYARROW_ROOT}/arrow/python/filesystem.cc) - add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp ${ARROW_PYTHON_SRCS}) + + add_library(vendored_arrow STATIC ${ARROW_PYTHON_SRCS}) + set_target_properties(vendored_arrow PROPERTIES CXX_VISIBILITY_PRESET hidden ) + target_include_directories(vendored_arrow PUBLIC "${VENDORED_PYARROW_ROOT}") + target_compile_definitions(vendored_arrow PUBLIC ARROW_PYTHON_STATIC) # Ignore warning regarding static datetime API initialization coming from vendored Arrow code if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set_target_properties(parquetadapterimpl PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable") - target_compile_options(parquetadapterimpl PRIVATE "-fvisibility=default") + set_target_properties(vendored_arrow PROPERTIES COMPILE_OPTIONS "-Wno-unused-variable") endif() - target_link_libraries(parquetadapterimpl csp_core csp_engine cspimpl csp_parquet_adapter) - target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR} "${VENDORED_PYARROW_ROOT}") - target_compile_definitions(parquetadapterimpl PUBLIC ARROW_PYTHON_STATIC) + + add_library(parquetadapterimpl SHARED parquetadapterimpl.cpp) + set_target_properties(parquetadapterimpl PROPERTIES CXX_VISIBILITY_PRESET hidden ) + target_link_libraries(parquetadapterimpl PRIVATE csp_core csp_engine cspimpl csp_parquet_adapter vendored_arrow) + target_include_directories(parquetadapterimpl PUBLIC ${ARROW_INCLUDE_DIR} ${PARQUET_INCLUDE_DIR}) install(TARGETS parquetadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR} ) endif() @@ -44,6 +49,7 @@ if(CSP_BUILD_WS_CLIENT_ADAPTER) set(CMAKE_CXX_STANDARD 17) add_library(websocketadapterimpl SHARED websocketadapterimpl.cpp) target_link_libraries(websocketadapterimpl csp_core csp_engine cspimpl csp_websocket_client_adapter) + set_target_properties(websocketadapterimpl PROPERTIES CXX_VISIBILITY_PRESET hidden) install(TARGETS websocketadapterimpl RUNTIME DESTINATION ${CSP_RUNTIME_INSTALL_SUBDIR}) set(CMAKE_CXX_STANDARD 20) endif()