diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 626 |
1 files changed, 285 insertions, 341 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c415118920..b7521fc20c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later -cmake_minimum_required(VERSION 3.13.0...3.28) +cmake_minimum_required(VERSION 3.16.0...3.30) list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/Modules") @@ -90,7 +90,6 @@ set(OS_FREEBSD False) set(OS_LINUX False) set(OS_MACOS False) set(OS_WINDOWS False) -set(ALLOW_PLATFORM_SENSITIVE_OPTIONS True) set(NETDATA_RUNTIME_PREFIX "${CMAKE_INSTALL_PREFIX}") set(BINDIR usr/sbin) @@ -99,19 +98,14 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") set(OS_MACOS True) find_library(IOKIT IOKit) find_library(FOUNDATION Foundation) - message(INFO " Compiling for MacOS... ") + message(STATUS " Compiling for MacOS... ") elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") set(OS_FREEBSD True) - message(INFO " Compiling for FreeBSD... ") + message(STATUS " Compiling for FreeBSD... ") elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") set(OS_LINUX True) add_definitions(-D_GNU_SOURCE) - message(INFO " Compiling for Linux... ") - include(NetdataUtil) - netdata_identify_libc(LIBC_IMPLEMENTATION) - if(CMAKE_C_COMPILER_ID STREQUAL "Clang" AND LIBC_IMPLEMENTATION STREQUAL "musl") - set(ALLOW_PLATFORM_SENSITIVE_OPTIONS False) - endif() + message(STATUS " Compiling for Linux... ") elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") set(OS_WINDOWS True) @@ -124,6 +118,10 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQU endif() set(BINDIR usr/bin) + set(CMAKE_RC_COMPILER_INIT windres) + ENABLE_LANGUAGE(RC) + + SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") add_definitions(-D_GNU_SOURCE) if($ENV{CLION_IDE}) @@ -140,27 +138,27 @@ elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQU endif() endif() - message(INFO " Compiling for Windows (${CMAKE_SYSTEM_NAME}, MSYSTEM=$ENV{MSYSTEM})... ") + message(STATUS " Compiling for Windows (${CMAKE_SYSTEM_NAME}, MSYSTEM=$ENV{MSYSTEM})... ") else() message(FATAL_ERROR "Unknown/unsupported platform: ${CMAKE_SYSTEM_NAME} (Supported platforms: FreeBSD, Linux, macOS, Windows)") endif() # This is intended to make life easier for developers who are working on one # specific feature. +# +# NOTE: DO NOT USE THIS OPTION FOR PRODUCTION BUILDS. option(DEFAULT_FEATURE_STATE "Specify the default state for most optional features" True) mark_as_advanced(DEFAULT_FEATURE_STATE) # High-level features -option(ENABLE_ACLK "Enable Netdata Cloud support (ACLK)" ${DEFAULT_FEATURE_STATE}) -option(ENABLE_CLOUD "Enable Netdata Cloud by default at runtime" ${DEFAULT_FEATURE_STATE}) option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE}) option(ENABLE_DBENGINE "Enable dbengine metrics storage" True) # Data collection plugins -option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE}) option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE}) -cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD OR OS_MACOS" False) +cmake_dependent_option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False) +cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False) cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False) @@ -170,7 +168,6 @@ cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection" cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False) mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS) cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) -cmake_dependent_option(ENABLE_PLUGIN_LOGS_MANAGEMENT "Enable log collection and monitoring based on Fluent Bit" False "OS_LINUX AND ALLOW_PLATFORM_SENSITIVE_OPTIONS" False) cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False) @@ -187,10 +184,6 @@ option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False) option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False) option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False) -# Optional test code -cmake_dependent_option(ENABLE_LOGS_MANAGEMENT_TESTS "Enable test code for logs-management plugin." True "ENABLE_PLUGIN_LOGS_MANAGEMENT" False) -mark_as_advanced(ENABLE_LOGS_MANAGEMENT_TESTS) - # Experimental features option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False) mark_as_advanced(ENABLE_WEBRTC) @@ -207,11 +200,7 @@ mark_as_advanced(BUILD_FOR_PACKAGING) cmake_dependent_option(FORCE_LEGACY_LIBBPF "Force usage of libbpf 0.0.9 instead of the latest version." False "ENABLE_PLUGIN_EBPF" False) mark_as_advanced(FORCE_LEGACY_LIBBPF) -if(ENABLE_ACLK OR ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE) - set(NEED_PROTOBUF True) -else() - set(NEED_PROTOBUF False) -endif() +set(NEED_PROTOBUF True) if(ENABLE_PLUGIN_GO) include(NetdataGoTools) @@ -221,6 +210,12 @@ if(ENABLE_PLUGIN_GO) find_package(Go "${MIN_GO_VERSION}" REQUIRED) endif() +if(ENABLE_PLUGIN_GO) + set(NEED_NDSUDO TRUE) +else() + set(NEED_NDSUDO FALSE) +endif() + if(ENABLE_WEBRTC) include(FetchContent) include(NetdataFetchContentExtra) @@ -264,6 +259,9 @@ if(ENABLE_PLUGIN_EBPF) netdata_fetch_ebpf_co_re() endif() +pkg_check_modules(CURL libcurl>=7.21 REQUIRED IMPORTED_TARGET) +set(HAVE_LIBCURL TRUE) + # # Libm # @@ -527,7 +525,6 @@ if(OS_FREEBSD OR OS_MACOS) endif() # openssl/crypto -set(ENABLE_OPENSSL True) pkg_check_modules(TLS IMPORTED_TARGET openssl) if(NOT TARGET PkgConfig::TLS) @@ -622,6 +619,8 @@ set(LIBNETDATA_FILES src/libnetdata/avl/avl.h src/libnetdata/buffer/buffer.c src/libnetdata/buffer/buffer.h + src/libnetdata/ringbuffer/ringbuffer.c + src/libnetdata/ringbuffer/ringbuffer.h src/libnetdata/circular_buffer/circular_buffer.c src/libnetdata/circular_buffer/circular_buffer.h src/libnetdata/clocks/clocks.c @@ -717,6 +716,8 @@ set(LIBNETDATA_FILES src/libnetdata/dictionary/dictionary-callbacks.h src/libnetdata/linked-lists.h src/libnetdata/storage-point.h + src/libnetdata/parsers/parsers.h + src/libnetdata/parsers/duration.c src/libnetdata/bitmap64.h src/libnetdata/os/gettid.c src/libnetdata/os/gettid.h @@ -746,14 +747,48 @@ set(LIBNETDATA_FILES src/libnetdata/os/setenv.h src/libnetdata/os/strndup.c src/libnetdata/os/strndup.h - src/libnetdata/spawn_server/spawn_server.c + src/libnetdata/spawn_server/spawn_server_nofork.c src/libnetdata/spawn_server/spawn_server.h src/libnetdata/spawn_server/spawn_popen.c src/libnetdata/spawn_server/spawn_popen.h + src/libnetdata/spawn_server/spawn_server_windows.c + src/libnetdata/spawn_server/spawn_server_internals.h + src/libnetdata/spawn_server/spawn_server_libuv.c + src/libnetdata/spawn_server/spawn_server_posix.c + src/libnetdata/spawn_server/spawn_library.c + src/libnetdata/spawn_server/spawn_library.h src/libnetdata/os/close_range.c src/libnetdata/os/close_range.h src/libnetdata/os/setproctitle.c src/libnetdata/os/setproctitle.h + src/libnetdata/paths/paths.c + src/libnetdata/paths/paths.h + src/libnetdata/json/json-c-parser-inline.c + src/libnetdata/parsers/duration.h + src/libnetdata/parsers/timeframe.c + src/libnetdata/parsers/timeframe.h + src/libnetdata/parsers/size.c + src/libnetdata/parsers/size.h + src/libnetdata/libjudy/judy-malloc.c + src/libnetdata/libjudy/judy-malloc.h + src/libnetdata/config/appconfig_internals.h + src/libnetdata/config/appconfig_exporters.c + src/libnetdata/config/appconfig_conf_file.c + src/libnetdata/config/appconfig_cleanup.c + src/libnetdata/config/appconfig_sections.c + src/libnetdata/config/appconfig_options.c + src/libnetdata/config/appconfig_migrate.c + src/libnetdata/config/appconfig_traversal.c + src/libnetdata/config/appconfig_api_sizes.c + src/libnetdata/config/appconfig_api_sizes.h + src/libnetdata/config/appconfig_api_durations.c + src/libnetdata/config/appconfig_api_durations.h + src/libnetdata/config/appconfig_api_numbers.c + src/libnetdata/config/appconfig_api_numbers.h + src/libnetdata/config/appconfig_api_text.c + src/libnetdata/config/appconfig_api_text.h + src/libnetdata/config/appconfig_api_boolean.c + src/libnetdata/config/appconfig_api_boolean.h ) if(ENABLE_PLUGIN_EBPF) @@ -852,14 +887,15 @@ set(DAEMON_FILES src/daemon/common.h src/daemon/daemon.c src/daemon/daemon.h - src/daemon/event_loop.c - src/daemon/event_loop.h + src/daemon/libuv_workers.c + src/daemon/libuv_workers.h src/daemon/global_statistics.c src/daemon/global_statistics.h src/daemon/analytics.c src/daemon/analytics.h src/daemon/main.c src/daemon/main.h + src/daemon/environment.c src/daemon/win_system-info.c src/daemon/win_system-info.h src/daemon/signals.c @@ -908,16 +944,65 @@ set(API_PLUGIN_FILES src/web/api/web_api_v1.h src/web/api/web_api_v2.c src/web/api/web_api_v2.h + src/web/api/web_api_v3.c + src/web/api/web_api_v3.h src/web/api/http_auth.c src/web/api/http_auth.h src/web/api/http_header.c src/web/api/http_header.h - src/web/api/badges/web_buffer_svg.c - src/web/api/badges/web_buffer_svg.h - src/web/api/exporters/allmetrics.c - src/web/api/exporters/allmetrics.h - src/web/api/exporters/shell/allmetrics_shell.c - src/web/api/exporters/shell/allmetrics_shell.h + src/web/api/maps/rrdr_options.c + src/web/api/maps/rrdr_options.h + src/web/api/maps/contexts_options.c + src/web/api/maps/contexts_options.h + src/web/api/maps/datasource_formats.c + src/web/api/maps/datasource_formats.h + src/web/api/maps/maps.h + src/web/api/maps/contexts_alert_statuses.c + src/web/api/maps/contexts_alert_statuses.h + src/web/api/v1/api_v1_allmetrics.c + src/web/api/v1/api_v1_badge/web_buffer_svg.c + src/web/api/v1/api_v1_function.c + src/web/api/v1/api_v1_manage.c + src/web/api/v1/api_v1_calls.h + src/web/api/v1/api_v1_dbengine.c + src/web/api/v1/api_v1_config.c + src/web/api/v1/api_v1_functions.c + src/web/api/v1/api_v1_weights.c + src/web/api/v1/api_v1_info.c + src/web/api/v1/api_v1_registry.c + src/web/api/v1/api_v1_data.c + src/web/api/v1/api_v1_contexts.c + src/web/api/v1/api_v1_ml_info.c + src/web/api/v1/api_v1_aclk.c + src/web/api/v1/api_v1_context.c + src/web/api/v1/api_v1_alarms.c + src/web/api/v1/api_v1_charts.c + src/web/api/v2/api_v2_info.c + src/web/api/v2/api_v2_nodes.c + src/web/api/v2/api_v2_node_instances.c + src/web/api/v2/api_v2_q.c + src/web/api/v2/api_v2_versions.c + src/web/api/v2/api_v2_functions.c + src/web/api/v2/api_v2_alerts.c + src/web/api/v2/api_v2_alert_transitions.c + src/web/api/v2/api_v2_ilove/ilove.c + src/web/api/v2/api_v2_bearer.c + src/web/api/v2/api_v2_calls.h + src/web/api/v2/api_v2_data.c + src/web/api/v2/api_v2_progress.c + src/web/api/v2/api_v2_weights.c + src/web/api/v2/api_v2_alert_config.c + src/web/api/v2/api_v2_contexts.c + src/web/api/v2/api_v2_claim.c + src/web/api/v2/api_v2_webrtc.c + src/web/api/v3/api_v3_calls.h + src/web/api/v3/api_v3_settings.c + src/web/api/functions/functions.c + src/web/api/functions/functions.h + src/web/api/functions/function-progress.c + src/web/api/functions/function-progress.h + src/web/api/functions/function-streaming.c + src/web/api/functions/function-streaming.h src/web/api/queries/rrdr.c src/web/api/queries/rrdr.h src/web/api/queries/query.c @@ -964,10 +1049,11 @@ set(API_PLUGIN_FILES src/web/api/formatters/charts2json.h src/web/api/formatters/rrdset2json.c src/web/api/formatters/rrdset2json.h - src/web/api/ilove/ilove.c - src/web/api/ilove/ilove.h src/web/rtc/webrtc.c src/web/rtc/webrtc.h + src/web/api/functions/function-bearer_get_token.c + src/web/api/functions/function-bearer_get_token.h + src/web/api/v3/api_v3_me.c ) set(EXPORTING_ENGINE_FILES @@ -1058,8 +1144,14 @@ set(PLUGINSD_PLUGIN_FILES ) set(RRD_PLUGIN_FILES - src/database/contexts/api_v1.c - src/database/contexts/api_v2.c + src/database/contexts/api_v1_contexts.c + src/database/contexts/api_v2_contexts.c + src/database/contexts/api_v2_contexts.h + src/database/contexts/api_v2_contexts_agents.c + src/database/contexts/api_v2_contexts_alerts.c + src/database/contexts/api_v2_contexts_alerts.h + src/database/contexts/api_v2_contexts_alert_transitions.c + src/database/contexts/api_v2_contexts_alert_config.c src/database/contexts/context.c src/database/contexts/instance.c src/database/contexts/internal.h @@ -1076,10 +1168,6 @@ set(RRD_PLUGIN_FILES src/database/rrdfunctions.h src/database/rrdfunctions-inline.c src/database/rrdfunctions-inline.h - src/database/rrdfunctions-progress.c - src/database/rrdfunctions-progress.h - src/database/rrdfunctions-streaming.c - src/database/rrdfunctions-streaming.h src/database/rrdhost.c src/database/rrdlabels.c src/database/rrd.c @@ -1203,6 +1291,18 @@ set(STREAMING_PLUGIN_FILES src/streaming/replication.c src/streaming/replication.h src/streaming/common.h + src/streaming/protocol/command-nodeid.c + src/streaming/protocol/commands.c + src/streaming/protocol/commands.h + src/streaming/protocol/command-claimed_id.c + src/streaming/stream_path.c + src/streaming/stream_path.h + src/streaming/stream_capabilities.c + src/streaming/stream_capabilities.h + src/streaming/sender_connect.c + src/streaming/sender_internals.h + src/streaming/sender_execute.c + src/streaming/sender_commit.c ) set(WEB_PLUGIN_FILES @@ -1219,6 +1319,19 @@ set(WEB_PLUGIN_FILES set(CLAIM_PLUGIN_FILES src/claim/claim.c src/claim/claim.h + src/claim/claim_id.c + src/claim/claim_id.h + src/claim/cloud-conf.c + src/claim/claim-with-api.c + src/claim/cloud-status.c + src/claim/cloud-status.h +) + +set(CLAIM_WINDOWS_FILES + src/claim/main.c + src/claim/main.h + src/claim/ui.c + src/claim/ui.h ) set(ACLK_ALWAYS_BUILD @@ -1233,12 +1346,9 @@ set(ACLK_ALWAYS_BUILD src/aclk/aclk_util.h src/aclk/https_client.c src/aclk/https_client.h - src/aclk/mqtt_websockets/c-rbuf/cringbuffer.c - src/aclk/mqtt_websockets/c-rbuf/cringbuffer.h - src/aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h - src/aclk/mqtt_websockets/c_rhash/c_rhash.c - src/aclk/mqtt_websockets/c_rhash/c_rhash.h - src/aclk/mqtt_websockets/c_rhash/c_rhash_internal.h + src/libnetdata/c_rhash/c_rhash.c + src/libnetdata/c_rhash/c_rhash.h + src/libnetdata/c_rhash/c_rhash_internal.h ) set(TIMEX_PLUGIN_FILES @@ -1355,44 +1465,6 @@ set(TC_PLUGIN_FILES src/collectors/tc.plugin/plugin_tc.c ) -set(LOGS_MANAGEMENT_PLUGIN_FILES - src/logsmanagement/circular_buffer.c - src/logsmanagement/circular_buffer.h - src/logsmanagement/db_api.c - src/logsmanagement/db_api.h - src/logsmanagement/defaults.h - src/logsmanagement/file_info.h - src/logsmanagement/flb_plugin.c - src/logsmanagement/flb_plugin.h - src/logsmanagement/functions.c - src/logsmanagement/functions.h - src/logsmanagement/helper.h - src/logsmanagement/logsmanag_config.c - src/logsmanagement/logsmanag_config.h - src/logsmanagement/logsmanagement.c - src/logsmanagement/parser.c - src/logsmanagement/parser.h - src/logsmanagement/query.c - src/logsmanagement/query.h - src/logsmanagement/rrd_api/rrd_api_docker_ev.c - src/logsmanagement/rrd_api/rrd_api_docker_ev.h - src/logsmanagement/rrd_api/rrd_api_generic.c - src/logsmanagement/rrd_api/rrd_api_generic.h - src/logsmanagement/rrd_api/rrd_api_kernel.c - src/logsmanagement/rrd_api/rrd_api_kernel.h - src/logsmanagement/rrd_api/rrd_api_mqtt.c - src/logsmanagement/rrd_api/rrd_api_mqtt.h - src/logsmanagement/rrd_api/rrd_api_stats.c - src/logsmanagement/rrd_api/rrd_api_stats.h - src/logsmanagement/rrd_api/rrd_api_systemd.c - src/logsmanagement/rrd_api/rrd_api_systemd.h - src/logsmanagement/rrd_api/rrd_api_web_log.c - src/logsmanagement/rrd_api/rrd_api_web_log.h - src/logsmanagement/rrd_api/rrd_api.h - src/database/sqlite/sqlite3.c - src/database/sqlite/sqlite3.h -) - set(NETDATA_FILES src/collectors/all.h ${DAEMON_FILES} @@ -1480,8 +1552,6 @@ set(ACLK_PROTO_DEFS ) set(ACLK_FILES - src/aclk/aclk_stats.c - src/aclk/aclk_stats.h src/aclk/aclk_query.c src/aclk/aclk_query.h src/aclk/aclk_query_queue.c @@ -1521,8 +1591,6 @@ set(ACLK_FILES src/aclk/schema-wrappers/schema_wrapper_utils.h src/aclk/schema-wrappers/agent_cmds.cc src/aclk/schema-wrappers/agent_cmds.h - src/aclk/helpers/mqtt_wss_pal.h - src/aclk/helpers/ringbuffer_pal.h ) @@ -1718,10 +1786,7 @@ endif() # # mqtt library # -if (ENABLE_H2O OR ENABLE_ACLK) - set(ENABLE_MQTTWEBSOCKETS True) -endif() - +set(ENABLE_MQTTWEBSOCKETS True) if(ENABLE_MQTTWEBSOCKETS) add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES}) @@ -1736,20 +1801,17 @@ if(ENABLE_MQTTWEBSOCKETS) endif() -if(ENABLE_ACLK) - # - # proto definitions - # - netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" - "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" - ACLK_PROTO_BUILT_SRCS - ACLK_PROTO_BUILT_HDRS - ${ACLK_PROTO_DEFS}) - - list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS} - ${ACLK_PROTO_BUILT_HDRS}) +# +# proto definitions +# +netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" + "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" + ACLK_PROTO_BUILT_SRCS + ACLK_PROTO_BUILT_HDRS + ${ACLK_PROTO_DEFS}) -endif() +list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS} + ${ACLK_PROTO_BUILT_HDRS}) # # build plugins @@ -1781,6 +1843,9 @@ if(ENABLE_PLUGIN_DEBUGFS) endif() endif() +add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c) +target_link_libraries(spawn-tester libnetdata) + if(ENABLE_PLUGIN_APPS) pkg_check_modules(CAP QUIET libcap) @@ -1934,45 +1999,6 @@ if(ENABLE_PLUGIN_SLABINFO) endif() endif() -if(ENABLE_PLUGIN_LOGS_MANAGEMENT) - set(ENABLE_LOGSMANAGEMENT True) - - if(ENABLE_LOGS_MANAGEMENT_TESTS) - list(APPEND LOGS_MANAGEMENT_PLUGIN_FILES src/logsmanagement/unit_test/unit_test.c - src/logsmanagement/unit_test/unit_test.h) - set(ENABLE_LOGSMANAGEMENT_TESTS True) - endif() - - add_executable(logs-management.plugin ${LOGS_MANAGEMENT_PLUGIN_FILES}) - target_link_libraries(logs-management.plugin libnetdata) - - install(TARGETS logs-management.plugin - COMPONENT plugin-logs-management - DESTINATION usr/libexec/netdata/plugins.d) - - install(DIRECTORY src/logsmanagement/stock_conf/logsmanagement.d - COMPONENT plugin-logs-management - DESTINATION usr/lib/netdata/conf.d) - - install(DIRECTORY - COMPONENT plugin-logs-management - DESTINATION etc/netdata/logsmanagement.d) - - configure_file(src/logsmanagement/stock_conf/logsmanagement.d.conf.in - src/logsmanagement/stock_conf/logsmanagement.d.conf - @ONLY) - - install(FILES ${CMAKE_BINARY_DIR}/src/logsmanagement/stock_conf/logsmanagement.d.conf - COMPONENT plugin-logs-management - DESTINATION usr/lib/netdata/conf.d) - - if(BUILD_FOR_PACKAGING) - install(FILES - ${PKG_FILES_PATH}/copyright - COMPONENT plugin-logs-management - DESTINATION usr/share/doc/netdata-plugin-logs-management) - endif() -endif() if(ENABLE_PLUGIN_CUPS) pkg_check_modules(CUPS libcups) @@ -2014,13 +2040,15 @@ if(ENABLE_PLUGIN_CUPS) endif() endif() -set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c) +if(NEED_NDSUDO) + set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c) -add_executable(ndsudo ${NDSUDO_FILES}) + add_executable(ndsudo ${NDSUDO_FILES}) -install(TARGETS ndsudo - COMPONENT netdata - DESTINATION usr/libexec/netdata/plugins.d) + install(TARGETS ndsudo + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) +endif() if(ENABLE_PLUGIN_CGROUP_NETWORK) set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c) @@ -2240,14 +2268,32 @@ endif() # build netdata (only Linux ATM) # +if(OS_WINDOWS) + set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc") + configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY) + + set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc") + configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY) + + set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc") + configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY) +endif() + add_executable(netdata ${NETDATA_FILES} - "$<$<BOOL:${ENABLE_ACLK}>:${ACLK_FILES}>" + "${ACLK_FILES}" "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>" "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>" "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>" + "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>" ) +if(OS_WINDOWS) + add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES}) + target_link_libraries(NetdataClaim shell32;gdi32;msftedit) + target_compile_options(NetdataClaim PUBLIC -mwindows) +endif() + target_compile_definitions(netdata PRIVATE "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>" ) @@ -2258,7 +2304,7 @@ target_compile_options(netdata PRIVATE ) target_include_directories(netdata PRIVATE - "$<$<BOOL:${ENABLE_ACLK}>:${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas>" + "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas" "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>" "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>" ) @@ -2274,6 +2320,7 @@ target_link_libraries(netdata PRIVATE "$<$<BOOL:${ENABLE_SENTRY}>:sentry>" "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>" "$<$<BOOL:${ENABLE_H2O}>:h2o>" + "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>" ) if(NEED_PROTOBUF) @@ -2344,7 +2391,7 @@ set(NETDATACLI_FILES src/cli/cli.c ) -add_executable(netdatacli ${NETDATACLI_FILES}) +add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>") target_link_libraries(netdatacli libnetdata) install(TARGETS netdatacli @@ -2427,26 +2474,21 @@ set(cachedir_POST "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata") set(registrydir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata/registry") set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata") set(netdata_user_POST "${NETDATA_USER}") +set(netdata_group_POST "${NETDATA_USER}") -# netdata-claim.sh -if(ENABLE_CLOUD) - set(enable_cloud_POST "yes") -else() - set(enable_cloud_POST "no") -endif() - -if(ENABLE_ACLK) - set(enable_aclk_POST "yes") +if(NOT OS_WINDOWS) + configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY) + install(PROGRAMS + ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh + COMPONENT netdata + DESTINATION "${BINDIR}") else() - set(enable_aclk_POST "no") + install(PROGRAMS + ${CMAKE_BINARY_DIR}/NetdataClaim.exe + COMPONENT netdata + DESTINATION "${BINDIR}") endif() -configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY) -install(PROGRAMS - ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh - COMPONENT netdata - DESTINATION "${BINDIR}") - # # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume # the files exists unconditionally. @@ -2518,12 +2560,6 @@ install(PROGRAMS COMPONENT netdata DESTINATION usr/libexec/netdata) -configure_file(system/cron/netdata-updater-daily.in system/cron/netdata-updater-daily @ONLY) -install(FILES - ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily - COMPONENT netdata - DESTINATION usr/lib/netdata/system/cron) - configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY) install(FILES ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist @@ -2531,13 +2567,13 @@ install(FILES DESTINATION usr/lib/netdata/system/launchd) configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY) -install(PROGRAMS +install(FILES ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata COMPONENT netdata DESTINATION usr/lib/netdata/system/freebsd/rc.d) configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY) -install(PROGRAMS +install(FILES ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata COMPONENT netdata DESTINATION usr/lib/netdata/system/initd/init.d) @@ -2553,7 +2589,7 @@ install(FILES DESTINATION etc/logrotate.d) configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY) -install(PROGRAMS +install(FILES ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata COMPONENT netdata DESTINATION usr/lib/netdata/system/lsb/init.d) @@ -2565,13 +2601,13 @@ install(FILES DESTINATION usr/lib/netdata/system/openrc/conf.d) configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY) -install(PROGRAMS +install(FILES ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata COMPONENT netdata DESTINATION usr/lib/netdata/system/openrc/init.d) configure_file(system/runit/run.in system/runit/run @ONLY) -install(PROGRAMS +install(FILES ${CMAKE_BINARY_DIR}/system/runit/run COMPONENT netdata DESTINATION usr/lib/netdata/system/runit) @@ -2599,30 +2635,12 @@ install(FILES COMPONENT netdata DESTINATION usr/lib/netdata/system/systemd) -configure_file(system/systemd/netdata-updater.service.in system/systemd/netdata-updater.service @ONLY) -install(FILES - ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service - COMPONENT netdata - DESTINATION usr/lib/netdata/system/systemd) - -install(FILES - system/systemd/netdata-updater.timer - COMPONENT netdata - DESTINATION usr/lib/netdata/system/systemd) if(BUILD_FOR_PACKAGING) install(FILES ${CMAKE_BINARY_DIR}/system/systemd/netdata.service COMPONENT netdata DESTINATION lib/systemd/system) - install(FILES - ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service - COMPONENT netdata - DESTINATION lib/systemd/system) - install(FILES - system/systemd/netdata-updater.timer - COMPONENT netdata - DESTINATION lib/systemd/system) install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/systemd/journald@netdata.conf.d) @@ -2659,12 +2677,6 @@ else() set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d") endif() -install(FILES - system/netdata.conf - system/netdata-updater.conf - COMPONENT netdata - DESTINATION ${NETDATA_CONF_DEST}) - # # misc files # @@ -2680,10 +2692,50 @@ if(BUILD_FOR_PACKAGING) DESTINATION etc/init.d) endif() -install(PROGRAMS - packaging/installer/netdata-updater.sh - COMPONENT netdata - DESTINATION usr/libexec/netdata) +if(NOT OS_WINDOWS) + install(PROGRAMS + packaging/installer/netdata-updater.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata) + + install(FILES + system/netdata.conf + system/netdata-updater.conf + COMPONENT netdata + DESTINATION ${NETDATA_CONF_DEST}) + + configure_file(system/cron/netdata-updater-daily.in + system/cron/netdata-updater-daily + @ONLY) + install(FILES + ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily + COMPONENT netdata + DESTINATION usr/lib/netdata/system/cron) + + configure_file(system/systemd/netdata-updater.service.in + system/systemd/netdata-updater.service + @ONLY) + install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + + install(FILES + system/systemd/netdata-updater.timer + COMPONENT netdata + DESTINATION usr/lib/netdata/system/systemd) + + if(BUILD_FOR_PACKAGING) + install(FILES + ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service + COMPONENT netdata + DESTINATION lib/systemd/system) + install(FILES + system/systemd/netdata-updater.timer + COMPONENT netdata + DESTINATION lib/systemd/system) + endif() +endif() # # TODO: check the following files for correct substitutions @@ -2721,11 +2773,13 @@ install(PROGRAMS COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d) -install(PROGRAMS - src/health/notifications/alarm-email.sh - src/health/notifications/alarm-test.sh - COMPONENT netdata - DESTINATION usr/libexec/netdata/plugins.d) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(PROGRAMS + src/health/notifications/alarm-email.sh + src/health/notifications/alarm-test.sh + COMPONENT netdata + DESTINATION usr/libexec/netdata/plugins.d) +endif() install(FILES src/health/notifications/health_alarm_notify.conf @@ -2736,22 +2790,23 @@ install(FILES # test/ files # -configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY) -configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY) -configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY) -configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY) -configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY) -configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY) - -install(FILES - ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh - ${CMAKE_BINARY_DIR}/tests/acls/acl.sh - ${CMAKE_BINARY_DIR}/tests/urls/request.sh - ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh - ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh - ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh - DESTINATION usr/libexec/netdata/plugins.d) +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY) + configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY) + configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY) + configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY) + configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY) + configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY) + install(FILES + ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh + ${CMAKE_BINARY_DIR}/tests/acls/acl.sh + ${CMAKE_BINARY_DIR}/tests/urls/request.sh + ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh + ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh + ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh + DESTINATION usr/libexec/netdata/plugins.d) +endif() # # charts.d plugin # @@ -2781,22 +2836,16 @@ install(FILES DESTINATION usr/lib/netdata/conf.d) install(PROGRAMS - src/collectors/charts.d.plugin/ap/ap.chart.sh - src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh src/collectors/charts.d.plugin/example/example.chart.sh src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh src/collectors/charts.d.plugin/opensips/opensips.chart.sh - src/collectors/charts.d.plugin/sensors/sensors.chart.sh COMPONENT plugin-chartsd DESTINATION usr/libexec/netdata/charts.d) install(FILES - src/collectors/charts.d.plugin/ap/ap.conf - src/collectors/charts.d.plugin/apcupsd/apcupsd.conf src/collectors/charts.d.plugin/example/example.conf src/collectors/charts.d.plugin/libreswan/libreswan.conf src/collectors/charts.d.plugin/opensips/opensips.conf - src/collectors/charts.d.plugin/sensors/sensors.conf COMPONENT plugin-chartsd DESTINATION usr/lib/netdata/conf.d/charts.d) @@ -2842,77 +2891,31 @@ install(FILES src/collectors/python.d.plugin/python.d.conf DESTINATION usr/lib/netdata/conf.d) install(FILES - src/collectors/python.d.plugin/alarms/alarms.conf src/collectors/python.d.plugin/am2320/am2320.conf - src/collectors/python.d.plugin/anomalies/anomalies.conf - src/collectors/python.d.plugin/beanstalk/beanstalk.conf - src/collectors/python.d.plugin/boinc/boinc.conf src/collectors/python.d.plugin/ceph/ceph.conf - src/collectors/python.d.plugin/changefinder/changefinder.conf |