Skip to content

Commit

Permalink
more fine-grained visibility control
Browse files Browse the repository at this point in the history
  • Loading branch information
svatasoiu committed Jul 25, 2024
1 parent 75352e8 commit 71db938
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 20 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/kafka/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions cpp/csp/adapters/parquet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/adapters/websocket/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cpp/csp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion cpp/csp/cppnodes/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions cpp/csp/engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 10 additions & 3 deletions cpp/csp/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 )

Expand All @@ -92,30 +92,37 @@ 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
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})
Expand Down
20 changes: 13 additions & 7 deletions cpp/csp/python/adapters/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()

Expand All @@ -28,22 +28,28 @@ 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()

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()

0 comments on commit 71db938

Please sign in to comment.