CMakeLists.txt 111 KB

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