CMakeLists.txt 112 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108
  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. src/libnetdata/sanitizers/utf8-sanitizer.c
  698. src/libnetdata/sanitizers/utf8-sanitizer.h
  699. src/libnetdata/sanitizers/sanitizers.h
  700. src/libnetdata/sanitizers/sanitizers-labels.c
  701. src/libnetdata/sanitizers/sanitizers-labels.h
  702. src/libnetdata/sanitizers/sanitizers-functions.c
  703. src/libnetdata/sanitizers/sanitizers-functions.h
  704. src/libnetdata/sanitizers/sanitizers-pluginsd.c
  705. src/libnetdata/sanitizers/sanitizers-pluginsd.h
  706. )
  707. if(ENABLE_PLUGIN_EBPF)
  708. list(APPEND LIBNETDATA_FILES
  709. src/libnetdata/ebpf/ebpf.c
  710. src/libnetdata/ebpf/ebpf.h
  711. )
  712. endif()
  713. set(LIBH2O_FILES
  714. src/web/server/h2o/libh2o/deps/cloexec/cloexec.c
  715. src/web/server/h2o/libh2o/deps/libgkc/gkc.c
  716. src/web/server/h2o/libh2o/deps/libyrmcds/close.c
  717. src/web/server/h2o/libh2o/deps/libyrmcds/connect.c
  718. src/web/server/h2o/libh2o/deps/libyrmcds/recv.c
  719. src/web/server/h2o/libh2o/deps/libyrmcds/send.c
  720. src/web/server/h2o/libh2o/deps/libyrmcds/send_text.c
  721. src/web/server/h2o/libh2o/deps/libyrmcds/socket.c
  722. src/web/server/h2o/libh2o/deps/libyrmcds/strerror.c
  723. src/web/server/h2o/libh2o/deps/libyrmcds/text_mode.c
  724. src/web/server/h2o/libh2o/deps/picohttpparser/picohttpparser.c
  725. src/web/server/h2o/libh2o/lib/common/cache.c
  726. src/web/server/h2o/libh2o/lib/common/file.c
  727. src/web/server/h2o/libh2o/lib/common/filecache.c
  728. src/web/server/h2o/libh2o/lib/common/hostinfo.c
  729. src/web/server/h2o/libh2o/lib/common/http1client.c
  730. src/web/server/h2o/libh2o/lib/common/memcached.c
  731. src/web/server/h2o/libh2o/lib/common/memory.c
  732. src/web/server/h2o/libh2o/lib/common/multithread.c
  733. src/web/server/h2o/libh2o/lib/common/serverutil.c
  734. src/web/server/h2o/libh2o/lib/common/socket.c
  735. src/web/server/h2o/libh2o/lib/common/socketpool.c
  736. src/web/server/h2o/libh2o/lib/common/string.c
  737. src/web/server/h2o/libh2o/lib/common/time.c
  738. src/web/server/h2o/libh2o/lib/common/timeout.c
  739. src/web/server/h2o/libh2o/lib/common/url.c
  740. src/web/server/h2o/libh2o/lib/core/config.c
  741. src/web/server/h2o/libh2o/lib/core/configurator.c
  742. src/web/server/h2o/libh2o/lib/core/context.c
  743. src/web/server/h2o/libh2o/lib/core/headers.c
  744. src/web/server/h2o/libh2o/lib/core/logconf.c
  745. src/web/server/h2o/libh2o/lib/core/proxy.c
  746. src/web/server/h2o/libh2o/lib/core/request.c
  747. src/web/server/h2o/libh2o/lib/core/token.c
  748. src/web/server/h2o/libh2o/lib/core/util.c
  749. src/web/server/h2o/libh2o/lib/handler/access_log.c
  750. src/web/server/h2o/libh2o/lib/handler/chunked.c
  751. src/web/server/h2o/libh2o/lib/handler/compress.c
  752. src/web/server/h2o/libh2o/lib/handler/compress/gzip.c
  753. src/web/server/h2o/libh2o/lib/handler/errordoc.c
  754. src/web/server/h2o/libh2o/lib/handler/expires.c
  755. src/web/server/h2o/libh2o/lib/handler/fastcgi.c
  756. src/web/server/h2o/libh2o/lib/handler/file.c
  757. src/web/server/h2o/libh2o/lib/handler/headers.c
  758. src/web/server/h2o/libh2o/lib/handler/mimemap.c
  759. src/web/server/h2o/libh2o/lib/handler/proxy.c
  760. src/web/server/h2o/libh2o/lib/handler/redirect.c
  761. src/web/server/h2o/libh2o/lib/handler/reproxy.c
  762. src/web/server/h2o/libh2o/lib/handler/throttle_resp.c
  763. src/web/server/h2o/libh2o/lib/handler/status.c
  764. src/web/server/h2o/libh2o/lib/handler/headers_util.c
  765. src/web/server/h2o/libh2o/lib/handler/status/events.c
  766. src/web/server/h2o/libh2o/lib/handler/status/requests.c
  767. src/web/server/h2o/libh2o/lib/handler/http2_debug_state.c
  768. src/web/server/h2o/libh2o/lib/handler/status/durations.c
  769. src/web/server/h2o/libh2o/lib/handler/configurator/access_log.c
  770. src/web/server/h2o/libh2o/lib/handler/configurator/compress.c
  771. src/web/server/h2o/libh2o/lib/handler/configurator/errordoc.c
  772. src/web/server/h2o/libh2o/lib/handler/configurator/expires.c
  773. src/web/server/h2o/libh2o/lib/handler/configurator/fastcgi.c
  774. src/web/server/h2o/libh2o/lib/handler/configurator/file.c
  775. src/web/server/h2o/libh2o/lib/handler/configurator/headers.c
  776. src/web/server/h2o/libh2o/lib/handler/configurator/proxy.c
  777. src/web/server/h2o/libh2o/lib/handler/configurator/redirect.c
  778. src/web/server/h2o/libh2o/lib/handler/configurator/reproxy.c
  779. src/web/server/h2o/libh2o/lib/handler/configurator/throttle_resp.c
  780. src/web/server/h2o/libh2o/lib/handler/configurator/status.c
  781. src/web/server/h2o/libh2o/lib/handler/configurator/http2_debug_state.c
  782. src/web/server/h2o/libh2o/lib/handler/configurator/headers_util.c
  783. src/web/server/h2o/libh2o/lib/http1.c
  784. src/web/server/h2o/libh2o/lib/tunnel.c
  785. src/web/server/h2o/libh2o/lib/http2/cache_digests.c
  786. src/web/server/h2o/libh2o/lib/http2/casper.c
  787. src/web/server/h2o/libh2o/lib/http2/connection.c
  788. src/web/server/h2o/libh2o/lib/http2/frame.c
  789. src/web/server/h2o/libh2o/lib/http2/hpack.c
  790. src/web/server/h2o/libh2o/lib/http2/scheduler.c
  791. src/web/server/h2o/libh2o/lib/http2/stream.c
  792. src/web/server/h2o/libh2o/lib/http2/http2_debug_state.c
  793. )
  794. set(DAEMON_FILES
  795. src/daemon/buildinfo.c
  796. src/daemon/buildinfo.h
  797. src/daemon/common.c
  798. src/daemon/common.h
  799. src/daemon/daemon.c
  800. src/daemon/daemon.h
  801. src/daemon/libuv_workers.c
  802. src/daemon/libuv_workers.h
  803. src/daemon/global_statistics.c
  804. src/daemon/global_statistics.h
  805. src/daemon/analytics.c
  806. src/daemon/analytics.h
  807. src/daemon/main.c
  808. src/daemon/main.h
  809. src/daemon/environment.c
  810. src/daemon/win_system-info.c
  811. src/daemon/win_system-info.h
  812. src/daemon/signals.c
  813. src/daemon/signals.h
  814. src/daemon/service.c
  815. src/daemon/watcher.c
  816. src/daemon/watcher.h
  817. src/daemon/static_threads.c
  818. src/daemon/static_threads.h
  819. src/daemon/commands.c
  820. src/daemon/commands.h
  821. src/daemon/pipename.c
  822. src/daemon/pipename.h
  823. src/daemon/unit_test.c
  824. src/daemon/unit_test.h
  825. src/daemon/config/dyncfg.c
  826. src/daemon/config/dyncfg.h
  827. src/daemon/config/dyncfg-files.c
  828. src/daemon/config/dyncfg-unittest.c
  829. src/daemon/config/dyncfg-inline.c
  830. src/daemon/config/dyncfg-echo.c
  831. src/daemon/config/dyncfg-internals.h
  832. src/daemon/config/dyncfg-intercept.c
  833. src/daemon/config/dyncfg-tree.c
  834. )
  835. set(H2O_FILES
  836. src/web/server/h2o/http_server.c
  837. src/web/server/h2o/http_server.h
  838. src/web/server/h2o/h2o_utils.c
  839. src/web/server/h2o/h2o_utils.h
  840. src/web/server/h2o/streaming.c
  841. src/web/server/h2o/streaming.h
  842. src/web/server/h2o/connlist.c
  843. src/web/server/h2o/connlist.h
  844. )
  845. if(ENABLE_H2O)
  846. list(APPEND DAEMON_FILES ${H2O_FILES})
  847. endif()
  848. set(API_PLUGIN_FILES
  849. src/web/api/web_api.c
  850. src/web/api/web_api.h
  851. src/web/api/web_api_v1.c
  852. src/web/api/web_api_v1.h
  853. src/web/api/web_api_v2.c
  854. src/web/api/web_api_v2.h
  855. src/web/api/web_api_v3.c
  856. src/web/api/web_api_v3.h
  857. src/web/api/http_auth.c
  858. src/web/api/http_auth.h
  859. src/web/api/http_header.c
  860. src/web/api/http_header.h
  861. src/web/api/maps/rrdr_options.c
  862. src/web/api/maps/rrdr_options.h
  863. src/web/api/maps/contexts_options.c
  864. src/web/api/maps/contexts_options.h
  865. src/web/api/maps/datasource_formats.c
  866. src/web/api/maps/datasource_formats.h
  867. src/web/api/maps/maps.h
  868. src/web/api/maps/contexts_alert_statuses.c
  869. src/web/api/maps/contexts_alert_statuses.h
  870. src/web/api/v1/api_v1_allmetrics.c
  871. src/web/api/v1/api_v1_badge/web_buffer_svg.c
  872. src/web/api/v1/api_v1_function.c
  873. src/web/api/v1/api_v1_manage.c
  874. src/web/api/v1/api_v1_calls.h
  875. src/web/api/v1/api_v1_dbengine.c
  876. src/web/api/v1/api_v1_config.c
  877. src/web/api/v1/api_v1_functions.c
  878. src/web/api/v1/api_v1_weights.c
  879. src/web/api/v1/api_v1_info.c
  880. src/web/api/v1/api_v1_registry.c
  881. src/web/api/v1/api_v1_data.c
  882. src/web/api/v1/api_v1_contexts.c
  883. src/web/api/v1/api_v1_ml_info.c
  884. src/web/api/v1/api_v1_aclk.c
  885. src/web/api/v1/api_v1_context.c
  886. src/web/api/v1/api_v1_alarms.c
  887. src/web/api/v1/api_v1_charts.c
  888. src/web/api/v2/api_v2_info.c
  889. src/web/api/v2/api_v2_nodes.c
  890. src/web/api/v2/api_v2_node_instances.c
  891. src/web/api/v2/api_v2_q.c
  892. src/web/api/v2/api_v2_versions.c
  893. src/web/api/v2/api_v2_functions.c
  894. src/web/api/v2/api_v2_alerts.c
  895. src/web/api/v2/api_v2_alert_transitions.c
  896. src/web/api/v2/api_v2_ilove/ilove.c
  897. src/web/api/v2/api_v2_bearer.c
  898. src/web/api/v2/api_v2_calls.h
  899. src/web/api/v2/api_v2_data.c
  900. src/web/api/v2/api_v2_progress.c
  901. src/web/api/v2/api_v2_weights.c
  902. src/web/api/v2/api_v2_alert_config.c
  903. src/web/api/v2/api_v2_contexts.c
  904. src/web/api/v2/api_v2_claim.c
  905. src/web/api/v2/api_v2_webrtc.c
  906. src/web/api/v3/api_v3_calls.h
  907. src/web/api/v3/api_v3_settings.c
  908. src/web/api/functions/functions.c
  909. src/web/api/functions/functions.h
  910. src/web/api/functions/function-progress.c
  911. src/web/api/functions/function-progress.h
  912. src/web/api/functions/function-streaming.c
  913. src/web/api/functions/function-streaming.h
  914. src/web/api/queries/rrdr.c
  915. src/web/api/queries/rrdr.h
  916. src/web/api/queries/query.c
  917. src/web/api/queries/query.h
  918. src/web/api/queries/average/average.c
  919. src/web/api/queries/average/average.h
  920. src/web/api/queries/countif/countif.c
  921. src/web/api/queries/countif/countif.h
  922. src/web/api/queries/incremental_sum/incremental_sum.c
  923. src/web/api/queries/incremental_sum/incremental_sum.h
  924. src/web/api/queries/max/max.c
  925. src/web/api/queries/max/max.h
  926. src/web/api/queries/min/min.c
  927. src/web/api/queries/min/min.h
  928. src/web/api/queries/sum/sum.c
  929. src/web/api/queries/sum/sum.h
  930. src/web/api/queries/median/median.c
  931. src/web/api/queries/median/median.h
  932. src/web/api/queries/percentile/percentile.c
  933. src/web/api/queries/percentile/percentile.h
  934. src/web/api/queries/stddev/stddev.c
  935. src/web/api/queries/stddev/stddev.h
  936. src/web/api/queries/ses/ses.c
  937. src/web/api/queries/ses/ses.h
  938. src/web/api/queries/des/des.c
  939. src/web/api/queries/des/des.h
  940. src/web/api/queries/trimmed_mean/trimmed_mean.c
  941. src/web/api/queries/trimmed_mean/trimmed_mean.h
  942. src/web/api/queries/weights.c
  943. src/web/api/queries/weights.h
  944. src/web/api/formatters/rrd2json.c
  945. src/web/api/formatters/rrd2json.h
  946. src/web/api/formatters/csv/csv.c
  947. src/web/api/formatters/csv/csv.h
  948. src/web/api/formatters/json/json.c
  949. src/web/api/formatters/json/json.h
  950. src/web/api/formatters/ssv/ssv.c
  951. src/web/api/formatters/ssv/ssv.h
  952. src/web/api/formatters/value/value.c
  953. src/web/api/formatters/value/value.h
  954. src/web/api/formatters/json_wrapper.c
  955. src/web/api/formatters/json_wrapper.h
  956. src/web/api/formatters/charts2json.c
  957. src/web/api/formatters/charts2json.h
  958. src/web/api/formatters/rrdset2json.c
  959. src/web/api/formatters/rrdset2json.h
  960. src/web/rtc/webrtc.c
  961. src/web/rtc/webrtc.h
  962. src/web/api/functions/function-bearer_get_token.c
  963. src/web/api/functions/function-bearer_get_token.h
  964. src/web/api/v3/api_v3_me.c
  965. )
  966. set(EXPORTING_ENGINE_FILES
  967. src/exporting/exporting_engine.c
  968. src/exporting/exporting_engine.h
  969. src/exporting/graphite/graphite.c
  970. src/exporting/graphite/graphite.h
  971. src/exporting/json/json.c
  972. src/exporting/json/json.h
  973. src/exporting/opentsdb/opentsdb.c
  974. src/exporting/opentsdb/opentsdb.h
  975. src/exporting/prometheus/prometheus.c
  976. src/exporting/prometheus/prometheus.h
  977. src/exporting/read_config.c
  978. src/exporting/clean_connectors.c
  979. src/exporting/init_connectors.c
  980. src/exporting/process_data.c
  981. src/exporting/check_filters.c
  982. src/exporting/send_data.c
  983. src/exporting/send_internal_metrics.c
  984. )
  985. set(HEALTH_PLUGIN_FILES
  986. src/health/health.c
  987. src/health/health.h
  988. src/health/health_config.c
  989. src/health/health_json.c
  990. src/health/health_log.c
  991. src/health/health_prototypes.c
  992. src/health/health_prototypes.h
  993. src/health/health_silencers.c
  994. src/health/health_silencers.h
  995. src/health/health_internals.h
  996. src/health/health_notifications.c
  997. src/health/health_event_loop.c
  998. src/health/health_dyncfg.c
  999. src/health/health_variable.c
  1000. src/health/rrdcalc.c
  1001. src/health/rrdcalc.h
  1002. src/health/rrdvar.c
  1003. src/health/rrdvar.h
  1004. )
  1005. set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c)
  1006. if(ENABLE_ML)
  1007. set(ML_FILES
  1008. src/ml/ad_charts.h
  1009. src/ml/ad_charts.cc
  1010. src/ml/Config.cc
  1011. src/ml/dlib/dlib/all/source.cpp
  1012. src/ml/ml.h
  1013. src/ml/ml.cc
  1014. src/ml/ml-private.h
  1015. )
  1016. else()
  1017. set(ML_FILES
  1018. src/ml/ml.h
  1019. src/ml/ml-dummy.c
  1020. )
  1021. endif()
  1022. set(INTERNAL_COLLECTORS_FILES
  1023. src/collectors/common-contexts/common-contexts.h
  1024. src/collectors/common-contexts/disk-io.h
  1025. src/collectors/common-contexts/system-io.h
  1026. src/collectors/common-contexts/system-interrupts.h
  1027. src/collectors/common-contexts/system-processes.h
  1028. src/collectors/common-contexts/system-ram.h
  1029. src/collectors/common-contexts/mem-swap.h
  1030. src/collectors/common-contexts/mem-pgfaults.h
  1031. src/collectors/common-contexts/mem-available.h
  1032. )
  1033. set(PLUGINSD_PLUGIN_FILES
  1034. src/plugins.d/plugins_d.c
  1035. src/plugins.d/plugins_d.h
  1036. src/plugins.d/pluginsd_dyncfg.c
  1037. src/plugins.d/pluginsd_dyncfg.h
  1038. src/plugins.d/pluginsd_functions.c
  1039. src/plugins.d/pluginsd_functions.h
  1040. src/plugins.d/pluginsd_internals.c
  1041. src/plugins.d/pluginsd_internals.h
  1042. src/plugins.d/pluginsd_parser.c
  1043. src/plugins.d/pluginsd_parser.h
  1044. src/plugins.d/pluginsd_replication.c
  1045. src/plugins.d/pluginsd_replication.h
  1046. )
  1047. set(RRD_PLUGIN_FILES
  1048. src/database/contexts/api_v1_contexts.c
  1049. src/database/contexts/api_v2_contexts.c
  1050. src/database/contexts/api_v2_contexts.h
  1051. src/database/contexts/api_v2_contexts_agents.c
  1052. src/database/contexts/api_v2_contexts_alerts.c
  1053. src/database/contexts/api_v2_contexts_alerts.h
  1054. src/database/contexts/api_v2_contexts_alert_transitions.c
  1055. src/database/contexts/api_v2_contexts_alert_config.c
  1056. src/database/contexts/context.c
  1057. src/database/contexts/instance.c
  1058. src/database/contexts/internal.h
  1059. src/database/contexts/metric.c
  1060. src/database/contexts/query_scope.c
  1061. src/database/contexts/query_target.c
  1062. src/database/contexts/rrdcontext.c
  1063. src/database/contexts/rrdcontext.h
  1064. src/database/contexts/worker.c
  1065. src/database/rrdcollector.c
  1066. src/database/rrdcollector.h
  1067. src/database/rrddim.c
  1068. src/database/rrdfunctions.c
  1069. src/database/rrdfunctions.h
  1070. src/database/rrdfunctions-inline.c
  1071. src/database/rrdfunctions-inline.h
  1072. src/database/rrdhost.c
  1073. src/database/rrdlabels.c
  1074. src/database/rrd.c
  1075. src/database/rrd.h
  1076. src/database/rrdset.c
  1077. src/database/storage_engine.c
  1078. src/database/storage_engine.h
  1079. src/database/ram/rrddim_mem.c
  1080. src/database/ram/rrddim_mem.h
  1081. src/database/sqlite/sqlite_metadata.c
  1082. src/database/sqlite/sqlite_metadata.h
  1083. src/database/sqlite/sqlite_functions.c
  1084. src/database/sqlite/sqlite_functions.h
  1085. src/database/sqlite/sqlite_context.c
  1086. src/database/sqlite/sqlite_context.h
  1087. src/database/sqlite/sqlite_db_migration.c
  1088. src/database/sqlite/sqlite_db_migration.h
  1089. src/database/sqlite/sqlite_aclk.c
  1090. src/database/sqlite/sqlite_aclk.h
  1091. src/database/sqlite/sqlite_health.c
  1092. src/database/sqlite/sqlite_health.h
  1093. src/database/sqlite/sqlite_aclk_node.c
  1094. src/database/sqlite/sqlite_aclk_node.h
  1095. src/database/sqlite/sqlite_aclk_alert.c
  1096. src/database/sqlite/sqlite_aclk_alert.h
  1097. src/database/sqlite/sqlite3.c
  1098. src/database/sqlite/sqlite3.h
  1099. src/database/sqlite/sqlite3recover.c
  1100. src/database/sqlite/sqlite3recover.h
  1101. src/database/sqlite/dbdata.c
  1102. src/database/KolmogorovSmirnovDist.c
  1103. src/database/KolmogorovSmirnovDist.h
  1104. src/database/rrdfunctions-inflight.c
  1105. src/database/rrdfunctions-inflight.h
  1106. src/database/rrdfunctions-exporters.c
  1107. src/database/rrdfunctions-exporters.h
  1108. src/database/rrdfunctions-internals.h
  1109. src/database/rrdcollector-internals.h
  1110. )
  1111. if(ENABLE_DBENGINE)
  1112. list(APPEND RRD_PLUGIN_FILES
  1113. src/database/engine/rrdengine.c
  1114. src/database/engine/rrdengine.h
  1115. src/database/engine/rrddiskprotocol.h
  1116. src/database/engine/datafile.c
  1117. src/database/engine/datafile.h
  1118. src/database/engine/journalfile.c
  1119. src/database/engine/journalfile.h
  1120. src/database/engine/rrdenginelib.c
  1121. src/database/engine/rrdenginelib.h
  1122. src/database/engine/rrdengineapi.c
  1123. src/database/engine/rrdengineapi.h
  1124. src/database/engine/pagecache.c
  1125. src/database/engine/pagecache.h
  1126. src/database/engine/page_test.cc
  1127. src/database/engine/page.c
  1128. src/database/engine/page.h
  1129. src/database/engine/cache.c
  1130. src/database/engine/cache.h
  1131. src/database/engine/metric.c
  1132. src/database/engine/metric.h
  1133. src/database/engine/pdc.c
  1134. src/database/engine/pdc.h
  1135. src/database/engine/dbengine-unittest.c
  1136. src/database/engine/dbengine-stresstest.c
  1137. src/database/engine/dbengine-compression.c
  1138. src/database/engine/dbengine-compression.h
  1139. )
  1140. endif()
  1141. set(REGISTRY_PLUGIN_FILES
  1142. src/registry/registry.c
  1143. src/registry/registry.h
  1144. src/registry/registry_db.c
  1145. src/registry/registry_init.c
  1146. src/registry/registry_internals.c
  1147. src/registry/registry_internals.h
  1148. src/registry/registry_log.c
  1149. src/registry/registry_machine.c
  1150. src/registry/registry_machine.h
  1151. src/registry/registry_person.c
  1152. src/registry/registry_person.h
  1153. )
  1154. set(STATSD_PLUGIN_FILES
  1155. src/collectors/statsd.plugin/statsd.c
  1156. )
  1157. set(SYSTEMD_JOURNAL_PLUGIN_FILES
  1158. src/collectors/systemd-journal.plugin/systemd-journal.c
  1159. src/collectors/systemd-journal.plugin/systemd-internals.h
  1160. src/collectors/systemd-journal.plugin/systemd-main.c
  1161. src/collectors/systemd-journal.plugin/systemd-units.c
  1162. src/collectors/systemd-journal.plugin/systemd-journal.c
  1163. src/collectors/systemd-journal.plugin/systemd-journal-annotations.c
  1164. src/collectors/systemd-journal.plugin/systemd-journal-files.c
  1165. src/collectors/systemd-journal.plugin/systemd-journal-fstat.c
  1166. src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
  1167. src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c
  1168. src/libnetdata/maps/system-users.h
  1169. src/libnetdata/maps/system-groups.h
  1170. src/libnetdata/maps/system-services.h
  1171. src/collectors/systemd-journal.plugin/systemd-journal-sampling.h
  1172. )
  1173. set(STREAMING_PLUGIN_FILES
  1174. src/streaming/rrdpush.c
  1175. src/streaming/rrdpush.h
  1176. src/streaming/compression.c
  1177. src/streaming/compression.h
  1178. src/streaming/compression_brotli.c
  1179. src/streaming/compression_brotli.h
  1180. src/streaming/compression_gzip.c
  1181. src/streaming/compression_gzip.h
  1182. src/streaming/compression_lz4.c
  1183. src/streaming/compression_lz4.h
  1184. src/streaming/compression_zstd.c
  1185. src/streaming/compression_zstd.h
  1186. src/streaming/receiver.c
  1187. src/streaming/sender.c
  1188. src/streaming/replication.c
  1189. src/streaming/replication.h
  1190. src/streaming/common.h
  1191. src/streaming/protocol/command-nodeid.c
  1192. src/streaming/protocol/commands.c
  1193. src/streaming/protocol/commands.h
  1194. src/streaming/protocol/command-claimed_id.c
  1195. src/streaming/stream_path.c
  1196. src/streaming/stream_path.h
  1197. src/streaming/stream_capabilities.c
  1198. src/streaming/stream_capabilities.h
  1199. src/streaming/sender_connect.c
  1200. src/streaming/sender_internals.h
  1201. src/streaming/sender_execute.c
  1202. src/streaming/sender_commit.c
  1203. )
  1204. set(WEB_PLUGIN_FILES
  1205. src/web/server/web_client.c
  1206. src/web/server/web_client.h
  1207. src/web/server/web_server.c
  1208. src/web/server/web_server.h
  1209. src/web/server/static/static-threaded.c
  1210. src/web/server/static/static-threaded.h
  1211. src/web/server/web_client_cache.c
  1212. src/web/server/web_client_cache.h
  1213. )
  1214. set(CLAIM_PLUGIN_FILES
  1215. src/claim/claim.c
  1216. src/claim/claim.h
  1217. src/claim/claim_id.c
  1218. src/claim/claim_id.h
  1219. src/claim/cloud-conf.c
  1220. src/claim/claim-with-api.c
  1221. src/claim/cloud-status.c
  1222. src/claim/cloud-status.h
  1223. )
  1224. set(CLAIM_WINDOWS_FILES
  1225. src/claim/main.c
  1226. src/claim/main.h
  1227. src/claim/ui.c
  1228. src/claim/ui.h
  1229. )
  1230. set(ACLK_ALWAYS_BUILD
  1231. src/aclk/aclk_proxy.c
  1232. src/aclk/aclk_proxy.h
  1233. src/aclk/aclk.c
  1234. src/aclk/aclk.h
  1235. src/aclk/aclk_capas.c
  1236. src/aclk/aclk_capas.h
  1237. src/aclk/aclk_util.c
  1238. src/aclk/aclk_util.h
  1239. src/aclk/https_client.c
  1240. src/aclk/https_client.h
  1241. src/libnetdata/c_rhash/c_rhash.c
  1242. src/libnetdata/c_rhash/c_rhash.h
  1243. src/libnetdata/c_rhash/c_rhash_internal.h
  1244. )
  1245. set(TIMEX_PLUGIN_FILES
  1246. src/collectors/timex.plugin/plugin_timex.c
  1247. )
  1248. set(PROFILE_PLUGIN_FILES
  1249. src/collectors/profile.plugin/plugin_profile.cc
  1250. )
  1251. set(CGROUPS_PLUGIN_FILES
  1252. src/collectors/cgroups.plugin/sys_fs_cgroup.c
  1253. src/collectors/cgroups.plugin/sys_fs_cgroup.h
  1254. src/collectors/cgroups.plugin/cgroup-internals.h
  1255. src/collectors/cgroups.plugin/cgroup-discovery.c
  1256. src/collectors/cgroups.plugin/cgroup-charts.c
  1257. src/collectors/cgroups.plugin/cgroup-top.c
  1258. )
  1259. set(DISKSPACE_PLUGIN_FILES
  1260. src/collectors/diskspace.plugin/plugin_diskspace.c
  1261. )
  1262. set(MACOS_PLUGIN_FILES
  1263. src/collectors/macos.plugin/plugin_macos.c
  1264. src/collectors/macos.plugin/plugin_macos.h
  1265. src/collectors/macos.plugin/macos_sysctl.c
  1266. src/collectors/macos.plugin/macos_mach_smi.c
  1267. src/collectors/macos.plugin/macos_fw.c
  1268. )
  1269. set(FREEBSD_PLUGIN_FILES
  1270. src/collectors/freebsd.plugin/plugin_freebsd.c
  1271. src/collectors/freebsd.plugin/plugin_freebsd.h
  1272. src/collectors/freebsd.plugin/freebsd_sysctl.c
  1273. src/collectors/freebsd.plugin/freebsd_getmntinfo.c
  1274. src/collectors/freebsd.plugin/freebsd_getifaddrs.c
  1275. src/collectors/freebsd.plugin/freebsd_devstat.c
  1276. src/collectors/freebsd.plugin/freebsd_kstat_zfs.c
  1277. src/collectors/freebsd.plugin/freebsd_ipfw.c
  1278. src/collectors/proc.plugin/zfs_common.c
  1279. src/collectors/proc.plugin/zfs_common.h
  1280. )
  1281. set(WINDOWS_EVENTS_PLUGIN_FILES
  1282. src/collectors/windows-events.plugin/windows-events.c
  1283. src/collectors/windows-events.plugin/windows-events.h
  1284. src/collectors/windows-events.plugin/windows-events-query.h
  1285. src/collectors/windows-events.plugin/windows-events-query.c
  1286. src/collectors/windows-events.plugin/windows-events-sources.c
  1287. src/collectors/windows-events.plugin/windows-events-sources.h
  1288. src/collectors/windows-events.plugin/windows-events-sid.c
  1289. src/collectors/windows-events.plugin/windows-events-sid.h
  1290. src/collectors/windows-events.plugin/windows-events-unicode.c
  1291. src/collectors/windows-events.plugin/windows-events-unicode.h
  1292. src/collectors/windows-events.plugin/windows-events-xml.c
  1293. src/collectors/windows-events.plugin/windows-events-xml.h
  1294. src/collectors/windows-events.plugin/windows-events-publishers.c
  1295. src/collectors/windows-events.plugin/windows-events-publishers.h
  1296. src/collectors/windows-events.plugin/windows-events-fields-cache.c
  1297. src/collectors/windows-events.plugin/windows-events-fields-cache.h
  1298. src/collectors/windows-events.plugin/windows-events-query-builder.c
  1299. src/collectors/windows-events.plugin/windows-events-query-builder.h
  1300. )
  1301. set(WINDOWS_PLUGIN_FILES
  1302. src/collectors/windows.plugin/windows_plugin.c
  1303. src/collectors/windows.plugin/windows_plugin.h
  1304. src/collectors/windows.plugin/GetSystemUptime.c
  1305. src/collectors/windows.plugin/GetSystemRAM.c
  1306. src/collectors/windows.plugin/GetSystemCPU.c
  1307. src/collectors/windows.plugin/perflib-rrd.c
  1308. src/collectors/windows.plugin/perflib-rrd.h
  1309. src/collectors/windows.plugin/perflib-storage.c
  1310. src/collectors/windows.plugin/perflib-processor.c
  1311. src/collectors/windows.plugin/perflib-thermalzone.c
  1312. src/collectors/windows.plugin/perflib-objects.c
  1313. src/collectors/windows.plugin/perflib-network.c
  1314. src/collectors/windows.plugin/perflib-memory.c
  1315. src/collectors/windows.plugin/perflib-processes.c
  1316. src/collectors/windows.plugin/perflib-web-service.c
  1317. )
  1318. set(PROC_PLUGIN_FILES
  1319. src/collectors/proc.plugin/ipc.c
  1320. src/collectors/proc.plugin/plugin_proc.c
  1321. src/collectors/proc.plugin/plugin_proc.h
  1322. src/collectors/proc.plugin/proc_sys_fs_file_nr.c
  1323. src/collectors/proc.plugin/proc_diskstats.c
  1324. src/collectors/proc.plugin/proc_mdstat.c
  1325. src/collectors/proc.plugin/proc_interrupts.c
  1326. src/collectors/proc.plugin/proc_softirqs.c
  1327. src/collectors/proc.plugin/proc_loadavg.c
  1328. src/collectors/proc.plugin/proc_meminfo.c
  1329. src/collectors/proc.plugin/proc_pagetypeinfo.c
  1330. src/collectors/proc.plugin/proc_net_dev.c
  1331. src/collectors/proc.plugin/proc_net_dev_renames.c
  1332. src/collectors/proc.plugin/proc_net_dev_renames.h
  1333. src/collectors/proc.plugin/proc_net_wireless.c
  1334. src/collectors/proc.plugin/proc_net_ip_vs_stats.c
  1335. src/collectors/proc.plugin/proc_net_netstat.c
  1336. src/collectors/proc.plugin/proc_net_rpc_nfs.c
  1337. src/collectors/proc.plugin/proc_net_rpc_nfsd.c
  1338. src/collectors/proc.plugin/proc_net_sctp_snmp.c
  1339. src/collectors/proc.plugin/proc_net_sockstat.c
  1340. src/collectors/proc.plugin/proc_net_sockstat6.c
  1341. src/collectors/proc.plugin/proc_net_softnet_stat.c
  1342. src/collectors/proc.plugin/proc_net_stat_conntrack.c
  1343. src/collectors/proc.plugin/proc_net_stat_synproxy.c
  1344. src/collectors/proc.plugin/proc_self_mountinfo.c
  1345. src/collectors/proc.plugin/proc_self_mountinfo.h
  1346. src/collectors/proc.plugin/zfs_common.c
  1347. src/collectors/proc.plugin/zfs_common.h
  1348. src/collectors/proc.plugin/proc_spl_kstat_zfs.c
  1349. src/collectors/proc.plugin/proc_stat.c
  1350. src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
  1351. src/collectors/proc.plugin/proc_vmstat.c
  1352. src/collectors/proc.plugin/proc_uptime.c
  1353. src/collectors/proc.plugin/proc_pressure.c
  1354. src/collectors/proc.plugin/proc_pressure.h
  1355. src/collectors/proc.plugin/sys_kernel_mm_ksm.c
  1356. src/collectors/proc.plugin/sys_block_zram.c
  1357. src/collectors/proc.plugin/sys_devices_system_edac_mc.c
  1358. src/collectors/proc.plugin/sys_devices_system_node.c
  1359. src/collectors/proc.plugin/sys_class_infiniband.c
  1360. src/collectors/proc.plugin/sys_fs_btrfs.c
  1361. src/collectors/proc.plugin/sys_class_power_supply.c
  1362. src/collectors/proc.plugin/sys_devices_pci_aer.c
  1363. src/collectors/proc.plugin/sys_class_drm.c
  1364. )
  1365. set(TC_PLUGIN_FILES
  1366. src/collectors/tc.plugin/plugin_tc.c
  1367. )
  1368. set(NETDATA_FILES
  1369. src/collectors/all.h
  1370. ${DAEMON_FILES}
  1371. ${API_PLUGIN_FILES}
  1372. ${EXPORTING_ENGINE_FILES}
  1373. ${HEALTH_PLUGIN_FILES}
  1374. ${IDLEJITTER_PLUGIN_FILES}
  1375. ${ML_FILES}
  1376. ${PLUGINSD_PLUGIN_FILES}
  1377. ${RRD_PLUGIN_FILES}
  1378. ${REGISTRY_PLUGIN_FILES}
  1379. ${STATSD_PLUGIN_FILES}
  1380. ${STREAMING_PLUGIN_FILES}
  1381. ${WEB_PLUGIN_FILES}
  1382. ${CLAIM_PLUGIN_FILES}
  1383. ${ACLK_ALWAYS_BUILD}
  1384. ${PROFILE_PLUGIN_FILES}
  1385. )
  1386. if(OS_LINUX)
  1387. list(APPEND NETDATA_FILES
  1388. src/daemon/static_threads_linux.c
  1389. ${CGROUPS_PLUGIN_FILES}
  1390. ${DISKSPACE_PLUGIN_FILES}
  1391. ${PROC_PLUGIN_FILES}
  1392. ${TC_PLUGIN_FILES}
  1393. ${TIMEX_PLUGIN_FILES}
  1394. ${INTERNAL_COLLECTORS_FILES}
  1395. )
  1396. if(ENABLE_SENTRY)
  1397. list(APPEND NETDATA_FILES
  1398. src/daemon/sentry-native/sentry-native.c
  1399. src/daemon/sentry-native/sentry-native.h)
  1400. endif()
  1401. elseif(OS_MACOS)
  1402. list(APPEND NETDATA_FILES
  1403. src/daemon/static_threads_macos.c
  1404. ${MACOS_PLUGIN_FILES}
  1405. ${TIMEX_PLUGIN_FILES}
  1406. ${INTERNAL_COLLECTORS_FILES}
  1407. )
  1408. elseif(OS_FREEBSD)
  1409. list(APPEND NETDATA_FILES
  1410. src/daemon/static_threads_freebsd.c
  1411. ${FREEBSD_PLUGIN_FILES}
  1412. ${TIMEX_PLUGIN_FILES}
  1413. ${INTERNAL_COLLECTORS_FILES}
  1414. )
  1415. elseif(OS_WINDOWS)
  1416. list(APPEND NETDATA_FILES
  1417. src/daemon/static_threads_windows.c
  1418. src/daemon/winsvc.cc
  1419. ${WINDOWS_PLUGIN_FILES}
  1420. ${INTERNAL_COLLECTORS_FILES}
  1421. )
  1422. endif()
  1423. set(MQTT_WEBSOCKETS_FILES
  1424. src/aclk/mqtt_websockets/mqtt_wss_client.c
  1425. src/aclk/mqtt_websockets/mqtt_wss_client.h
  1426. src/aclk/mqtt_websockets/ws_client.c
  1427. src/aclk/mqtt_websockets/ws_client.h
  1428. src/aclk/mqtt_websockets/mqtt_ng.c
  1429. src/aclk/mqtt_websockets/mqtt_ng.h
  1430. src/aclk/mqtt_websockets/common_public.c
  1431. src/aclk/mqtt_websockets/common_public.h
  1432. src/aclk/mqtt_websockets/common_internal.h
  1433. )
  1434. set(ACLK_PROTO_DEFS
  1435. src/aclk/aclk-schemas/proto/aclk/v1/lib.proto
  1436. src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto
  1437. src/aclk/aclk-schemas/proto/agent/v1/connection.proto
  1438. src/aclk/aclk-schemas/proto/alarm/v1/config.proto
  1439. src/aclk/aclk-schemas/proto/alarm/v1/stream.proto
  1440. src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto
  1441. src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto
  1442. src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
  1443. src/aclk/aclk-schemas/proto/context/v1/context.proto
  1444. src/aclk/aclk-schemas/proto/context/v1/stream.proto
  1445. src/aclk/aclk-schemas/proto/agent/v1/cmds.proto
  1446. )
  1447. set(ACLK_FILES
  1448. src/aclk/aclk_query.c
  1449. src/aclk/aclk_query.h
  1450. src/aclk/aclk_query_queue.c
  1451. src/aclk/aclk_query_queue.h
  1452. src/aclk/aclk_otp.c
  1453. src/aclk/aclk_otp.h
  1454. src/aclk/aclk_tx_msgs.c
  1455. src/aclk/aclk_tx_msgs.h
  1456. src/aclk/aclk_rx_msgs.c
  1457. src/aclk/aclk_rx_msgs.h
  1458. src/aclk/aclk_alarm_api.c
  1459. src/aclk/aclk_alarm_api.h
  1460. src/aclk/aclk_contexts_api.c
  1461. src/aclk/aclk_contexts_api.h
  1462. src/aclk/schema-wrappers/connection.cc
  1463. src/aclk/schema-wrappers/connection.h
  1464. src/aclk/schema-wrappers/node_connection.cc
  1465. src/aclk/schema-wrappers/node_connection.h
  1466. src/aclk/schema-wrappers/node_creation.cc
  1467. src/aclk/schema-wrappers/node_creation.h
  1468. src/aclk/schema-wrappers/alarm_stream.cc
  1469. src/aclk/schema-wrappers/alarm_stream.h
  1470. src/aclk/schema-wrappers/alarm_config.cc
  1471. src/aclk/schema-wrappers/alarm_config.h
  1472. src/aclk/schema-wrappers/node_info.cc
  1473. src/aclk/schema-wrappers/node_info.h
  1474. src/aclk/schema-wrappers/capability.cc
  1475. src/aclk/schema-wrappers/capability.h
  1476. src/aclk/schema-wrappers/proto_2_json.cc
  1477. src/aclk/schema-wrappers/proto_2_json.h
  1478. src/aclk/schema-wrappers/context_stream.cc
  1479. src/aclk/schema-wrappers/context_stream.h
  1480. src/aclk/schema-wrappers/context.cc
  1481. src/aclk/schema-wrappers/context.h
  1482. src/aclk/schema-wrappers/schema_wrappers.h
  1483. src/aclk/schema-wrappers/schema_wrapper_utils.cc
  1484. src/aclk/schema-wrappers/schema_wrapper_utils.h
  1485. src/aclk/schema-wrappers/agent_cmds.cc
  1486. src/aclk/schema-wrappers/agent_cmds.h
  1487. )
  1488. set(MONGODB_EXPORTING_FILES
  1489. src/exporting/mongodb/mongodb.c
  1490. src/exporting/mongodb/mongodb.h
  1491. )
  1492. set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1493. src/exporting/prometheus/remote_write/remote_write.c
  1494. src/exporting/prometheus/remote_write/remote_write.h
  1495. src/exporting/prometheus/remote_write/remote_write_request.cc
  1496. src/exporting/prometheus/remote_write/remote_write_request.h
  1497. )
  1498. #
  1499. # build h2o
  1500. #
  1501. if(ENABLE_H2O)
  1502. add_library(h2o STATIC ${LIBH2O_FILES})
  1503. target_include_directories(h2o BEFORE PUBLIC
  1504. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include"
  1505. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/cloexec"
  1506. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/brotli/enc"
  1507. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/golombset"
  1508. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libgkc"
  1509. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libyrmcds"
  1510. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/klib"
  1511. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/neverbleed"
  1512. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picohttpparser"
  1513. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picotest"
  1514. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yaml/include"
  1515. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yoml"
  1516. )
  1517. target_compile_options(h2o PRIVATE
  1518. -Wno-all -Wno-extra
  1519. -Wno-shadow
  1520. -Wno-deprecated-declarations
  1521. -Wformat
  1522. )
  1523. target_compile_options(h2o PUBLIC -DH2O_USE_LIBUV=0)
  1524. target_link_libraries(h2o PRIVATE PkgConfig::TLS)
  1525. endif()
  1526. #
  1527. # build libjudy
  1528. #
  1529. add_library(judy STATIC ${LIBJUDY_SOURCES})
  1530. target_compile_options(judy PRIVATE
  1531. -Wno-all -Wno-extra
  1532. -Wno-shadow
  1533. -Wformat
  1534. )
  1535. target_compile_definitions(judy PRIVATE
  1536. JUDYL
  1537. $<$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>:JU_64BIT>
  1538. )
  1539. target_include_directories(judy PUBLIC
  1540. src/libnetdata/libjudy/src
  1541. src/libnetdata/libjudy/src/JudyCommon
  1542. )
  1543. set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV")
  1544. set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT")
  1545. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE")
  1546. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB")
  1547. set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL")
  1548. #
  1549. # build libnetdata
  1550. #
  1551. if(OS_LINUX)
  1552. include(NetdataDetectSystemd)
  1553. detect_systemd()
  1554. endif()
  1555. add_library(libnetdata STATIC ${LIBNETDATA_FILES})
  1556. target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)
  1557. # pthread (FIXME: use find_package for this)
  1558. # set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  1559. # set(THREADS_PREFER_PTHREAD_FLAG TRUE)
  1560. # find_package(Threads REQUIRED)
  1561. # add_executable(test test.cpp)
  1562. # target_link_libraries(test Threads::Threads)
  1563. target_link_libraries(libnetdata PUBLIC
  1564. "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>"
  1565. "$<$<OR:$<BOOL:${OS_LINUX}>,$<BOOL:${OS_FREEBSD}>>:pthread;rt>"
  1566. "$<$<BOOL:${OS_WINDOWS}>:kernel32;advapi32;winmm;rpcrt4;bcrypt>"
  1567. "$<$<BOOL:${LINK_LIBM}>:m>"
  1568. "${SYSTEMD_LDFLAGS}")
  1569. # ebpf
  1570. if(ENABLE_PLUGIN_EBPF)
  1571. netdata_add_libbpf_to_target(libnetdata)
  1572. endif()
  1573. # judy
  1574. target_link_libraries(libnetdata PUBLIC judy)
  1575. netdata_add_jsonc_to_target(libnetdata)
  1576. netdata_add_libyaml_to_target(libnetdata)
  1577. # zlib
  1578. if(OS_MACOS)
  1579. find_package(ZLIB REQUIRED)
  1580. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1581. target_link_libraries(libnetdata PUBLIC ZLIB::ZLIB)
  1582. else()
  1583. pkg_check_modules(ZLIB REQUIRED zlib)
  1584. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1585. target_compile_options(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER})
  1586. target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS})
  1587. endif()
  1588. # lz4 - try to find a version that is compatible with streaming compression
  1589. # otherwise pick whichever one we can find to support dbengine but don't set
  1590. # ENABLE_LZ4.
  1591. pkg_check_modules(LIBLZ4 liblz4>=1.9.0)
  1592. if(LIBLZ4_FOUND)
  1593. set(ENABLE_LZ4 On)
  1594. else()
  1595. pkg_check_modules(LIBLZ4 REQUIRED liblz4)
  1596. endif()
  1597. target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS})
  1598. target_compile_options(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER})
  1599. target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS})
  1600. # zstd
  1601. pkg_check_modules(LIBZSTD libzstd)
  1602. if(LIBZSTD_FOUND)
  1603. set(ENABLE_ZSTD On)
  1604. target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS})
  1605. target_compile_options(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER})
  1606. target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS})
  1607. endif()
  1608. # brotli
  1609. pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon)
  1610. if(LIBBROTLI_FOUND)
  1611. set(ENABLE_BROTLI On)
  1612. target_include_directories(libnetdata PUBLIC ${LIBBROTLI_INCLUDE_DIRS})
  1613. target_compile_options(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER})
  1614. target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS})
  1615. endif()
  1616. # uuid
  1617. if(OS_MACOS OR OS_WINDOWS)
  1618. # UUID functionality is part of the system libraries here, so no extra
  1619. # stuff needed.
  1620. else()
  1621. pkg_check_modules(UUID REQUIRED uuid)
  1622. target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS})
  1623. target_compile_options(libnetdata PUBLIC ${UUID_CFLAGS_OTHER})
  1624. target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS})
  1625. endif()
  1626. # uv
  1627. pkg_check_modules(LIBUV REQUIRED libuv)
  1628. target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS})
  1629. target_compile_options(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER})
  1630. target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS})
  1631. # crypto
  1632. target_link_libraries(libnetdata PUBLIC PkgConfig::CRYPTO)
  1633. # openssl
  1634. target_link_libraries(libnetdata PUBLIC PkgConfig::TLS)
  1635. # mnl
  1636. if(NOT OS_MACOS)
  1637. pkg_check_modules(MNL libmnl)
  1638. if(MNL_FOUND)
  1639. set(HAVE_LIBMNL True)
  1640. endif()
  1641. endif()
  1642. #
  1643. # mqtt library
  1644. #
  1645. set(ENABLE_MQTTWEBSOCKETS True)
  1646. if(ENABLE_MQTTWEBSOCKETS)
  1647. add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
  1648. target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC
  1649. -DRBUF_CUSTOM_MALLOC
  1650. -DMQTT_WSS_CPUSTATS)
  1651. target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers
  1652. ${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include)
  1653. target_link_libraries(mqttwebsockets PRIVATE libnetdata)
  1654. endif()
  1655. #
  1656. # proto definitions
  1657. #
  1658. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1659. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1660. ACLK_PROTO_BUILT_SRCS
  1661. ACLK_PROTO_BUILT_HDRS
  1662. ${ACLK_PROTO_DEFS})
  1663. list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS}
  1664. ${ACLK_PROTO_BUILT_HDRS})
  1665. #
  1666. # build plugins
  1667. #
  1668. if(ENABLE_PLUGIN_DEBUGFS)
  1669. pkg_check_modules(CAP QUIET libcap)
  1670. set(DEBUGFS_PLUGIN_FILES src/collectors/debugfs.plugin/debugfs_plugin.c
  1671. src/collectors/debugfs.plugin/debugfs_plugin.h
  1672. src/collectors/debugfs.plugin/debugfs_extfrag.c
  1673. src/collectors/debugfs.plugin/debugfs_zswap.c
  1674. src/collectors/debugfs.plugin/sys_devices_virtual_powercap.c)
  1675. add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES})
  1676. target_link_libraries(debugfs.plugin libnetdata ${CAP_LIBRARIES})
  1677. target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1678. target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1679. install(TARGETS debugfs.plugin
  1680. COMPONENT plugin-debugfs
  1681. DESTINATION usr/libexec/netdata/plugins.d)
  1682. if(BUILD_FOR_PACKAGING)
  1683. install(FILES
  1684. ${PKG_FILES_PATH}/copyright
  1685. COMPONENT plugin-debugfs
  1686. DESTINATION usr/share/doc/netdata-plugin-debugfs)
  1687. endif()
  1688. endif()
  1689. add_executable(spawn-tester src/libnetdata/spawn_server/spawn-tester.c)
  1690. target_link_libraries(spawn-tester libnetdata)
  1691. if(ENABLE_PLUGIN_APPS)
  1692. pkg_check_modules(CAP QUIET libcap)
  1693. set(APPS_PLUGIN_FILES
  1694. src/collectors/apps.plugin/apps_plugin.c
  1695. src/collectors/apps.plugin/apps_plugin.h
  1696. src/collectors/apps.plugin/apps_functions.c
  1697. src/collectors/apps.plugin/apps_targets.c
  1698. src/collectors/apps.plugin/apps_users_and_groups.c
  1699. src/collectors/apps.plugin/apps_output.c
  1700. src/collectors/apps.plugin/apps_pid_files.c
  1701. src/collectors/apps.plugin/apps_pid.c
  1702. src/collectors/apps.plugin/apps_aggregations.c
  1703. src/collectors/apps.plugin/apps_os_linux.c
  1704. src/collectors/apps.plugin/apps_os_freebsd.c
  1705. src/collectors/apps.plugin/apps_os_macos.c
  1706. src/collectors/apps.plugin/apps_os_windows.c
  1707. src/collectors/apps.plugin/apps_incremental_collection.c
  1708. src/collectors/apps.plugin/apps_os_windows_nt.c
  1709. src/collectors/apps.plugin/apps_pid_match.c
  1710. )
  1711. add_executable(apps.plugin ${APPS_PLUGIN_FILES})
  1712. target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES}
  1713. "$<$<BOOL:${OS_WINDOWS}>:Version>"
  1714. "$<$<BOOL:${OS_WINDOWS}>:ntdll>")
  1715. target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1716. target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1717. install(TARGETS apps.plugin
  1718. COMPONENT plugin-apps
  1719. DESTINATION usr/libexec/netdata/plugins.d)
  1720. install(FILES src/collectors/apps.plugin/apps_groups.conf
  1721. COMPONENT plugin-apps
  1722. DESTINATION usr/lib/netdata/conf.d)
  1723. if(BUILD_FOR_PACKAGING)
  1724. install(FILES
  1725. ${PKG_FILES_PATH}/copyright
  1726. COMPONENT plugin-apps
  1727. DESTINATION usr/share/doc/netdata-plugin-apps)
  1728. endif()
  1729. endif()
  1730. if(CAP_FOUND)
  1731. set(HAVE_CAPABILITY True)
  1732. endif()
  1733. if(ENABLE_PLUGIN_FREEIPMI)
  1734. pkg_check_modules(IPMI REQUIRED libipmimonitoring)
  1735. set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c)
  1736. add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES})
  1737. target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES})
  1738. target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS})
  1739. target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER})
  1740. install(TARGETS freeipmi.plugin
  1741. COMPONENT plugin-freeipmi
  1742. DESTINATION usr/libexec/netdata/plugins.d)
  1743. if(BUILD_FOR_PACKAGING)
  1744. install(FILES
  1745. ${PKG_FILES_PATH}/copyright
  1746. COMPONENT plugin-freeipmi
  1747. DESTINATION usr/share/doc/netdata-plugin-freeipmi)
  1748. endif()
  1749. endif()
  1750. if(ENABLE_PLUGIN_NFACCT)
  1751. if (NOT MNL_FOUND)
  1752. message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.")
  1753. endif()
  1754. pkg_check_modules(NFACCT REQUIRED libnetfilter_acct)
  1755. set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c)
  1756. add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES})
  1757. target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES})
  1758. target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS})
  1759. target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER})
  1760. install(TARGETS nfacct.plugin
  1761. COMPONENT plugin-nfacct
  1762. DESTINATION usr/libexec/netdata/plugins.d)
  1763. if(BUILD_FOR_PACKAGING)
  1764. install(FILES
  1765. ${PKG_FILES_PATH}/copyright
  1766. COMPONENT plugin-nfacct
  1767. DESTINATION usr/share/doc/netdata-plugin-nfacct)
  1768. endif()
  1769. endif()
  1770. if(ENABLE_PLUGIN_XENSTAT)
  1771. pkg_check_modules(XENSTAT REQUIRED xenstat)
  1772. pkg_check_modules(XENLIGHT REQUIRED xenlight)
  1773. set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c)
  1774. add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES})
  1775. target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES})
  1776. target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS})
  1777. target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER})
  1778. install(TARGETS xenstat.plugin
  1779. COMPONENT plugin-xenstat
  1780. DESTINATION usr/libexec/netdata/plugins.d)
  1781. if(BUILD_FOR_PACKAGING)
  1782. install(FILES
  1783. ${PKG_FILES_PATH}/copyright
  1784. COMPONENT plugin-xenstat
  1785. DESTINATION usr/share/doc/netdata-plugin-xenstat)
  1786. endif()
  1787. endif()
  1788. if(ENABLE_PLUGIN_PERF)
  1789. set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c)
  1790. add_executable(perf.plugin ${PERF_PLUGIN_FILES})
  1791. target_link_libraries(perf.plugin libnetdata)
  1792. install(TARGETS perf.plugin
  1793. COMPONENT plugin-perf
  1794. DESTINATION usr/libexec/netdata/plugins.d)
  1795. if(BUILD_FOR_PACKAGING)
  1796. install(FILES
  1797. ${PKG_FILES_PATH}/copyright
  1798. COMPONENT plugin-perf
  1799. DESTINATION usr/share/doc/netdata-plugin-perf)
  1800. endif()
  1801. endif()
  1802. if(ENABLE_PLUGIN_SLABINFO)
  1803. set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c)
  1804. add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES})
  1805. target_link_libraries(slabinfo.plugin libnetdata)
  1806. install(TARGETS slabinfo.plugin
  1807. COMPONENT plugin-slabinfo
  1808. DESTINATION usr/libexec/netdata/plugins.d)
  1809. if(BUILD_FOR_PACKAGING)
  1810. install(FILES
  1811. ${PKG_FILES_PATH}/copyright
  1812. COMPONENT plugin-slabinfo
  1813. DESTINATION usr/share/doc/netdata-plugin-slabinfo)
  1814. endif()
  1815. endif()
  1816. if(ENABLE_PLUGIN_CUPS)
  1817. pkg_check_modules(CUPS libcups)
  1818. if(NOT CUPS_FOUND)
  1819. pkg_check_modules(CUPS cups)
  1820. if(NOT CUPS_FOUND)
  1821. find_program(CUPS_CONFIG cups-config)
  1822. if(CUPS_CONFIG)
  1823. execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  1824. if(CUPS_API_VERSION VERSION_LESS "1.7")
  1825. set(CUPS_FOUND False)
  1826. else()
  1827. execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE)
  1828. execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
  1829. set(CUPS_FOUND True)
  1830. endif()
  1831. endif()
  1832. endif()
  1833. endif()
  1834. if(NOT CUPS_FOUND)
  1835. message(WARNING "Could not find cups cflags and libs.")
  1836. else()
  1837. set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c)
  1838. add_executable(cups.plugin ${CUPS_PLUGIN_FILES})
  1839. target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES})
  1840. target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER})
  1841. install(TARGETS cups.plugin
  1842. COMPONENT plugin-cups
  1843. DESTINATION usr/libexec/netdata/plugins.d)
  1844. if(BUILD_FOR_PACKAGING)
  1845. install(FILES
  1846. ${PKG_FILES_PATH}/copyright
  1847. COMPONENT plugin-cups
  1848. DESTINATION usr/share/doc/netdata-plugin-cups)
  1849. endif()
  1850. endif()
  1851. endif()
  1852. if(NEED_NDSUDO)
  1853. set(NDSUDO_FILES src/collectors/utils/ndsudo.c)
  1854. add_executable(ndsudo ${NDSUDO_FILES})
  1855. install(TARGETS ndsudo
  1856. COMPONENT netdata
  1857. DESTINATION usr/libexec/netdata/plugins.d)
  1858. endif()
  1859. if(ENABLE_PLUGIN_CGROUP_NETWORK)
  1860. set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c)
  1861. add_executable(cgroup-network ${CGROUP_NETWORK_FILES})
  1862. target_link_libraries(cgroup-network libnetdata)
  1863. install(TARGETS cgroup-network
  1864. COMPONENT netdata
  1865. DESTINATION usr/libexec/netdata/plugins.d)
  1866. endif()
  1867. if(ENABLE_PLUGIN_SYSTEMD_JOURNAL)
  1868. if(NOT SYSTEMD_FOUND)
  1869. message(FATAL_ERROR "Systemd journal plugin requires systemd, but systemd was not found.")
  1870. endif()
  1871. add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES})
  1872. target_link_libraries(systemd-journal.plugin libnetdata)
  1873. install(TARGETS systemd-journal.plugin
  1874. COMPONENT plugin-systemd-journal
  1875. DESTINATION usr/libexec/netdata/plugins.d)
  1876. if(BUILD_FOR_PACKAGING)
  1877. install(FILES
  1878. ${PKG_FILES_PATH}/copyright
  1879. COMPONENT plugin-systemd-journal
  1880. DESTINATION usr/share/doc/netdata-plugin-systemd-journal)
  1881. endif()
  1882. endif()
  1883. if(OS_WINDOWS)
  1884. add_executable(windows-events.plugin ${WINDOWS_EVENTS_PLUGIN_FILES})
  1885. target_link_libraries(windows-events.plugin libnetdata wevtapi)
  1886. install(TARGETS windows-events.plugin
  1887. COMPONENT plugin-windows-events
  1888. DESTINATION usr/libexec/netdata/plugins.d)
  1889. endif()
  1890. if(ENABLE_PLUGIN_EBPF)
  1891. set(EBPF_PLUGIN_FILES
  1892. src/collectors/ebpf.plugin/ebpf.c
  1893. src/collectors/ebpf.plugin/ebpf.h
  1894. src/collectors/ebpf.plugin/ebpf_cachestat.c
  1895. src/collectors/ebpf.plugin/ebpf_cachestat.h
  1896. src/collectors/ebpf.plugin/ebpf_dcstat.c
  1897. src/collectors/ebpf.plugin/ebpf_dcstat.h
  1898. src/collectors/ebpf.plugin/ebpf_disk.c
  1899. src/collectors/ebpf.plugin/ebpf_disk.h
  1900. src/collectors/ebpf.plugin/ebpf_fd.c
  1901. src/collectors/ebpf.plugin/ebpf_fd.h
  1902. src/collectors/ebpf.plugin/ebpf_hardirq.c
  1903. src/collectors/ebpf.plugin/ebpf_hardirq.h
  1904. src/collectors/ebpf.plugin/ebpf_mdflush.c
  1905. src/collectors/ebpf.plugin/ebpf_mdflush.h
  1906. src/collectors/ebpf.plugin/ebpf_mount.c
  1907. src/collectors/ebpf.plugin/ebpf_mount.h
  1908. src/collectors/ebpf.plugin/ebpf_filesystem.c
  1909. src/collectors/ebpf.plugin/ebpf_filesystem.h
  1910. src/collectors/ebpf.plugin/ebpf_oomkill.c
  1911. src/collectors/ebpf.plugin/ebpf_oomkill.h
  1912. src/collectors/ebpf.plugin/ebpf_process.c
  1913. src/collectors/ebpf.plugin/ebpf_process.h
  1914. src/collectors/ebpf.plugin/ebpf_shm.c
  1915. src/collectors/ebpf.plugin/ebpf_shm.h
  1916. src/collectors/ebpf.plugin/ebpf_socket.c
  1917. src/collectors/ebpf.plugin/ebpf_socket.h
  1918. src/collectors/ebpf.plugin/ebpf_softirq.c
  1919. src/collectors/ebpf.plugin/ebpf_softirq.h
  1920. src/collectors/ebpf.plugin/ebpf_sync.c
  1921. src/collectors/ebpf.plugin/ebpf_sync.h
  1922. src/collectors/ebpf.plugin/ebpf_swap.c
  1923. src/collectors/ebpf.plugin/ebpf_swap.h
  1924. src/collectors/ebpf.plugin/ebpf_vfs.c
  1925. src/collectors/ebpf.plugin/ebpf_vfs.h
  1926. src/collectors/ebpf.plugin/ebpf_apps.c
  1927. src/collectors/ebpf.plugin/ebpf_apps.h
  1928. src/collectors/ebpf.plugin/ebpf_cgroup.c
  1929. src/collectors/ebpf.plugin/ebpf_cgroup.h
  1930. src/collectors/ebpf.plugin/ebpf_unittest.c
  1931. src/collectors/ebpf.plugin/ebpf_unittest.h
  1932. src/collectors/ebpf.plugin/ebpf_functions.c
  1933. src/collectors/ebpf.plugin/ebpf_functions.h
  1934. )
  1935. add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES})
  1936. target_link_libraries(ebpf.plugin libnetdata)
  1937. netdata_add_ebpf_co_re_to_target(ebpf.plugin)
  1938. install(TARGETS ebpf.plugin
  1939. COMPONENT plugin-ebpf
  1940. DESTINATION usr/libexec/netdata/plugins.d)
  1941. install(FILES
  1942. src/collectors/ebpf.plugin/ebpf.d.conf
  1943. COMPONENT plugin-ebpf
  1944. DESTINATION usr/lib/netdata/conf.d)
  1945. install(FILES
  1946. src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
  1947. src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
  1948. src/collectors/ebpf.plugin/ebpf.d/disk.conf
  1949. src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt
  1950. src/collectors/ebpf.plugin/ebpf.d/fd.conf
  1951. src/collectors/ebpf.plugin/ebpf.d/filesystem.conf
  1952. src/collectors/ebpf.plugin/ebpf.d/hardirq.conf
  1953. src/collectors/ebpf.plugin/ebpf.d/mdflush.conf
  1954. src/collectors/ebpf.plugin/ebpf.d/mount.conf
  1955. src/collectors/ebpf.plugin/ebpf.d/network.conf
  1956. src/collectors/ebpf.plugin/ebpf.d/oomkill.conf
  1957. src/collectors/ebpf.plugin/ebpf.d/process.conf
  1958. src/collectors/ebpf.plugin/ebpf.d/shm.conf
  1959. src/collectors/ebpf.plugin/ebpf.d/softirq.conf
  1960. src/collectors/ebpf.plugin/ebpf.d/swap.conf
  1961. src/collectors/ebpf.plugin/ebpf.d/sync.conf
  1962. src/collectors/ebpf.plugin/ebpf.d/vfs.conf
  1963. COMPONENT plugin-ebpf
  1964. DESTINATION usr/lib/netdata/conf.d/ebpf.d)
  1965. if(BUILD_FOR_PACKAGING)
  1966. install(FILES
  1967. ${PKG_FILES_PATH}/copyright
  1968. COMPONENT plugin-ebpf
  1969. DESTINATION usr/share/doc/netdata-plugin-ebpf)
  1970. endif()
  1971. if(ENABLE_LEGACY_EBPF_PROGRAMS)
  1972. netdata_install_legacy_ebpf_code()
  1973. endif()
  1974. endif()
  1975. if(ENABLE_PLUGIN_LOCAL_LISTENERS)
  1976. set(LOCAL_LISTENERS_FILES
  1977. src/collectors/utils/local_listeners.c
  1978. src/libnetdata/maps/local-sockets.h
  1979. )
  1980. add_executable(local-listeners ${LOCAL_LISTENERS_FILES})
  1981. target_compile_options(local-listeners PRIVATE
  1982. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1983. target_include_directories(local-listeners PRIVATE
  1984. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1985. target_link_libraries(local-listeners libnetdata
  1986. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1987. install(TARGETS local-listeners
  1988. COMPONENT netdata
  1989. DESTINATION usr/libexec/netdata/plugins.d)
  1990. endif()
  1991. if(ENABLE_PLUGIN_NETWORK_VIEWER)
  1992. set(NETWORK_VIEWER_FILES
  1993. src/libnetdata/maps/local-sockets.h
  1994. src/libnetdata/maps/system-users.h
  1995. src/collectors/network-viewer.plugin/network-viewer.c
  1996. )
  1997. add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES})
  1998. target_compile_options(network-viewer.plugin PRIVATE
  1999. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  2000. target_include_directories(network-viewer.plugin PRIVATE
  2001. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  2002. target_link_libraries(network-viewer.plugin libnetdata
  2003. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  2004. install(TARGETS network-viewer.plugin
  2005. COMPONENT plugin-network-viewer
  2006. DESTINATION usr/libexec/netdata/plugins.d)
  2007. if(BUILD_FOR_PACKAGING)
  2008. install(FILES
  2009. ${PKG_FILES_PATH}/copyright
  2010. COMPONENT plugin-network-viewer
  2011. DESTINATION usr/share/doc/netdata-plugin-network-viewer)
  2012. endif()
  2013. endif()
  2014. #
  2015. # exporters
  2016. #
  2017. if(ENABLE_EXPORTER_MONGODB)
  2018. pkg_check_modules(MONGOC libmongoc-1.0>=1.7)
  2019. if(MONGOC_FOUND)
  2020. SET(HAVE_MONGOC True)
  2021. else()
  2022. SET(ENABLE_EXPORTER_MONGODB False)
  2023. endif()
  2024. endif()
  2025. if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
  2026. pkg_check_modules(SNAPPY snappy)
  2027. if (NOT SNAPPY_FOUND)
  2028. include(CheckLibraryExists)
  2029. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
  2030. if(HAVE_SNAPPY_LIB)
  2031. set(SNAPPY_INCLUDE_DIRS "")
  2032. set(SNAPPY_CFLAGS_OTHER "")
  2033. set(SNAPPY_LIBRARIES "-lsnappy")
  2034. else()
  2035. message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.")
  2036. endif()
  2037. endif()
  2038. netdata_protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  2039. "${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  2040. PROMETHEUS_REMOTE_WRITE_BUILT_SRCS
  2041. PROMETHEUS_REMOTE_WRITE_BUILT_HDRS
  2042. "src/exporting/prometheus/remote_write/remote_write.proto")
  2043. list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  2044. ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS}
  2045. ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS})
  2046. set(ENABLE_PROMETHEUS_REMOTE_WRITE True)
  2047. endif()
  2048. #
  2049. # build netdata (only Linux ATM)
  2050. #
  2051. if(OS_WINDOWS)
  2052. set(NETDATA_CLAIM_RES_FILES "packaging/windows/resources/netdata_claim.rc")
  2053. configure_file(packaging/windows/resources/netdata_claim.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata_claim.manifest @ONLY)
  2054. set(NETDATACLI_RES_FILES "packaging/windows/resources/netdatacli.rc")
  2055. configure_file(packaging/windows/resources/netdatacli.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdatacli.manifest @ONLY)
  2056. set(NETDATA_RES_FILES "packaging/windows/resources/netdata.rc")
  2057. configure_file(packaging/windows/resources/netdata.manifest.in ${CMAKE_SOURCE_DIR}/packaging/windows/resources/netdata.manifest @ONLY)
  2058. endif()
  2059. add_executable(netdata
  2060. ${NETDATA_FILES}
  2061. "${ACLK_FILES}"
  2062. "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>"
  2063. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
  2064. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
  2065. "$<$<BOOL:${OS_WINDOWS}>:${NETDATA_RES_FILES}>"
  2066. )
  2067. if(OS_WINDOWS)
  2068. add_executable(NetdataClaim ${CLAIM_WINDOWS_FILES} ${NETDATA_CLAIM_RES_FILES})
  2069. target_link_libraries(NetdataClaim shell32;gdi32;msftedit)
  2070. target_compile_options(NetdataClaim PUBLIC -mwindows)
  2071. endif()
  2072. target_compile_definitions(netdata PRIVATE
  2073. "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>"
  2074. )
  2075. target_compile_options(netdata PRIVATE
  2076. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_CFLAGS_OTHER}>"
  2077. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_CFLAGS_OTHER}>"
  2078. )
  2079. target_include_directories(netdata PRIVATE
  2080. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  2081. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
  2082. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
  2083. )
  2084. target_link_libraries(netdata PRIVATE
  2085. m
  2086. libnetdata
  2087. "$<$<BOOL:${OS_LINUX}>:rt>"
  2088. "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:mqttwebsockets>"
  2089. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_LIBRARIES}>"
  2090. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_LIBRARIES}>"
  2091. "$<$<BOOL:${OS_MACOS}>:${IOKIT};${FOUNDATION}>"
  2092. "$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
  2093. "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
  2094. "$<$<BOOL:${ENABLE_H2O}>:h2o>"
  2095. "$<$<BOOL:${CURL_FOUND}>:PkgConfig::CURL>"
  2096. )
  2097. if(NEED_PROTOBUF)
  2098. netdata_add_protobuf(netdata)
  2099. endif()
  2100. #
  2101. # build systemd-cat-native
  2102. #
  2103. set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c
  2104. src/libnetdata/log/systemd-cat-native.h)
  2105. add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES})
  2106. target_link_libraries(systemd-cat-native libnetdata)
  2107. install(TARGETS systemd-cat-native
  2108. COMPONENT netdata
  2109. DESTINATION "${BINDIR}")
  2110. #
  2111. # build log2journal
  2112. #
  2113. pkg_check_modules(PCRE2 libpcre2-8)
  2114. if(PCRE2_FOUND)
  2115. set(LOG2JOURNAL_FILES
  2116. ${CONFIG_H}
  2117. src/collectors/log2journal/log2journal.h
  2118. src/collectors/log2journal/log2journal.c
  2119. src/collectors/log2journal/log2journal-help.c
  2120. src/collectors/log2journal/log2journal-yaml.c
  2121. src/collectors/log2journal/log2journal-json.c
  2122. src/collectors/log2journal/log2journal-logfmt.c
  2123. src/collectors/log2journal/log2journal-pcre2.c
  2124. src/collectors/log2journal/log2journal-params.c
  2125. src/collectors/log2journal/log2journal-inject.c
  2126. src/collectors/log2journal/log2journal-pattern.c
  2127. src/collectors/log2journal/log2journal-replace.c
  2128. src/collectors/log2journal/log2journal-rename.c
  2129. src/collectors/log2journal/log2journal-rewrite.c
  2130. )
  2131. add_executable(log2journal ${LOG2JOURNAL_FILES})
  2132. target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS})
  2133. target_compile_options(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER})
  2134. target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}")
  2135. netdata_add_libyaml_to_target(log2journal)
  2136. install(TARGETS log2journal
  2137. COMPONENT netdata
  2138. DESTINATION "${BINDIR}")
  2139. install(DIRECTORY src/collectors/log2journal/log2journal.d
  2140. COMPONENT netdata
  2141. DESTINATION usr/lib/netdata/conf.d)
  2142. endif()
  2143. #
  2144. # build netdatacli
  2145. #
  2146. set(NETDATACLI_FILES
  2147. src/daemon/commands.h
  2148. src/daemon/pipename.c
  2149. src/daemon/pipename.h
  2150. src/cli/cli.c
  2151. )
  2152. add_executable(netdatacli ${NETDATACLI_FILES} "$<$<BOOL:${OS_WINDOWS}>:${NETDATACLI_RES_FILES}>")
  2153. target_link_libraries(netdatacli libnetdata)
  2154. install(TARGETS netdatacli
  2155. COMPONENT netdata
  2156. DESTINATION "${BINDIR}")
  2157. #
  2158. # Build go.d.plugin
  2159. #
  2160. if(ENABLE_PLUGIN_GO)
  2161. add_go_target(go-plugin go.d.plugin src/go cmd/godplugin)
  2162. install(PROGRAMS ${CMAKE_BINARY_DIR}/go.d.plugin
  2163. COMPONENT plugin-go
  2164. DESTINATION usr/libexec/netdata/plugins.d)
  2165. endif()
  2166. #
  2167. # Generate config file
  2168. #
  2169. if(NOT NETDATA_RUNTIME_PREFIX STREQUAL "")
  2170. string(REGEX REPLACE "/$" "" NETDATA_RUNTIME_PREFIX "${NETDATA_RUNTIME_PREFIX}")
  2171. endif()
  2172. set(CACHE_DIR "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2173. set(CONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2174. set(LIBCONFIG_DIR "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2175. set(LOG_DIR "${NETDATA_RUNTIME_PREFIX}/var/log/netdata")
  2176. set(PLUGINS_DIR "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata/plugins.d")
  2177. set(VARLIB_DIR "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2178. # A non-default value is only used when building Debian packages (/var/lib/netdata/www)
  2179. if(NOT DEFINED WEB_DIR)
  2180. set(WEB_DIR "usr/share/netdata/web")
  2181. else()
  2182. string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}")
  2183. endif()
  2184. set(WEB_DEST "${WEB_DIR}")
  2185. set(WEB_DIR "${NETDATA_RUNTIME_PREFIX}/${WEB_DEST}")
  2186. set(CONFIGURE_COMMAND "dummy-configure-command")
  2187. if (NOT NETDATA_USER)
  2188. set(NETDATA_USER "netdata")
  2189. endif()
  2190. configure_file(packaging/cmake/config.cmake.h.in config.h)
  2191. #
  2192. # install
  2193. #
  2194. install(TARGETS netdata COMPONENT netdata DESTINATION "${BINDIR}")
  2195. install(DIRECTORY COMPONENT netdata DESTINATION var/cache/netdata)
  2196. install(DIRECTORY COMPONENT netdata DESTINATION var/log/netdata)
  2197. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/registry)
  2198. install(DIRECTORY COMPONENT netdata DESTINATION var/lib/netdata/cloud.d)
  2199. install(DIRECTORY COMPONENT netdata DESTINATION var/run/netdata)
  2200. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata)
  2201. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/custom-plugins.d)
  2202. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/health.d)
  2203. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/ssl)
  2204. install(DIRECTORY COMPONENT netdata DESTINATION etc/netdata/statsd.d)
  2205. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d)
  2206. install(DIRECTORY COMPONENT netdata DESTINATION usr/lib/netdata/conf.d/schema.d)
  2207. install(DIRECTORY COMPONENT netdata DESTINATION usr/libexec/netdata/plugins.d)
  2208. install(DIRECTORY COMPONENT netdata DESTINATION ${WEB_DEST})
  2209. set(libsysdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/system")
  2210. set(pkglibexecdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/libexec/netdata")
  2211. set(localstatedir_POST "${NETDATA_RUNTIME_PREFIX}/var")
  2212. set(sbindir_POST "${NETDATA_RUNTIME_PREFIX}/${BINDIR}")
  2213. set(configdir_POST "${NETDATA_RUNTIME_PREFIX}/etc/netdata")
  2214. set(libconfigdir_POST "${NETDATA_RUNTIME_PREFIX}/usr/lib/netdata/conf.d")
  2215. set(cachedir_POST "${NETDATA_RUNTIME_PREFIX}/var/cache/netdata")
  2216. set(registrydir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata/registry")
  2217. set(varlibdir_POST "${NETDATA_RUNTIME_PREFIX}/var/lib/netdata")
  2218. set(netdata_user_POST "${NETDATA_USER}")
  2219. set(netdata_group_POST "${NETDATA_USER}")
  2220. if(NOT OS_WINDOWS)
  2221. configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
  2222. install(PROGRAMS
  2223. ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
  2224. COMPONENT netdata
  2225. DESTINATION "${BINDIR}")
  2226. else()
  2227. install(PROGRAMS
  2228. ${CMAKE_BINARY_DIR}/NetdataClaim.exe
  2229. COMPONENT netdata
  2230. DESTINATION "${BINDIR}")
  2231. endif()
  2232. #
  2233. # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume
  2234. # the files exists unconditionally.
  2235. #
  2236. configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in
  2237. src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY)
  2238. install(PROGRAMS
  2239. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh
  2240. COMPONENT netdata
  2241. DESTINATION usr/libexec/netdata/plugins.d)
  2242. configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in
  2243. src/collectors/cgroups.plugin/cgroup-name.sh @ONLY)
  2244. install(PROGRAMS
  2245. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh
  2246. COMPONENT netdata
  2247. DESTINATION usr/libexec/netdata/plugins.d)
  2248. #
  2249. # statsd
  2250. #
  2251. install(FILES
  2252. src/collectors/statsd.plugin/asterisk.conf
  2253. src/collectors/statsd.plugin/example.conf
  2254. src/collectors/statsd.plugin/k6.conf
  2255. COMPONENT netdata
  2256. DESTINATION usr/lib/netdata/conf.d/statsd.d)
  2257. #
  2258. # exporting
  2259. #
  2260. install(FILES
  2261. src/exporting/exporting.conf
  2262. COMPONENT netdata
  2263. DESTINATION usr/lib/netdata/conf.d)
  2264. #
  2265. # ioping.plugin
  2266. #
  2267. install(FILES
  2268. src/collectors/ioping.plugin/ioping.conf
  2269. COMPONENT netdata
  2270. DESTINATION usr/lib/netdata/conf.d)
  2271. #
  2272. # streaming
  2273. #
  2274. install(FILES
  2275. src/streaming/stream.conf
  2276. COMPONENT netdata
  2277. DESTINATION usr/lib/netdata/conf.d)
  2278. #
  2279. # swagger
  2280. #
  2281. install(FILES
  2282. src/web/api/netdata-swagger.json
  2283. src/web/api/netdata-swagger.yaml
  2284. COMPONENT netdata
  2285. DESTINATION ${WEB_DEST})
  2286. #
  2287. # service files
  2288. #
  2289. configure_file(system/install-service.sh.in system/install-service.sh @ONLY)
  2290. install(PROGRAMS
  2291. ${CMAKE_BINARY_DIR}/system/install-service.sh
  2292. COMPONENT netdata
  2293. DESTINATION usr/libexec/netdata)
  2294. configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY)
  2295. install(FILES
  2296. ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist
  2297. COMPONENT netdata
  2298. DESTINATION usr/lib/netdata/system/launchd)
  2299. configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY)
  2300. install(FILES
  2301. ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata
  2302. COMPONENT netdata
  2303. DESTINATION usr/lib/netdata/system/freebsd/rc.d)
  2304. configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY)
  2305. install(FILES
  2306. ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata
  2307. COMPONENT netdata
  2308. DESTINATION usr/lib/netdata/system/initd/init.d)
  2309. configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY)
  2310. install(FILES
  2311. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2312. COMPONENT netdata
  2313. DESTINATION usr/lib/netdata/system/logrotate)
  2314. install(FILES
  2315. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2316. COMPONENT netdata
  2317. DESTINATION etc/logrotate.d)
  2318. configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY)
  2319. install(FILES
  2320. ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata
  2321. COMPONENT netdata
  2322. DESTINATION usr/lib/netdata/system/lsb/init.d)
  2323. configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY)
  2324. install(FILES
  2325. ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata
  2326. COMPONENT netdata
  2327. DESTINATION usr/lib/netdata/system/openrc/conf.d)
  2328. configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY)
  2329. install(FILES
  2330. ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata
  2331. COMPONENT netdata
  2332. DESTINATION usr/lib/netdata/system/openrc/init.d)
  2333. configure_file(system/runit/run.in system/runit/run @ONLY)
  2334. install(FILES
  2335. ${CMAKE_BINARY_DIR}/system/runit/run
  2336. COMPONENT netdata
  2337. DESTINATION usr/lib/netdata/system/runit)
  2338. configure_file(system/dinit/netdata.in system/dinit/netdata @ONLY)
  2339. install(FILES
  2340. ${CMAKE_BINARY_DIR}/system/dinit/netdata
  2341. COMPONENT netdata
  2342. DESTINATION usr/lib/netdata/system/dinit)
  2343. configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY)
  2344. install(FILES
  2345. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2346. COMPONENT netdata
  2347. DESTINATION usr/lib/netdata/system/systemd)
  2348. install(FILES
  2349. system/systemd/journald@netdata.conf
  2350. COMPONENT netdata
  2351. DESTINATION usr/lib/netdata/system/systemd)
  2352. configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY)
  2353. install(FILES
  2354. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235
  2355. COMPONENT netdata
  2356. DESTINATION usr/lib/netdata/system/systemd)
  2357. if(BUILD_FOR_PACKAGING)
  2358. install(FILES
  2359. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2360. COMPONENT netdata
  2361. DESTINATION lib/systemd/system)
  2362. install(DIRECTORY
  2363. COMPONENT netdata
  2364. DESTINATION usr/lib/systemd/journald@netdata.conf.d)
  2365. install(FILES
  2366. system/systemd/journald@netdata.conf
  2367. COMPONENT netdata
  2368. DESTINATION usr/lib/systemd/journald@netdata.conf.d
  2369. RENAME netdata.conf)
  2370. endif()
  2371. install(FILES
  2372. system/systemd/50-netdata.preset
  2373. COMPONENT netdata
  2374. DESTINATION usr/lib/netdata/system/systemd)
  2375. install(FILES
  2376. system/vnodes/vnodes.conf
  2377. COMPONENT netdata
  2378. DESTINATION usr/lib/netdata/conf.d/vnodes)
  2379. install(FILES
  2380. system/.install-type
  2381. COMPONENT netdata
  2382. DESTINATION etc/netdata)
  2383. install(PROGRAMS
  2384. system/edit-config
  2385. COMPONENT netdata
  2386. DESTINATION etc/netdata)
  2387. if(BUILD_FOR_PACKAGING)
  2388. set(NETDATA_CONF_DEST "etc/netdata")
  2389. else()
  2390. set(NETDATA_CONF_DEST "usr/lib/netdata/conf.d")
  2391. endif()
  2392. #
  2393. # misc files
  2394. #
  2395. if(BUILD_FOR_PACKAGING)
  2396. install(FILES
  2397. ${PKG_FILES_PATH}/deb/netdata/etc/default/netdata
  2398. COMPONENT netdata
  2399. DESTINATION etc/default)
  2400. install(PROGRAMS
  2401. ${PKG_FILES_PATH}/deb/netdata/etc/init.d/netdata
  2402. COMPONENT netdata
  2403. DESTINATION etc/init.d)
  2404. endif()
  2405. if(NOT OS_WINDOWS)
  2406. install(PROGRAMS
  2407. packaging/installer/netdata-updater.sh
  2408. COMPONENT netdata
  2409. DESTINATION usr/libexec/netdata)
  2410. install(FILES
  2411. system/netdata.conf
  2412. system/netdata-updater.conf
  2413. COMPONENT netdata
  2414. DESTINATION ${NETDATA_CONF_DEST})
  2415. configure_file(system/cron/netdata-updater-daily.in
  2416. system/cron/netdata-updater-daily
  2417. @ONLY)
  2418. install(FILES
  2419. ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily
  2420. COMPONENT netdata
  2421. DESTINATION usr/lib/netdata/system/cron)
  2422. configure_file(system/systemd/netdata-updater.service.in
  2423. system/systemd/netdata-updater.service
  2424. @ONLY)
  2425. install(FILES
  2426. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2427. COMPONENT netdata
  2428. DESTINATION usr/lib/netdata/system/systemd)
  2429. install(FILES
  2430. system/systemd/netdata-updater.timer
  2431. COMPONENT netdata
  2432. DESTINATION usr/lib/netdata/system/systemd)
  2433. if(BUILD_FOR_PACKAGING)
  2434. install(FILES
  2435. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2436. COMPONENT netdata
  2437. DESTINATION lib/systemd/system)
  2438. install(FILES
  2439. system/systemd/netdata-updater.timer
  2440. COMPONENT netdata
  2441. DESTINATION lib/systemd/system)
  2442. endif()
  2443. endif()
  2444. #
  2445. # TODO: check the following files for correct substitutions
  2446. #
  2447. configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY)
  2448. install(PROGRAMS
  2449. ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh
  2450. COMPONENT netdata
  2451. DESTINATION usr/libexec/netdata/plugins.d)
  2452. configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY)
  2453. install(PROGRAMS
  2454. ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh
  2455. COMPONENT netdata
  2456. DESTINATION usr/libexec/netdata/plugins.d)
  2457. install(PROGRAMS
  2458. src/daemon/system-info.sh
  2459. COMPONENT netdata
  2460. DESTINATION usr/libexec/netdata/plugins.d)
  2461. #
  2462. # health files
  2463. #
  2464. file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf")
  2465. install(FILES
  2466. ${HEALTH_CONF_FILES}
  2467. COMPONENT netdata
  2468. DESTINATION usr/lib/netdata/conf.d/health.d)
  2469. configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY)
  2470. install(PROGRAMS
  2471. ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh
  2472. COMPONENT netdata
  2473. DESTINATION usr/libexec/netdata/plugins.d)
  2474. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2475. install(PROGRAMS
  2476. src/health/notifications/alarm-email.sh
  2477. src/health/notifications/alarm-test.sh
  2478. COMPONENT netdata
  2479. DESTINATION usr/libexec/netdata/plugins.d)
  2480. endif()
  2481. install(FILES
  2482. src/health/notifications/health_alarm_notify.conf
  2483. src/health/notifications/health_email_recipients.conf
  2484. COMPONENT netdata
  2485. DESTINATION usr/lib/netdata/conf.d)
  2486. #
  2487. # test/ files
  2488. #
  2489. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  2490. configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY)
  2491. configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY)
  2492. configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY)
  2493. configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY)
  2494. configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY)
  2495. configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY)
  2496. install(FILES
  2497. ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh
  2498. ${CMAKE_BINARY_DIR}/tests/acls/acl.sh
  2499. ${CMAKE_BINARY_DIR}/tests/urls/request.sh
  2500. ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh
  2501. ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh
  2502. ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh
  2503. DESTINATION usr/libexec/netdata/plugins.d)
  2504. endif()
  2505. #
  2506. # charts.d plugin
  2507. #
  2508. if(ENABLE_PLUGIN_CHARTS)
  2509. install(DIRECTORY COMPONENT plugin-chartsd DESTINATION etc/netdata/charts.d)
  2510. configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY)
  2511. install(PROGRAMS
  2512. ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin
  2513. COMPONENT plugin-chartsd
  2514. DESTINATION usr/libexec/netdata/plugins.d)
  2515. install(PROGRAMS
  2516. src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
  2517. COMPONENT plugin-chartsd
  2518. DESTINATION usr/libexec/netdata/plugins.d)
  2519. install(FILES
  2520. src/collectors/charts.d.plugin/charts.d.conf
  2521. COMPONENT plugin-chartsd
  2522. DESTINATION usr/lib/netdata/conf.d)
  2523. install(PROGRAMS
  2524. src/collectors/charts.d.plugin/example/example.chart.sh
  2525. src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
  2526. src/collectors/charts.d.plugin/opensips/opensips.chart.sh
  2527. COMPONENT plugin-chartsd
  2528. DESTINATION usr/libexec/netdata/charts.d)
  2529. install(FILES
  2530. src/collectors/charts.d.plugin/example/example.conf
  2531. src/collectors/charts.d.plugin/libreswan/libreswan.conf
  2532. src/collectors/charts.d.plugin/opensips/opensips.conf
  2533. COMPONENT plugin-chartsd
  2534. DESTINATION usr/lib/netdata/conf.d/charts.d)
  2535. if(BUILD_FOR_PACKAGING)
  2536. install(FILES
  2537. ${PKG_FILES_PATH}/copyright
  2538. COMPONENT plugin-chartsd
  2539. DESTINATION usr/share/doc/netdata-plugin-chartsd)
  2540. endif()
  2541. endif()
  2542. # This is needed both by the TC plugin (which only gets built on Linux) and the charts plugin.
  2543. if(OS_LINUX OR ENABLE_PLUGIN_CHARTS)
  2544. install(FILES
  2545. src/collectors/charts.d.plugin/loopsleepms.sh.inc
  2546. COMPONENT netdata
  2547. DESTINATION usr/libexec/netdata/plugins.d)
  2548. endif()
  2549. #
  2550. # tc-qos-helper
  2551. #
  2552. if(OS_LINUX)
  2553. configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY)
  2554. install(PROGRAMS
  2555. ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh
  2556. COMPONENT netdata
  2557. DESTINATION usr/libexec/netdata/plugins.d)
  2558. endif()
  2559. # confs
  2560. install(FILES
  2561. src/collectors/systemd-journal.plugin/schema.d/systemd-journal%3Amonitored-directories.json
  2562. src/health/schema.d/health%3Aalert%3Aprototype.json
  2563. COMPONENT netdata
  2564. DESTINATION usr/lib/netdata/conf.d/schema.d)
  2565. #
  2566. # python.d plugin
  2567. #
  2568. if(ENABLE_PLUGIN_PYTHON)
  2569. install(DIRECTORY COMPONENT plugin-pythond DESTINATION etc/netdata/python.d)
  2570. configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY)
  2571. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin
  2572. COMPONENT plugin-pythond
  2573. DESTINATION usr/libexec/netdata/plugins.d)
  2574. install(DIRECTORY src/collectors/python.d.plugin/python_modules
  2575. COMPONENT plugin-pythond
  2576. DESTINATION usr/libexec/netdata/python.d)
  2577. install(FILES src/collectors/python.d.plugin/python.d.conf
  2578. COMPONENT plugin-pythond
  2579. DESTINATION usr/lib/netdata/conf.d)
  2580. install(FILES
  2581. src/collectors/python.d.plugin/am2320/am2320.conf
  2582. src/collectors/python.d.plugin/go_expvar/go_expvar.conf
  2583. src/collectors/python.d.plugin/haproxy/haproxy.conf
  2584. src/collectors/python.d.plugin/pandas/pandas.conf
  2585. src/collectors/python.d.plugin/spigotmc/spigotmc.conf
  2586. src/collectors/python.d.plugin/traefik/traefik.conf
  2587. src/collectors/python.d.plugin/zscores/zscores.conf
  2588. COMPONENT plugin-pythond
  2589. DESTINATION usr/lib/netdata/conf.d/python.d)
  2590. install(FILES
  2591. src/collectors/python.d.plugin/am2320/am2320.chart.py
  2592. src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
  2593. src/collectors/python.d.plugin/haproxy/haproxy.chart.py
  2594. src/collectors/python.d.plugin/pandas/pandas.chart.py
  2595. src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
  2596. src/collectors/python.d.plugin/traefik/traefik.chart.py
  2597. src/collectors/python.d.plugin/zscores/zscores.chart.py
  2598. COMPONENT plugin-pythond
  2599. DESTINATION usr/libexec/netdata/python.d)
  2600. if(BUILD_FOR_PACKAGING)
  2601. install(FILES
  2602. ${PKG_FILES_PATH}/copyright
  2603. COMPONENT plugin-pythond
  2604. DESTINATION usr/share/doc/netdata-plugin-pythond)
  2605. endif()
  2606. endif()
  2607. #
  2608. # ioping.plugin
  2609. #
  2610. configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY)
  2611. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin
  2612. COMPONENT netdata
  2613. DESTINATION usr/libexec/netdata/plugins.d)
  2614. #
  2615. # go.d.plugin
  2616. #
  2617. if(ENABLE_PLUGIN_GO)
  2618. install(DIRECTORY COMPONENT plugin-go DESTINATION etc/netdata/go.d)
  2619. install(FILES src/go/plugin/go.d/config/go.d.conf
  2620. COMPONENT plugin-go
  2621. DESTINATION usr/lib/netdata/conf.d)
  2622. install(DIRECTORY
  2623. COMPONENT plugin-go
  2624. DESTINATION usr/lib/netdata/conf.d/go.d)
  2625. file(GLOB GO_CONF_FILES src/go/plugin/go.d/config/go.d/*.conf)
  2626. install(FILES ${GO_CONF_FILES}
  2627. COMPONENT plugin-go
  2628. DESTINATION usr/lib/netdata/conf.d/go.d)
  2629. install(DIRECTORY
  2630. COMPONENT plugin-go
  2631. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2632. file(GLOB GO_SD_CONF_FILES src/go/plugin/go.d/config/go.d/sd/*.conf)
  2633. install(FILES ${GO_SD_CONF_FILES}
  2634. COMPONENT plugin-go
  2635. DESTINATION usr/lib/netdata/conf.d/go.d/sd)
  2636. if(BUILD_FOR_PACKAGING)
  2637. install(FILES
  2638. ${PKG_FILES_PATH}/copyright
  2639. COMPONENT plugin-go
  2640. DESTINATION usr/share/doc/netdata-plugin-go)
  2641. endif()
  2642. endif()
  2643. #
  2644. # dashboard
  2645. #
  2646. include(src/web/gui/v1/dashboard_v1.cmake)
  2647. include(src/web/gui/v2/dashboard_v2.cmake)
  2648. include(src/web/gui/gui.cmake)
  2649. function(cat IN_FILE OUT_FILE)
  2650. file(READ ${IN_FILE} CONTENTS)
  2651. file(APPEND ${OUT_FILE} "${CONTENTS}")
  2652. endfunction()
  2653. file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "")
  2654. foreach(JS_FILE ${DASHBOARD_JS_FILES})
  2655. cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in)
  2656. endforeach()
  2657. configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in
  2658. ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY)
  2659. install(FILES
  2660. ${CMAKE_BINARY_DIR}/dashboard.js
  2661. COMPONENT netdata
  2662. DESTINATION ${WEB_DEST})
  2663. install(FILES
  2664. src/web/gui/dashboard_info_custom_example.js
  2665. src/web/gui/dashboard_info.js
  2666. src/web/gui/index.html
  2667. src/web/gui/main.css
  2668. src/web/gui/main.js
  2669. src/web/gui/registry-access.html
  2670. src/web/gui/registry-alert-redirect.html
  2671. src/web/gui/registry-hello.html
  2672. src/web/gui/switch.html
  2673. src/web/gui/ilove.html
  2674. COMPONENT netdata
  2675. DESTINATION ${WEB_DEST})
  2676. install(FILES
  2677. src/web/gui/old/index.html
  2678. COMPONENT netdata
  2679. DESTINATION ${WEB_DEST}/old)
  2680. install(FILES
  2681. src/web/gui/static/img/netdata-logomark.svg
  2682. COMPONENT netdata
  2683. DESTINATION ${WEB_DEST}/static/img)
  2684. install(FILES
  2685. src/web/gui/css/morris-0.5.1.css
  2686. src/web/gui/css/c3-0.4.18.min.css
  2687. COMPONENT netdata
  2688. DESTINATION ${WEB_DEST}/css)
  2689. install(FILES
  2690. src/web/gui/.well-known/dnt/cookies
  2691. COMPONENT netdata
  2692. DESTINATION ${WEB_DEST}/.well-known/dnt)
  2693. if(NOT OS_WINDOWS)
  2694. # v0 dashboard
  2695. install(FILES
  2696. src/web/gui/v0/index.html
  2697. COMPONENT netdata
  2698. DESTINATION ${WEB_DEST}/v0)
  2699. endif()
  2700. if(OS_WINDOWS)
  2701. install(FILES /usr/bin/msys-protobuf-32.dll
  2702. /usr/bin/msys-uv-1.dll
  2703. DESTINATION "${BINDIR}")
  2704. # Make bash & netdata happy
  2705. install(DIRECTORY DESTINATION tmp)
  2706. # Make curl work with ssl
  2707. install(DIRECTORY /usr/ssl DESTINATION usr)
  2708. endif()
  2709. include(Packaging)