CMakeLists.txt 111 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082
  1. # SPDX-License-Identifier: GPL-3.0-or-later
  2. cmake_minimum_required(VERSION 3.16.0...3.30)
  3. list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/Modules")
  4. include(NetdataVersion)
  5. netdata_version()
  6. project(netdata
  7. VERSION "${NETDATA_VERSION_MAJOR}.${NETDATA_VERSION_MINOR}.${NETDATA_VERSION_PATCH}.${NETDATA_VERSION_TWEAK}"
  8. HOMEPAGE_URL "https://www.netdata.cloud"
  9. LANGUAGES C CXX)
  10. include(CMakeDependentOption)
  11. if(DEFINED BUILD_SHARED_LIBS)
  12. if(NOT BUILD_SHARED_LIBS)
  13. set(STATIC_BUILD TRUE)
  14. endif()
  15. endif()
  16. if(STATIC_BUILD)
  17. set(CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_STATIC_LIBRARY_PREFIX}")
  18. set(CMAKE_FIND_LIBRARY_SUFFIXES "${CMAKE_STATIC_LIBRARY_SUFFIX}")
  19. endif()
  20. find_package(PkgConfig REQUIRED)
  21. if(STATIC_BUILD)
  22. list(APPEND PKG_CONFIG_EXECUTABLE "--static")
  23. endif()
  24. set(CMAKE_C_STANDARD 11)
  25. set(CMAKE_CXX_STANDARD 14)
  26. set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME "netdata")
  27. option(USE_CXX_11 "Use C++11 instead of C++14 (should only be used on legacy systems that cannot support C++14, may disable some features)" False)
  28. mark_as_advanced(USE_CXX_11)
  29. if(USE_CXX_11)
  30. set(CMAKE_CXX_STANDARD 11)
  31. endif()
  32. set(CMAKE_C_STANDARD_REQUIRED On)
  33. set(CMAKE_CXX_STANDARD_REQUIRED On)
  34. set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
  35. if(NOT CMAKE_BUILD_TYPE)
  36. set(CMAKE_BUILD_TYPE "Release")
  37. endif()
  38. include(NetdataCompilerFlags)
  39. set(CMAKE_EXPORT_COMPILE_COMMANDS On)
  40. # Check for the mold linker and try to use it if available
  41. option(USE_MOLD "If the MOLD linker is available on the system, use it instead of the default linker." TRUE)
  42. if(USE_MOLD)
  43. message(CHECK_START "Searching for MOLD linker")
  44. find_program(MOLD_LINKER NAMES ld.mold mold)
  45. if(MOLD_LINKER)
  46. execute_process(COMMAND ${MOLD_LINKER} --version
  47. RESULT_VARIABLE MOLD_VERSION_RESULT
  48. OUTPUT_VARIABLE MOLD_VERSION)
  49. if(NOT MOLD_VERSION_RESULT)
  50. string(REPLACE "\n" "" MOLD_VERSION "${MOLD_VERSION}")
  51. message(CHECK_PASS "found (version: ${MOLD_VERSION})")
  52. message(STATUS "Using mold instead of the system default for linking.")
  53. add_link_options("-fuse-ld=mold")
  54. else()
  55. message(CHECK_FAIL "failed")
  56. endif()
  57. else()
  58. message(CHECK_FAIL "failed")
  59. endif()
  60. endif()
  61. set(CONFIG_H_DIR ${CMAKE_BINARY_DIR})
  62. set(CONFIG_H ${CONFIG_H_DIR}/config.h)
  63. #
  64. # detect OS
  65. #
  66. set(OS_FREEBSD False)
  67. set(OS_LINUX False)
  68. set(OS_MACOS False)
  69. set(OS_WINDOWS False)
  70. set(NETDATA_RUNTIME_PREFIX "${CMAKE_INSTALL_PREFIX}")
  71. set(BINDIR usr/sbin)
  72. if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
  73. set(OS_MACOS True)
  74. find_library(IOKIT IOKit)
  75. find_library(FOUNDATION Foundation)
  76. message(STATUS " Compiling for MacOS... ")
  77. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
  78. set(OS_FREEBSD True)
  79. message(STATUS " Compiling for FreeBSD... ")
  80. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
  81. set(OS_LINUX True)
  82. add_definitions(-D_GNU_SOURCE)
  83. message(STATUS " Compiling for Linux... ")
  84. elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  85. set(OS_WINDOWS True)
  86. if(NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/opt/netdata")
  87. message(FATAL_ERROR "CMAKE_INSTALL_PREFIX must be set to /opt/netdata, but it is set to ${CMAKE_INSTALL_PREFIX}")
  88. endif()
  89. if(BUILD_FOR_PACKAGING)
  90. set(NETDATA_RUNTIME_PREFIX "/")
  91. endif()
  92. set(BINDIR usr/bin)
  93. set(CMAKE_RC_COMPILER_INIT windres)
  94. ENABLE_LANGUAGE(RC)
  95. SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
  96. add_definitions(-D_GNU_SOURCE)
  97. if($ENV{CLION_IDE})
  98. # clion needs these to find the includes
  99. if("${CMAKE_SYSTEM_NAME}" STREQUAL "MSYS" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
  100. if("$ENV{MSYSTEM}" STREQUAL "MSYS")
  101. include_directories(c:/msys64/usr/include)
  102. include_directories(c:/msys64/usr/include/w32api)
  103. elseif("$ENV{MSYSTEM}" STREQUAL "MINGW64")
  104. include_directories(c:/msys64/mingw64/include)
  105. elseif("$ENV{MSYSTEM}" STREQUAL "UCRT64")
  106. include_directories(c:/msys64/ucrt64/include)
  107. endif()
  108. endif()
  109. endif()
  110. message(STATUS " Compiling for Windows (${CMAKE_SYSTEM_NAME}, MSYSTEM=$ENV{MSYSTEM})... ")
  111. else()
  112. message(FATAL_ERROR "Unknown/unsupported platform: ${CMAKE_SYSTEM_NAME} (Supported platforms: FreeBSD, Linux, macOS, Windows)")
  113. endif()
  114. # This is intended to make life easier for developers who are working on one
  115. # specific feature.
  116. #
  117. # NOTE: DO NOT USE THIS OPTION FOR PRODUCTION BUILDS.
  118. option(DEFAULT_FEATURE_STATE "Specify the default state for most optional features" True)
  119. mark_as_advanced(DEFAULT_FEATURE_STATE)
  120. # High-level features
  121. option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE})
  122. option(ENABLE_DBENGINE "Enable dbengine metrics storage" True)
  123. # Data collection plugins
  124. option(ENABLE_PLUGIN_GO "Enable metric collectors written in Go" ${DEFAULT_FEATURE_STATE})
  125. cmake_dependent_option(ENABLE_PLUGIN_APPS "Enable per-process resource usage monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
  126. cmake_dependent_option(ENABLE_PLUGIN_CUPS "Enable CUPS monitoring" ${DEFAULT_FEATURE_STATE} "NOT OS_WINDOWS" False)
  127. cmake_dependent_option(ENABLE_PLUGIN_FREEIPMI "Enable IPMI monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX OR OS_FREEBSD" False)
  128. cmake_dependent_option(ENABLE_PLUGIN_CGROUP_NETWORK "Enable Linux CGroup network usage monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  129. cmake_dependent_option(ENABLE_PLUGIN_DEBUGFS "Enable Linux DebugFS metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  130. cmake_dependent_option(ENABLE_PLUGIN_EBPF "Enable Linux eBPF metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  131. cmake_dependent_option(ENABLE_LEGACY_EBPF_PROGRAMS "Enable eBPF programs for kernels without BTF support" True "ENABLE_PLUGIN_EBPF" False)
  132. mark_as_advanced(ENABLE_LEGACY_EBPF_PROGRAMS)
  133. cmake_dependent_option(ENABLE_PLUGIN_LOCAL_LISTENERS "Enable local listening socket tracking (including service auto-discovery support)" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  134. cmake_dependent_option(ENABLE_PLUGIN_NETWORK_VIEWER "Enable network viewer functionality" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  135. cmake_dependent_option(ENABLE_PLUGIN_NFACCT "Enable Linux NFACCT metric collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  136. cmake_dependent_option(ENABLE_PLUGIN_PERF "Enable Linux performance counter monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  137. cmake_dependent_option(ENABLE_PLUGIN_SLABINFO "Enable Linux kernel SLAB allocator monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  138. cmake_dependent_option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "Enable systemd journal log collection" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  139. cmake_dependent_option(ENABLE_PLUGIN_XENSTAT "Enable Xen domain monitoring" ${DEFAULT_FEATURE_STATE} "OS_LINUX" False)
  140. # Metrics exporters
  141. option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "Enable exporting to Prometheus via remote write API" ${DEFAULT_FEATURE_STATE})
  142. option(ENABLE_EXPORTER_MONGODB "Enable exporting to MongoDB" ${DEFAULT_FEATURE_STATE})
  143. # Vendoring
  144. option(ENABLE_BUNDLED_JSONC "Force use of a vendored copy of JSON-C" False)
  145. option(ENABLE_BUNDLED_YAML "Force use of a vendored copy of libyaml" False)
  146. option(ENABLE_BUNDLED_PROTOBUF "Use a vendored copy of protobuf" False)
  147. # Experimental features
  148. option(ENABLE_WEBRTC "Enable WebRTC dashboard communications (experimental)" False)
  149. mark_as_advanced(ENABLE_WEBRTC)
  150. option(ENABLE_H2O "Enable H2O web server (experimental)" True)
  151. mark_as_advanced(ENABLE_H2O)
  152. # Other optional functionality
  153. option(ENABLE_SENTRY "Build with Sentry Native crash reporting" False)
  154. mark_as_advanced(ENABLE_SENTRY)
  155. option(BUILD_FOR_PACKAGING "Include component files for native packages" False)
  156. mark_as_advanced(BUILD_FOR_PACKAGING)
  157. cmake_dependent_option(FORCE_LEGACY_LIBBPF "Force usage of libbpf 0.0.9 instead of the latest version." False "ENABLE_PLUGIN_EBPF" False)
  158. mark_as_advanced(FORCE_LEGACY_LIBBPF)
  159. set(NEED_PROTOBUF True)
  160. if(ENABLE_PLUGIN_GO)
  161. include(NetdataGoTools)
  162. find_min_go_version("${CMAKE_SOURCE_DIR}/src/go")
  163. find_package(Go "${MIN_GO_VERSION}" REQUIRED)
  164. endif()
  165. if(ENABLE_PLUGIN_GO)
  166. set(NEED_NDSUDO TRUE)
  167. else()
  168. set(NEED_NDSUDO FALSE)
  169. endif()
  170. if(ENABLE_WEBRTC)
  171. include(FetchContent)
  172. include(NetdataFetchContentExtra)
  173. # ignore debhelper
  174. set(FETCHCONTENT_FULLY_DISCONNECTED Off)
  175. set(PREFER_SYSTEM_LIB True)
  176. set(NO_MEDIA True)
  177. set(NO_WEBSOCKET True)
  178. set(HAVE_LIBDATACHANNEL True)
  179. FetchContent_Declare(libdatachannel
  180. GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
  181. GIT_TAG v0.20.1
  182. CMAKE_ARGS ${NETDATA_PROPAGATE_TOOLCHAIN_ARGS}
  183. )
  184. FetchContent_MakeAvailable(libdatachannel)
  185. endif()
  186. if(NEED_PROTOBUF)
  187. include(NetdataProtobuf)
  188. if(ENABLE_BUNDLED_PROTOBUF)
  189. netdata_bundle_protobuf()
  190. endif()
  191. endif()
  192. set(PKG_FILES_PATH "${CMAKE_SOURCE_DIR}/packaging/cmake/pkg-files")
  193. if(ENABLE_PLUGIN_EBPF)
  194. include(NetdataLibBPF)
  195. include(NetdataEBPFCORE)
  196. if(NOT OS_LINUX)
  197. message(FATAL_ERROR "The eBPF plugin is not supported on non-Linux systems")
  198. endif()
  199. netdata_bundle_libbpf()
  200. netdata_fetch_ebpf_co_re()
  201. endif()
  202. pkg_check_modules(CURL libcurl>=7.21 REQUIRED IMPORTED_TARGET)
  203. set(HAVE_LIBCURL TRUE)
  204. #
  205. # Libm
  206. #
  207. # checks link with cmake required libs
  208. cmake_policy(SET CMP0075 NEW)
  209. include(CheckFunctionExists)
  210. check_function_exists(log10 HAVE_LOG10)
  211. if(NOT HAVE_LOG10)
  212. unset(HAVE_LOG10 CACHE)
  213. list(APPEND CMAKE_REQUIRED_LIBRARIES m)
  214. check_function_exists(log10 HAVE_LOG10)
  215. if(HAVE_LOG10)
  216. set(LINK_LIBM True)
  217. else()
  218. message(FATAL_ERROR "Can not use log10 with/without libm.")
  219. endif()
  220. endif()
  221. #
  222. # Custom Modules
  223. #
  224. include(NetdataJSONC)
  225. include(NetdataYAML)
  226. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  227. include(NetdataEBPFLegacy)
  228. endif()
  229. if(ENABLE_SENTRY)
  230. include(NetdataSentry)
  231. endif()
  232. #
  233. # Checks from custom modules
  234. #
  235. netdata_detect_jsonc()
  236. netdata_detect_libyaml()
  237. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  238. netdata_fetch_legacy_ebpf_code()
  239. endif()
  240. if(ENABLE_SENTRY)
  241. netdata_bundle_sentry()
  242. endif()
  243. #
  244. # check include files
  245. #
  246. include(CheckIncludeFile)
  247. check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
  248. check_include_file("resolv.h" HAVE_RESOLV_H)
  249. check_include_file("netdb.h" HAVE_NETDB_H)
  250. check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
  251. check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
  252. check_include_file("sys/vfs.h" HAVE_SYS_VFS_H)
  253. check_include_file("sys/statfs.h" HAVE_SYS_STATFS_H)
  254. check_include_file("linux/magic.h" HAVE_LINUX_MAGIC_H)
  255. check_include_file("sys/mount.h" HAVE_SYS_MOUNT_H)
  256. check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H)
  257. check_include_file("inttypes.h" HAVE_INTTYPES_H)
  258. check_include_file("stdint.h" HAVE_STDINT_H)
  259. check_include_file("sys/capability.h" HAVE_SYS_CAPABILITY_H)
  260. check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
  261. check_include_file("netinet/tcp.h" HAVE_NETINET_TCP_H)
  262. check_include_file("sys/ioctl.h" HAVE_SYS_IOCTL_H)
  263. check_include_file("grp.h" HAVE_GRP_H)
  264. check_include_file("pwd.h" HAVE_PWD_H)
  265. check_include_file("net/if.h" HAVE_NET_IF_H)
  266. check_include_file("poll.h" HAVE_POLL_H)
  267. check_include_file("syslog.h" HAVE_SYSLOG_H)
  268. check_include_file("sys/mman.h" HAVE_SYS_MMAN_H)
  269. check_include_file("sys/resource.h" HAVE_SYS_RESOURCE_H)
  270. check_include_file("sys/socket.h" HAVE_SYS_SOCKET_H)
  271. check_include_file("sys/wait.h" HAVE_SYS_WAIT_H)
  272. check_include_file("sys/un.h" HAVE_SYS_UN_H)
  273. check_include_file("spawn.h" HAVE_SPAWN_H)
  274. #
  275. # check symbols
  276. #
  277. include(CheckSymbolExists)
  278. check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
  279. check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
  280. check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
  281. check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
  282. check_symbol_exists(finite "math.h" HAVE_FINITE)
  283. check_symbol_exists(isfinite "math.h" HAVE_ISFINITE)
  284. check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM)
  285. check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP)
  286. check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
  287. check_function_exists(gettid HAVE_GETTID)
  288. check_function_exists(waitid HAVE_WAITID)
  289. check_function_exists(nice HAVE_NICE)
  290. check_function_exists(recvmmsg HAVE_RECVMMSG)
  291. check_function_exists(getpriority HAVE_GETPRIORITY)
  292. check_function_exists(setenv HAVE_SETENV)
  293. check_function_exists(strndup HAVE_STRNDUP)
  294. check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER)
  295. check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER)
  296. check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
  297. check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
  298. check_function_exists(close_range HAVE_CLOSE_RANGE)
  299. check_function_exists(backtrace HAVE_BACKTRACE)
  300. #
  301. # check source compilation
  302. #
  303. include(CheckCSourceCompiles)
  304. include(CheckCXXSourceCompiles)
  305. set(CMAKE_REQUIRED_LIBRARIES pthread)
  306. check_c_source_compiles("
  307. #define _GNU_SOURCE
  308. #include <pthread.h>
  309. int main() {
  310. char name[16];
  311. pthread_t thread = pthread_self();
  312. return pthread_getname_np(thread, name, sizeof(name));
  313. }
  314. " HAVE_PTHREAD_GETNAME_NP)
  315. check_c_source_compiles("
  316. #include <stdio.h>
  317. #define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u')
  318. int main() {
  319. char type = mytype(0);
  320. return 0;
  321. }
  322. " HAVE_C__GENERIC)
  323. check_c_source_compiles("
  324. #include <malloc.h>
  325. int main() {
  326. mallopt(M_ARENA_MAX, 1);
  327. mallopt(M_PERTURB, 0x5A);
  328. return 0;
  329. }
  330. " HAVE_C_MALLOPT)
  331. check_c_source_compiles("
  332. #define _GNU_SOURCE
  333. #include <stdio.h>
  334. #include <sys/socket.h>
  335. int main() {
  336. accept4(0, NULL, NULL, 0);
  337. return 0;
  338. }
  339. " HAVE_ACCEPT4)
  340. check_c_source_compiles("
  341. #define _GNU_SOURCE
  342. #include <string.h>
  343. int main() {
  344. char x = *strerror_r(0, &x, sizeof(x)); return 0;
  345. }
  346. " STRERROR_R_CHAR_P)
  347. check_c_source_compiles("
  348. #ifndef _GNU_SOURCE
  349. #define _GNU_SOURCE
  350. #endif
  351. #include <sched.h>
  352. int main() {
  353. setns(0, 0); return 0;
  354. }
  355. " HAVE_SETNS)
  356. check_cxx_source_compiles("
  357. int main() {
  358. __atomic_load_8(nullptr, 0);
  359. return 0;
  360. }
  361. " HAVE_BUILTIN_ATOMICS)
  362. check_c_source_compiles("
  363. void my_printf(char const *s, ...) __attribute__((format(gnu_printf, 1, 2)));
  364. int main() { return 0; }
  365. " HAVE_FUNC_ATTRIBUTE_FORMAT_GNU_PRINTF FAIL_REGEX "warning:")
  366. check_c_source_compiles("
  367. void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
  368. int main() { return 0; }
  369. " HAVE_FUNC_ATTRIBUTE_FORMAT_PRINTF FAIL_REGEX "warning:")
  370. check_c_source_compiles("
  371. #include <stdio.h>
  372. #include <stdlib.h>
  373. #include <unistd.h>
  374. void* my_alloc(size_t size) __attribute__((malloc));
  375. int main() {
  376. void *x = my_alloc(1);
  377. free(x);
  378. return 0;
  379. }
  380. void* my_alloc(size_t size) {
  381. void *ret = malloc(size);
  382. if(!ret) exit(1);
  383. return ret;
  384. }
  385. " HAVE_FUNC_ATTRIBUTE_MALLOC)
  386. check_c_source_compiles("
  387. void my_function() __attribute__((noinline));
  388. int main() { my_function(); return 0; }
  389. void my_function() { ; }
  390. " HAVE_FUNC_ATTRIBUTE_NOINLINE)
  391. check_c_source_compiles("
  392. void my_exit_function() __attribute__((noreturn));
  393. int main() {
  394. my_exit_function(); // Call the noreturn function
  395. return 0;
  396. }
  397. void my_exit_function() {
  398. exit(1);
  399. }
  400. " HAVE_FUNC_ATTRIBUTE_NORETURN)
  401. check_c_source_compiles("
  402. #include <stdio.h>
  403. #include <stdlib.h>
  404. #include <unistd.h>
  405. void* my_alloc(size_t size) __attribute__((returns_nonnull));
  406. int main() {
  407. void* ptr = my_alloc(10);
  408. free(ptr);
  409. return 0;
  410. }
  411. void* my_alloc(size_t size) {
  412. void *ret = malloc(size);
  413. if(!ret) exit(1);
  414. return ret;
  415. }
  416. " HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL)
  417. check_c_source_compiles("
  418. int my_function() __attribute__((warn_unused_result));
  419. int main() {
  420. return my_function();
  421. }
  422. int my_function() {
  423. return 1;
  424. }
  425. " HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT)
  426. if(OS_FREEBSD OR OS_MACOS)
  427. set(HAVE_BUILTIN_ATOMICS True)
  428. endif()
  429. # openssl/crypto
  430. pkg_check_modules(TLS IMPORTED_TARGET openssl)
  431. if(NOT TARGET PkgConfig::TLS)
  432. if(OS_MACOS)
  433. execute_process(COMMAND
  434. brew --prefix --installed openssl
  435. RESULT_VARIABLE BREW_OPENSSL
  436. OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
  437. OUTPUT_STRIP_TRAILING_WHITESPACE)
  438. if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
  439. message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
  440. endif()
  441. add_library(PkgConfig::CRYPTO IMPORTED)
  442. set_target_properties(PkgConfig::CRYPTO
  443. IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libcrypto.dylib
  444. INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
  445. add_library(PkgConfig::TLS IMPORTED)
  446. set_target_properties(PkgConfig::TLS
  447. IMPORTED_LOCATION ${BREW_OPENSSL_PREFIX}/lib/libssl.dylib
  448. INTERFACE_LINK_LIBRARIES PkgConfig::CRYPTO
  449. INTERFACE_INCLUDE_DIRECTORIES ${BREW_OPENSSL_PREFIX}/include)
  450. else()
  451. message(FATAL_ERROR "OpenSSL (or LibreSSL) is required for building Netdata, but could not be found.")
  452. endif()
  453. else()
  454. pkg_check_modules(CRYPTO IMPORTED_TARGET REQUIRED libcrypto)
  455. endif()
  456. #
  457. # figure out if we need protoc/protobuf
  458. #
  459. if(NEED_PROTOBUF)
  460. netdata_detect_protobuf()
  461. endif()
  462. #
  463. # source files
  464. #
  465. set(LIBJUDY_PREV_FILES
  466. src/libnetdata/libjudy/src/JudyL/JudyLPrev.c
  467. src/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c
  468. )
  469. set(LIBJUDY_NEXT_FILES
  470. src/libnetdata/libjudy/src/JudyL/JudyLNext.c
  471. src/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c
  472. )
  473. set(LIBJUDY_SOURCES
  474. src/libnetdata/libjudy/src/Judy.h
  475. src/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c
  476. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h
  477. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h
  478. src/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h
  479. src/libnetdata/libjudy/src/JudyL/JudyL.h
  480. src/libnetdata/libjudy/src/JudyL/JudyLByCount.c
  481. src/libnetdata/libjudy/src/JudyL/JudyLCascade.c
  482. src/libnetdata/libjudy/src/JudyL/JudyLCount.c
  483. src/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c
  484. src/libnetdata/libjudy/src/JudyL/JudyLDecascade.c
  485. src/libnetdata/libjudy/src/JudyL/JudyLDel.c
  486. src/libnetdata/libjudy/src/JudyL/JudyLFirst.c
  487. src/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c
  488. src/libnetdata/libjudy/src/JudyL/j__udyLGet.c
  489. src/libnetdata/libjudy/src/JudyL/JudyLGet.c
  490. src/libnetdata/libjudy/src/JudyL/JudyLInsArray.c
  491. src/libnetdata/libjudy/src/JudyL/JudyLIns.c
  492. src/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c
  493. src/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c
  494. src/libnetdata/libjudy/src/JudyL/JudyLMemActive.c
  495. src/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c
  496. src/libnetdata/libjudy/src/JudyL/JudyLTables.c
  497. src/libnetdata/libjudy/src/JudyHS/JudyHS.c
  498. ${LIBJUDY_PREV_FILES}
  499. ${LIBJUDY_NEXT_FILES}
  500. )
  501. set(LIBNETDATA_FILES
  502. ${CONFIG_H}
  503. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.c
  504. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h
  505. src/libnetdata/config/appconfig.c
  506. src/libnetdata/config/appconfig.h
  507. src/libnetdata/aral/aral.c
  508. src/libnetdata/aral/aral.h
  509. src/libnetdata/avl/avl.c
  510. src/libnetdata/avl/avl.h
  511. src/libnetdata/buffer/buffer.c
  512. src/libnetdata/buffer/buffer.h
  513. src/libnetdata/ringbuffer/ringbuffer.c
  514. src/libnetdata/ringbuffer/ringbuffer.h
  515. src/libnetdata/circular_buffer/circular_buffer.c
  516. src/libnetdata/circular_buffer/circular_buffer.h
  517. src/libnetdata/clocks/clocks.c
  518. src/libnetdata/clocks/clocks.h
  519. src/libnetdata/completion/completion.c
  520. src/libnetdata/completion/completion.h
  521. src/libnetdata/datetime/iso8601.c
  522. src/libnetdata/datetime/iso8601.h
  523. src/libnetdata/datetime/rfc7231.c
  524. src/libnetdata/datetime/rfc7231.h
  525. src/libnetdata/datetime/rfc3339.c
  526. src/libnetdata/datetime/rfc3339.h
  527. src/libnetdata/dictionary/dictionary.c
  528. src/libnetdata/dictionary/dictionary.h
  529. src/libnetdata/eval/eval.c
  530. src/libnetdata/eval/eval.h
  531. src/libnetdata/facets/facets.c
  532. src/libnetdata/facets/facets.h
  533. src/libnetdata/functions_evloop/functions_evloop.c
  534. src/libnetdata/functions_evloop/functions_evloop.h
  535. src/libnetdata/gorilla/gorilla.cc
  536. src/libnetdata/gorilla/gorilla.h
  537. src/libnetdata/july/july.c
  538. src/libnetdata/july/july.h
  539. src/libnetdata/inlined.h
  540. src/libnetdata/json/json.c
  541. src/libnetdata/json/json.h
  542. src/libnetdata/json/jsmn.c
  543. src/libnetdata/json/jsmn.h
  544. src/libnetdata/libnetdata.c
  545. src/libnetdata/libnetdata.h
  546. src/libnetdata/line_splitter/line_splitter.c
  547. src/libnetdata/line_splitter/line_splitter.h
  548. src/libnetdata/libnetdata.h
  549. src/libnetdata/locks/locks.c
  550. src/libnetdata/locks/locks.h
  551. src/libnetdata/log/journal.c
  552. src/libnetdata/log/journal.h
  553. src/libnetdata/log/log.c
  554. src/libnetdata/log/log.h
  555. src/libnetdata/os/os.c
  556. src/libnetdata/os/os.h
  557. src/libnetdata/simple_hashtable.h
  558. src/libnetdata/os/byteorder.h
  559. src/libnetdata/onewayalloc/onewayalloc.c
  560. src/libnetdata/onewayalloc/onewayalloc.h
  561. src/libnetdata/procfile/procfile.c
  562. src/libnetdata/procfile/procfile.h
  563. src/libnetdata/query_progress/progress.c
  564. src/libnetdata/query_progress/progress.h
  565. src/libnetdata/required_dummies.h
  566. src/libnetdata/socket/security.c
  567. src/libnetdata/socket/security.h
  568. src/libnetdata/simple_pattern/simple_pattern.c
  569. src/libnetdata/simple_pattern/simple_pattern.h
  570. src/libnetdata/socket/socket.c
  571. src/libnetdata/socket/socket.h
  572. src/libnetdata/statistical/statistical.c
  573. src/libnetdata/statistical/statistical.h
  574. src/libnetdata/storage_number/storage_number.c
  575. src/libnetdata/storage_number/storage_number.h
  576. src/libnetdata/string/string.c
  577. src/libnetdata/string/string.h
  578. src/libnetdata/threads/threads.c
  579. src/libnetdata/threads/threads.h
  580. src/libnetdata/url/url.c
  581. src/libnetdata/url/url.h
  582. src/libnetdata/uuid/uuid.c
  583. src/libnetdata/uuid/uuid.h
  584. src/libnetdata/string/utf8.h
  585. src/libnetdata/worker_utilization/worker_utilization.c
  586. src/libnetdata/worker_utilization/worker_utilization.h
  587. src/libnetdata/http/http_access.c
  588. src/libnetdata/http/http_access.h
  589. src/libnetdata/http/http_defs.c
  590. src/libnetdata/http/http_defs.h
  591. src/libnetdata/http/content_type.c
  592. src/libnetdata/http/content_type.h
  593. src/libnetdata/config/dyncfg.c
  594. src/libnetdata/config/dyncfg.h
  595. src/libnetdata/json/json-c-parser-inline.h
  596. src/libnetdata/template-enum.h
  597. src/libnetdata/dictionary/dictionary-internals.h
  598. src/libnetdata/dictionary/dictionary-unittest.c
  599. src/libnetdata/dictionary/thread-cache.c
  600. src/libnetdata/dictionary/thread-cache.h
  601. src/libnetdata/dictionary/dictionary-traversal.c
  602. src/libnetdata/dictionary/dictionary-statistics.h
  603. src/libnetdata/dictionary/dictionary-locks.h
  604. src/libnetdata/dictionary/dictionary-refcount.h
  605. src/libnetdata/dictionary/dictionary-hashtable.h
  606. src/libnetdata/dictionary/dictionary-item.h
  607. src/libnetdata/dictionary/dictionary-callbacks.h
  608. src/libnetdata/linked-lists.h
  609. src/libnetdata/storage-point.h
  610. src/libnetdata/bitmap64.h
  611. src/libnetdata/os/gettid.c
  612. src/libnetdata/os/gettid.h
  613. src/libnetdata/os/adjtimex.c
  614. src/libnetdata/os/adjtimex.h
  615. src/libnetdata/os/setresuid.c
  616. src/libnetdata/os/setresuid.h
  617. src/libnetdata/os/setresgid.c
  618. src/libnetdata/os/setresgid.h
  619. src/libnetdata/os/getgrouplist.c
  620. src/libnetdata/os/getgrouplist.h
  621. src/libnetdata/os/get_pid_max.c
  622. src/libnetdata/os/get_pid_max.h
  623. src/libnetdata/os/os-freebsd-wrappers.c
  624. src/libnetdata/os/os-freebsd-wrappers.h
  625. src/libnetdata/os/os-macos-wrappers.c
  626. src/libnetdata/os/os-macos-wrappers.h
  627. src/libnetdata/os/os-windows-wrappers.c
  628. src/libnetdata/os/os-windows-wrappers.h
  629. src/libnetdata/os/get_system_cpus.c
  630. src/libnetdata/os/get_system_cpus.h
  631. src/libnetdata/os/tinysleep.c
  632. src/libnetdata/os/tinysleep.h
  633. src/libnetdata/os/uuid_generate.c
  634. src/libnetdata/os/uuid_generate.h
  635. src/libnetdata/os/setenv.c
  636. src/libnetdata/os/setenv.h
  637. src/libnetdata/os/strndup.c
  638. src/libnetdata/os/strndup.h
  639. src/libnetdata/spawn_server/spawn_server_nofork.c
  640. src/libnetdata/spawn_server/spawn_server.h
  641. src/libnetdata/spawn_server/spawn_popen.c
  642. src/libnetdata/spawn_server/spawn_popen.h
  643. src/libnetdata/spawn_server/spawn_server_windows.c
  644. src/libnetdata/spawn_server/spawn_server_internals.h
  645. src/libnetdata/spawn_server/spawn_server_libuv.c
  646. src/libnetdata/spawn_server/spawn_server_posix.c
  647. src/libnetdata/spawn_server/spawn_library.c
  648. src/libnetdata/spawn_server/spawn_library.h
  649. src/libnetdata/os/close_range.c
  650. src/libnetdata/os/close_range.h
  651. src/libnetdata/os/setproctitle.c
  652. src/libnetdata/os/setproctitle.h
  653. src/libnetdata/paths/paths.c
  654. src/libnetdata/paths/paths.h
  655. src/libnetdata/json/json-c-parser-inline.c
  656. )
  657. if(ENABLE_PLUGIN_EBPF)
  658. list(APPEND LIBNETDATA_FILES
  659. src/libnetdata/ebpf/ebpf.c
  660. src/libnetdata/ebpf/ebpf.h
  661. )
  662. endif()
  663. set(LIBH2O_FILES
  664. src/web/server/h2o/libh2o/deps/cloexec/cloexec.c
  665. src/web/server/h2o/libh2o/deps/libgkc/gkc.c
  666. src/web/server/h2o/libh2o/deps/libyrmcds/close.c
  667. src/web/server/h2o/libh2o/deps/libyrmcds/connect.c
  668. src/web/server/h2o/libh2o/deps/libyrmcds/recv.c
  669. src/web/server/h2o/libh2o/deps/libyrmcds/send.c
  670. src/web/server/h2o/libh2o/deps/libyrmcds/send_text.c
  671. src/web/server/h2o/libh2o/deps/libyrmcds/socket.c
  672. src/web/server/h2o/libh2o/deps/libyrmcds/strerror.c
  673. src/web/server/h2o/libh2o/deps/libyrmcds/text_mode.c
  674. src/web/server/h2o/libh2o/deps/picohttpparser/picohttpparser.c
  675. src/web/server/h2o/libh2o/lib/common/cache.c
  676. src/web/server/h2o/libh2o/lib/common/file.c
  677. src/web/server/h2o/libh2o/lib/common/filecache.c
  678. src/web/server/h2o/libh2o/lib/common/hostinfo.c
  679. src/web/server/h2o/libh2o/lib/common/http1client.c
  680. src/web/server/h2o/libh2o/lib/common/memcached.c
  681. src/web/server/h2o/libh2o/lib/common/memory.c
  682. src/web/server/h2o/libh2o/lib/common/multithread.c
  683. src/web/server/h2o/libh2o/lib/common/serverutil.c
  684. src/web/server/h2o/libh2o/lib/common/socket.c
  685. src/web/server/h2o/libh2o/lib/common/socketpool.c
  686. src/web/server/h2o/libh2o/lib/common/string.c
  687. src/web/server/h2o/libh2o/lib/common/time.c
  688. src/web/server/h2o/libh2o/lib/common/timeout.c
  689. src/web/server/h2o/libh2o/lib/common/url.c
  690. src/web/server/h2o/libh2o/lib/core/config.c
  691. src/web/server/h2o/libh2o/lib/core/configurator.c
  692. src/web/server/h2o/libh2o/lib/core/context.c
  693. src/web/server/h2o/libh2o/lib/core/headers.c
  694. src/web/server/h2o/libh2o/lib/core/logconf.c
  695. src/web/server/h2o/libh2o/lib/core/proxy.c
  696. src/web/server/h2o/libh2o/lib/core/request.c
  697. src/web/server/h2o/libh2o/lib/core/token.c
  698. src/web/server/h2o/libh2o/lib/core/util.c
  699. src/web/server/h2o/libh2o/lib/handler/access_log.c
  700. src/web/server/h2o/libh2o/lib/handler/chunked.c
  701. src/web/server/h2o/libh2o/lib/handler/compress.c
  702. src/web/server/h2o/libh2o/lib/handler/compress/gzip.c
  703. src/web/server/h2o/libh2o/lib/handler/errordoc.c
  704. src/web/server/h2o/libh2o/lib/handler/expires.c
  705. src/web/server/h2o/libh2o/lib/handler/fastcgi.c
  706. src/web/server/h2o/libh2o/lib/handler/file.c
  707. src/web/server/h2o/libh2o/lib/handler/headers.c
  708. src/web/server/h2o/libh2o/lib/handler/mimemap.c
  709. src/web/server/h2o/libh2o/lib/handler/proxy.c
  710. src/web/server/h2o/libh2o/lib/handler/redirect.c
  711. src/web/server/h2o/libh2o/lib/handler/reproxy.c
  712. src/web/server/h2o/libh2o/lib/handler/throttle_resp.c
  713. src/web/server/h2o/libh2o/lib/handler/status.c
  714. src/web/server/h2o/libh2o/lib/handler/headers_util.c
  715. src/web/server/h2o/libh2o/lib/handler/status/events.c
  716. src/web/server/h2o/libh2o/lib/handler/status/requests.c
  717. src/web/server/h2o/libh2o/lib/handler/http2_debug_state.c
  718. src/web/server/h2o/libh2o/lib/handler/status/durations.c
  719. src/web/server/h2o/libh2o/lib/handler/configurator/access_log.c
  720. src/web/server/h2o/libh2o/lib/handler/configurator/compress.c
  721. src/web/server/h2o/libh2o/lib/handler/configurator/errordoc.c
  722. src/web/server/h2o/libh2o/lib/handler/configurator/expires.c
  723. src/web/server/h2o/libh2o/lib/handler/configurator/fastcgi.c
  724. src/web/server/h2o/libh2o/lib/handler/configurator/file.c
  725. src/web/server/h2o/libh2o/lib/handler/configurator/headers.c
  726. src/web/server/h2o/libh2o/lib/handler/configurator/proxy.c
  727. src/web/server/h2o/libh2o/lib/handler/configurator/redirect.c
  728. src/web/server/h2o/libh2o/lib/handler/configurator/reproxy.c
  729. src/web/server/h2o/libh2o/lib/handler/configurator/throttle_resp.c
  730. src/web/server/h2o/libh2o/lib/handler/configurator/status.c
  731. src/web/server/h2o/libh2o/lib/handler/configurator/http2_debug_state.c
  732. src/web/server/h2o/libh2o/lib/handler/configurator/headers_util.c
  733. src/web/server/h2o/libh2o/lib/http1.c
  734. src/web/server/h2o/libh2o/lib/tunnel.c
  735. src/web/server/h2o/libh2o/lib/http2/cache_digests.c
  736. src/web/server/h2o/libh2o/lib/http2/casper.c
  737. src/web/server/h2o/libh2o/lib/http2/connection.c
  738. src/web/server/h2o/libh2o/lib/http2/frame.c
  739. src/web/server/h2o/libh2o/lib/http2/hpack.c
  740. src/web/server/h2o/libh2o/lib/http2/scheduler.c
  741. src/web/server/h2o/libh2o/lib/http2/stream.c
  742. src/web/server/h2o/libh2o/lib/http2/http2_debug_state.c
  743. )
  744. set(DAEMON_FILES
  745. src/daemon/buildinfo.c
  746. src/daemon/buildinfo.h
  747. src/daemon/common.c
  748. src/daemon/common.h
  749. src/daemon/daemon.c
  750. src/daemon/daemon.h
  751. src/daemon/libuv_workers.c
  752. src/daemon/libuv_workers.h
  753. src/daemon/global_statistics.c
  754. src/daemon/global_statistics.h
  755. src/daemon/analytics.c
  756. src/daemon/analytics.h
  757. src/daemon/main.c
  758. src/daemon/main.h
  759. src/daemon/environment.c
  760. src/daemon/win_system-info.c
  761. src/daemon/win_system-info.h
  762. src/daemon/signals.c
  763. src/daemon/signals.h
  764. src/daemon/service.c
  765. src/daemon/watcher.c
  766. src/daemon/watcher.h
  767. src/daemon/static_threads.c
  768. src/daemon/static_threads.h
  769. src/daemon/commands.c
  770. src/daemon/commands.h
  771. src/daemon/pipename.c
  772. src/daemon/pipename.h
  773. src/daemon/unit_test.c
  774. src/daemon/unit_test.h
  775. src/daemon/config/dyncfg.c
  776. src/daemon/config/dyncfg.h
  777. src/daemon/config/dyncfg-files.c
  778. src/daemon/config/dyncfg-unittest.c
  779. src/daemon/config/dyncfg-inline.c
  780. src/daemon/config/dyncfg-echo.c
  781. src/daemon/config/dyncfg-internals.h
  782. src/daemon/config/dyncfg-intercept.c
  783. src/daemon/config/dyncfg-tree.c
  784. )
  785. set(H2O_FILES
  786. src/web/server/h2o/http_server.c
  787. src/web/server/h2o/http_server.h
  788. src/web/server/h2o/h2o_utils.c
  789. src/web/server/h2o/h2o_utils.h
  790. src/web/server/h2o/streaming.c
  791. src/web/server/h2o/streaming.h
  792. src/web/server/h2o/connlist.c
  793. src/web/server/h2o/connlist.h
  794. )
  795. if(ENABLE_H2O)
  796. list(APPEND DAEMON_FILES ${H2O_FILES})
  797. endif()
  798. set(API_PLUGIN_FILES
  799. src/web/api/web_api.c
  800. src/web/api/web_api.h
  801. src/web/api/web_api_v1.c
  802. src/web/api/web_api_v1.h
  803. src/web/api/web_api_v2.c
  804. src/web/api/web_api_v2.h
  805. src/web/api/web_api_v3.c
  806. src/web/api/web_api_v3.h
  807. src/web/api/http_auth.c
  808. src/web/api/http_auth.h
  809. src/web/api/http_header.c
  810. src/web/api/http_header.h
  811. src/web/api/maps/rrdr_options.c
  812. src/web/api/maps/rrdr_options.h
  813. src/web/api/maps/contexts_options.c
  814. src/web/api/maps/contexts_options.h
  815. src/web/api/maps/datasource_formats.c
  816. src/web/api/maps/datasource_formats.h
  817. src/web/api/maps/maps.h
  818. src/web/api/maps/contexts_alert_statuses.c
  819. src/web/api/maps/contexts_alert_statuses.h
  820. src/web/api/v1/api_v1_allmetrics.c
  821. src/web/api/v1/api_v1_badge/web_buffer_svg.c
  822. src/web/api/v1/api_v1_function.c
  823. src/web/api/v1/api_v1_manage.c
  824. src/web/api/v1/api_v1_calls.h
  825. src/web/api/v1/api_v1_dbengine.c
  826. src/web/api/v1/api_v1_config.c
  827. src/web/api/v1/api_v1_functions.c
  828. src/web/api/v1/api_v1_weights.c
  829. src/web/api/v1/api_v1_info.c
  830. src/web/api/v1/api_v1_registry.c
  831. src/web/api/v1/api_v1_data.c
  832. src/web/api/v1/api_v1_contexts.c
  833. src/web/api/v1/api_v1_ml_info.c
  834. src/web/api/v1/api_v1_aclk.c
  835. src/web/api/v1/api_v1_context.c
  836. src/web/api/v1/api_v1_alarms.c
  837. src/web/api/v1/api_v1_charts.c
  838. src/web/api/v2/api_v2_info.c
  839. src/web/api/v2/api_v2_nodes.c
  840. src/web/api/v2/api_v2_node_instances.c
  841. src/web/api/v2/api_v2_q.c
  842. src/web/api/v2/api_v2_versions.c
  843. src/web/api/v2/api_v2_functions.c
  844. src/web/api/v2/api_v2_alerts.c
  845. src/web/api/v2/api_v2_alert_transitions.c
  846. src/web/api/v2/api_v2_ilove/ilove.c
  847. src/web/api/v2/api_v2_bearer.c
  848. src/web/api/v2/api_v2_calls.h
  849. src/web/api/v2/api_v2_data.c
  850. src/web/api/v2/api_v2_progress.c
  851. src/web/api/v2/api_v2_weights.c
  852. src/web/api/v2/api_v2_alert_config.c
  853. src/web/api/v2/api_v2_contexts.c
  854. src/web/api/v2/api_v2_claim.c
  855. src/web/api/v2/api_v2_webrtc.c
  856. src/web/api/v3/api_v3_calls.h
  857. src/web/api/v3/api_v3_settings.c
  858. src/web/api/functions/functions.c
  859. src/web/api/functions/functions.h
  860. src/web/api/functions/function-progress.c
  861. src/web/api/functions/function-progress.h
  862. src/web/api/functions/function-streaming.c
  863. src/web/api/functions/function-streaming.h
  864. src/web/api/queries/rrdr.c
  865. src/web/api/queries/rrdr.h
  866. src/web/api/queries/query.c
  867. src/web/api/queries/query.h
  868. src/web/api/queries/average/average.c
  869. src/web/api/queries/average/average.h
  870. src/web/api/queries/countif/countif.c
  871. src/web/api/queries/countif/countif.h
  872. src/web/api/queries/incremental_sum/incremental_sum.c
  873. src/web/api/queries/incremental_sum/incremental_sum.h
  874. src/web/api/queries/max/max.c
  875. src/web/api/queries/max/max.h
  876. src/web/api/queries/min/min.c
  877. src/web/api/queries/min/min.h
  878. src/web/api/queries/sum/sum.c
  879. src/web/api/queries/sum/sum.h
  880. src/web/api/queries/median/median.c
  881. src/web/api/queries/median/median.h
  882. src/web/api/queries/percentile/percentile.c
  883. src/web/api/queries/percentile/percentile.h
  884. src/web/api/queries/stddev/stddev.c
  885. src/web/api/queries/stddev/stddev.h
  886. src/web/api/queries/ses/ses.c
  887. src/web/api/queries/ses/ses.h
  888. src/web/api/queries/des/des.c
  889. src/web/api/queries/des/des.h
  890. src/web/api/queries/trimmed_mean/trimmed_mean.c
  891. src/web/api/queries/trimmed_mean/trimmed_mean.h
  892. src/web/api/queries/weights.c
  893. src/web/api/queries/weights.h
  894. src/web/api/formatters/rrd2json.c
  895. src/web/api/formatters/rrd2json.h
  896. src/web/api/formatters/csv/csv.c
  897. src/web/api/formatters/csv/csv.h
  898. src/web/api/formatters/json/json.c
  899. src/web/api/formatters/json/json.h
  900. src/web/api/formatters/ssv/ssv.c
  901. src/web/api/formatters/ssv/ssv.h
  902. src/web/api/formatters/value/value.c
  903. src/web/api/formatters/value/value.h
  904. src/web/api/formatters/json_wrapper.c
  905. src/web/api/formatters/json_wrapper.h
  906. src/web/api/formatters/charts2json.c
  907. src/web/api/formatters/charts2json.h
  908. src/web/api/formatters/rrdset2json.c
  909. src/web/api/formatters/rrdset2json.h
  910. src/web/rtc/webrtc.c
  911. src/web/rtc/webrtc.h
  912. src/web/api/functions/function-bearer_get_token.c
  913. src/web/api/functions/function-bearer_get_token.h
  914. src/web/api/v3/api_v3_me.c
  915. )
  916. set(EXPORTING_ENGINE_FILES
  917. src/exporting/exporting_engine.c
  918. src/exporting/exporting_engine.h
  919. src/exporting/graphite/graphite.c
  920. src/exporting/graphite/graphite.h
  921. src/exporting/json/json.c
  922. src/exporting/json/json.h
  923. src/exporting/opentsdb/opentsdb.c
  924. src/exporting/opentsdb/opentsdb.h
  925. src/exporting/prometheus/prometheus.c
  926. src/exporting/prometheus/prometheus.h
  927. src/exporting/read_config.c
  928. src/exporting/clean_connectors.c
  929. src/exporting/init_connectors.c
  930. src/exporting/process_data.c
  931. src/exporting/check_filters.c
  932. src/exporting/send_data.c
  933. src/exporting/send_internal_metrics.c
  934. )
  935. set(HEALTH_PLUGIN_FILES
  936. src/health/health.c
  937. src/health/health.h
  938. src/health/health_config.c
  939. src/health/health_json.c
  940. src/health/health_log.c
  941. src/health/health_prototypes.c
  942. src/health/health_prototypes.h
  943. src/health/health_silencers.c
  944. src/health/health_silencers.h
  945. src/health/health_internals.h
  946. src/health/health_notifications.c
  947. src/health/health_event_loop.c
  948. src/health/health_dyncfg.c
  949. src/health/health_variable.c
  950. src/health/rrdcalc.c
  951. src/health/rrdcalc.h
  952. src/health/rrdvar.c
  953. src/health/rrdvar.h
  954. )
  955. set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c)
  956. if(ENABLE_ML)
  957. set(ML_FILES
  958. src/ml/ad_charts.h
  959. src/ml/ad_charts.cc
  960. src/ml/Config.cc
  961. src/ml/dlib/dlib/all/source.cpp
  962. src/ml/ml.h
  963. src/ml/ml.cc
  964. src/ml/ml-private.h
  965. )
  966. else()
  967. set(ML_FILES
  968. src/ml/ml.h
  969. src/ml/ml-dummy.c
  970. )
  971. endif()
  972. set(INTERNAL_COLLECTORS_FILES
  973. src/collectors/common-contexts/common-contexts.h
  974. src/collectors/common-contexts/disk.io.h
  975. src/collectors/common-contexts/system.io.h
  976. src/collectors/common-contexts/system.interrupts.h
  977. src/collectors/common-contexts/system.processes.h
  978. src/collectors/common-contexts/system.ram.h
  979. src/collectors/common-contexts/mem.swap.h
  980. src/collectors/common-contexts/mem.pgfaults.h
  981. src/collectors/common-contexts/mem.available.h
  982. )
  983. set(PLUGINSD_PLUGIN_FILES
  984. src/collectors/plugins.d/plugins_d.c
  985. src/collectors/plugins.d/plugins_d.h
  986. src/collectors/plugins.d/pluginsd_dyncfg.c
  987. src/collectors/plugins.d/pluginsd_dyncfg.h
  988. src/collectors/plugins.d/pluginsd_functions.c
  989. src/collectors/plugins.d/pluginsd_functions.h
  990. src/collectors/plugins.d/pluginsd_internals.c
  991. src/collectors/plugins.d/pluginsd_internals.h
  992. src/collectors/plugins.d/pluginsd_parser.c
  993. src/collectors/plugins.d/pluginsd_parser.h
  994. src/collectors/plugins.d/pluginsd_replication.c
  995. src/collectors/plugins.d/pluginsd_replication.h
  996. )
  997. set(RRD_PLUGIN_FILES
  998. src/database/contexts/api_v1_contexts.c
  999. src/database/contexts/api_v2_contexts.c
  1000. src/database/contexts/api_v2_contexts.h
  1001. src/database/contexts/api_v2_contexts_agents.c
  1002. src/database/contexts/api_v2_contexts_alerts.c
  1003. src/database/contexts/api_v2_contexts_alerts.h
  1004. src/database/contexts/api_v2_contexts_alert_transitions.c
  1005. src/database/contexts/api_v2_contexts_alert_config.c
  1006. src/database/contexts/context.c
  1007. src/database/contexts/instance.c
  1008. src/database/contexts/internal.h
  1009. src/database/contexts/metric.c
  1010. src/database/contexts/query_scope.c
  1011. src/database/contexts/query_target.c
  1012. src/database/contexts/rrdcontext.c
  1013. src/database/contexts/rrdcontext.h
  1014. src/database/contexts/worker.c
  1015. src/database/rrdcollector.c
  1016. src/database/rrdcollector.h
  1017. src/database/rrddim.c
  1018. src/database/rrdfunctions.c
  1019. src/database/rrdfunctions.h
  1020. src/database/rrdfunctions-inline.c
  1021. src/database/rrdfunctions-inline.h
  1022. src/database/rrdhost.c
  1023. src/database/rrdlabels.c
  1024. src/database/rrd.c
  1025. src/database/rrd.h
  1026. src/database/rrdset.c
  1027. src/database/storage_engine.c
  1028. src/database/storage_engine.h
  1029. src/database/ram/rrddim_mem.c
  1030. src/database/ram/rrddim_mem.h
  1031. src/database/sqlite/sqlite_metadata.c
  1032. src/database/sqlite/sqlite_metadata.h
  1033. src/database/sqlite/sqlite_functions.c
  1034. src/database/sqlite/sqlite_functions.h
  1035. src/database/sqlite/sqlite_context.c
  1036. src/database/sqlite/sqlite_context.h
  1037. src/database/sqlite/sqlite_db_migration.c
  1038. src/database/sqlite/sqlite_db_migration.h
  1039. src/database/sqlite/sqlite_aclk.c
  1040. src/database/sqlite/sqlite_aclk.h
  1041. src/database/sqlite/sqlite_health.c
  1042. src/database/sqlite/sqlite_health.h
  1043. src/database/sqlite/sqlite_aclk_node.c
  1044. src/database/sqlite/sqlite_aclk_node.h
  1045. src/database/sqlite/sqlite_aclk_alert.c
  1046. src/database/sqlite/sqlite_aclk_alert.h
  1047. src/database/sqlite/sqlite3.c
  1048. src/database/sqlite/sqlite3.h
  1049. src/database/sqlite/sqlite3recover.c
  1050. src/database/sqlite/sqlite3recover.h
  1051. src/database/sqlite/dbdata.c
  1052. src/database/KolmogorovSmirnovDist.c
  1053. src/database/KolmogorovSmirnovDist.h
  1054. src/database/rrdfunctions-inflight.c
  1055. src/database/rrdfunctions-inflight.h
  1056. src/database/rrdfunctions-exporters.c
  1057. src/database/rrdfunctions-exporters.h
  1058. src/database/rrdfunctions-internals.h
  1059. src/database/rrdcollector-internals.h
  1060. )
  1061. if(ENABLE_DBENGINE)
  1062. list(APPEND RRD_PLUGIN_FILES
  1063. src/database/engine/rrdengine.c
  1064. src/database/engine/rrdengine.h
  1065. src/database/engine/rrddiskprotocol.h
  1066. src/database/engine/datafile.c
  1067. src/database/engine/datafile.h
  1068. src/database/engine/journalfile.c
  1069. src/database/engine/journalfile.h
  1070. src/database/engine/rrdenginelib.c
  1071. src/database/engine/rrdenginelib.h
  1072. src/database/engine/rrdengineapi.c
  1073. src/database/engine/rrdengineapi.h
  1074. src/database/engine/pagecache.c
  1075. src/database/engine/pagecache.h
  1076. src/database/engine/page_test.cc
  1077. src/database/engine/page.c
  1078. src/database/engine/page.h
  1079. src/database/engine/cache.c
  1080. src/database/engine/cache.h
  1081. src/database/engine/metric.c
  1082. src/database/engine/metric.h
  1083. src/database/engine/pdc.c
  1084. src/database/engine/pdc.h
  1085. src/database/engine/dbengine-unittest.c
  1086. src/database/engine/dbengine-stresstest.c
  1087. src/database/engine/dbengine-compression.c
  1088. src/database/engine/dbengine-compression.h
  1089. )
  1090. endif()
  1091. set(REGISTRY_PLUGIN_FILES
  1092. src/registry/registry.c
  1093. src/registry/registry.h
  1094. src/registry/registry_db.c
  1095. src/registry/registry_init.c
  1096. src/registry/registry_internals.c
  1097. src/registry/registry_internals.h
  1098. src/registry/registry_log.c
  1099. src/registry/registry_machine.c
  1100. src/registry/registry_machine.h
  1101. src/registry/registry_person.c
  1102. src/registry/registry_person.h
  1103. )
  1104. set(STATSD_PLUGIN_FILES
  1105. src/collectors/statsd.plugin/statsd.c
  1106. )
  1107. set(SYSTEMD_JOURNAL_PLUGIN_FILES
  1108. src/collectors/systemd-journal.plugin/systemd-journal.c
  1109. src/collectors/systemd-journal.plugin/systemd-internals.h
  1110. src/collectors/systemd-journal.plugin/systemd-main.c
  1111. src/collectors/systemd-journal.plugin/systemd-units.c
  1112. src/collectors/systemd-journal.plugin/systemd-journal.c
  1113. src/collectors/systemd-journal.plugin/systemd-journal-annotations.c
  1114. src/collectors/systemd-journal.plugin/systemd-journal-files.c
  1115. src/collectors/systemd-journal.plugin/systemd-journal-fstat.c
  1116. src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
  1117. src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c
  1118. src/libnetdata/maps/system-users.h
  1119. src/libnetdata/maps/system-groups.h
  1120. src/libnetdata/maps/system-services.h
  1121. )
  1122. set(STREAMING_PLUGIN_FILES
  1123. src/streaming/rrdpush.c
  1124. src/streaming/rrdpush.h
  1125. src/streaming/compression.c
  1126. src/streaming/compression.h
  1127. src/streaming/compression_brotli.c
  1128. src/streaming/compression_brotli.h
  1129. src/streaming/compression_gzip.c
  1130. src/streaming/compression_gzip.h
  1131. src/streaming/compression_lz4.c
  1132. src/streaming/compression_lz4.h
  1133. src/streaming/compression_zstd.c
  1134. src/streaming/compression_zstd.h
  1135. src/streaming/receiver.c
  1136. src/streaming/sender.c
  1137. src/streaming/replication.c
  1138. src/streaming/replication.h
  1139. src/streaming/common.h
  1140. src/streaming/protocol/command-nodeid.c
  1141. src/streaming/protocol/commands.c
  1142. src/streaming/protocol/commands.h
  1143. src/streaming/protocol/command-claimed_id.c
  1144. src/streaming/stream_path.c
  1145. src/streaming/stream_path.h
  1146. src/streaming/stream_capabilities.c
  1147. src/streaming/stream_capabilities.h
  1148. src/streaming/sender_connect.c
  1149. src/streaming/sender_internals.h
  1150. src/streaming/sender_execute.c
  1151. src/streaming/sender_commit.c
  1152. )
  1153. set(WEB_PLUGIN_FILES
  1154. src/web/server/web_client.c
  1155. src/web/server/web_client.h
  1156. src/web/server/web_server.c
  1157. src/web/server/web_server.h
  1158. src/web/server/static/static-threaded.c
  1159. src/web/server/static/static-threaded.h
  1160. src/web/server/web_client_cache.c
  1161. src/web/server/web_client_cache.h
  1162. )
  1163. set(CLAIM_PLUGIN_FILES
  1164. src/claim/claim.c
  1165. src/claim/claim.h
  1166. src/claim/claim_id.c
  1167. src/claim/claim_id.h
  1168. src/claim/cloud-conf.c
  1169. src/claim/claim-with-api.c
  1170. src/claim/cloud-status.c
  1171. src/claim/cloud-status.h
  1172. )
  1173. set(CLAIM_WINDOWS_FILES
  1174. src/claim/netdata_claim.c
  1175. src/claim/netdata_claim.h
  1176. src/claim/netdata_claim_window.c
  1177. src/claim/netdata_claim_window.h
  1178. )
  1179. set(ACLK_ALWAYS_BUILD
  1180. src/aclk/aclk_rrdhost_state.h
  1181. src/aclk/aclk_proxy.c
  1182. src/aclk/aclk_proxy.h
  1183. src/aclk/aclk.c
  1184. src/aclk/aclk.h
  1185. src/aclk/aclk_capas.c
  1186. src/aclk/aclk_capas.h
  1187. src/aclk/aclk_util.c
  1188. src/aclk/aclk_util.h
  1189. src/aclk/https_client.c
  1190. src/aclk/https_client.h
  1191. src/libnetdata/c_rhash/c_rhash.c
  1192. src/libnetdata/c_rhash/c_rhash.h
  1193. src/libnetdata/c_rhash/c_rhash_internal.h
  1194. )
  1195. set(TIMEX_PLUGIN_FILES
  1196. src/collectors/timex.plugin/plugin_timex.c
  1197. )
  1198. set(PROFILE_PLUGIN_FILES
  1199. src/collectors/profile.plugin/plugin_profile.cc
  1200. )
  1201. set(CGROUPS_PLUGIN_FILES
  1202. src/collectors/cgroups.plugin/sys_fs_cgroup.c
  1203. src/collectors/cgroups.plugin/sys_fs_cgroup.h
  1204. src/collectors/cgroups.plugin/cgroup-internals.h
  1205. src/collectors/cgroups.plugin/cgroup-discovery.c
  1206. src/collectors/cgroups.plugin/cgroup-charts.c
  1207. src/collectors/cgroups.plugin/cgroup-top.c
  1208. )
  1209. set(DISKSPACE_PLUGIN_FILES
  1210. src/collectors/diskspace.plugin/plugin_diskspace.c
  1211. )
  1212. set(MACOS_PLUGIN_FILES
  1213. src/collectors/macos.plugin/plugin_macos.c
  1214. src/collectors/macos.plugin/plugin_macos.h
  1215. src/collectors/macos.plugin/macos_sysctl.c
  1216. src/collectors/macos.plugin/macos_mach_smi.c
  1217. src/collectors/macos.plugin/macos_fw.c
  1218. )
  1219. set(FREEBSD_PLUGIN_FILES
  1220. src/collectors/freebsd.plugin/plugin_freebsd.c
  1221. src/collectors/freebsd.plugin/plugin_freebsd.h
  1222. src/collectors/freebsd.plugin/freebsd_sysctl.c
  1223. src/collectors/freebsd.plugin/freebsd_getmntinfo.c
  1224. src/collectors/freebsd.plugin/freebsd_getifaddrs.c
  1225. src/collectors/freebsd.plugin/freebsd_devstat.c
  1226. src/collectors/freebsd.plugin/freebsd_kstat_zfs.c
  1227. src/collectors/freebsd.plugin/freebsd_ipfw.c
  1228. src/collectors/proc.plugin/zfs_common.c
  1229. src/collectors/proc.plugin/zfs_common.h
  1230. )
  1231. set(WINDOWS_PLUGIN_FILES
  1232. src/collectors/windows.plugin/windows_plugin.c
  1233. src/collectors/windows.plugin/windows_plugin.h
  1234. src/collectors/windows.plugin/GetSystemUptime.c
  1235. src/collectors/windows.plugin/GetSystemRAM.c
  1236. src/collectors/windows.plugin/GetSystemCPU.c
  1237. src/collectors/windows.plugin/perflib.c
  1238. src/collectors/windows.plugin/perflib.h
  1239. src/collectors/windows.plugin/perflib-rrd.c
  1240. src/collectors/windows.plugin/perflib-rrd.h
  1241. src/collectors/windows.plugin/perflib-names.c
  1242. src/collectors/windows.plugin/perflib-dump.c
  1243. src/collectors/windows.plugin/perflib-storage.c
  1244. src/collectors/windows.plugin/perflib-processor.c
  1245. src/collectors/windows.plugin/perflib-objects.c
  1246. src/collectors/windows.plugin/perflib-network.c
  1247. src/collectors/windows.plugin/perflib-memory.c
  1248. src/collectors/windows.plugin/perflib-processes.c
  1249. )
  1250. set(PROC_PLUGIN_FILES
  1251. src/collectors/proc.plugin/ipc.c
  1252. src/collectors/proc.plugin/plugin_proc.c
  1253. src/collectors/proc.plugin/plugin_proc.h
  1254. src/collectors/proc.plugin/proc_sys_fs_file_nr.c
  1255. src/collectors/proc.plugin/proc_diskstats.c
  1256. src/collectors/proc.plugin/proc_mdstat.c
  1257. src/collectors/proc.plugin/proc_interrupts.c
  1258. src/collectors/proc.plugin/proc_softirqs.c
  1259. src/collectors/proc.plugin/proc_loadavg.c
  1260. src/collectors/proc.plugin/proc_meminfo.c
  1261. src/collectors/proc.plugin/proc_pagetypeinfo.c
  1262. src/collectors/proc.plugin/proc_net_dev.c
  1263. src/collectors/proc.plugin/proc_net_dev_renames.c
  1264. src/collectors/proc.plugin/proc_net_dev_renames.h
  1265. src/collectors/proc.plugin/proc_net_wireless.c
  1266. src/collectors/proc.plugin/proc_net_ip_vs_stats.c
  1267. src/collectors/proc.plugin/proc_net_netstat.c
  1268. src/collectors/proc.plugin/proc_net_rpc_nfs.c
  1269. src/collectors/proc.plugin/proc_net_rpc_nfsd.c
  1270. src/collectors/proc.plugin/proc_net_sctp_snmp.c
  1271. src/collectors/proc.plugin/proc_net_sockstat.c
  1272. src/collectors/proc.plugin/proc_net_sockstat6.c
  1273. src/collectors/proc.plugin/proc_net_softnet_stat.c
  1274. src/collectors/proc.plugin/proc_net_stat_conntrack.c
  1275. src/collectors/proc.plugin/proc_net_stat_synproxy.c
  1276. src/collectors/proc.plugin/proc_self_mountinfo.c
  1277. src/collectors/proc.plugin/proc_self_mountinfo.h
  1278. src/collectors/proc.plugin/zfs_common.c
  1279. src/collectors/proc.plugin/zfs_common.h
  1280. src/collectors/proc.plugin/proc_spl_kstat_zfs.c
  1281. src/collectors/proc.plugin/proc_stat.c
  1282. src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
  1283. src/collectors/proc.plugin/proc_vmstat.c
  1284. src/collectors/proc.plugin/proc_uptime.c
  1285. src/collectors/proc.plugin/proc_pressure.c
  1286. src/collectors/proc.plugin/proc_pressure.h
  1287. src/collectors/proc.plugin/sys_kernel_mm_ksm.c
  1288. src/collectors/proc.plugin/sys_block_zram.c
  1289. src/collectors/proc.plugin/sys_devices_system_edac_mc.c
  1290. src/collectors/proc.plugin/sys_devices_system_node.c
  1291. src/collectors/proc.plugin/sys_class_infiniband.c
  1292. src/collectors/proc.plugin/sys_fs_btrfs.c
  1293. src/collectors/proc.plugin/sys_class_power_supply.c
  1294. src/collectors/proc.plugin/sys_devices_pci_aer.c
  1295. src/collectors/proc.plugin/sys_class_drm.c
  1296. )
  1297. set(TC_PLUGIN_FILES
  1298. src/collectors/tc.plugin/plugin_tc.c
  1299. )
  1300. set(NETDATA_FILES
  1301. src/collectors/all.h
  1302. ${DAEMON_FILES}
  1303. ${API_PLUGIN_FILES}
  1304. ${EXPORTING_ENGINE_FILES}
  1305. ${HEALTH_PLUGIN_FILES}
  1306. ${IDLEJITTER_PLUGIN_FILES}
  1307. ${ML_FILES}
  1308. ${PLUGINSD_PLUGIN_FILES}
  1309. ${RRD_PLUGIN_FILES}
  1310. ${REGISTRY_PLUGIN_FILES}
  1311. ${STATSD_PLUGIN_FILES}
  1312. ${STREAMING_PLUGIN_FILES}
  1313. ${WEB_PLUGIN_FILES}
  1314. ${CLAIM_PLUGIN_FILES}
  1315. ${ACLK_ALWAYS_BUILD}
  1316. ${PROFILE_PLUGIN_FILES}
  1317. )
  1318. if(OS_LINUX)
  1319. list(APPEND NETDATA_FILES
  1320. src/daemon/static_threads_linux.c
  1321. ${CGROUPS_PLUGIN_FILES}
  1322. ${DISKSPACE_PLUGIN_FILES}
  1323. ${PROC_PLUGIN_FILES}
  1324. ${TC_PLUGIN_FILES}
  1325. ${TIMEX_PLUGIN_FILES}
  1326. ${INTERNAL_COLLECTORS_FILES}
  1327. )
  1328. if(ENABLE_SENTRY)
  1329. list(APPEND NETDATA_FILES
  1330. src/daemon/sentry-native/sentry-native.c
  1331. src/daemon/sentry-native/sentry-native.h)
  1332. endif()
  1333. elseif(OS_MACOS)
  1334. list(APPEND NETDATA_FILES
  1335. src/daemon/static_threads_macos.c
  1336. ${MACOS_PLUGIN_FILES}
  1337. ${TIMEX_PLUGIN_FILES}
  1338. ${INTERNAL_COLLECTORS_FILES}
  1339. )
  1340. elseif(OS_FREEBSD)
  1341. list(APPEND NETDATA_FILES
  1342. src/daemon/static_threads_freebsd.c
  1343. ${FREEBSD_PLUGIN_FILES}
  1344. ${TIMEX_PLUGIN_FILES}
  1345. ${INTERNAL_COLLECTORS_FILES}
  1346. )
  1347. elseif(OS_WINDOWS)
  1348. list(APPEND NETDATA_FILES
  1349. src/daemon/static_threads_windows.c
  1350. src/daemon/winsvc.cc
  1351. ${WINDOWS_PLUGIN_FILES}
  1352. ${INTERNAL_COLLECTORS_FILES}
  1353. )
  1354. endif()
  1355. set(MQTT_WEBSOCKETS_FILES
  1356. src/aclk/mqtt_websockets/mqtt_wss_client.c
  1357. src/aclk/mqtt_websockets/mqtt_wss_client.h
  1358. src/aclk/mqtt_websockets/mqtt_wss_log.c
  1359. src/aclk/mqtt_websockets/mqtt_wss_log.h
  1360. src/aclk/mqtt_websockets/ws_client.c
  1361. src/aclk/mqtt_websockets/ws_client.h
  1362. src/aclk/mqtt_websockets/mqtt_ng.c
  1363. src/aclk/mqtt_websockets/mqtt_ng.h
  1364. src/aclk/mqtt_websockets/common_public.c
  1365. src/aclk/mqtt_websockets/common_public.h
  1366. src/aclk/mqtt_websockets/common_internal.h
  1367. )
  1368. set(ACLK_PROTO_DEFS
  1369. src/aclk/aclk-schemas/proto/aclk/v1/lib.proto
  1370. src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto
  1371. src/aclk/aclk-schemas/proto/agent/v1/connection.proto
  1372. src/aclk/aclk-schemas/proto/alarm/v1/config.proto
  1373. src/aclk/aclk-schemas/proto/alarm/v1/stream.proto
  1374. src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto
  1375. src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto
  1376. src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
  1377. src/aclk/aclk-schemas/proto/context/v1/context.proto
  1378. src/aclk/aclk-schemas/proto/context/v1/stream.proto
  1379. src/aclk/aclk-schemas/proto/agent/v1/cmds.proto
  1380. )
  1381. set(ACLK_FILES
  1382. src/aclk/aclk_query.c
  1383. src/aclk/aclk_query.h
  1384. src/aclk/aclk_query_queue.c
  1385. src/aclk/aclk_query_queue.h
  1386. src/aclk/aclk_otp.c
  1387. src/aclk/aclk_otp.h
  1388. src/aclk/aclk_tx_msgs.c
  1389. src/aclk/aclk_tx_msgs.h
  1390. src/aclk/aclk_rx_msgs.c
  1391. src/aclk/aclk_rx_msgs.h
  1392. src/aclk/aclk_alarm_api.c
  1393. src/aclk/aclk_alarm_api.h
  1394. src/aclk/aclk_contexts_api.c
  1395. src/aclk/aclk_contexts_api.h
  1396. src/aclk/schema-wrappers/connection.cc
  1397. src/aclk/schema-wrappers/connection.h
  1398. src/aclk/schema-wrappers/node_connection.cc
  1399. src/aclk/schema-wrappers/node_connection.h
  1400. src/aclk/schema-wrappers/node_creation.cc
  1401. src/aclk/schema-wrappers/node_creation.h
  1402. src/aclk/schema-wrappers/alarm_stream.cc
  1403. src/aclk/schema-wrappers/alarm_stream.h
  1404. src/aclk/schema-wrappers/alarm_config.cc
  1405. src/aclk/schema-wrappers/alarm_config.h
  1406. src/aclk/schema-wrappers/node_info.cc
  1407. src/aclk/schema-wrappers/node_info.h
  1408. src/aclk/schema-wrappers/capability.cc
  1409. src/aclk/schema-wrappers/capability.h
  1410. src/aclk/schema-wrappers/proto_2_json.cc
  1411. src/aclk/schema-wrappers/proto_2_json.h
  1412. src/aclk/schema-wrappers/context_stream.cc
  1413. src/aclk/schema-wrappers/context_stream.h
  1414. src/aclk/schema-wrappers/context.cc
  1415. src/aclk/schema-wrappers/context.h
  1416. src/aclk/schema-wrappers/schema_wrappers.h
  1417. src/aclk/schema-wrappers/schema_wrapper_utils.cc
  1418. src/aclk/schema-wrappers/schema_wrapper_utils.h
  1419. src/aclk/schema-wrappers/agent_cmds.cc
  1420. src/aclk/schema-wrappers/agent_cmds.h
  1421. )
  1422. set(MONGODB_EXPORTING_FILES
  1423. src/exporting/mongodb/mongodb.c
  1424. src/exporting/mongodb/mongodb.h
  1425. )
  1426. set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1427. src/exporting/prometheus/remote_write/remote_write.c
  1428. src/exporting/prometheus/remote_write/remote_write.h
  1429. src/exporting/prometheus/remote_write/remote_write_request.cc
  1430. src/exporting/prometheus/remote_write/remote_write_request.h
  1431. )
  1432. #
  1433. # build h2o
  1434. #
  1435. if(ENABLE_H2O)
  1436. add_library(h2o STATIC ${LIBH2O_FILES})
  1437. target_include_directories(h2o BEFORE PUBLIC
  1438. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include"
  1439. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/cloexec"
  1440. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/brotli/enc"
  1441. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/golombset"
  1442. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libgkc"
  1443. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libyrmcds"
  1444. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/klib"
  1445. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/neverbleed"
  1446. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picohttpparser"
  1447. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picotest"
  1448. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yaml/include"
  1449. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yoml"
  1450. )
  1451. target_compile_options(h2o PRIVATE
  1452. -Wno-all -Wno-extra
  1453. -Wno-shadow
  1454. -Wno-deprecated-declarations
  1455. -Wformat
  1456. )
  1457. target_compile_options(h2o PUBLIC -DH2O_USE_LIBUV=0)
  1458. target_link_libraries(h2o PRIVATE PkgConfig::TLS)
  1459. endif()
  1460. #
  1461. # build libjudy
  1462. #
  1463. add_library(judy STATIC ${LIBJUDY_SOURCES})
  1464. target_compile_options(judy PRIVATE
  1465. -Wno-all -Wno-extra
  1466. -Wno-shadow
  1467. -Wformat
  1468. )
  1469. target_compile_definitions(judy PRIVATE
  1470. JUDYL
  1471. $<$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>:JU_64BIT>
  1472. )
  1473. target_include_directories(judy PUBLIC
  1474. src/libnetdata/libjudy/src
  1475. src/libnetdata/libjudy/src/JudyCommon
  1476. )
  1477. set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV")
  1478. set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT")
  1479. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE")
  1480. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB")
  1481. set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL")
  1482. #
  1483. # build libnetdata
  1484. #
  1485. if(OS_LINUX)
  1486. include(NetdataDetectSystemd)
  1487. detect_systemd()
  1488. endif()
  1489. add_library(libnetdata STATIC ${LIBNETDATA_FILES})
  1490. target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)
  1491. # pthread (FIXME: use find_package for this)
  1492. # set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  1493. # set(THREADS_PREFER_PTHREAD_FLAG TRUE)
  1494. # find_package(Threads REQUIRED)
  1495. # add_executable(test test.cpp)
  1496. # target_link_libraries(test Threads::Threads)
  1497. target_link_libraries(libnetdata PUBLIC
  1498. "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>"
  1499. "$<$<OR:$<BOOL:${OS_LINUX}>,$<BOOL:${OS_FREEBSD}>>:pthread;rt>"
  1500. "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4>"
  1501. "$<$<BOOL:${LINK_LIBM}>:m>"
  1502. "${SYSTEMD_LDFLAGS}")
  1503. # ebpf
  1504. if(ENABLE_PLUGIN_EBPF)
  1505. netdata_add_libbpf_to_target(libnetdata)
  1506. endif()
  1507. # judy
  1508. target_link_libraries(libnetdata PUBLIC judy)
  1509. netdata_add_jsonc_to_target(libnetdata)
  1510. netdata_add_libyaml_to_target(libnetdata)
  1511. # zlib
  1512. if(OS_MACOS)
  1513. find_package(ZLIB REQUIRED)
  1514. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1515. target_link_libraries(libnetdata PUBLIC ZLIB::ZLIB)
  1516. else()
  1517. pkg_check_modules(ZLIB REQUIRED zlib)
  1518. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1519. target_compile_options(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER})
  1520. target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS})
  1521. endif()
  1522. # lz4 - try to find a version that is compatible with streaming compression
  1523. # otherwise pick whichever one we can find to support dbengine but don't set
  1524. # ENABLE_LZ4.
  1525. pkg_check_modules(LIBLZ4 liblz4>=1.9.0)
  1526. if(LIBLZ4_FOUND)
  1527. set(ENABLE_LZ4 On)
  1528. else()
  1529. pkg_check_modules(LIBLZ4 REQUIRED liblz4)
  1530. endif()
  1531. target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS})
  1532. target_compile_options(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER})
  1533. target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS})
  1534. # zstd
  1535. pkg_check_modules(LIBZSTD libzstd)
  1536. if(LIBZSTD_FOUND)
  1537. set(ENABLE_ZSTD On)
  1538. target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS})
  1539. target_compile_options(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER})
  1540. target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS})
  1541. endif()
  1542. # brotli
  1543. pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon)
  1544. if(LIBBROTLI_FOUND)
  1545. set(ENABLE_BROTLI On)
  1546. target_include_directories(libnetdata PUBLIC ${LIBBROTLI_INCLUDE_DIRS})
  1547. target_compile_options(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER})
  1548. target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS})
  1549. endif()
  1550. # uuid
  1551. if(OS_MACOS OR OS_WINDOWS)
  1552. # UUID functionality is part of the system libraries here, so no extra
  1553. # stuff needed.
  1554. else()
  1555. pkg_check_modules(UUID REQUIRED uuid)
  1556. target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS})
  1557. target_compile_options(libnetdata PUBLIC ${UUID_CFLAGS_OTHER})
  1558. target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS})
  1559. endif()
  1560. # uv
  1561. pkg_check_modules(LIBUV REQUIRED libuv)
  1562. target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS})
  1563. target_compile_options(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER})
  1564. target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS})
  1565. # crypto
  1566. target_link_libraries(libnetdata PUBLIC PkgConfig::CRYPTO)
  1567. # openssl
  1568. target_link_libraries(libnetdata PUBLIC PkgConfig::TLS)
  1569. # mnl
  1570. if(NOT OS_MACOS)
  1571. pkg_check_modules(MNL libmnl)
  1572. if(MNL_FOUND)
  1573. set(HAVE_LIBMNL True)
  1574. endif()
  1575. endif()
  1576. #
  1577. # mqtt library
  1578. #
  1579. set(ENABLE_MQTTWEBSOCKETS True)
  1580. if(ENABLE_MQTTWEBSOCKETS)
  1581. add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
  1582. target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC
  1583. -DRBUF_CUSTOM_MALLOC
  1584. -DMQTT_WSS_CPUSTATS)
  1585. target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers
  1586. ${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include)
  1587. target_link_libraries(mqttwebsockets PRIVATE libnetdata)
  1588. endif()
  1589. #
  1590. # proto definitions
  1591. #
  1592. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1593. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1594. ACLK_PROTO_BUILT_SRCS
  1595. ACLK_PROTO_BUILT_HDRS
  1596. ${ACLK_PROTO_DEFS})
  1597. list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS}
  1598. ${ACLK_PROTO_BUILT_HDRS})
  1599. #
  1600. # build plugins
  1601. #
  1602. if(ENABLE_PLUGIN_DEBUGFS)
  1603. pkg_check_modules(CAP QUIET libcap)
  1604. set(DEBUGFS_PLUGIN_FILES src/collectors/debugfs.plugin/debugfs_plugin.c
  1605. src/collectors/debugfs.plugin/debugfs_plugin.h
  1606. src/collectors/debugfs.plugin/debugfs_extfrag.c
  1607. src/collectors/debugfs.plugin/debugfs_zswap.c
  1608. src/collectors/debugfs.plugin/sys_devices_virtual_powercap.c)
  1609. add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES})
  1610. target_link_libraries(debugfs.plugin libnetdata ${CAP_LIBRARIES})
  1611. target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1612. target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1613. install(TARGETS debugfs.plugin
  1614. COMPONENT plugin-debugfs
  1615. DESTINATION usr/libexec/netdata/plugins.d)
  1616. if(BUILD_FOR_PACKAGING)
  1617. install(FILES
  1618. ${PKG_FILES_PATH}/copyright
  1619. COMPONENT plugin-debugfs
  1620. DESTINATION usr/share/doc/netdata-plugin-debugfs)
  1621. endif()
  1622. endif()
  1623. add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c)
  1624. target_link_libraries(spawn-tester libnetdata)
  1625. if(ENABLE_PLUGIN_APPS)
  1626. pkg_check_modules(CAP QUIET libcap)
  1627. set(APPS_PLUGIN_FILES
  1628. src/collectors/apps.plugin/apps_plugin.c
  1629. src/collectors/apps.plugin/apps_plugin.h
  1630. src/collectors/apps.plugin/apps_functions.c
  1631. src/collectors/apps.plugin/apps_targets.c
  1632. src/collectors/apps.plugin/apps_users_and_groups.c
  1633. src/collectors/apps.plugin/apps_output.c
  1634. src/collectors/apps.plugin/apps_proc_pid_status.c
  1635. src/collectors/apps.plugin/apps_proc_pid_limits.c
  1636. src/collectors/apps.plugin/apps_proc_pid_stat.c
  1637. src/collectors/apps.plugin/apps_proc_pid_cmdline.c
  1638. src/collectors/apps.plugin/apps_proc_pid_io.c
  1639. src/collectors/apps.plugin/apps_proc_stat.c
  1640. src/collectors/apps.plugin/apps_proc_pid_fd.c
  1641. src/collectors/apps.plugin/apps_proc_pids.c
  1642. src/collectors/apps.plugin/apps_proc_meminfo.c
  1643. )
  1644. add_executable(apps.plugin ${APPS_PLUGIN_FILES})
  1645. target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES})
  1646. target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1647. target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1648. install(TARGETS apps.plugin
  1649. COMPONENT plugin-apps
  1650. DESTINATION usr/libexec/netdata/plugins.d)
  1651. install(FILES src/collectors/apps.plugin/apps_groups.conf
  1652. COMPONENT plugin-apps
  1653. DESTINATION usr/lib/netdata/conf.d)
  1654. if(BUILD_FOR_PACKAGING)
  1655. install(FILES
  1656. ${PKG_FILES_PATH}/copyright
  1657. COMPONENT plugin-apps
  1658. DESTINATION usr/share/doc/netdata-plugin-apps)
  1659. endif()
  1660. endif()
  1661. if(CAP_FOUND)
  1662. set(HAVE_CAPABILITY True)
  1663. endif()
  1664. if(ENABLE_PLUGIN_FREEIPMI)
  1665. pkg_check_modules(IPMI REQUIRED libipmimonitoring)
  1666. set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c)
  1667. add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES})
  1668. target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES})
  1669. target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS})
  1670. target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER})
  1671. install(TARGETS freeipmi.plugin
  1672. COMPONENT plugin-freeipmi
  1673. DESTINATION usr/libexec/netdata/plugins.d)
  1674. if(BUILD_FOR_PACKAGING)
  1675. install(FILES
  1676. ${PKG_FILES_PATH}/copyright
  1677. COMPONENT plugin-freeipmi
  1678. DESTINATION usr/share/doc/netdata-plugin-freeipmi)
  1679. endif()
  1680. endif()
  1681. if(ENABLE_PLUGIN_NFACCT)
  1682. if (NOT MNL_FOUND)
  1683. message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.")
  1684. endif()
  1685. pkg_check_modules(NFACCT REQUIRED libnetfilter_acct)
  1686. set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c)
  1687. add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES})
  1688. target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES})
  1689. target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS})
  1690. target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER})
  1691. install(TARGETS nfacct.plugin
  1692. COMPONENT plugin-nfacct
  1693. DESTINATION usr/libexec/netdata/plugins.d)
  1694. if(BUILD_FOR_PACKAGING)
  1695. install(FILES
  1696. ${PKG_FILES_PATH}/copyright
  1697. COMPONENT plugin-nfacct
  1698. DESTINATION usr/share/doc/netdata-plugin-nfacct)
  1699. endif()
  1700. endif()
  1701. if(ENABLE_PLUGIN_XENSTAT)
  1702. pkg_check_modules(XENSTAT REQUIRED xenstat)
  1703. pkg_check_modules(XENLIGHT REQUIRED xenlight)
  1704. set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c)
  1705. add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES})
  1706. target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES})
  1707. target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS})
  1708. target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER})
  1709. install(TARGETS xenstat.plugin
  1710. COMPONENT plugin-xenstat
  1711. DESTINATION usr/libexec/netdata/plugins.d)
  1712. if(BUILD_FOR_PACKAGING)
  1713. install(FILES
  1714. ${PKG_FILES_PATH}/copyright
  1715. COMPONENT plugin-xenstat
  1716. DESTINATION usr/share/doc/netdata-plugin-xenstat)
  1717. endif()
  1718. endif()
  1719. if(ENABLE_PLUGIN_PERF)
  1720. set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c)
  1721. add_executable(perf.plugin ${PERF_PLUGIN_FILES})
  1722. target_link_libraries(perf.plugin libnetdata)
  1723. install(TARGETS perf.plugin
  1724. COMPONENT plugin-perf
  1725. DESTINATION usr/libexec/netdata/plugins.d)
  1726. if(BUILD_FOR_PACKAGING)
  1727. install(FILES
  1728. ${PKG_FILES_PATH}/copyright
  1729. COMPONENT plugin-perf
  1730. DESTINATION usr/share/doc/netdata-plugin-perf)
  1731. endif()
  1732. endif()
  1733. if(ENABLE_PLUGIN_SLABINFO)
  1734. set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c)
  1735. add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES})
  1736. target_link_libraries(slabinfo.plugin libnetdata)
  1737. install(TARGETS slabinfo.plugin
  1738. COMPONENT plugin-slabinfo
  1739. DESTINATION usr/libexec/netdata/plugins.d)
  1740. if(BUILD_FOR_PACKAGING)
  1741. install(FILES
  1742. ${PKG_FILES_PATH}/copyright
  1743. COMPONENT plugin-slabinfo
  1744. DESTINATION usr/share/doc/netdata-plugin-slabinfo)
  1745. endif()
  1746. endif()
  1747. if(ENABLE_PLUGIN_CUPS)
  1748. pkg_check_modules(CUPS libcups)
  1749. if(NOT CUPS_FOUND)
  1750. pkg_check_modules(CUPS cups)
  1751. if(NOT CUPS_FOUND)
  1752. find_program(CUPS_CONFIG cups-config)
  1753. if(CUPS_CONFIG)
  1754. execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  1755. if(CUPS_API_VERSION VERSION_LESS "1.7")
  1756. set(CUPS_FOUND False)
  1757. else()
  1758. execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE)
  1759. execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
  1760. set(CUPS_FOUND True)
  1761. endif()
  1762. endif()
  1763. endif()
  1764. endif()
  1765. if(NOT CUPS_FOUND)
  1766. message(WARNING "Could not find cups cflags and libs.")
  1767. else()
  1768. set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c)
  1769. add_executable(cups.plugin ${CUPS_PLUGIN_FILES})
  1770. target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES})
  1771. target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER})
  1772. install(TARGETS cups.plugin
  1773. COMPONENT plugin-cups
  1774. DESTINATION usr/libexec/netdata/plugins.d)
  1775. if(BUILD_FOR_PACKAGING)
  1776. install(FILES
  1777. ${PKG_FILES_PATH}/copyright
  1778. COMPONENT plugin-cups
  1779. DESTINATION usr/share/doc/netdata-plugin-cups)
  1780. endif()
  1781. endif()
  1782. endif()
  1783. if(NEED_NDSUDO)
  1784. set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c)
  1785. add_executable(ndsudo ${NDSUDO_FILES})
  1786. install(TARGETS ndsudo
  1787. COMPONENT netdata
  1788. DESTINATION usr/libexec/netdata/plugins.d)
  1789. endif()
  1790. if(ENABLE_PLUGIN_CGROUP_NETWORK)
  1791. set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c)
  1792. add_executable(cgroup-network ${CGROUP_NETWORK_FILES})
  1793. target_link_libraries(cgroup-network libnetdata)
  1794. install(TARGETS cgroup-network
  1795. COMPONENT netdata
  1796. DESTINATION usr/libexec/netdata/plugins.d)
  1797. endif()
  1798. if(ENABLE_PLUGIN_SYSTEMD_JOURNAL)
  1799. if(NOT SYSTEMD_FOUND)
  1800. message(FATAL_ERROR "Systemd journal plugin requires systemd, but systemd was not found.")
  1801. endif()
  1802. add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES})
  1803. target_link_libraries(systemd-journal.plugin libnetdata)
  1804. install(TARGETS systemd-journal.plugin
  1805. COMPONENT plugin-systemd-journal
  1806. DESTINATION usr/libexec/netdata/plugins.d)
  1807. if(BUILD_FOR_PACKAGING)
  1808. install(FILES
  1809. ${PKG_FILES_PATH}/copyright
  1810. COMPONENT plugin-systemd-journal
  1811. DESTINATION usr/share/doc/netdata-plugin-systemd-journal)
  1812. endif()
  1813. endif()
  1814. if(ENABLE_PLUGIN_EBPF)
  1815. set(EBPF_PLUGIN_FILES
  1816. src/collectors/ebpf.plugin/ebpf.c
  1817. src/collectors/ebpf.plugin/ebpf.h
  1818. src/collectors/ebpf.plugin/ebpf_cachestat.c
  1819. src/collectors/ebpf.plugin/ebpf_cachestat.h
  1820. src/collectors/ebpf.plugin/ebpf_dcstat.c
  1821. src/collectors/ebpf.plugin/ebpf_dcstat.h
  1822. src/collectors/ebpf.plugin/ebpf_disk.c
  1823. src/collectors/ebpf.plugin/ebpf_disk.h
  1824. src/collectors/ebpf.plugin/ebpf_fd.c
  1825. src/collectors/ebpf.plugin/ebpf_fd.h
  1826. src/collectors/ebpf.plugin/ebpf_hardirq.c
  1827. src/collectors/ebpf.plugin/ebpf_hardirq.h
  1828. src/collectors/ebpf.plugin/ebpf_mdflush.c
  1829. src/collectors/ebpf.plugin/ebpf_mdflush.h
  1830. src/collectors/ebpf.plugin/ebpf_mount.c
  1831. src/collectors/ebpf.plugin/ebpf_mount.h
  1832. src/collectors/ebpf.plugin/ebpf_filesystem.c
  1833. src/collectors/ebpf.plugin/ebpf_filesystem.h
  1834. src/collectors/ebpf.plugin/ebpf_oomkill.c
  1835. src/collectors/ebpf.plugin/ebpf_oomkill.h
  1836. src/collectors/ebpf.plugin/ebpf_process.c
  1837. src/collectors/ebpf.plugin/ebpf_process.h
  1838. src/collectors/ebpf.plugin/ebpf_shm.c
  1839. src/collectors/ebpf.plugin/ebpf_shm.h
  1840. src/collectors/ebpf.plugin/ebpf_socket.c
  1841. src/collectors/ebpf.plugin/ebpf_socket.h
  1842. src/collectors/ebpf.plugin/ebpf_softirq.c
  1843. src/collectors/ebpf.plugin/ebpf_softirq.h
  1844. src/collectors/ebpf.plugin/ebpf_sync.c
  1845. src/collectors/ebpf.plugin/ebpf_sync.h
  1846. src/collectors/ebpf.plugin/ebpf_swap.c
  1847. src/collectors/ebpf.plugin/ebpf_swap.h
  1848. src/collectors/ebpf.plugin/ebpf_vfs.c
  1849. src/collectors/ebpf.plugin/ebpf_vfs.h
  1850. src/collectors/ebpf.plugin/ebpf_apps.c
  1851. src/collectors/ebpf.plugin/ebpf_apps.h
  1852. src/collectors/ebpf.plugin/ebpf_cgroup.c
  1853. src/collectors/ebpf.plugin/ebpf_cgroup.h
  1854. src/collectors/ebpf.plugin/ebpf_unittest.c
  1855. src/collectors/ebpf.plugin/ebpf_unittest.h
  1856. src/collectors/ebpf.plugin/ebpf_functions.c
  1857. src/collectors/ebpf.plugin/ebpf_functions.h
  1858. )
  1859. add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES})
  1860. target_link_libraries(ebpf.plugin libnetdata)
  1861. netdata_add_ebpf_co_re_to_target(ebpf.plugin)
  1862. install(TARGETS ebpf.plugin
  1863. COMPONENT plugin-ebpf
  1864. DESTINATION usr/libexec/netdata/plugins.d)
  1865. install(FILES
  1866. src/collectors/ebpf.plugin/ebpf.d.conf
  1867. COMPONENT plugin-ebpf
  1868. DESTINATION usr/lib/netdata/conf.d)
  1869. install(FILES
  1870. src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
  1871. src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
  1872. src/collectors/ebpf.plugin/ebpf.d/disk.conf
  1873. src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt
  1874. src/collectors/ebpf.plugin/ebpf.d/fd.conf
  1875. src/collectors/ebpf.plugin/ebpf.d/filesystem.conf
  1876. src/collectors/ebpf.plugin/ebpf.d/hardirq.conf
  1877. src/collectors/ebpf.plugin/ebpf.d/mdflush.conf
  1878. src/collectors/ebpf.plugin/ebpf.d/mount.conf
  1879. src/collectors/ebpf.plugin/ebpf.d/network.conf
  1880. src/collectors/ebpf.plugin/ebpf.d/oomkill.conf
  1881. src/collectors/ebpf.plugin/ebpf.d/process.conf
  1882. src/collectors/ebpf.plugin/ebpf.d/shm.conf
  1883. src/collectors/ebpf.plugin/ebpf.d/softirq.conf
  1884. src/collectors/ebpf.plugin/ebpf.d/swap.conf
  1885. src/collectors/ebpf.plugin/ebpf.d/sync.conf
  1886. src/collectors/ebpf.plugin/ebpf.d/vfs.conf
  1887. COMPONENT plugin-ebpf
  1888. DESTINATION usr/lib/netdata/conf.d/ebpf.d)
  1889. if(BUILD_FOR_PACKAGING)
  1890. install(FILES
  1891. ${PKG_FILES_PATH}/copyright
  1892. COMPONENT plugin-ebpf
  1893. DESTINATION usr/share/doc/netdata-plugin-ebpf)
  1894. endif()
  1895. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  1896. netdata_install_legacy_ebpf_code()
  1897. endif()
  1898. endif()
  1899. if(ENABLE_PLUGIN_LOCAL_LISTENERS)
  1900. set(LOCAL_LISTENERS_FILES
  1901. src/collectors/plugins.d/local_listeners.c
  1902. src/libnetdata/maps/local-sockets.h
  1903. )
  1904. add_executable(local-listeners ${LOCAL_LISTENERS_FILES})
  1905. target_compile_options(local-listeners PRIVATE
  1906. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1907. target_include_directories(local-listeners PRIVATE
  1908. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1909. target_link_libraries(local-listeners libnetdata
  1910. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1911. install(TARGETS local-listeners
  1912. COMPONENT netdata
  1913. DESTINATION usr/libexec/netdata/plugins.d)
  1914. endif()
  1915. if(ENABLE_PLUGIN_NETWORK_VIEWER)
  1916. set(NETWORK_VIEWER_FILES
  1917. src/libnetdata/maps/local-sockets.h
  1918. src/libnetdata/maps/system-users.h
  1919. src/collectors/network-viewer.plugin/network-viewer.c
  1920. )
  1921. add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES})
  1922. target_compile_options(network-viewer.plugin PRIVATE
  1923. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1924. target_include_directories(network-viewer.plugin PRIVATE
  1925. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1926. target_link_libraries(network-viewer.plugin libnetdata
  1927. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1928. install(TARGETS network-viewer.plugin
  1929. COMPONENT plugin-network-viewer
  1930. DESTINATION usr/libexec/netdata/plugins.d)
  1931. if(BUILD_FOR_PACKAGING)
  1932. install(FILES
  1933. ${PKG_FILES_PATH}/copyright
  1934. COMPONENT plugin-network-viewer
  1935. DESTINATION usr/share/doc/netdata-plugin-network-viewer)
  1936. endif()
  1937. endif()
  1938. #
  1939. # exporters
  1940. #
  1941. if(ENABLE_EXPORTER_MONGODB)
  1942. pkg_check_modules(MONGOC libmongoc-1.0>=1.7)
  1943. if(MONGOC_FOUND)
  1944. SET(HAVE_MONGOC True)
  1945. else()
  1946. SET(ENABLE_EXPORTER_MONGODB False)
  1947. endif()
  1948. endif()
  1949. if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
  1950. pkg_check_modules(SNAPPY snappy)
  1951. if (NOT SNAPPY_FOUND)
  1952. include(CheckLibraryExists)
  1953. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
  1954. if(HAVE_SNAPPY_LIB)
  1955. set(SNAPPY_INCLUDE_DIRS "")
  1956. set(SNAPPY_CFLAGS_OTHER "")
  1957. set(SNAPPY_LIBRARIES "-lsnappy")
  1958. else()
  1959. message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.")
  1960. endif()
  1961. endif()
  1962. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  1963. "${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  1964. PROMETHEUS_REMOTE_WRITE_BUILT_SRCS
  1965. PROMETHEUS_REMOTE_WRITE_BUILT_HDRS
  1966. "src/exporting/prometheus/remote_write/remote_write.proto")
  1967. list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1968. ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS}
  1969. ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS})
  1970. set(ENABLE_PROMETHEUS_REMOTE_WRITE True)
  1971. endif()
  1972. #
  1973. # build netdata (only Linux ATM)
  1974. #
  1975. if(OS_WINDOWS)
  1976. set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
  1977. configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY)
  1978. set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc")
  1979. configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY)
  1980. set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
  1981. configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
  1982. endif()
  1983. add_executable(netdata
  1984. ${NETDATA_FILES}
  1985. "${ACLK_FILES}"
  1986. "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>"
  1987. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
  1988. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
  1989. "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>"
  1990. )
  1991. if(OS_WINDOWS)
  1992. add_executable(netdata_claim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
  1993. target_link_libraries(netdata_claim shell32;gdi32;msftedit)
  1994. endif()
  1995. target_compile_definitions(netdata PRIVATE
  1996. "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>"
  1997. )
  1998. target_compile_options(netdata PRIVATE
  1999. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_CFLAGS_OTHER}>"
  2000. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_CFLAGS_OTHER}>"
  2001. )
  2002. target_include_directories(netdata PRIVATE
  2003. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  2004. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
  2005. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
  2006. )
  2007. target_link_libraries(netdata PRIVATE
  2008. m
  2009. libnetdata
  2010. "$<$<BOOL:${OS_LINUX}>:rt>"
  2011. "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:mqttwebsockets>"
  2012. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_LIBRARIES}>"
  2013. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_LIBRARIES}>"
  2014. "$<$<BOOL:${OS_MACOS}>:${IOKIT};${FOUNDATION}>"
  2015. "$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
  2016. "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
  2017. "$<$<BOOL:${ENABLE_H2O}>:h2o>"
  2018. "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>"
  2019. )
  2020. if(NEED_PROTOBUF)
  2021. netdata_add_protobuf(netdata)
  2022. endif()
  2023. #
  2024. # build systemd-cat-native
  2025. #
  2026. set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c
  2027. src/libnetdata/log/systemd-cat-native.h)
  2028. add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES})
  2029. target_link_libraries(systemd-cat-native libnetdata)
  2030. install(TARGETS systemd-cat-native
  2031. COMPONENT netdata
  2032. DESTINATION "${BINDIR}")
  2033. #
  2034. # build log2journal
  2035. #
  2036. pkg_check_modules(PCRE2 libpcre2-8)
  2037. if(PCRE2_FOUND)
  2038. set(LOG2JOURNAL_FILES
  2039. ${CONFIG_H}
  2040. src/collectors/log2journal/log2journal.h
  2041. src/collectors/log2journal/log2journal.c
  2042. src/collectors/log2journal/log2journal-help.c
  2043. src/collectors/log2journal/log2journal-yaml.c
  2044. src/collectors/log2journal/log2journal-json.c
  2045. src/collectors/log2journal/log2journal-logfmt.c
  2046. src/collectors/log2journal/log2journal-pcre2.c
  2047. src/collectors/log2journal/log2journal-params.c
  2048. src/collectors/log2journal/log2journal-inject.c
  2049. src/collectors/log2journal/log2journal-pattern.c
  2050. src/collectors/log2journal/log2journal-replace.c
  2051. src/collectors/log2journal/log2journal-rename.c
  2052. src/collectors/log2journal/log2journal-rewrite.c
  2053. )
  2054. add_executable(log2journal ${LOG2JOURNAL_FILES})
  2055. target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS})
  2056. target_compile_options(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER})
  2057. target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}")
  2058. netdata_add_libyaml_to_target(log2journal)
  2059. install(TARGETS log2journal
  2060. COMPONENT netdata
  2061. DESTINATION "${BINDIR}")
  2062. install(DIRECTORY src/collectors/log2journal/log2journal.d
  2063. COMPONENT netdata
  2064. DESTINATION usr/lib/netdata/conf.d)
  2065. endif()
  2066. #
  2067. # build netdatacli
  2068. #
  2069. set(NETDATACLI_FILES
  2070. src/daemon/commands.h
  2071. src/daemon/pipename.c
  2072. src/daemon/pipename.h
  2073. src/cli/cli.c
  2074. )
  2075. add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>")
  2076. target_link_libraries(netdatacli libnetdata)
  2077. install(TARGETS netdatacli
  2078. COMPONENT netdata
  2079. DESTINATION "${BINDIR}")
  2080. #
  2081. # Build go.d.plugin
  2082. #
  2083. if(ENABLE_PLUGIN_GO)
  2084. add_go_target(go-plugin go.d.plugin src/go cmd/godplugin)
  2085. install(PROGRAMS ${CMAKE_BINARY_DIR}/go.d.plugin
  2086. COMPONENT plugin-go
  2087. DESTINATION usr/libexec/netdata/plugins.d)
  2088. endif()
  2089. #
  2090. # Generate config file
  2091. #
  2092. if(NOT NETDATA_RUNTIME_PREFIX STREQUAL "")
  2093. string(REGEX REPLACE "/$" "" NETDATA_RUNTIME_PREFIX "${NETDATA_RUNTIME_PREFIX}")
  2094. endif()
  2095. set(CACHE_DIR "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2096. set(CONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2097. set(LIBCONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2098. set(LOG_DIR "${NETDATA_RUNTIME_PREFIX}/var/log/netdata")
  2099. set(PLUGINS_DIR "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata/plugins.d")
  2100. set(VARLIB_DIR "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2101. # A non-default value is only used when building Debian packages (/var/lib/netdata/www)
  2102. if(NOT DEFINED WEB_DIR)
  2103. set(WEB_DIR "usr/share/netdata/web")
  2104. else()
  2105. string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}")
  2106. endif()
  2107. set(WEB_DEST "${WEB_DIR}")
  2108. set(WEB_DIR "${NETDATA_RUNTIME_PREFIX}/${WEB_DEST}")
  2109. set(CONFIGURE_COMMAND "dummy-configure-command")
  2110. if (NOT NETDATA_USER)
  2111. set(NETDATA_USER "netdata")
  2112. endif()
  2113. configure_file(packaging/cmake/config.cmake.h.in config.h)
  2114. #
  2115. # install
  2116. #
  2117. install(TARGETS netdata COMPONENT netdata DESTINATION "${BINDIR}")
  2118. install(DIRECTORY COMPONENT netdata DESTINATION var/cache/netdata)
  2119. install(DIRECTORY COMPONENT netdata DESTINATION var/log/netdata)
  2120. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/registry)
  2121. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/cloud.d)
  2122. install(DIRECTORY COMPONENT netdata DESTINATION var/run/netdata)
  2123. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata)
  2124. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/custom-plugins.d)
  2125. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/go.d)
  2126. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/health.d)
  2127. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/python.d)
  2128. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/ssl)
  2129. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/statsd.d)
  2130. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d)
  2131. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d/schema.d)
  2132. install(DIRECTORY COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d)
  2133. install(DIRECTORY COMPONENT netdata DESTINATION ${WEB_DEST})
  2134. set(libsysdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/system")
  2135. set(pkglibexecdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata")
  2136. set(localstatedir_POST "${NETDATA_RUNTIME_PREFIX}/var")
  2137. set(sbindir_POST "${NETDATA_RUNTIME_PREFIX}/${BINDIR}")
  2138. set(configdir_POST "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2139. set(libconfigdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2140. set(cachedir_POST "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2141. set(registrydir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata/registry")
  2142. set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2143. set(netdata_user_POST "${NETDATA_USER}")
  2144. set(netdata_group_POST "${NETDATA_USER}")
  2145. configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
  2146. install(PROGRAMS
  2147. ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
  2148. COMPONENT netdata
  2149. DESTINATION "${BINDIR}")
  2150. if(OS_WINDOWS)
  2151. install(PROGRAMS
  2152. ${CMAKE_BINARY_DIR}/netdata_claim.exe
  2153. COMPONENT netdata
  2154. DESTINATION "${BINDIR}")
  2155. endif()
  2156. #
  2157. # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume
  2158. # the files exists unconditionally.
  2159. #
  2160. configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in
  2161. src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY)
  2162. install(PROGRAMS
  2163. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh
  2164. COMPONENT netdata
  2165. DESTINATION usr/libexec/netdata/plugins.d)
  2166. configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in
  2167. src/collectors/cgroups.plugin/cgroup-name.sh @ONLY)
  2168. install(PROGRAMS
  2169. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh
  2170. COMPONENT netdata
  2171. DESTINATION usr/libexec/netdata/plugins.d)
  2172. #
  2173. # statsd
  2174. #
  2175. install(FILES
  2176. src/collectors/statsd.plugin/asterisk.conf
  2177. src/collectors/statsd.plugin/example.conf
  2178. src/collectors/statsd.plugin/k6.conf
  2179. COMPONENT netdata
  2180. DESTINATION usr/lib/netdata/conf.d/statsd.d)
  2181. #
  2182. # exporting
  2183. #
  2184. install(FILES
  2185. src/exporting/exporting.conf
  2186. COMPONENT netdata
  2187. DESTINATION usr/lib/netdata/conf.d)
  2188. #
  2189. # ioping.plugin
  2190. #
  2191. install(FILES
  2192. src/collectors/ioping.plugin/ioping.conf
  2193. COMPONENT netdata
  2194. DESTINATION usr/lib/netdata/conf.d)
  2195. #
  2196. # streaming
  2197. #
  2198. install(FILES
  2199. src/streaming/stream.conf
  2200. COMPONENT netdata
  2201. DESTINATION usr/lib/netdata/conf.d)
  2202. #
  2203. # swagger
  2204. #
  2205. install(FILES
  2206. src/web/api/netdata-swagger.json
  2207. src/web/api/netdata-swagger.yaml
  2208. COMPONENT netdata
  2209. DESTINATION ${WEB_DEST})
  2210. #
  2211. # service files
  2212. #
  2213. configure_file(system/install-service.sh.in system/install-service.sh @ONLY)
  2214. install(PROGRAMS
  2215. ${CMAKE_BINARY_DIR}/system/install-service.sh
  2216. COMPONENT netdata
  2217. DESTINATION usr/libexec/netdata)
  2218. configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY)
  2219. install(FILES
  2220. ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist
  2221. COMPONENT netdata
  2222. DESTINATION usr/lib/netdata/system/launchd)
  2223. configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY)
  2224. install(FILES
  2225. ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata
  2226. COMPONENT netdata
  2227. DESTINATION usr/lib/netdata/system/freebsd/rc.d)
  2228. configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY)
  2229. install(FILES
  2230. ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata
  2231. COMPONENT netdata
  2232. DESTINATION usr/lib/netdata/system/initd/init.d)
  2233. configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY)
  2234. install(FILES
  2235. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2236. COMPONENT netdata
  2237. DESTINATION usr/lib/netdata/system/logrotate)
  2238. install(FILES
  2239. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2240. COMPONENT netdata
  2241. DESTINATION etc/logrotate.d)
  2242. configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY)
  2243. install(FILES
  2244. ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata
  2245. COMPONENT netdata
  2246. DESTINATION usr/lib/netdata/system/lsb/init.d)
  2247. configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY)
  2248. install(FILES
  2249. ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata
  2250. COMPONENT netdata
  2251. DESTINATION usr/lib/netdata/system/openrc/conf.d)
  2252. configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY)
  2253. install(FILES
  2254. ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata
  2255. COMPONENT netdata
  2256. DESTINATION usr/lib/netdata/system/openrc/init.d)
  2257. configure_file(system/runit/run.in system/runit/run @ONLY)
  2258. install(FILES
  2259. ${CMAKE_BINARY_DIR}/system/runit/run
  2260. COMPONENT netdata
  2261. DESTINATION usr/lib/netdata/system/runit)
  2262. configure_file(system/dinit/netdata.in system/dinit/netdata @ONLY)
  2263. install(FILES
  2264. ${CMAKE_BINARY_DIR}/system/dinit/netdata
  2265. COMPONENT netdata
  2266. DESTINATION usr/lib/netdata/system/dinit)
  2267. configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY)
  2268. install(FILES
  2269. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2270. COMPONENT netdata
  2271. DESTINATION usr/lib/netdata/system/systemd)
  2272. install(FILES
  2273. system/systemd/journald@netdata.conf
  2274. COMPONENT netdata
  2275. DESTINATION usr/lib/netdata/system/systemd)
  2276. configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY)
  2277. install(FILES
  2278. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235
  2279. COMPONENT netdata
  2280. DESTINATION usr/lib/netdata/system/systemd)
  2281. if(BUILD_FOR_PACKAGING)
  2282. install(FILES
  2283. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2284. COMPONENT netdata
  2285. DESTINATION lib/systemd/system)
  2286. install(DIRECTORY
  2287. COMPONENT netdata
  2288. DESTINATION usr/lib/systemd/journald@netdata.conf.d)
  2289. install(FILES
  2290. system/systemd/journald@netdata.conf
  2291. COMPONENT netdata
  2292. DESTINATION usr/lib/systemd/journald@netdata.conf.d
  2293. RENAME netdata.conf)
  2294. endif()
  2295. install(FILES
  2296. system/systemd/50-netdata.preset
  2297. COMPONENT netdata
  2298. DESTINATION usr/lib/netdata/system/systemd)
  2299. install(FILES
  2300. system/vnodes/vnodes.conf
  2301. COMPONENT netdata
  2302. DESTINATION usr/lib/netdata/conf.d/vnodes)
  2303. install(FILES
  2304. system/.install-type
  2305. COMPONENT netdata
  2306. DESTINATION etc/netdata)
  2307. install(PROGRAMS
  2308. system/edit-config
  2309. COMPONENT netdata
  2310. DESTINATION etc/netdata)
  2311. if(BUILD_FOR_PACKAGING)
  2312. set(NETDATA_CONF_DEST "etc/netdata")
  2313. else()
  2314. set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d")
  2315. endif()
  2316. #
  2317. # misc files
  2318. #
  2319. if(BUILD_FOR_PACKAGING)
  2320. install(FILES
  2321. ${PKG_FILES_PATH}/deb/netdata/etc/default/netdata
  2322. COMPONENT netdata
  2323. DESTINATION etc/default)
  2324. install(PROGRAMS
  2325. ${PKG_FILES_PATH}/deb/netdata/etc/init.d/netdata
  2326. COMPONENT netdata
  2327. DESTINATION etc/init.d)
  2328. endif()
  2329. if(NOT OS_WINDOWS)
  2330. install(PROGRAMS
  2331. packaging/installer/netdata-updater.sh
  2332. COMPONENT netdata
  2333. DESTINATION usr/libexec/netdata)
  2334. install(FILES
  2335. system/netdata.conf
  2336. system/netdata-updater.conf
  2337. COMPONENT netdata
  2338. DESTINATION ${NETDATA_CONF_DEST})
  2339. configure_file(system/cron/netdata-updater-daily.in
  2340. system/cron/netdata-updater-daily
  2341. @ONLY)
  2342. install(FILES
  2343. ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily
  2344. COMPONENT netdata
  2345. DESTINATION usr/lib/netdata/system/cron)
  2346. configure_file(system/systemd/netdata-updater.service.in
  2347. system/systemd/netdata-updater.service
  2348. @ONLY)
  2349. install(FILES
  2350. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2351. COMPONENT netdata
  2352. DESTINATION usr/lib/netdata/system/systemd)
  2353. install(FILES
  2354. system/systemd/netdata-updater.timer
  2355. COMPONENT netdata
  2356. DESTINATION usr/lib/netdata/system/systemd)
  2357. if(BUILD_FOR_PACKAGING)
  2358. install(FILES
  2359. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2360. COMPONENT netdata
  2361. DESTINATION lib/systemd/system)
  2362. install(FILES
  2363. system/systemd/netdata-updater.timer
  2364. COMPONENT netdata
  2365. DESTINATION lib/systemd/system)
  2366. endif()
  2367. endif()
  2368. #
  2369. # TODO: check the following files for correct substitutions
  2370. #
  2371. configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY)
  2372. install(PROGRAMS
  2373. ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh
  2374. COMPONENT netdata
  2375. DESTINATION usr/libexec/netdata/plugins.d)
  2376. configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY)
  2377. install(PROGRAMS
  2378. ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh
  2379. COMPONENT netdata
  2380. DESTINATION usr/libexec/netdata/plugins.d)
  2381. install(PROGRAMS
  2382. src/daemon/system-info.sh
  2383. COMPONENT netdata
  2384. DESTINATION usr/libexec/netdata/plugins.d)
  2385. #
  2386. # health files
  2387. #
  2388. file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf")
  2389. install(FILES
  2390. ${HEALTH_CONF_FILES}
  2391. COMPONENT netdata
  2392. DESTINATION usr/lib/netdata/conf.d/health.d)
  2393. configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY)
  2394. install(PROGRAMS
  2395. ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh
  2396. COMPONENT netdata
  2397. DESTINATION usr/libexec/netdata/plugins.d)
  2398. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2399. install(PROGRAMS
  2400. src/health/notifications/alarm-email.sh
  2401. src/health/notifications/alarm-test.sh
  2402. COMPONENT netdata
  2403. DESTINATION usr/libexec/netdata/plugins.d)
  2404. endif()
  2405. install(FILES
  2406. src/health/notifications/health_alarm_notify.conf
  2407. src/health/notifications/health_email_recipients.conf
  2408. COMPONENT netdata
  2409. DESTINATION usr/lib/netdata/conf.d)
  2410. #
  2411. # test/ files
  2412. #
  2413. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2414. configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY)
  2415. configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY)
  2416. configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY)
  2417. configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY)
  2418. configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY)
  2419. configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY)
  2420. install(FILES
  2421. ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh
  2422. ${CMAKE_BINARY_DIR}/tests/acls/acl.sh
  2423. ${CMAKE_BINARY_DIR}/tests/urls/request.sh
  2424. ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh
  2425. ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh
  2426. ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh
  2427. DESTINATION usr/libexec/netdata/plugins.d)
  2428. endif()
  2429. #
  2430. # charts.d plugin
  2431. #
  2432. install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d)
  2433. configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY)
  2434. install(PROGRAMS
  2435. ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin
  2436. COMPONENT plugin-chartsd
  2437. DESTINATION usr/libexec/netdata/plugins.d)
  2438. install(PROGRAMS
  2439. src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
  2440. COMPONENT plugin-chartsd
  2441. DESTINATION usr/libexec/netdata/plugins.d)
  2442. # loopsleepms is used by the tc.plugin -> ship it in the netdata component
  2443. install(FILES
  2444. src/collectors/charts.d.plugin/loopsleepms.sh.inc
  2445. COMPONENT netdata
  2446. DESTINATION usr/libexec/netdata/plugins.d)
  2447. install(FILES
  2448. src/collectors/charts.d.plugin/charts.d.conf
  2449. COMPONENT plugin-chartsd
  2450. DESTINATION usr/lib/netdata/conf.d)
  2451. install(PROGRAMS
  2452. src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
  2453. src/collectors/charts.d.plugin/example/example.chart.sh
  2454. src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
  2455. src/collectors/charts.d.plugin/opensips/opensips.chart.sh
  2456. COMPONENT plugin-chartsd
  2457. DESTINATION usr/libexec/netdata/charts.d)
  2458. install(FILES
  2459. src/collectors/charts.d.plugin/apcupsd/apcupsd.conf
  2460. src/collectors/charts.d.plugin/example/example.conf
  2461. src/collectors/charts.d.plugin/libreswan/libreswan.conf
  2462. src/collectors/charts.d.plugin/opensips/opensips.conf
  2463. COMPONENT plugin-chartsd
  2464. DESTINATION usr/lib/netdata/conf.d/charts.d)
  2465. if(BUILD_FOR_PACKAGING)
  2466. install(FILES
  2467. ${PKG_FILES_PATH}/copyright
  2468. COMPONENT plugin-chartsd
  2469. DESTINATION usr/share/doc/netdata-plugin-chartsd)
  2470. endif()
  2471. #
  2472. # tc-qos-helper
  2473. #
  2474. configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY)
  2475. install(PROGRAMS
  2476. ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh
  2477. COMPONENT netdata
  2478. DESTINATION usr/libexec/netdata/plugins.d)
  2479. # confs
  2480. install(FILES
  2481. src/collectors/systemd-journal.plugin/schema.d/systemd-journal%3Amonitored-directories.json
  2482. src/health/schema.d/health%3Aalert%3Aprototype.json
  2483. COMPONENT netdata
  2484. DESTINATION usr/lib/netdata/conf.d/schema.d)
  2485. #
  2486. # python.d plugin
  2487. #
  2488. configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY)
  2489. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin
  2490. COMPONENT plugin-pythond
  2491. DESTINATION usr/libexec/netdata/plugins.d)
  2492. install(DIRECTORY src/collectors/python.d.plugin/python_modules
  2493. COMPONENT plugin-pythond
  2494. DESTINATION usr/libexec/netdata/python.d)
  2495. install(FILES src/collectors/python.d.plugin/python.d.conf
  2496. COMPONENT plugin-pythond
  2497. DESTINATION usr/lib/netdata/conf.d)
  2498. install(FILES
  2499. src/collectors/python.d.plugin/am2320/am2320.conf
  2500. src/collectors/python.d.plugin/ceph/ceph.conf
  2501. src/collectors/python.d.plugin/go_expvar/go_expvar.conf
  2502. src/collectors/python.d.plugin/haproxy/haproxy.conf
  2503. src/collectors/python.d.plugin/openldap/openldap.conf
  2504. src/collectors/python.d.plugin/oracledb/oracledb.conf
  2505. src/collectors/python.d.plugin/pandas/pandas.conf
  2506. src/collectors/python.d.plugin/spigotmc/spigotmc.conf
  2507. src/collectors/python.d.plugin/traefik/traefik.conf
  2508. src/collectors/python.d.plugin/varnish/varnish.conf
  2509. src/collectors/python.d.plugin/w1sensor/w1sensor.conf
  2510. src/collectors/python.d.plugin/zscores/zscores.conf
  2511. COMPONENT plugin-pythond
  2512. DESTINATION usr/lib/netdata/conf.d/python.d)
  2513. install(FILES
  2514. src/collectors/python.d.plugin/am2320/am2320.chart.py
  2515. src/collectors/python.d.plugin/ceph/ceph.chart.py
  2516. src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
  2517. src/collectors/python.d.plugin/haproxy/haproxy.chart.py
  2518. src/collectors/python.d.plugin/openldap/openldap.chart.py
  2519. src/collectors/python.d.plugin/oracledb/oracledb.chart.py
  2520. src/collectors/python.d.plugin/pandas/pandas.chart.py
  2521. src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
  2522. src/collectors/python.d.plugin/traefik/traefik.chart.py
  2523. src/collectors/python.d.plugin/varnish/varnish.chart.py
  2524. src/collectors/python.d.plugin/w1sensor/w1sensor.chart.py
  2525. src/collectors/python.d.plugin/zscores/zscores.chart.py
  2526. COMPONENT plugin-pythond
  2527. DESTINATION usr/libexec/netdata/python.d)
  2528. if(BUILD_FOR_PACKAGING)
  2529. install(FILES
  2530. ${PKG_FILES_PATH}/copyright
  2531. COMPONENT plugin-pythond
  2532. DESTINATION usr/share/doc/netdata-plugin-pythond)
  2533. endif()
  2534. #
  2535. # ioping.plugin
  2536. #
  2537. configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY)
  2538. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin
  2539. COMPONENT netdata
  2540. DESTINATION usr/libexec/netdata/plugins.d)
  2541. #
  2542. # go.d.plugin
  2543. #
  2544. if(ENABLE_PLUGIN_GO)
  2545. install(FILES src/go/plugin/go.d/config/go.d.conf
  2546. COMPONENT plugin-go
  2547. DESTINATION usr/lib/netdata/conf.d)
  2548. install(DIRECTORY
  2549. COMPONENT plugin-go
  2550. DESTINATION usr/lib/netdata/conf.d/go.d)
  2551. file(GLOB GO_CONF_FILES src/go/plugin/go.d/config/go.d/*.conf)
  2552. install(FILES ${GO_CONF_FILES}
  2553. COMPONENT plugin-go
  2554. DESTINATION usr/lib/netdata/conf.d/go.d)
  2555. install(DIRECTORY
  2556. COMPONENT plugin-go
  2557. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2558. file(GLOB GO_SD_CONF_FILES src/go/plugin/go.d/config/go.d/sd/*.conf)
  2559. install(FILES ${GO_SD_CONF_FILES}
  2560. COMPONENT plugin-go
  2561. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2562. if(BUILD_FOR_PACKAGING)
  2563. install(FILES
  2564. ${PKG_FILES_PATH}/copyright
  2565. COMPONENT plugin-go
  2566. DESTINATION usr/share/doc/netdata-plugin-go)
  2567. endif()
  2568. endif()
  2569. #
  2570. # dashboard
  2571. #
  2572. include(src/web/gui/v1/dashboard_v1.cmake)
  2573. include(src/web/gui/v2/dashboard_v2.cmake)
  2574. include(src/web/gui/gui.cmake)
  2575. function(cat IN_FILE OUT_FILE)
  2576. file(READ ${IN_FILE} CONTENTS)
  2577. file(APPEND ${OUT_FILE} "${CONTENTS}")
  2578. endfunction()
  2579. file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "")
  2580. foreach(JS_FILE ${DASHBOARD_JS_FILES})
  2581. cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in)
  2582. endforeach()
  2583. configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in
  2584. ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY)
  2585. install(FILES
  2586. ${CMAKE_BINARY_DIR}/dashboard.js
  2587. COMPONENT netdata
  2588. DESTINATION ${WEB_DEST})
  2589. install(FILES
  2590. src/web/gui/dashboard_info_custom_example.js
  2591. src/web/gui/dashboard_info.js
  2592. src/web/gui/index.html
  2593. src/web/gui/main.css
  2594. src/web/gui/main.js
  2595. src/web/gui/registry-access.html
  2596. src/web/gui/registry-alert-redirect.html
  2597. src/web/gui/registry-hello.html
  2598. src/web/gui/switch.html
  2599. src/web/gui/ilove.html
  2600. COMPONENT netdata
  2601. DESTINATION ${WEB_DEST})
  2602. install(FILES
  2603. src/web/gui/old/index.html
  2604. COMPONENT netdata
  2605. DESTINATION ${WEB_DEST}/old)
  2606. install(FILES
  2607. src/web/gui/static/img/netdata-logomark.svg
  2608. COMPONENT netdata
  2609. DESTINATION ${WEB_DEST}/static/img)
  2610. install(FILES
  2611. src/web/gui/css/morris-0.5.1.css
  2612. src/web/gui/css/c3-0.4.18.min.css
  2613. COMPONENT netdata
  2614. DESTINATION ${WEB_DEST}/css)
  2615. install(FILES
  2616. src/web/gui/.well-known/dnt/cookies
  2617. COMPONENT netdata
  2618. DESTINATION ${WEB_DEST}/.well-known/dnt)
  2619. if(NOT OS_WINDOWS)
  2620. # v0 dashboard
  2621. install(FILES
  2622. src/web/gui/v0/index.html
  2623. COMPONENT netdata
  2624. DESTINATION ${WEB_DEST}/v0)
  2625. endif()
  2626. if(OS_WINDOWS)
  2627. install(FILES /usr/bin/awk.exe
  2628. /usr/bin/bash.exe
  2629. /usr/bin/cat.exe
  2630. /usr/bin/chown.exe
  2631. /usr/bin/curl.exe
  2632. /usr/bin/env.exe
  2633. /usr/bin/grep.exe
  2634. /usr/bin/mkdir.exe
  2635. /usr/bin/openssl.exe
  2636. /usr/bin/rm.exe
  2637. /usr/bin/sed.exe
  2638. /usr/bin/sh.exe
  2639. /usr/bin/tail.exe
  2640. /usr/bin/tr.exe
  2641. /usr/bin/uuidgen.exe
  2642. /usr/bin/whoami.exe
  2643. DESTINATION "${BINDIR}")
  2644. install(FILES /usr/bin/msys-2.0.dll
  2645. /usr/bin/msys-asn1-8.dll
  2646. /usr/bin/msys-brotlicommon-1.dll
  2647. /usr/bin/msys-brotlidec-1.dll
  2648. /usr/bin/msys-brotlienc-1.dll
  2649. /usr/bin/msys-com_err-1.dll
  2650. /usr/bin/msys-crypt-2.dll
  2651. /usr/bin/msys-crypto-3.dll
  2652. /usr/bin/msys-curl-4.dll
  2653. /usr/bin/msys-gcc_s-seh-1.dll
  2654. /usr/bin/msys-gmp-10.dll
  2655. /usr/bin/msys-gssapi-3.dll
  2656. /usr/bin/msys-hcrypto-4.dll
  2657. /usr/bin/msys-heimbase-1.dll
  2658. /usr/bin/msys-heimntlm-0.dll
  2659. /usr/bin/msys-hx509-5.dll
  2660. /usr/bin/msys-iconv-2.dll
  2661. /usr/bin/msys-idn2-0.dll
  2662. /usr/bin/msys-intl-8.dll
  2663. /usr/bin/msys-krb5-26.dll
  2664. /usr/bin/msys-lz4-1.dll
  2665. /usr/bin/msys-mpfr-6.dll
  2666. /usr/bin/msys-ncursesw6.dll
  2667. /usr/bin/msys-nghttp2-14.dll
  2668. /usr/bin/msys-pcre-1.dll
  2669. /usr/bin/msys-protobuf-32.dll
  2670. /usr/bin/msys-psl-5.dll
  2671. /usr/bin/msys-readline8.dll
  2672. /usr/bin/msys-roken-18.dll
  2673. /usr/bin/msys-sqlite3-0.dll
  2674. /usr/bin/msys-ssh2-1.dll
  2675. /usr/bin/msys-ssl-3.dll
  2676. /usr/bin/msys-stdc++-6.dll
  2677. /usr/bin/msys-unistring-5.dll
  2678. /usr/bin/msys-uuid-1.dll
  2679. /usr/bin/msys-uv-1.dll
  2680. /usr/bin/msys-wind-0.dll
  2681. /usr/bin/msys-z.dll
  2682. /usr/bin/msys-zstd-1.dll
  2683. DESTINATION "${BINDIR}")
  2684. # Make bash & netdata happy
  2685. install(DIRECTORY DESTINATION tmp)
  2686. # Make curl work with ssl
  2687. install(DIRECTORY /usr/ssl DESTINATION usr)
  2688. endif()
  2689. include(Packaging)