From 639c922ac798b4f1aff7d49c4a438ef017bc5b19 Mon Sep 17 00:00:00 2001 From: handsome_feng Date: Sat, 17 Feb 2024 15:19:23 +0800 Subject: [PATCH] Set cxx visibility hidden and update symbols --- debian/libkysdk-base.symbols | 8 ++++++++ src/diagnostics/CMakeLists.txt | 9 ++++++++- src/diagnostics/buriedpoint.h | 4 +++- src/diagnostics/libkydiagnostics.cpp | 2 +- src/diagnostics/nlohmann/adl_serializer.hpp | 4 +++- .../nlohmann/byte_container_with_subtype.hpp | 4 +++- src/diagnostics/nlohmann/detail/exceptions.hpp | 14 ++++++++------ src/diagnostics/nlohmann/detail/json_pointer.hpp | 4 +++- src/diagnostics/nlohmann/detail/json_ref.hpp | 4 +++- src/diagnostics/nlohmann/json.hpp | 4 +++- 10 files changed, 43 insertions(+), 14 deletions(-) diff --git a/debian/libkysdk-base.symbols b/debian/libkysdk-base.symbols index 242540d..b3a6230 100644 --- a/debian/libkysdk-base.symbols +++ b/debian/libkysdk-base.symbols @@ -20,6 +20,14 @@ libkydiagnostics.so.1 libkysdk-base #MINVER# _ZN3kdk11BuriedPointD1Ev@Base 2.2.0.1 _ZN3kdk11BuriedPointD2Ev@Base 2.2.0.1 kdk_buried_point@Base 2.2.0.1 + (optional)_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE24_M_get_insert_unique_posERS7_@Base 2.2.0.1 + (optional)_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_S5_ESt10_Select1stIS8_ESt4lessIS5_ESaIS8_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS8_ERS7_@Base 2.2.0.1 + (optional)_ZTISt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.2.0.1 + (optional)_ZTISt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.2.0.1 + (optional)_ZTSSt11_Mutex_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.2.0.1 + (optional)_ZTSSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE@Base 2.2.0.1 + (optional)_ZTSSt19_Sp_make_shared_tag@Base 2.2.0.1 + (optional)_ZZNSt19_Sp_make_shared_tag5_S_tiEvE5__tag@Base 2.2.0.1 libkysdk-config.so.1 libkysdk-base #MINVER# * Build-Depends-Package: libkysdk-base-dev S_destroyParse@Base 2.2.0.0 diff --git a/src/diagnostics/CMakeLists.txt b/src/diagnostics/CMakeLists.txt index 37019ba..05c22b6 100644 --- a/src/diagnostics/CMakeLists.txt +++ b/src/diagnostics/CMakeLists.txt @@ -3,8 +3,12 @@ cmake_minimum_required(VERSION 3.5) project(kydiagnostics LANGUAGES CXX) set(DIAGNOSTICS_TOP_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) add_library(${PROJECT_NAME} SHARED) +include(GenerateExportHeader) +generate_export_header(kydiagnostics) set_target_properties(kydiagnostics PROPERTIES VERSION 2.0.0 SOVERSION 1) target_compile_options(${PROJECT_NAME} PRIVATE -Wall -g) @@ -32,5 +36,8 @@ target_sources(${PROJECT_NAME} PRIVATE ${SRCS}) install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(FILES libkydiagnostics.h +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +install(FILES + libkydiagnostics.h + ${CMAKE_CURRENT_BINARY_DIR}/kydiagnostics_export.h DESTINATION include/kysdk/kysdk-base) diff --git a/src/diagnostics/buriedpoint.h b/src/diagnostics/buriedpoint.h index 21d199e..693a7e8 100644 --- a/src/diagnostics/buriedpoint.h +++ b/src/diagnostics/buriedpoint.h @@ -21,13 +21,15 @@ #ifndef BURIEDPOINT_H_ #define BURIEDPOINT_H_ +#include "kydiagnostics_export.h" + #include #include namespace kdk { -class BuriedPoint +class KYDIAGNOSTICS_EXPORT BuriedPoint { public: BuriedPoint(); diff --git a/src/diagnostics/libkydiagnostics.cpp b/src/diagnostics/libkydiagnostics.cpp index baeabd9..bee94d0 100644 --- a/src/diagnostics/libkydiagnostics.cpp +++ b/src/diagnostics/libkydiagnostics.cpp @@ -21,7 +21,7 @@ #include "buriedpoint.h" #include "libkydiagnostics.h" -int kdk_buried_point(char *appName , char *messageType , KBuriedPoint *data , int length) +KYDIAGNOSTICS_EXPORT int kdk_buried_point(char *appName , char *messageType , KBuriedPoint *data , int length) { std::map uploadData; for (int i = 0 ; i < length ; i++) { diff --git a/src/diagnostics/nlohmann/adl_serializer.hpp b/src/diagnostics/nlohmann/adl_serializer.hpp index 51f2206..039f09b 100644 --- a/src/diagnostics/nlohmann/adl_serializer.hpp +++ b/src/diagnostics/nlohmann/adl_serializer.hpp @@ -16,12 +16,14 @@ #include #include +#include "kydiagnostics_export.h" + namespace nlohmann { /// @sa https://json.nlohmann.me/api/adl_serializer/ template -struct adl_serializer +struct KYDIAGNOSTICS_NO_EXPORT adl_serializer { /// @brief convert a JSON value to any value type /// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ diff --git a/src/diagnostics/nlohmann/byte_container_with_subtype.hpp b/src/diagnostics/nlohmann/byte_container_with_subtype.hpp index 83e88a5..70af51f 100644 --- a/src/diagnostics/nlohmann/byte_container_with_subtype.hpp +++ b/src/diagnostics/nlohmann/byte_container_with_subtype.hpp @@ -12,13 +12,15 @@ #include // tie #include // move +#include "kydiagnostics_export.h" + namespace nlohmann { /// @brief an internal type for a backed binary type /// @sa https://json.nlohmann.me/api/byte_container_with_subtype/ template -class byte_container_with_subtype : public BinaryType +class KYDIAGNOSTICS_NO_EXPORT byte_container_with_subtype : public BinaryType { public: using container_type = BinaryType; diff --git a/src/diagnostics/nlohmann/detail/exceptions.hpp b/src/diagnostics/nlohmann/detail/exceptions.hpp index 5c79147..b18549c 100644 --- a/src/diagnostics/nlohmann/detail/exceptions.hpp +++ b/src/diagnostics/nlohmann/detail/exceptions.hpp @@ -18,6 +18,8 @@ #include #include +#include "kydiagnostics_export.h" + namespace nlohmann { namespace detail @@ -28,7 +30,7 @@ namespace detail /// @brief general exception of the @ref basic_json class /// @sa https://json.nlohmann.me/api/basic_json/exception/ -class exception : public std::exception +class KYDIAGNOSTICS_NO_EXPORT exception : public std::exception { public: /// returns the explanatory string @@ -120,7 +122,7 @@ class exception : public std::exception /// @brief exception indicating a parse error /// @sa https://json.nlohmann.me/api/basic_json/parse_error/ -class parse_error : public exception +class KYDIAGNOSTICS_NO_EXPORT parse_error : public exception { public: /*! @@ -173,7 +175,7 @@ class parse_error : public exception /// @brief exception indicating errors with iterators /// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/ -class invalid_iterator : public exception +class KYDIAGNOSTICS_NO_EXPORT invalid_iterator : public exception { public: template @@ -191,7 +193,7 @@ class invalid_iterator : public exception /// @brief exception indicating executing a member function with a wrong type /// @sa https://json.nlohmann.me/api/basic_json/type_error/ -class type_error : public exception +class KYDIAGNOSTICS_NO_EXPORT type_error : public exception { public: template @@ -208,7 +210,7 @@ class type_error : public exception /// @brief exception indicating access out of the defined range /// @sa https://json.nlohmann.me/api/basic_json/out_of_range/ -class out_of_range : public exception +class KYDIAGNOSTICS_NO_EXPORT out_of_range : public exception { public: template @@ -225,7 +227,7 @@ class out_of_range : public exception /// @brief exception indicating other library errors /// @sa https://json.nlohmann.me/api/basic_json/other_error/ -class other_error : public exception +class KYDIAGNOSTICS_NO_EXPORT other_error : public exception { public: template diff --git a/src/diagnostics/nlohmann/detail/json_pointer.hpp b/src/diagnostics/nlohmann/detail/json_pointer.hpp index b433a69..5956956 100644 --- a/src/diagnostics/nlohmann/detail/json_pointer.hpp +++ b/src/diagnostics/nlohmann/detail/json_pointer.hpp @@ -21,13 +21,15 @@ #include #include +#include "kydiagnostics_export.h" + namespace nlohmann { /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document /// @sa https://json.nlohmann.me/api/json_pointer/ template -class json_pointer +class KYDIAGNOSTICS_NO_EXPORT json_pointer { // allow basic_json to access private members NLOHMANN_BASIC_JSON_TPL_DECLARATION diff --git a/src/diagnostics/nlohmann/detail/json_ref.hpp b/src/diagnostics/nlohmann/detail/json_ref.hpp index 9154787..c70f7b9 100644 --- a/src/diagnostics/nlohmann/detail/json_ref.hpp +++ b/src/diagnostics/nlohmann/detail/json_ref.hpp @@ -13,12 +13,14 @@ #include +#include "kydiagnostics_export.h" + namespace nlohmann { namespace detail { template -class json_ref +class KYDIAGNOSTICS_NO_EXPORT json_ref { public: using value_type = BasicJsonType; diff --git a/src/diagnostics/nlohmann/json.hpp b/src/diagnostics/nlohmann/json.hpp index cac898b..43e66e4 100644 --- a/src/diagnostics/nlohmann/json.hpp +++ b/src/diagnostics/nlohmann/json.hpp @@ -68,6 +68,8 @@ #include #endif +#include "kydiagnostics_export.h" + /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @@ -95,7 +97,7 @@ The invariants are checked by member function assert_invariant(). @nosubgrouping */ NLOHMANN_BASIC_JSON_TPL_DECLARATION -class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) +class KYDIAGNOSTICS_NO_EXPORT basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-special-member-functions) { private: template friend struct detail::external_constructor;