diff --git a/CMakeLists.txt b/CMakeLists.txt index a7ca2551794..53abdefc091 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,6 +228,13 @@ endif() find_package(ZLIB REQUIRED) +# ncurses is used in traffic_top +find_package(Curses) +set(HAVE_CURSES_H ${CURSES_HAVE_CURSES_H}) +set(HAVE_NCURSES_H ${CURSES_HAVE_NCURSES_H}) +set(HAVE_NCURSES_CURSES_H ${CURSES_HAVE_NCURSES_CURSES_H}) +set(HAVE_NCURSES_NCURSES_H ${CURSES_HAVE_NCURSES_NCURSES_H}) + include(Check128BitCas) include(ConfigureTransparentProxy) @@ -388,6 +395,13 @@ add_subdirectory(src/traffic_crashlog) add_subdirectory(src/traffic_server) add_subdirectory(src/traffic_ctl) add_subdirectory(src/traffic_layout) +add_subdirectory(src/traffic_cache_tool) +add_subdirectory(src/traffic_logcat) +add_subdirectory(src/traffic_logstats) +if(CURSES_FOUND) +add_subdirectory(src/traffic_top) +endif() +add_subdirectory(src/traffic_via) if(ENABLE_WCCP) add_subdirectory(src/wccp) add_subdirectory(src/traffic_wccp) diff --git a/include/tscore/ink_config.h.cmake.in b/include/tscore/ink_config.h.cmake.in index 25b74ef8095..1bf6d071098 100644 --- a/include/tscore/ink_config.h.cmake.in +++ b/include/tscore/ink_config.h.cmake.in @@ -34,6 +34,10 @@ #cmakedefine HAVE_BROTLI_ENCODE_H 1 #cmakedefine HAVE_CLOCK_GETTIME 1 +#cmakedefine HAVE_CURSES_H 1 +#cmakedefine HAVE_NCURSES_H 1 +#cmakedefine HAVE_NCURSES_CURSES_H 1 +#cmakedefine HAVE_NCURSES_NCURSES_H 1 #cmakedefine HAVE_DLFCN_H 1 #cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_LZMA_H 1 diff --git a/proxy/http/unit_tests/CMakeLists.txt b/proxy/http/unit_tests/CMakeLists.txt index 1f9ef16c43b..64cc7d3d1bf 100644 --- a/proxy/http/unit_tests/CMakeLists.txt +++ b/proxy/http/unit_tests/CMakeLists.txt @@ -35,7 +35,6 @@ target_link_libraries(test_http PRIVATE catch2::catch2 ts::http - ts::tsapi ts::hdrs # transitive logging # transitive http_remap # transitive diff --git a/proxy/http3/CMakeLists.txt b/proxy/http3/CMakeLists.txt index d3408bd1ff2..2f8ce3f9ca3 100644 --- a/proxy/http3/CMakeLists.txt +++ b/proxy/http3/CMakeLists.txt @@ -38,17 +38,5 @@ add_library(http3 STATIC add_library(ts::http3 ALIAS http3) target_include_directories(http3 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") +target_link_libraries(http3 PUBLIC ts::quic PRIVATE ts::proxy) -target_link_libraries(http3 - PUBLIC - ts::hdrs - ts::http - ts::inknet - ts::inkutils - ts::inkevent - ts::proxy - ts::quic - ts::records - ts::tscpputil - ts::tscore -) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 8ee2b3ddb45..ad417a9a37b 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -17,6 +17,8 @@ add_library(tsapi SHARED Metrics.cc) add_library(ts::tsapi ALIAS tsapi) +target_link_libraries(tsapi PRIVATE ts::tscore) + install(TARGETS tsapi) diff --git a/src/traffic_cache_tool/CMakeLists.txt b/src/traffic_cache_tool/CMakeLists.txt new file mode 100644 index 00000000000..e8864cdbe64 --- /dev/null +++ b/src/traffic_cache_tool/CMakeLists.txt @@ -0,0 +1,24 @@ +####################### +# +# 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_executable(traffic_cache_tool + CacheDefs.cc + CacheTool.cc + CacheScan.cc) + +target_link_libraries(traffic_cache_tool PRIVATE ts::tscore libswoc) +install(TARGETS traffic_cache_tool) diff --git a/src/traffic_logcat/CMakeLists.txt b/src/traffic_logcat/CMakeLists.txt new file mode 100644 index 00000000000..7a0c3978fc5 --- /dev/null +++ b/src/traffic_logcat/CMakeLists.txt @@ -0,0 +1,20 @@ +####################### +# +# 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_executable(traffic_logcat logcat.cc) +target_link_libraries(traffic_logcat PRIVATE ts::tscore ts::proxy ts::logging ts::hdrs ts::tsapi ts::diagsconfig libswoc) +install(TARGETS traffic_logcat) diff --git a/src/traffic_logstats/CMakeLists.txt b/src/traffic_logstats/CMakeLists.txt new file mode 100644 index 00000000000..be589c1761b --- /dev/null +++ b/src/traffic_logstats/CMakeLists.txt @@ -0,0 +1,31 @@ +####################### +# +# 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_executable(traffic_logstats logstats.cc) +target_link_libraries(traffic_logstats PRIVATE ts::logging ts::hdrs ts::tscore ts::tsapi ts::records ts::diagsconfig ts::inkevent libswoc) + +add_test( + NAME test_logstats_json + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_logstats_json ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src +) + +add_test( + NAME test_logstats_summary + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_logstats_summary ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src +) diff --git a/src/traffic_logstats/tests/test_logstats_json b/src/traffic_logstats/tests/test_logstats_json index 413ad429b61..c2c11f66b51 100755 --- a/src/traffic_logstats/tests/test_logstats_json +++ b/src/traffic_logstats/tests/test_logstats_json @@ -18,6 +18,10 @@ set -e # exit on error +if [ ! -z $1 ]; then + srcdir=$1 +fi + TMPDIR=${TMPDIR:-/tmp} tmpfile=$(mktemp "$TMPDIR/logstats.XXXXXX") srcdir=$(cd $srcdir && pwd)/traffic_logstats diff --git a/src/traffic_logstats/tests/test_logstats_summary b/src/traffic_logstats/tests/test_logstats_summary index 9c8b63d071e..5b395df46ed 100755 --- a/src/traffic_logstats/tests/test_logstats_summary +++ b/src/traffic_logstats/tests/test_logstats_summary @@ -17,7 +17,11 @@ # limitations under the License. set -e # exit on error -set -x # turn on debug +#set -x # turn on debug + +if [ ! -z $1 ]; then + srcdir=$1 +fi TMPDIR=${TMPDIR:-/tmp} tmpfile=$(mktemp "$TMPDIR/logstats.XXXXXX") diff --git a/src/traffic_top/CMakeLists.txt b/src/traffic_top/CMakeLists.txt new file mode 100644 index 00000000000..4a0c9728bcd --- /dev/null +++ b/src/traffic_top/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. +# +####################### + +add_executable(traffic_top traffic_top.cc ${CMAKE_SOURCE_DIR}/src/shared/rpc/IPCSocketClient.cc) +target_include_directories(traffic_top PRIVATE ${CURSES_INCLUDE_DIRS}) +target_link_libraries(traffic_top PRIVATE ts::tscore ts::inkevent libswoc ${CURSES_LIBRARIES}) +install(TARGETS traffic_top) diff --git a/src/traffic_via/CMakeLists.txt b/src/traffic_via/CMakeLists.txt new file mode 100644 index 00000000000..d27675d94e2 --- /dev/null +++ b/src/traffic_via/CMakeLists.txt @@ -0,0 +1,27 @@ +####################### +# +# 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_executable(traffic_via traffic_via.cc) +target_link_libraries(traffic_via ts::tscore libswoc) +install(TARGETS traffic_via) + +# Odd test to maintain compatibility with autotools. This could be better. +add_test( + NAME test_traffic_via + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test_traffic_via ${CMAKE_SOURCE_DIR}/src + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src +) diff --git a/src/traffic_via/test_traffic_via b/src/traffic_via/test_traffic_via index d8bb617df30..9d732eb1ff5 100755 --- a/src/traffic_via/test_traffic_via +++ b/src/traffic_via/test_traffic_via @@ -18,9 +18,13 @@ set -e # exit on error +if [ ! -z $1 ]; then + srcdir=$1 +fi + TMPDIR=${TMPDIR:-/tmp} tmpfile=$(mktemp "$TMPDIR/via.XXXXXX") -if [ ! -z "$srcdir"]; then +if [ ! -z "$srcdir" ]; then srcdir=$(cd $srcdir && pwd) else srcdir=$(pwd) diff --git a/src/traffic_wccp/CMakeLists.txt b/src/traffic_wccp/CMakeLists.txt index 1a83912e587..de2a5fb65a2 100644 --- a/src/traffic_wccp/CMakeLists.txt +++ b/src/traffic_wccp/CMakeLists.txt @@ -16,5 +16,6 @@ ####################### add_executable(traffic_wccp wccp_client.cc) +install(TARGETS traffic_wccp) target_link_libraries(traffic_wccp PRIVATE tscore wccp)