This is an automated email from the ASF dual-hosted git repository. cmcfarlen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push: new 2fd4caf49c Add example subdir to cmake enabled with 'ENABLE_EXAMPLE' cmake option (#10211) 2fd4caf49c is described below commit 2fd4caf49c8ef9b5517f8f5fa41af54f5852fa9d Author: Chris McFarlen <ch...@mcfarlen.us> AuthorDate: Mon Aug 21 15:22:19 2023 -0500 Add example subdir to cmake enabled with 'ENABLE_EXAMPLE' cmake option (#10211) Co-authored-by: Chris McFarlen <cmcfar...@apple.com> --- CMakeLists.txt | 4 ++ .../CMakeLists.txt => cmake/add_atsplugin.cmake | 37 ------------ example/CMakeLists.txt | 21 +++++++ example/plugins/CMakeLists.txt | 18 ++++++ example/plugins/c-api/CMakeLists.txt | 66 ++++++++++++++++++++++ plugins/CMakeLists.txt | 14 +---- 6 files changed, 110 insertions(+), 50 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88987ddcc3..2a3016c9df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,6 +79,7 @@ set(ENABLE_TPROXY option(ENABLE_QUICHE "Use quiche (default OFF)") option(ENABLE_UNWIND "Use libunwind if found on system (default ON)" ON) option(ENABLE_WCCP "Use WCCP v2 (default OFF)") +option(ENABLE_EXAMPLE "Build example directory (default OFF)") set(TS_MAX_HOST_NAME_LEN 256 CACHE STRING "Max host name length (default 256)") set(MAX_EVENT_THREADS 4096 @@ -387,6 +388,9 @@ add_subdirectory(src/tests) add_subdirectory(tests) add_subdirectory(plugins) add_subdirectory(configs) +if(ENABLE_EXAMPLE) + add_subdirectory(example) +endif() add_custom_target(clang-format-install COMMAND ${CMAKE_SOURCE_DIR}/tools/clang-format.sh --install diff --git a/plugins/CMakeLists.txt b/cmake/add_atsplugin.cmake similarity index 58% copy from plugins/CMakeLists.txt copy to cmake/add_atsplugin.cmake index 4bdc856c44..899d351694 100644 --- a/plugins/CMakeLists.txt +++ b/cmake/add_atsplugin.cmake @@ -28,40 +28,3 @@ endfunction() if(APPLE) set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup") endif() - -add_subdirectory(authproxy) -add_subdirectory(background_fetch) -add_subdirectory(cache_promote) -add_subdirectory(cache_range_requests) -add_subdirectory(cachekey) -add_subdirectory(certifier) -add_subdirectory(compress) -add_subdirectory(conf_remap) -add_subdirectory(escalate) -add_subdirectory(esi) - -add_subdirectory(generator) -add_subdirectory(header_rewrite) -add_subdirectory(libloader) -add_subdirectory(multiplexer) -add_subdirectory(prefetch) -add_subdirectory(regex_remap) -add_subdirectory(regex_revalidate) -add_subdirectory(remap_purge) -add_subdirectory(s3_auth) -add_subdirectory(server_push_preload) -add_subdirectory(stats_over_http) -add_subdirectory(tcpinfo) -add_subdirectory(xdebug) - -if(ENABLE_LUAJIT) - add_subdirectory(lua) -endif() - -if(BUILD_EXPERIMENTAL_PLUGINS) - add_subdirectory(experimental) -endif() - -if(HOST_OS STREQUAL "linux") - add_subdirectory(healthchecks) -endif() diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt new file mode 100644 index 0000000000..15bea86104 --- /dev/null +++ b/example/CMakeLists.txt @@ -0,0 +1,21 @@ +####################### +# +# 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. +# +####################### + + +# It might be better if this is a subproject + +add_subdirectory(plugins) diff --git a/example/plugins/CMakeLists.txt b/example/plugins/CMakeLists.txt new file mode 100644 index 0000000000..7814cabb19 --- /dev/null +++ b/example/plugins/CMakeLists.txt @@ -0,0 +1,18 @@ +####################### +# +# 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_subdirectory(c-api) diff --git a/example/plugins/c-api/CMakeLists.txt b/example/plugins/c-api/CMakeLists.txt new file mode 100644 index 0000000000..cce968816f --- /dev/null +++ b/example/plugins/c-api/CMakeLists.txt @@ -0,0 +1,66 @@ +####################### +# +# 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. +# +####################### + + +include(add_atsplugin) + +add_atsplugin(example_cache_scan ./cache_scan/cache_scan.cc) +add_atsplugin(example_lifecycle_plugin ./lifecycle_plugin/lifecycle_plugin.cc) +add_atsplugin(example_request_buffer ./request_buffer/request_buffer.cc) +add_atsplugin(example_secure_link ./secure_link/secure_link.cc) +target_link_libraries(example_secure_link PRIVATE OpenSSL::SSL) +add_atsplugin(example_remap ./remap/remap.cc) +add_atsplugin(example_redirect_1 ./redirect_1/redirect_1.cc) +add_atsplugin(example_query_remap ./query_remap/query_remap.cc) +add_atsplugin(example_thread_pool ./thread_pool/psi.cc ./thread_pool/thread.cc) +add_atsplugin(example_bnull_transform ./bnull_transform/bnull_transform.cc) +add_atsplugin(example_replace_header ./replace_header/replace_header.cc) +add_atsplugin(example_ssl_sni ./ssl_sni/ssl_sni.cc) +target_link_libraries(example_ssl_sni PRIVATE OpenSSL::SSL) +add_atsplugin(example_passthru ./passthru/passthru.cc) +add_atsplugin(example_response_header_1 ./response_header_1/response_header_1.cc) +add_atsplugin(example_denylist_1 ./denylist_1/denylist_1.cc) +add_atsplugin(example_denylist_0 ./denylist_0/denylist_0.cc) +add_atsplugin(example_server_push ./server_push/server_push.cc) +add_atsplugin(example_basic_auth ./basic_auth/basic_auth.cc) +add_atsplugin(example_verify_cert ./verify_cert/verify_cert.cc) +target_link_libraries(example_verify_cert PRIVATE OpenSSL::SSL) +add_atsplugin(example_intercept ./intercept/intercept.cc) +add_atsplugin(example_null_transform ./null_transform/null_transform.cc) +add_atsplugin(example_ssl_sni_allowlist ./ssl_sni_allowlist/ssl_sni_allowlist.cc) +target_link_libraries(example_ssl_sni_allowlist PRIVATE OpenSSL::SSL) +add_atsplugin(example_protocol ./protocol/Protocol.cc ./protocol/TxnSM.cc) +add_atsplugin(example_file_1 ./file_1/file_1.cc) +add_atsplugin(example_output_header ./output_header/output_header.cc) +add_atsplugin(example_session_hooks ./session_hooks/session_hooks.cc) +add_atsplugin(example_add_header ./add_header/add_header.cc) +add_atsplugin(example_version ./version/version.cc) +add_atsplugin(example_ssl_preaccept ./ssl_preaccept/ssl_preaccept.cc) +add_atsplugin(example_txn_data_sink ./txn_data_sink/txn_data_sink.cc) +add_atsplugin(example_remap_header_add ./remap_header_add/remap_header_add.cc) +add_atsplugin(example_disable_http2 ./disable_http2/disable_http2.cc) +target_link_libraries(example_disable_http2 PRIVATE OpenSSL::SSL) +add_atsplugin(example_server_transform ./server_transform/server_transform.cc) +add_atsplugin(example_append_transform ./append_transform/append_transform.cc) +add_atsplugin(example_thread_1 ./thread_1/thread_1.cc) +add_atsplugin(example_vconn_args ./vconn_args/vconn_args.cc) +add_atsplugin(example_cert_update ./cert_update/cert_update.cc) +add_atsplugin(example_hello ./hello/hello.cc) +add_atsplugin(example_statistic ./statistic/statistic.cc) +add_atsplugin(example_protocol_stack ./protocol_stack/protocol_stack.cc) +add_atsplugin(example_client_context_dump ./client_context_dump/client_context_dump.cc) +target_link_libraries(example_client_context_dump PRIVATE OpenSSL::SSL) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4bdc856c44..af5695581b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -15,19 +15,7 @@ # ####################### -set(CMAKE_SHARED_LIBRARY_PREFIX "") - -function(add_atsplugin name) - add_library(${name} MODULE ${ARGN}) - target_link_libraries(${name} PRIVATE traffic_server) - set_target_properties(${name} PROPERTIES PREFIX "") - set_target_properties(${name} PROPERTIES SUFFIX ".so") - install(TARGETS ${name} DESTINATION libexec/trafficserver) -endfunction() - -if(APPLE) - set(CMAKE_MODULE_LINKER_FLAGS "-undefined dynamic_lookup") -endif() +include(add_atsplugin) add_subdirectory(authproxy) add_subdirectory(background_fetch)