From be34f24c00789ff172a911f1ce8b7e6e9426eb83 Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Sat, 24 Jun 2023 07:33:03 +0200 Subject: [PATCH 01/10] Add hide symbols config for static bundles libs --- bundles/pubsub/pubsub_spi/CMakeLists.txt | 2 ++ bundles/pubsub/pubsub_utils/CMakeLists.txt | 1 + bundles/remote_services/rsa_common/CMakeLists.txt | 1 + bundles/remote_services/rsa_dfi_utils/CMakeLists.txt | 1 + bundles/remote_services/thpool/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bundles/pubsub/pubsub_spi/CMakeLists.txt b/bundles/pubsub/pubsub_spi/CMakeLists.txt index e3934409d..b88c8f1b1 100644 --- a/bundles/pubsub/pubsub_spi/CMakeLists.txt +++ b/bundles/pubsub/pubsub_spi/CMakeLists.txt @@ -31,6 +31,8 @@ target_link_libraries(pubsub_spi PUBLIC Celix::framework Celix::pubsub_api) target_link_libraries(pubsub_spi PUBLIC Celix::pubsub_utils libuuid::libuuid) celix_deprecated_utils_headers(pubsub_spi) celix_deprecated_framework_headers(pubsub_spi) +celix_target_hide_symbols(pubsub_spi) + add_library(Celix::pubsub_spi ALIAS pubsub_spi) install(TARGETS pubsub_spi EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT pubsub diff --git a/bundles/pubsub/pubsub_utils/CMakeLists.txt b/bundles/pubsub/pubsub_utils/CMakeLists.txt index 91fe25234..5cf9c90f2 100644 --- a/bundles/pubsub/pubsub_utils/CMakeLists.txt +++ b/bundles/pubsub/pubsub_utils/CMakeLists.txt @@ -31,6 +31,7 @@ target_link_libraries(pubsub_utils PUBLIC Celix::framework Celix::dfi Celix::pub target_link_libraries(pubsub_utils PRIVATE Celix::pubsub_spi) celix_deprecated_utils_headers(pubsub_utils) celix_deprecated_framework_headers(pubsub_utils) +celix_target_hide_symbols(pubsub_utils) add_library(Celix::pubsub_utils ALIAS pubsub_utils) diff --git a/bundles/remote_services/rsa_common/CMakeLists.txt b/bundles/remote_services/rsa_common/CMakeLists.txt index c06a02e75..2dcb5d8ca 100644 --- a/bundles/remote_services/rsa_common/CMakeLists.txt +++ b/bundles/remote_services/rsa_common/CMakeLists.txt @@ -25,6 +25,7 @@ target_include_directories(rsa_common PRIVATE src) target_link_libraries(rsa_common PUBLIC Celix::framework Celix::c_rsa_spi Celix::log_helper) celix_deprecated_utils_headers(rsa_common) celix_deprecated_framework_headers(rsa_common) +celix_target_hide_symbols(rsa_common) install(TARGETS rsa_common EXPORT celix COMPONENT rsa DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/bundles/remote_services/rsa_dfi_utils/CMakeLists.txt b/bundles/remote_services/rsa_dfi_utils/CMakeLists.txt index 2526c4446..b45c536d2 100644 --- a/bundles/remote_services/rsa_dfi_utils/CMakeLists.txt +++ b/bundles/remote_services/rsa_dfi_utils/CMakeLists.txt @@ -25,6 +25,7 @@ target_include_directories(rsa_dfi_utils PUBLIC target_include_directories(rsa_dfi_utils PRIVATE src) target_link_libraries(rsa_dfi_utils PUBLIC Celix::framework Celix::log_helper Celix::dfi) celix_deprecated_utils_headers(rsa_dfi_utils) +celix_target_hide_symbols(rsa_dfi_utils) #Setup target aliases to match external usage add_library(Celix::rsa_dfi_utils ALIAS rsa_dfi_utils) diff --git a/bundles/remote_services/thpool/CMakeLists.txt b/bundles/remote_services/thpool/CMakeLists.txt index 1465c0ff5..7545fb298 100644 --- a/bundles/remote_services/thpool/CMakeLists.txt +++ b/bundles/remote_services/thpool/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(thpool STATIC src/thpool.c ) - +celix_target_hide_symbols(thpool) target_include_directories(thpool PUBLIC include) add_library(Celix::thpool ALIAS thpool) From fac303ec2fff8631d818ccb247f94947c4929cc9 Mon Sep 17 00:00:00 2001 From: Pepijn Noltes Date: Wed, 28 Jun 2023 18:46:41 +0200 Subject: [PATCH 02/10] Remove hide symbols from rsa_common --- bundles/remote_services/rsa_common/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/remote_services/rsa_common/CMakeLists.txt b/bundles/remote_services/rsa_common/CMakeLists.txt index 2dcb5d8ca..c06a02e75 100644 --- a/bundles/remote_services/rsa_common/CMakeLists.txt +++ b/bundles/remote_services/rsa_common/CMakeLists.txt @@ -25,7 +25,6 @@ target_include_directories(rsa_common PRIVATE src) target_link_libraries(rsa_common PUBLIC Celix::framework Celix::c_rsa_spi Celix::log_helper) celix_deprecated_utils_headers(rsa_common) celix_deprecated_framework_headers(rsa_common) -celix_target_hide_symbols(rsa_common) install(TARGETS rsa_common EXPORT celix COMPONENT rsa DESTINATION ${CMAKE_INSTALL_LIBDIR}) From b0339baa7c7e6623aaa237ae0a095e9840adb9b5 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 09:29:08 +0800 Subject: [PATCH 03/10] Revert "Remove hide symbols from rsa_common" This reverts commit fac303ec2fff8631d818ccb247f94947c4929cc9. --- bundles/remote_services/rsa_common/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/bundles/remote_services/rsa_common/CMakeLists.txt b/bundles/remote_services/rsa_common/CMakeLists.txt index c06a02e75..2dcb5d8ca 100644 --- a/bundles/remote_services/rsa_common/CMakeLists.txt +++ b/bundles/remote_services/rsa_common/CMakeLists.txt @@ -25,6 +25,7 @@ target_include_directories(rsa_common PRIVATE src) target_link_libraries(rsa_common PUBLIC Celix::framework Celix::c_rsa_spi Celix::log_helper) celix_deprecated_utils_headers(rsa_common) celix_deprecated_framework_headers(rsa_common) +celix_target_hide_symbols(rsa_common) install(TARGETS rsa_common EXPORT celix COMPONENT rsa DESTINATION ${CMAKE_INSTALL_LIBDIR}) From 55b76b65d421e36bda0d484b4c024973e58845e8 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 10:03:22 +0800 Subject: [PATCH 04/10] Fix testing issue caused by `celix_target_hide_symbols(rsa_common)`. --- .../discovery_zeroconf/gtest/CMakeLists.txt | 2 +- .../rsa_shm/gtest/CMakeLists.txt | 2 +- .../remote_services/rsa_common/CMakeLists.txt | 18 +++++++++++++----- .../rsa_common/gtest/CMakeLists.txt | 2 +- .../rsa_rpc_json/gtest/CMakeLists.txt | 2 +- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt b/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt index 789c16760..9a7ba819b 100644 --- a/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt +++ b/bundles/remote_services/discovery_zeroconf/gtest/CMakeLists.txt @@ -52,7 +52,7 @@ if (LINKER_WRAP_SUPPORTED) target_link_libraries(unit_test_discovery_zeroconf PRIVATE rsa_discovery_zeroconf_cut - Celix::rsa_common + rsa_common_cut Celix::c_rsa_spi Celix::framework Celix::threads_ei diff --git a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt index dda5874e5..dddf7d17b 100644 --- a/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt +++ b/bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/gtest/CMakeLists.txt @@ -53,7 +53,7 @@ if (LINKER_WRAP_SUPPORTED) target_link_libraries(unit_test_rsa_shm PRIVATE rsa_shm_cut Celix::c_rsa_spi - Celix::rsa_common + rsa_common_cut Celix::log_helper Celix::framework Celix::threads_ei diff --git a/bundles/remote_services/rsa_common/CMakeLists.txt b/bundles/remote_services/rsa_common/CMakeLists.txt index 2dcb5d8ca..d4390bf66 100644 --- a/bundles/remote_services/rsa_common/CMakeLists.txt +++ b/bundles/remote_services/rsa_common/CMakeLists.txt @@ -15,11 +15,14 @@ # specific language governing permissions and limitations # under the License. -add_library(rsa_common STATIC - src/endpoint_description.c - src/export_registration_impl.c - src/import_registration_impl.c - src/remote_interceptors_handler.c) +set(RSA_COMMON_SRC + src/endpoint_description.c + src/export_registration_impl.c + src/import_registration_impl.c + src/remote_interceptors_handler.c + ) + +add_library(rsa_common STATIC ${RSA_COMMON_SRC}) set_target_properties(rsa_common PROPERTIES OUTPUT_NAME "celix_rsa_common") target_include_directories(rsa_common PRIVATE src) target_link_libraries(rsa_common PUBLIC Celix::framework Celix::c_rsa_spi Celix::log_helper) @@ -33,5 +36,10 @@ install(TARGETS rsa_common EXPORT celix COMPONENT rsa DESTINATION ${CMAKE_INSTAL add_library(Celix::rsa_common ALIAS rsa_common) if (ENABLE_TESTING) + add_library(rsa_common_cut STATIC ${RSA_COMMON_SRC}) + target_include_directories(rsa_common_cut PUBLIC src) + target_link_libraries(rsa_common_cut PUBLIC Celix::framework Celix::c_rsa_spi Celix::log_helper) + celix_deprecated_utils_headers(rsa_common_cut) + celix_deprecated_framework_headers(rsa_common_cut) add_subdirectory(gtest) endif() \ No newline at end of file diff --git a/bundles/remote_services/rsa_common/gtest/CMakeLists.txt b/bundles/remote_services/rsa_common/gtest/CMakeLists.txt index c6dfb2f97..4c6c2410f 100644 --- a/bundles/remote_services/rsa_common/gtest/CMakeLists.txt +++ b/bundles/remote_services/rsa_common/gtest/CMakeLists.txt @@ -21,7 +21,7 @@ if (LINKER_WRAP_SUPPORTED) ) target_link_libraries(unit_test_rsa_common PRIVATE - Celix::rsa_common + rsa_common_cut Celix::rsa_spi Celix::framework Celix::utils diff --git a/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt b/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt index b3d7db693..c94990556 100644 --- a/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt +++ b/bundles/remote_services/rsa_rpc_json/gtest/CMakeLists.txt @@ -49,7 +49,7 @@ if (LINKER_WRAP_SUPPORTED) target_link_libraries(unit_test_rsa_json_rpc PRIVATE rsa_json_rpc_cut Celix::c_rsa_spi - Celix::rsa_common + rsa_common_cut Celix::framework Celix::bundle_ei Celix::malloc_ei From 740fe550eb7ed6c0a46b09c68114991be75015c2 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 10:32:17 +0800 Subject: [PATCH 05/10] Add the "hide symbols" configuration to remaining shared library under libs dir. --- libs/dfi/CMakeLists.txt | 1 + libs/etcdlib/CMakeLists.txt | 1 + libs/framework/CMakeLists.txt | 1 + libs/utils/CMakeLists.txt | 1 + 4 files changed, 4 insertions(+) diff --git a/libs/dfi/CMakeLists.txt b/libs/dfi/CMakeLists.txt index da160e818..d27a7a74e 100644 --- a/libs/dfi/CMakeLists.txt +++ b/libs/dfi/CMakeLists.txt @@ -57,6 +57,7 @@ if (CELIX_DFI) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/dfi COMPONENT dfi) install(DIRECTORY ${CMAKE_BINARY_DIR}/celix/gen/includes/dfi/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/dfi COMPONENT dfi) + celix_target_hide_symbols(dfi) #Alias setup to match external usage add_library(Celix::dfi ALIAS dfi) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index c640450ff..310abdb89 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,6 +71,7 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) + celix_target_hide_symbols(etcdlib) add_library(etcdlib_static STATIC src/etcd.c) diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt index 82968846b..fd528bc09 100644 --- a/libs/framework/CMakeLists.txt +++ b/libs/framework/CMakeLists.txt @@ -66,6 +66,7 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framewo install(DIRECTORY include_deprecated/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framework COMPONENT framework) install(DIRECTORY ${CMAKE_BINARY_DIR}/celix/gen/includes/framework/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framework COMPONENT framework) +celix_target_hide_symbols(framework) #Alias setup to match external usage add_library(Celix::framework ALIAS framework) diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt index eca648115..4161c0784 100644 --- a/libs/utils/CMakeLists.txt +++ b/libs/utils/CMakeLists.txt @@ -106,6 +106,7 @@ if (CELIX_INSTALL_DEPRECATED_API) install(DIRECTORY include_deprecated/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/utils COMPONENT framework) endif () +celix_target_hide_symbols(utils) #Alias setup to match external usage add_library(Celix::utils ALIAS utils) From 5d0e47d6f9c4966ad18066d5267f660964731362 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 10:45:35 +0800 Subject: [PATCH 06/10] Fix standalone etcdlib build error. --- libs/etcdlib/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index 310abdb89..404d32eff 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,7 +71,9 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) - celix_target_hide_symbols(etcdlib) + if (NOT ETCDLIB_STANDALONE) + celix_target_hide_symbols(etcdlib) + endif () add_library(etcdlib_static STATIC src/etcd.c) From b6a4713f48b5aa38a78aa00e645283aed1308afe Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 10:51:50 +0800 Subject: [PATCH 07/10] Apply symbol visibility control for standalone etcdlib. --- libs/etcdlib/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index 404d32eff..209244b4a 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,10 +71,11 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) - if (NOT ETCDLIB_STANDALONE) - celix_target_hide_symbols(etcdlib) - endif () - + set_target_properties(etcdlib + PROPERTIES + C_VISIBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VISIBILITY_INLINES_HIDDEN ON) add_library(etcdlib_static STATIC src/etcd.c) target_include_directories(etcdlib_static PUBLIC $) From 17035e0fbfd6a30b9131ecb9ca0d214ff226340d Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 17:06:46 +0800 Subject: [PATCH 08/10] Revert "Apply symbol visibility control for standalone etcdlib." This reverts commit b6a4713f48b5aa38a78aa00e645283aed1308afe. --- libs/etcdlib/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index 209244b4a..404d32eff 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,11 +71,10 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) - set_target_properties(etcdlib - PROPERTIES - C_VISIBILITY_PRESET hidden - CXX_VISIBILITY_PRESET hidden - VISIBILITY_INLINES_HIDDEN ON) + if (NOT ETCDLIB_STANDALONE) + celix_target_hide_symbols(etcdlib) + endif () + add_library(etcdlib_static STATIC src/etcd.c) target_include_directories(etcdlib_static PUBLIC $) From 7e9911bbe85ddc430f1ff922936721927239a170 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 17:06:47 +0800 Subject: [PATCH 09/10] Revert "Fix standalone etcdlib build error." This reverts commit 5d0e47d6f9c4966ad18066d5267f660964731362. --- libs/etcdlib/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index 404d32eff..310abdb89 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,9 +71,7 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) - if (NOT ETCDLIB_STANDALONE) - celix_target_hide_symbols(etcdlib) - endif () + celix_target_hide_symbols(etcdlib) add_library(etcdlib_static STATIC src/etcd.c) From 84934abb478b56fca1b0c86110d1f4f1d50bd882 Mon Sep 17 00:00:00 2001 From: PengZheng Date: Thu, 29 Jun 2023 17:06:47 +0800 Subject: [PATCH 10/10] Revert "Add the "hide symbols" configuration to remaining shared library under libs dir." This reverts commit 740fe550eb7ed6c0a46b09c68114991be75015c2. --- libs/dfi/CMakeLists.txt | 1 - libs/etcdlib/CMakeLists.txt | 1 - libs/framework/CMakeLists.txt | 1 - libs/utils/CMakeLists.txt | 1 - 4 files changed, 4 deletions(-) diff --git a/libs/dfi/CMakeLists.txt b/libs/dfi/CMakeLists.txt index d27a7a74e..da160e818 100644 --- a/libs/dfi/CMakeLists.txt +++ b/libs/dfi/CMakeLists.txt @@ -57,7 +57,6 @@ if (CELIX_DFI) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/dfi COMPONENT dfi) install(DIRECTORY ${CMAKE_BINARY_DIR}/celix/gen/includes/dfi/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/dfi COMPONENT dfi) - celix_target_hide_symbols(dfi) #Alias setup to match external usage add_library(Celix::dfi ALIAS dfi) diff --git a/libs/etcdlib/CMakeLists.txt b/libs/etcdlib/CMakeLists.txt index 310abdb89..c640450ff 100644 --- a/libs/etcdlib/CMakeLists.txt +++ b/libs/etcdlib/CMakeLists.txt @@ -71,7 +71,6 @@ if (CELIX_ETCDLIB OR ETCDLIB_STANDALONE) BASE_NAME "ETCDLIB" EXPORT_FILE_NAME "${CMAKE_BINARY_DIR}/celix/gen/includes/etcdlib/etcdlib_export.h") target_include_directories(etcdlib PUBLIC $) - celix_target_hide_symbols(etcdlib) add_library(etcdlib_static STATIC src/etcd.c) diff --git a/libs/framework/CMakeLists.txt b/libs/framework/CMakeLists.txt index fd528bc09..82968846b 100644 --- a/libs/framework/CMakeLists.txt +++ b/libs/framework/CMakeLists.txt @@ -66,7 +66,6 @@ install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framewo install(DIRECTORY include_deprecated/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framework COMPONENT framework) install(DIRECTORY ${CMAKE_BINARY_DIR}/celix/gen/includes/framework/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/framework COMPONENT framework) -celix_target_hide_symbols(framework) #Alias setup to match external usage add_library(Celix::framework ALIAS framework) diff --git a/libs/utils/CMakeLists.txt b/libs/utils/CMakeLists.txt index 4161c0784..eca648115 100644 --- a/libs/utils/CMakeLists.txt +++ b/libs/utils/CMakeLists.txt @@ -106,7 +106,6 @@ if (CELIX_INSTALL_DEPRECATED_API) install(DIRECTORY include_deprecated/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/utils COMPONENT framework) endif () -celix_target_hide_symbols(utils) #Alias setup to match external usage add_library(Celix::utils ALIAS utils)