This is an automated email from the ASF dual-hosted git repository. pengzheng pushed a commit to branch feature/579-automatic-dependency-deduction in repository https://gitbox.apache.org/repos/asf/celix.git
commit 096e19f779f9d674c612e90f3be126e372f75887 Author: PengZheng <[email protected]> AuthorDate: Fri Jul 7 09:17:21 2023 +0800 Add options for log/shell api and log helper. --- bundles/logging/log_helper/CMakeLists.txt | 57 +++++---- bundles/logging/log_service_api/CMakeLists.txt | 34 +++--- .../log_service_api/include/celix_log_control.h | 1 + bundles/shell/shell/CMakeLists.txt | 136 +++++++++++---------- conanfile.py | 39 ++++-- 5 files changed, 151 insertions(+), 116 deletions(-) diff --git a/bundles/logging/log_helper/CMakeLists.txt b/bundles/logging/log_helper/CMakeLists.txt index c180014c..e46eef11 100644 --- a/bundles/logging/log_helper/CMakeLists.txt +++ b/bundles/logging/log_helper/CMakeLists.txt @@ -15,36 +15,39 @@ # specific language governing permissions and limitations # under the License. -if (CELIX_INSTALL_DEPRECATED_API) - set(SOURCES src/celix_log_helper.c src/log_helper.c) -else () - set(SOURCES src/celix_log_helper.c) -endif () +celix_subproject(LOG_HELPER "Option to enable building the log helper library" ON) +if (LOG_HELPER) + if (CELIX_INSTALL_DEPRECATED_API) + set(SOURCES src/celix_log_helper.c src/log_helper.c) + else () + set(SOURCES src/celix_log_helper.c) + endif () -add_library(log_helper STATIC ${SOURCES}) -set_target_properties(log_helper PROPERTIES OUTPUT_NAME "celix_log_utils") -target_include_directories(log_helper PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> -) -target_link_libraries(log_helper PUBLIC Celix::log_service_api Celix::framework PRIVATE Celix::utils) + add_library(log_helper STATIC ${SOURCES}) + set_target_properties(log_helper PROPERTIES OUTPUT_NAME "celix_log_utils") + target_include_directories(log_helper PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> + ) + target_link_libraries(log_helper PUBLIC Celix::log_service_api Celix::framework PRIVATE Celix::utils) -if (CELIX_INSTALL_DEPRECATED_API) - target_include_directories(log_helper PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include_v1> - ) - install(DIRECTORY include_v1/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper) -endif () + if (CELIX_INSTALL_DEPRECATED_API) + target_include_directories(log_helper PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include_v1> + ) + install(DIRECTORY include_v1/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper) + endif () -install(TARGETS log_helper EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT logging - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper COMPONENT logging) + install(TARGETS log_helper EXPORT celix DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT logging + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper) + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_helper COMPONENT logging) -celix_target_hide_symbols(log_helper) -celix_deprecated_utils_headers(log_helper) -celix_deprecated_framework_headers(log_helper) + celix_target_hide_symbols(log_helper) + celix_deprecated_utils_headers(log_helper) + celix_deprecated_framework_headers(log_helper) -add_library(Celix::log_helper ALIAS log_helper) + add_library(Celix::log_helper ALIAS log_helper) -if (ENABLE_TESTING) - add_subdirectory(gtest) -endif() + if (ENABLE_TESTING) + add_subdirectory(gtest) + endif () +endif () diff --git a/bundles/logging/log_service_api/CMakeLists.txt b/bundles/logging/log_service_api/CMakeLists.txt index c1828ef6..afd92dc7 100644 --- a/bundles/logging/log_service_api/CMakeLists.txt +++ b/bundles/logging/log_service_api/CMakeLists.txt @@ -15,21 +15,25 @@ # specific language governing permissions and limitations # under the License. -add_library(log_service_api INTERFACE) -target_include_directories(log_service_api INTERFACE - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> -) -target_link_libraries(log_service_api INTERFACE Celix::utils Celix::framework) +celix_subproject(LOG_SERVICE_API "Option to enable building the log service API" ON) +if (LOG_SERVICE_API) + add_library(log_service_api INTERFACE) + target_include_directories(log_service_api INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> + ) + target_link_libraries(log_service_api INTERFACE Celix::utils) -if (CELIX_INSTALL_DEPRECATED_API) - target_include_directories(log_service_api INTERFACE - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include_v2> - ) - install(DIRECTORY include_v2/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) -endif () + if (CELIX_INSTALL_DEPRECATED_API) + target_link_libraries(log_service_api INTERFACE Celix::framework) + target_include_directories(log_service_api INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include_v2> + ) + install(DIRECTORY include_v2/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) + endif () -install(TARGETS log_service_api EXPORT celix - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) -install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) + install(TARGETS log_service_api EXPORT celix + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) + install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/log_service) -add_library(Celix::log_service_api ALIAS log_service_api) + add_library(Celix::log_service_api ALIAS log_service_api) +endif () diff --git a/bundles/logging/log_service_api/include/celix_log_control.h b/bundles/logging/log_service_api/include/celix_log_control.h index b42a2f0f..5f3d82f3 100644 --- a/bundles/logging/log_service_api/include/celix_log_control.h +++ b/bundles/logging/log_service_api/include/celix_log_control.h @@ -21,6 +21,7 @@ #define CELIX_LOG_CONTROL_H #include <stdbool.h> +#include <stddef.h> #include "celix_log_level.h" #include "celix_array_list.h" diff --git a/bundles/shell/shell/CMakeLists.txt b/bundles/shell/shell/CMakeLists.txt index 34914da8..a48acf18 100644 --- a/bundles/shell/shell/CMakeLists.txt +++ b/bundles/shell/shell/CMakeLists.txt @@ -15,82 +15,86 @@ # specific language governing permissions and limitations # under the License. -add_library(shell_api INTERFACE) -target_include_directories(shell_api INTERFACE - $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api> - ) +celix_subproject(SHELL_API "Option to enable building the Shell API" ON) +if (SHELL_API) + add_library(shell_api INTERFACE) + target_include_directories(shell_api INTERFACE + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/api> + ) + target_link_libraries(shell_api INTERFACE Celix::utils) -if (CELIX_INSTALL_DEPRECATED_API) - target_include_directories(shell_api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deprecated_api>) - install(DIRECTORY deprecated_api/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell COMPONENT shell) -endif () + if (CELIX_INSTALL_DEPRECATED_API) + target_include_directories(shell_api INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/deprecated_api>) + install(DIRECTORY deprecated_api/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell COMPONENT shell) + endif () -install(TARGETS shell_api EXPORT celix COMPONENT shell - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell) -install(DIRECTORY api/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell COMPONENT shell) + install(TARGETS shell_api EXPORT celix COMPONENT shell + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell) + install(DIRECTORY api/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/celix/shell COMPONENT shell) -add_library(Celix::shell_api ALIAS shell_api) + add_library(Celix::shell_api ALIAS shell_api) +endif () celix_subproject(SHELL "Option to enable building the Shell bundles" ON) if (SHELL) - add_library(shell_commands STATIC - src/lb_command.c - src/start_command.c - src/stop_command.c - src/install_command.c - src/update_command.c - src/uninstall_command.c - src/unload_command.c - src/help_command.c - src/dm_shell_list_command.c - src/query_command.c - src/quit_command.c - src/std_commands.c - src/bundle_command.c) - target_include_directories(shell_commands PRIVATE src) - target_link_libraries(shell_commands PRIVATE Celix::shell_api Celix::log_helper) - celix_deprecated_utils_headers(shell_commands) + add_library(shell_commands STATIC + src/lb_command.c + src/start_command.c + src/stop_command.c + src/install_command.c + src/update_command.c + src/uninstall_command.c + src/unload_command.c + src/help_command.c + src/dm_shell_list_command.c + src/query_command.c + src/quit_command.c + src/std_commands.c + src/bundle_command.c) + target_include_directories(shell_commands PRIVATE src) + target_link_libraries(shell_commands PRIVATE Celix::shell_api Celix::log_helper) + celix_deprecated_utils_headers(shell_commands) add_celix_bundle(shell - SYMBOLIC_NAME "apache_celix_c_shell" - VERSION "2.1.0" - NAME "Apache Celix C Shell" - FILENAME celix_shell - GROUP "Celix/Shell" - SOURCES - src/c_shell_activator.c - src/c_shell.c - ) - target_include_directories(shell PRIVATE src) - target_link_libraries(shell PRIVATE shell_commands Celix::shell_api Celix::log_helper) - target_compile_options(shell PRIVATE -Wno-deprecated-declarations) - celix_deprecated_utils_headers(shell) - if (CELIX_INSTALL_DEPRECATED_API) - target_compile_definitions(shell PRIVATE CELIX_INSTALL_DEPRECATED_API) - endif () - install_celix_bundle(shell EXPORT celix COMPONENT shell) + SYMBOLIC_NAME "apache_celix_c_shell" + VERSION "2.1.0" + NAME "Apache Celix C Shell" + FILENAME celix_shell + GROUP "Celix/Shell" + SOURCES + src/c_shell_activator.c + src/c_shell.c + ) + target_include_directories(shell PRIVATE src) + target_link_libraries(shell PRIVATE shell_commands Celix::shell_api Celix::log_helper) + target_compile_options(shell PRIVATE -Wno-deprecated-declarations) + celix_deprecated_utils_headers(shell) + if (CELIX_INSTALL_DEPRECATED_API) + target_compile_definitions(shell PRIVATE CELIX_INSTALL_DEPRECATED_API) + endif () + install_celix_bundle(shell EXPORT celix COMPONENT shell) - #Setup target aliases to match external usage - add_library(Celix::shell ALIAS shell) + #Setup target aliases to match external usage + add_library(Celix::shell ALIAS shell) - if (CELIX_CXX14) - add_celix_bundle(ShellCxx - SYMBOLIC_NAME "Apache_Celix_CxxShell" - VERSION "2.1.0" - NAME "Apache Celix CXX Shell" - FILENAME celix_ShellCxx - GROUP "Celix/Shell" - SOURCES - src/Shell.cc - ) - target_include_directories(ShellCxx PRIVATE src) - target_link_libraries(ShellCxx PRIVATE shell_commands Celix::shell_api Celix::log_service_api Celix::log_helper) - install_celix_bundle(ShellCxx EXPORT celix COMPONENT shell) - add_library(Celix::ShellCxx ALIAS ShellCxx) - endif () + if (CELIX_CXX14) + add_celix_bundle(ShellCxx + SYMBOLIC_NAME "Apache_Celix_CxxShell" + VERSION "2.1.0" + NAME "Apache Celix CXX Shell" + FILENAME celix_ShellCxx + GROUP "Celix/Shell" + SOURCES + src/Shell.cc + ) + target_include_directories(ShellCxx PRIVATE src) + target_link_libraries(ShellCxx PRIVATE shell_commands Celix::shell_api Celix::log_service_api Celix::log_helper) + install_celix_bundle(ShellCxx EXPORT celix COMPONENT shell) + add_library(Celix::ShellCxx ALIAS ShellCxx) + endif () - if (ENABLE_TESTING) - add_subdirectory(gtest) - endif() + if (ENABLE_TESTING) + add_subdirectory(gtest) + endif () endif (SHELL) diff --git a/conanfile.py b/conanfile.py index a3446e23..36fd65fa 100644 --- a/conanfile.py +++ b/conanfile.py @@ -84,6 +84,9 @@ class CelixConan(ConanFile): "build_framework": [True, False], "build_rcm": [True, False], "build_utils": [True, False], + "build_log_helper": [True, False], + "build_log_service_api": [True, False], + "build_shell_api": [True, False], "celix_cxx14": [True, False], "celix_cxx17": [True, False], "celix_install_deprecated_api": [True, False], @@ -137,6 +140,9 @@ class CelixConan(ConanFile): "build_framework": False, "build_rcm": False, "build_utils": False, + "build_log_helper": False, + "build_log_service_api": False, + "build_shell_api": False, "celix_cxx14": True, "celix_cxx17": True, "celix_install_deprecated_api": False, @@ -191,14 +197,6 @@ class CelixConan(ConanFile): self.options.build_rsa_discovery_zeroconf = False self.options.build_shell_bonjour = False - if not self.options.celix_cxx14: - self.options.celix_cxx17 = False - if not self.options.celix_cxx17: - self.options.build_cxx_remote_service_admin = False - self.options.build_promises = False - self.options.build_pushstreams = False - if not self.options.build_cxx_remote_service_admin: - self.options.build_cxx_rsa_integration = False if not self.options.enable_testing: self.options.build_pubsub_integration = False self.options.enable_code_coverage = False @@ -227,6 +225,31 @@ class CelixConan(ConanFile): if not self.options.celix_install_deprecated_api: self.options.build_shell_bonjour = False + if self.options.build_cxx_rsa_integration: + self.options.build_cxx_remote_service_admin = True + self.options.build_pubsub = True + self.options.build_pushstreams = True + self.options.build_promises = True + self.options.build_log_helper = True + self.options.build_shell = True + self.options.build_shell_tui = True + self.options.build_shell_api = True + self.options.build_pubsub_psa_zmq = True + self.options.build_pubsub_discovery_etcd = True + + if self.options.build_cxx_remote_service_admin: + self.options.build_framework = True + self.options.celix_cxx17 = True + + if self.options.build_pushstreams: + self.options.build_promises = True + + if self.options.build_promises: + self.options.celix_cxx17 = True + + if self.options.celix_cxx17: + self.options.celix_cxx14 = True + def requirements(self): self.requires("libcurl/[>=7.64.1 <8.0.0]") self.options['libcurl'].shared = True
