This is an automated email from the ASF dual-hosted git repository. pnoltes pushed a commit to branch feature/split_celix_cxx_option in repository https://gitbox.apache.org/repos/asf/celix.git
commit 7a55a3988992aaddadfe40a67089b1cc6320c44a Author: Pepijn Noltes <[email protected]> AuthorDate: Sun Dec 4 15:55:38 2022 +0100 Splitting CELIX_CXX option into CELIX_CXX14 and CELIX_CXX17 --- CMakeLists.txt | 9 +++-- bundles/CMakeLists.txt | 4 +-- .../topology_manager/CMakeLists.txt | 41 ---------------------- bundles/shell/shell/CMakeLists.txt | 2 +- bundles/shell/shell/gtest/CMakeLists.txt | 2 +- conanfile.py | 11 +++--- examples/celix-examples/CMakeLists.txt | 4 +-- libs/CMakeLists.txt | 2 +- libs/promises/CMakeLists.txt | 3 +- libs/pushstreams/CMakeLists.txt | 3 +- 10 files changed, 25 insertions(+), 56 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fc96ee5e..40d538e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,7 +83,7 @@ set(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -fPIC ${CMAKE_C_FLAGS}") set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") # Set C++ specific flags -set(CMAKE_CXX_STANDARD 17) #Celix header only C++ supported is based on C++17. +set(CMAKE_CXX_STANDARD 14) #Celix header only C++ supported is based on C++14. set(CMAKE_CXX_FLAGS "-fno-rtti ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "-Wall -Werror -Wextra -Weffc++ ${CMAKE_CXX_FLAGS}") @@ -186,7 +186,12 @@ endif () option(CELIX_USE_ZIP_INSTEAD_OF_JAR "Default Celix cmake command will use jar to package bundle (if found). This option enforces Celix to use zip instead." OFF) -option(CELIX_CXX "Build C++ libraries and bundles. Note for tests C++ is always used." ON) +option(CELIX_CXX14 "Build C++14 libraries and bundles. Note for tests C++ is always used." ON) +option(CELIX_CXX17 "Build C++17 libraries and bundles." ON) +if (CELIX_CXX17 AND NOT CELIX_CXX14) + set(CELIX_CXX14 ON) +endif () + option(ENABLE_TESTING_DEPENDENCY_MANAGER_FOR_CXX11 "Test the Dependency Manager for C++11 support" OFF) option(ENABLE_TESTING_FOR_CXX14 "Test celix utils and framework C++ header for C++14 support" OFF) diff --git a/bundles/CMakeLists.txt b/bundles/CMakeLists.txt index d84f4e0b..02e85704 100644 --- a/bundles/CMakeLists.txt +++ b/bundles/CMakeLists.txt @@ -24,7 +24,7 @@ add_subdirectory(deployment_admin) add_subdirectory(remote_services) add_subdirectory(pubsub) -# Celix C++17 bundles -if (CELIX_CXX) +# Celix C++14 bundles +if (CELIX_CXX14) add_subdirectory(cxx_remote_services) endif () diff --git a/bundles/cxx_remote_services/topology_manager/CMakeLists.txt b/bundles/cxx_remote_services/topology_manager/CMakeLists.txt deleted file mode 100644 index 7459fa3e..00000000 --- a/bundles/cxx_remote_services/topology_manager/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -add_celix_bundle(async_topology_manager - VERSION 0.9.0 - SYMBOLIC_NAME "apache_celix_async_topology_manager" - NAME "Apache Celix Async Topology Manager" - GROUP "Celix/AsyncRSA" - SOURCES - src/topology_manager.cc - ) -target_include_directories(async_topology_manager PRIVATE include) -target_link_libraries(async_topology_manager PRIVATE - Celix::async_rsa_common - Celix::async_rsa_discovery_configured - Celix::framework - Celix::log_helper -) - -#if (ENABLE_TESTING) -# add_subdirectory(gtest) -#endif() - - -install_celix_bundle(async_topology_manager EXPORT celix COMPONENT async_rsa) -#Setup target aliases to match external usage -add_library(Celix::async_topology_manager ALIAS async_topology_manager) \ No newline at end of file diff --git a/bundles/shell/shell/CMakeLists.txt b/bundles/shell/shell/CMakeLists.txt index 5d480a4e..ec56bf48 100644 --- a/bundles/shell/shell/CMakeLists.txt +++ b/bundles/shell/shell/CMakeLists.txt @@ -71,7 +71,7 @@ if (SHELL) #Setup target aliases to match external usage add_library(Celix::shell ALIAS shell) - if (CELIX_CXX) + if (CELIX_CXX14) add_celix_bundle(ShellCxx SYMBOLIC_NAME "Apache_Celix_CxxShell" VERSION "2.1.0" diff --git a/bundles/shell/shell/gtest/CMakeLists.txt b/bundles/shell/shell/gtest/CMakeLists.txt index fb79c918..2167e07d 100644 --- a/bundles/shell/shell/gtest/CMakeLists.txt +++ b/bundles/shell/shell/gtest/CMakeLists.txt @@ -30,7 +30,7 @@ add_test(NAME test_shell COMMAND test_shell) setup_target_for_coverage(test_shell SCAN_DIR ..) -if (CELIX_CXX) +if (CELIX_CXX14) add_executable(test_cxx_shell src/ShellTestSuite.cc) target_link_libraries(test_cxx_shell PRIVATE Celix::framework Celix::shell_api GTest::gtest GTest::gtest_main) diff --git a/conanfile.py b/conanfile.py index fa70e343..f448e8fe 100644 --- a/conanfile.py +++ b/conanfile.py @@ -79,7 +79,8 @@ class CelixConan(ConanFile): "build_launcher": [True, False], "build_promises": [True, False], "build_pushstreams": [True, False], - "celix_cxx": [True, False], + "celix_cxx14": [True, False], + "celix_cxx17": [True, False], "celix_install_deprecated_api": [True, False], "celix_add_deprecated_attributes": [True, False], "celix_use_compression_for_bundle_zips": [True, False], @@ -108,7 +109,7 @@ class CelixConan(ConanFile): "build_pubsub_psa_udp_mc": False, "build_pubsub_psa_ws": True, "build_pubsub_discovery_etcd": False, - "build_cxx_remote_service_admin": False, + "build_cxx_remote_service_admin": True, "build_cxx_rsa_integration": False, "build_remote_service_admin": True, "build_rsa_remote_service_admin_dfi": True, @@ -126,7 +127,8 @@ class CelixConan(ConanFile): "build_launcher": False, "build_promises": False, "build_pushstreams": False, - "celix_cxx": False, + "celix_cxx14": False, + "celix_cxx17": False, "celix_install_deprecated_api": False, "celix_add_deprecated_attributes": True, "celix_use_compression_for_bundle_zips": True, @@ -160,8 +162,9 @@ class CelixConan(ConanFile): for opt, val in self.options.values.items(): if opt.startswith('build_'): setattr(self.options, opt, True) - if not self.options.celix_cxx: + if not self.options.celix_cxx14: self.options.build_cxx_remote_service_admin = False + if not self.options.celix_cxx17: self.options.build_promises = False self.options.build_pushstreams = False if not self.options.build_cxx_remote_service_admin: diff --git a/examples/celix-examples/CMakeLists.txt b/examples/celix-examples/CMakeLists.txt index 2a5052cd..671b9e2f 100644 --- a/examples/celix-examples/CMakeLists.txt +++ b/examples/celix-examples/CMakeLists.txt @@ -19,7 +19,7 @@ if (COMMAND celix_subproject) celix_subproject(EXAMPLES "Option to enable building the Examples" ON DEPS SHELL SHELL_TUI LOG_SERVICE) else () set(EXAMPLES true) #celix_subproject is only available in the celix project -> using examples dir in other project is also supported - option(CELIX_CXX ON) + option(CELIX_CXX14 ON) endif () if (EXAMPLES) add_definitions(-DADD_CELIX_DEPRECATED_WARNING) #ensure that no deprecated api is used in the examples @@ -29,7 +29,7 @@ if (EXAMPLES) add_subdirectory(services_example_c) add_subdirectory(readme_c_examples) - if (CELIX_CXX) + if (CELIX_CXX14) add_subdirectory(hello_world_cxx) add_subdirectory(dm_example_cxx) add_subdirectory(services_example_cxx) diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 8238864c..13aaa8ea 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -30,6 +30,6 @@ add_subdirectory(launcher) #add_subdirectory(event_admin)# event_admin is unstable add_subdirectory(dependency_manager) -if (CELIX_CXX) +if (CELIX_CXX14) add_subdirectory(dependency_manager_cxx) endif () diff --git a/libs/promises/CMakeLists.txt b/libs/promises/CMakeLists.txt index 69aa21b5..1dd4e686 100644 --- a/libs/promises/CMakeLists.txt +++ b/libs/promises/CMakeLists.txt @@ -32,11 +32,12 @@ if (NOT COMMAND celix_subproject) set(PROMISES_STANDALONE ON) else () - set(PROMISES_DEFAULT_ON ${CELIX_CXX}) + set(PROMISES_DEFAULT_ON ${CELIX_CXX17}) celix_subproject(PROMISES "Option to build the Promises library" ${PROMISES_DEFAULT_ON}) endif () if (PROMISES OR PROMISES_STANDALONE) + set(CMAKE_CXX_STANDARD 17) message("The Celix::Promises implementation is still experiment and the api and behaviour will probably still change.") set(CMAKE_CXX_STANDARD 17) diff --git a/libs/pushstreams/CMakeLists.txt b/libs/pushstreams/CMakeLists.txt index b05b1219..2db3c4df 100644 --- a/libs/pushstreams/CMakeLists.txt +++ b/libs/pushstreams/CMakeLists.txt @@ -15,10 +15,11 @@ # specific language governing permissions and limitations # under the License. -set(PUSHSTREAMS_DEFAULT_ON ${CELIX_CXX}) +set(PUSHSTREAMS_DEFAULT_ON ${CELIX_CXX17}) celix_subproject(PUSHSTREAMS "Option to build the PushStreams library" ${PUSHSTREAMS_DEFAULT_ON} DEPS PROMISES) if (PUSHSTREAMS) + set(CMAKE_CXX_STANDARD 17) find_package(Threads) add_library(PushStreams INTERFACE) target_include_directories(PushStreams INTERFACE
