CMakeLists.txt 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701
  1. # SPDX-License-Identifier: GPL-3.0-or-later
  2. cmake_minimum_required(VERSION 3.13.0)
  3. #
  4. # version atrocities
  5. #
  6. find_package(Git)
  7. if(GIT_EXECUTABLE)
  8. execute_process(COMMAND ${GIT_EXECUTABLE} describe
  9. WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
  10. RESULT_VARIABLE GIT_DESCRIBE_RESULT
  11. OUTPUT_VARIABLE GIT_DESCRIBE_OUTPUT)
  12. if(GIT_DESCRIBE_RESULT)
  13. file(STRINGS packaging/version GIT_DESCRIBE_OUTPUT)
  14. message(WARNING "using version from packaging/version: '${GIT_DESCRIBE_OUTPUT}'")
  15. endif()
  16. else()
  17. file(STRINGS packaging/version GIT_DESCRIBE_OUTPUT)
  18. message(WARNING "using version from packaging/version: '${GIT_DESCRIBE_OUTPUT}'")
  19. endif()
  20. string(STRIP ${GIT_DESCRIBE_OUTPUT} GIT_DESCRIBE_OUTPUT)
  21. string(REGEX MATCH "v?([0-9]+)\\.([0-9]+)\\.([0-9]+)-?([0-9]+)?-?([0-9a-zA-Z]+)?" MATCHES "${GIT_DESCRIBE_OUTPUT}")
  22. if(CMAKE_MATCH_COUNT EQUAL 3)
  23. set(FIELD_MAJOR ${CMAKE_MATCH_1})
  24. set(FIELD_MINOR ${CMAKE_MATCH_2})
  25. set(FIELD_PATCH ${CMAKE_MATCH_3})
  26. set(FIELD_TWEAK 0)
  27. set(FIELD_DESCR "N/A")
  28. elseif(CMAKE_MATCH_COUNT EQUAL 4)
  29. set(FIELD_MAJOR ${CMAKE_MATCH_1})
  30. set(FIELD_MINOR ${CMAKE_MATCH_2})
  31. set(FIELD_PATCH ${CMAKE_MATCH_3})
  32. set(FIELD_TWEAK ${CMAKE_MATCH_4})
  33. set(FIELD_DESCR "N/A")
  34. elseif(CMAKE_MATCH_COUNT EQUAL 5)
  35. set(FIELD_MAJOR ${CMAKE_MATCH_1})
  36. set(FIELD_MINOR ${CMAKE_MATCH_2})
  37. set(FIELD_PATCH ${CMAKE_MATCH_3})
  38. set(FIELD_TWEAK ${CMAKE_MATCH_4})
  39. set(FIELD_DESCR ${CMAKE_MATCH_5})
  40. else()
  41. message(FATAL_ERROR "Wrong version regex match count ${CMAKE_MATCH_COUNT} (should be in 3, 4 or 5)")
  42. endif()
  43. #
  44. # project
  45. #
  46. project(netdata
  47. VERSION ${FIELD_MAJOR}.${FIELD_MINOR}.${FIELD_PATCH}.${FIELD_TWEAK}
  48. DESCRIPTION "Netdata real-time monitoring"
  49. HOMEPAGE_URL "https://www.netdata.cloud"
  50. LANGUAGES C CXX)
  51. list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/packaging/cmake/Modules")
  52. find_package(PkgConfig REQUIRED)
  53. set(CMAKE_C_STANDARD 11)
  54. set(CMAKE_CXX_STANDARD 14)
  55. option(USE_CXX_11 "use C++11 instead of C++14" False)
  56. if(USE_CXX_11)
  57. set(CMAKE_CXX_STANDARD 11)
  58. endif()
  59. set(CMAKE_C_STANDARD_REQUIRED On)
  60. set(CMAKE_CXX_STANDARD_REQUIRED On)
  61. set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
  62. if(NOT CMAKE_BUILD_TYPE)
  63. set(CMAKE_BUILD_TYPE "Release")
  64. endif()
  65. option(ENABLE_ADDRESS_SANITIZER "enable address sanitizer" False)
  66. if(ENABLE_ADDRESS_SANITIZER)
  67. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
  68. endif()
  69. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
  70. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS}")
  71. set(CMAKE_EXPORT_COMPILE_COMMANDS On)
  72. set(CONFIG_H_DIR ${CMAKE_BINARY_DIR})
  73. set(CONFIG_H ${CONFIG_H_DIR}/config.h)
  74. option(ENABLE_CLOUD "enable cloud" True)
  75. option(ENABLE_ACLK "enable aclk" True)
  76. option(ENABLE_ML "enable machine learning" True)
  77. option(ENABLE_H2O "enable h2o" True)
  78. option(ENABLE_DBENGINE "enable dbengine" True)
  79. option(ENABLE_PLUGIN_DEBUGFS "enable debugfs.plugin" True)
  80. option(ENABLE_PLUGIN_APPS "enable apps.plugin" True)
  81. option(ENABLE_PLUGIN_FREEIPMI "enable freeipmi.plugin" True)
  82. option(ENABLE_PLUGIN_NFACCT "enable nfacct.plugin" True)
  83. option(ENABLE_PLUGIN_XENSTAT "enable xenstat.plugin" True)
  84. option(ENABLE_PLUGIN_PERF "enable perf.plugin" True)
  85. option(ENABLE_PLUGIN_SLABINFO "enable slabinfo.plugin" True)
  86. option(ENABLE_PLUGIN_CUPS "enable cups.plugin" True)
  87. option(ENABLE_PLUGIN_CGROUP_NETWORK "enable cgroup-network plugin" True)
  88. option(ENABLE_PLUGIN_EBPF "enable ebpf.plugin" True)
  89. option(ENABLE_PLUGIN_LOCAL_LISTENERS "enable local-listeners" True)
  90. option(ENABLE_PLUGIN_NETWORK_VIEWER "enable network-viewer" True)
  91. option(ENABLE_PLUGIN_SYSTEMD_JOURNAL "enable systemd-journal.plugin" True)
  92. option(ENABLE_PLUGIN_LOGS_MANAGEMENT "enable logs-management.plugin" True)
  93. option(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE "enable prometheus remote write exporter" True)
  94. option(ENABLE_EXPORTER_MONGODB "enable mongodb exporter" True)
  95. option(ENABLE_BUNDLED_JSONC "enable bundled json-c" False)
  96. option(ENABLE_BUNDLED_YAML "enable bundled yaml" False)
  97. option(ENABLE_BUNDLED_PROTOBUF "enable bundled protobuf" False)
  98. option(ENABLE_LOGS_MANAGEMENT_TESTS "enable logs management tests" True)
  99. option(ENABLE_SENTRY "enable sentry" False)
  100. option(ENABLE_WEBRTC "enable webrtc" False)
  101. if(ENABLE_SENTRY)
  102. include(FetchContent)
  103. # ignore debhelper
  104. set(FETCHCONTENT_FULLY_DISCONNECTED Off)
  105. set(SENTRY_VERSION 0.6.6)
  106. set(SENTRY_BACKEND "breakpad")
  107. set(SENTRY_BUILD_SHARED_LIBS OFF)
  108. FetchContent_Declare(
  109. sentry
  110. URL https://github.com/getsentry/sentry-native/releases/download/${SENTRY_VERSION}/sentry-native.zip
  111. URL_HASH SHA256=7a98467c0b2571380a3afc5e681cb13aa406a709529be12d74610b0015ccde0c
  112. )
  113. FetchContent_MakeAvailable(sentry)
  114. endif()
  115. if(ENABLE_WEBRTC)
  116. include(FetchContent)
  117. # ignore debhelper
  118. set(FETCHCONTENT_FULLY_DISCONNECTED Off)
  119. set(PREFER_SYSTEM_LIB True)
  120. set(NO_MEDIA True)
  121. set(NO_WEBSOCKET True)
  122. set(HAVE_LIBDATACHANNEL True)
  123. FetchContent_Declare(libdatachannel
  124. GIT_REPOSITORY https://github.com/paullouisageneau/libdatachannel.git
  125. GIT_TAG v0.20.1
  126. )
  127. FetchContent_MakeAvailable(libdatachannel)
  128. endif()
  129. #
  130. # handling of extra compiler flags
  131. #
  132. include(NetdataCompilerFlags)
  133. # Disable hardening for debug builds by default.
  134. if(CMAKE_BUILD_TYPE STREQUAL "Debug")
  135. option(DISABLE_HARDENING "disable adding extra compiler flags for hardening" TRUE)
  136. else()
  137. option(DISABLE_HARDENING "disable adding extra compiler flags for hardening" FALSE)
  138. endif()
  139. set(EXTRA_HARDENING_C_FLAGS "")
  140. set(EXTRA_HARDENING_CXX_FLAGS "")
  141. set(EXTRA_OPT_C_FLAGS "")
  142. set(EXTRA_OPT_CXX_FLAGS "")
  143. if(NOT ${DISABLE_HARDENING})
  144. add_double_extra_compiler_flag("stack-protector" "-fstack-protector-strong" "-fstack-protector" EXTRA_HARDENING)
  145. add_double_extra_compiler_flag("_FORTIFY_SOURCE" "-D_FORTIFY_SOURCE=3" "-D_FORTIFY_SOURCE=2" EXTRA_HARDENING)
  146. add_simple_extra_compiler_flag("stack-clash-protection" "-fstack-clash-protection" EXTRA_HARDENING)
  147. add_simple_extra_compiler_flag("-fcf-protection" "-fcf-protection=full" EXTRA_HARDENING)
  148. add_simple_extra_compiler_flag("branch-protection" "-mbranch-protection=standard" EXTRA_HARDENING)
  149. endif()
  150. foreach(FLAG function-sections data-sections)
  151. add_simple_extra_compiler_flag("${FLAG}" "-f${FLAG}" EXTRA_OPT)
  152. endforeach()
  153. foreach(RELTYP RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
  154. foreach(L C CXX)
  155. set(CMAKE_${L}_FLAGS_${RELTYP} "${CMAKE_${L}_FLAGS_${RELTYP}} ${EXTRA_HARDENING_C_FLAGS} ${EXTRA_OPT_C_FLAGS}")
  156. endforeach()
  157. endforeach()
  158. #
  159. # detect OS
  160. #
  161. set(LINUX False)
  162. set(FREEBSD False)
  163. set(MACOS False)
  164. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  165. set(MACOS True)
  166. set(COMPILED_FOR_MACOS True)
  167. find_library(IOKIT IOKit)
  168. find_library(FOUNDATION Foundation)
  169. elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
  170. set(FREEBSD True)
  171. set(COMPILED_FOR_FREEBSD True)
  172. else()
  173. set(LINUX True)
  174. set(COMPILED_FOR_LINUX True)
  175. add_definitions(-D_GNU_SOURCE)
  176. endif()
  177. #
  178. # Libm
  179. #
  180. # checks link with cmake required libs
  181. cmake_policy(SET CMP0075 NEW)
  182. include(CheckFunctionExists)
  183. check_function_exists(log10 HAVE_LOG10)
  184. if(NOT HAVE_LOG10)
  185. unset(HAVE_LOG10 CACHE)
  186. list(APPEND CMAKE_REQUIRED_LIBRARIES m)
  187. check_function_exists(log10 HAVE_LOG10)
  188. if(HAVE_LOG10)
  189. set(LINK_LIBM True CACHE BOOL "" FORCE)
  190. else()
  191. message(FATAL_ERROR "Can not use log10 with/without libm.")
  192. endif()
  193. endif()
  194. #
  195. # check include files
  196. #
  197. include(CheckIncludeFile)
  198. check_include_file("netinet/in.h" HAVE_NETINET_IN_H)
  199. check_include_file("resolv.h" HAVE_RESOLV_H)
  200. check_include_file("netdb.h" HAVE_NETDB_H)
  201. check_include_file("sys/prctl.h" HAVE_SYS_PRCTL_H)
  202. check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
  203. check_include_file("sys/vfs.h" HAVE_SYS_VFS_H)
  204. check_include_file("sys/statfs.h" HAVE_SYS_STATFS_H)
  205. check_include_file("linux/magic.h" HAVE_LINUX_MAGIC_H)
  206. check_include_file("sys/mount.h" HAVE_SYS_MOUNT_H)
  207. check_include_file("sys/statvfs.h" HAVE_SYS_STATVFS_H)
  208. check_include_file("inttypes.h" HAVE_INTTYPES_H)
  209. check_include_file("stdint.h" HAVE_STDINT_H)
  210. check_include_file("sys/capability.h" HAVE_SYS_CAPABILITY_H)
  211. #
  212. # check libraries we need
  213. #
  214. include(CheckLibraryExists)
  215. check_library_exists(snappy snappy_compress "" HAVE_SNAPPY_LIB)
  216. #check_include_file("snappy.h" HAVE_SNAPPY_H)
  217. #
  218. # check symbols
  219. #
  220. include(CheckSymbolExists)
  221. check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
  222. check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
  223. check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
  224. check_symbol_exists(strerror_r "string.h" HAVE_STRERROR_R)
  225. check_symbol_exists(finite "math.h" HAVE_FINITE)
  226. check_symbol_exists(isfinite "math.h" HAVE_ISFINITE)
  227. check_symbol_exists(dlsym "dlfcn.h" HAVE_DLSYM)
  228. check_function_exists(nice HAVE_NICE)
  229. check_function_exists(recvmmsg HAVE_RECVMMSG)
  230. check_function_exists(getpriority HAVE_GETPRIORITY)
  231. check_function_exists(sched_getscheduler HAVE_SCHED_GETSCHEDULER)
  232. check_function_exists(sched_setscheduler HAVE_SCHED_SETSCHEDULER)
  233. check_function_exists(sched_get_priority_min HAVE_SCHED_GET_PRIORITY_MIN)
  234. check_function_exists(sched_get_priority_max HAVE_SCHED_GET_PRIORITY_MAX)
  235. check_function_exists(close_range HAVE_CLOSE_RANGE)
  236. check_function_exists(backtrace HAVE_BACKTRACE)
  237. #
  238. # check source compilation
  239. #
  240. include(CheckCSourceCompiles)
  241. include(CheckCXXSourceCompiles)
  242. set(CMAKE_REQUIRED_LIBRARIES pthread)
  243. check_c_source_compiles("
  244. #define _GNU_SOURCE
  245. #include <pthread.h>
  246. int main() {
  247. char name[16];
  248. pthread_t thread = pthread_self();
  249. return pthread_getname_np(thread, name, sizeof(name));
  250. }
  251. " HAVE_PTHREAD_GETNAME_NP)
  252. check_c_source_compiles("
  253. #include <stdio.h>
  254. #define mytype(X) _Generic((X), int: 'i', float: 'f', default: 'u')
  255. int main() {
  256. char type = mytype(0);
  257. return 0;
  258. }
  259. " HAVE_C__GENERIC)
  260. check_c_source_compiles("
  261. #include <malloc.h>
  262. int main() {
  263. mallopt(M_ARENA_MAX, 1);
  264. mallopt(M_PERTURB, 0x5A);
  265. return 0;
  266. }
  267. " HAVE_C_MALLOPT)
  268. check_c_source_compiles("
  269. #define _GNU_SOURCE
  270. #include <stdio.h>
  271. #include <sys/socket.h>
  272. int main() {
  273. accept4(0, NULL, NULL, 0);
  274. return 0;
  275. }
  276. " HAVE_ACCEPT4)
  277. check_c_source_compiles("
  278. #define _GNU_SOURCE
  279. #include <string.h>
  280. int main() {
  281. char x = *strerror_r(0, &x, sizeof(x)); return 0;
  282. }
  283. " STRERROR_R_CHAR_P)
  284. check_c_source_compiles("
  285. #ifndef _GNU_SOURCE
  286. #define _GNU_SOURCE
  287. #endif
  288. #include <sched.h>
  289. int main() {
  290. setns(0, 0); return 0;
  291. }
  292. " HAVE_SETNS)
  293. check_cxx_source_compiles("
  294. int main() {
  295. __atomic_load_8(nullptr, 0);
  296. return 0;
  297. }
  298. " HAVE_BUILTIN_ATOMICS)
  299. check_c_source_compiles("
  300. void my_printf(char const *s, ...) __attribute__((format(printf, 1, 2)));
  301. int main() { return 0; }
  302. " HAVE_FUNC_ATTRIBUTE_FORMAT)
  303. check_c_source_compiles("
  304. #include <stdio.h>
  305. #include <stdlib.h>
  306. #include <unistd.h>
  307. void* my_alloc(size_t size) __attribute__((malloc));
  308. int main() {
  309. void *x = my_alloc(1);
  310. free(x);
  311. return 0;
  312. }
  313. void* my_alloc(size_t size) {
  314. void *ret = malloc(size);
  315. if(!ret) exit(1);
  316. return ret;
  317. }
  318. " HAVE_FUNC_ATTRIBUTE_MALLOC)
  319. check_c_source_compiles("
  320. void my_function() __attribute__((noinline));
  321. int main() { my_function(); return 0; }
  322. void my_function() { ; }
  323. " HAVE_FUNC_ATTRIBUTE_NOINLINE)
  324. check_c_source_compiles("
  325. void my_exit_function() __attribute__((noreturn));
  326. int main() {
  327. my_exit_function(); // Call the noreturn function
  328. return 0;
  329. }
  330. void my_exit_function() {
  331. exit(1);
  332. }
  333. " HAVE_FUNC_ATTRIBUTE_NORETURN)
  334. check_c_source_compiles("
  335. #include <stdio.h>
  336. #include <stdlib.h>
  337. #include <unistd.h>
  338. void* my_alloc(size_t size) __attribute__((returns_nonnull));
  339. int main() {
  340. void* ptr = my_alloc(10);
  341. free(ptr);
  342. return 0;
  343. }
  344. void* my_alloc(size_t size) {
  345. void *ret = malloc(size);
  346. if(!ret) exit(1);
  347. return ret;
  348. }
  349. " HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL)
  350. check_c_source_compiles("
  351. int my_function() __attribute__((warn_unused_result));
  352. int main() {
  353. return my_function();
  354. }
  355. int my_function() {
  356. return 1;
  357. }
  358. " HAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT)
  359. if(FREEBSD OR MACOS)
  360. set(HAVE_BUILTIN_ATOMICS True)
  361. endif()
  362. # openssl/crypto
  363. set(ENABLE_OPENSSL True)
  364. if(NOT MACOS)
  365. pkg_check_modules(CRYPTO libcrypto)
  366. pkg_check_modules(OPENSSL REQUIRED openssl)
  367. else()
  368. # I think this is moot because we can only use openssl 3.x
  369. execute_process(COMMAND
  370. brew --prefix --installed openssl
  371. RESULT_VARIABLE BREW_OPENSSL
  372. OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
  373. OUTPUT_STRIP_TRAILING_WHITESPACE)
  374. if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
  375. execute_process(COMMAND
  376. brew --prefix --installed openssl@3
  377. RESULT_VARIABLE BREW_OPENSSL
  378. OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
  379. OUTPUT_STRIP_TRAILING_WHITESPACE)
  380. if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
  381. execute_process(COMMAND
  382. brew --prefix --installed openssl@1.1
  383. RESULT_VARIABLE BREW_OPENSSL
  384. OUTPUT_VARIABLE BREW_OPENSSL_PREFIX
  385. OUTPUT_STRIP_TRAILING_WHITESPACE)
  386. if((BREW_OPENSSL NOT EQUAL 0) OR (NOT EXISTS "${BREW_OPENSSL_PREFIX}"))
  387. message(FATAL_ERROR "Could not find openssl prefix with brew")
  388. endif()
  389. endif()
  390. endif()
  391. set(OPENSSL_INCLUDE_DIRS "${BREW_OPENSSL_PREFIX}/include")
  392. set(OPENSSL_CFLAGS_OTHER "")
  393. set(OPENSSL_LDFLAGS "-L${BREW_OPENSSL_PREFIX}/lib;-lssl;-lcrypto")
  394. endif()
  395. #
  396. # figure out if we need protoc/protobuf
  397. #
  398. if(ENABLE_ACLK OR ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
  399. if(ENABLE_BUNDLED_PROTOBUF)
  400. set(PROTOBUF_PROTOC_EXECUTABLE "${CMAKE_SOURCE_DIR}/externaldeps/protobuf/src/protoc")
  401. set(PROTOBUF_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/externaldeps/protobuf/src")
  402. set(PROTOBUF_LIBRARIES "${CMAKE_SOURCE_DIR}/externaldeps/protobuf/src/.libs/libprotobuf.a")
  403. else()
  404. if (NOT BUILD_SHARED_LIBS)
  405. set(Protobuf_USE_STATIC_LIBS On)
  406. endif()
  407. find_package(Protobuf REQUIRED)
  408. endif()
  409. set(ENABLE_PROTOBUF True)
  410. set(HAVE_PROTOBUF True)
  411. if (ENABLE_BUNDLED_PROTOBUF)
  412. set(BUNDLED_PROTOBUF True)
  413. endif()
  414. endif()
  415. #
  416. # source files
  417. #
  418. set(LIBJUDY_PREV_FILES
  419. src/libnetdata/libjudy/src/JudyL/JudyLPrev.c
  420. src/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c
  421. )
  422. set(LIBJUDY_NEXT_FILES
  423. src/libnetdata/libjudy/src/JudyL/JudyLNext.c
  424. src/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c
  425. )
  426. set(LIBJUDY_SOURCES
  427. src/libnetdata/libjudy/src/Judy.h
  428. src/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c
  429. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h
  430. src/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h
  431. src/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h
  432. src/libnetdata/libjudy/src/JudyL/JudyL.h
  433. src/libnetdata/libjudy/src/JudyL/JudyLByCount.c
  434. src/libnetdata/libjudy/src/JudyL/JudyLCascade.c
  435. src/libnetdata/libjudy/src/JudyL/JudyLCount.c
  436. src/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c
  437. src/libnetdata/libjudy/src/JudyL/JudyLDecascade.c
  438. src/libnetdata/libjudy/src/JudyL/JudyLDel.c
  439. src/libnetdata/libjudy/src/JudyL/JudyLFirst.c
  440. src/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c
  441. src/libnetdata/libjudy/src/JudyL/j__udyLGet.c
  442. src/libnetdata/libjudy/src/JudyL/JudyLGet.c
  443. src/libnetdata/libjudy/src/JudyL/JudyLInsArray.c
  444. src/libnetdata/libjudy/src/JudyL/JudyLIns.c
  445. src/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c
  446. src/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c
  447. src/libnetdata/libjudy/src/JudyL/JudyLMemActive.c
  448. src/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c
  449. src/libnetdata/libjudy/src/JudyL/JudyLTables.c
  450. src/libnetdata/libjudy/src/JudyHS/JudyHS.c
  451. ${LIBJUDY_PREV_FILES}
  452. ${LIBJUDY_NEXT_FILES}
  453. )
  454. set(LIBNETDATA_FILES
  455. ${CONFIG_H}
  456. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.c
  457. src/libnetdata/adaptive_resortable_list/adaptive_resortable_list.h
  458. src/libnetdata/config/appconfig.c
  459. src/libnetdata/config/appconfig.h
  460. src/libnetdata/aral/aral.c
  461. src/libnetdata/aral/aral.h
  462. src/libnetdata/avl/avl.c
  463. src/libnetdata/avl/avl.h
  464. src/libnetdata/buffer/buffer.c
  465. src/libnetdata/buffer/buffer.h
  466. src/libnetdata/circular_buffer/circular_buffer.c
  467. src/libnetdata/circular_buffer/circular_buffer.h
  468. src/libnetdata/clocks/clocks.c
  469. src/libnetdata/clocks/clocks.h
  470. src/libnetdata/completion/completion.c
  471. src/libnetdata/completion/completion.h
  472. src/libnetdata/datetime/iso8601.c
  473. src/libnetdata/datetime/iso8601.h
  474. src/libnetdata/datetime/rfc7231.c
  475. src/libnetdata/datetime/rfc7231.h
  476. src/libnetdata/datetime/rfc3339.c
  477. src/libnetdata/datetime/rfc3339.h
  478. src/libnetdata/dictionary/dictionary.c
  479. src/libnetdata/dictionary/dictionary.h
  480. src/libnetdata/eval/eval.c
  481. src/libnetdata/eval/eval.h
  482. src/libnetdata/facets/facets.c
  483. src/libnetdata/facets/facets.h
  484. src/libnetdata/functions_evloop/functions_evloop.c
  485. src/libnetdata/functions_evloop/functions_evloop.h
  486. src/libnetdata/gorilla/gorilla.cc
  487. src/libnetdata/gorilla/gorilla.h
  488. src/libnetdata/july/july.c
  489. src/libnetdata/july/july.h
  490. src/libnetdata/inlined.h
  491. src/libnetdata/json/json.c
  492. src/libnetdata/json/json.h
  493. src/libnetdata/json/jsmn.c
  494. src/libnetdata/json/jsmn.h
  495. src/libnetdata/libnetdata.c
  496. src/libnetdata/libnetdata.h
  497. src/libnetdata/line_splitter/line_splitter.c
  498. src/libnetdata/line_splitter/line_splitter.h
  499. src/libnetdata/libnetdata.h
  500. src/libnetdata/locks/locks.c
  501. src/libnetdata/locks/locks.h
  502. src/libnetdata/log/journal.c
  503. src/libnetdata/log/journal.h
  504. src/libnetdata/log/log.c
  505. src/libnetdata/log/log.h
  506. src/libnetdata/os.c
  507. src/libnetdata/os.h
  508. src/libnetdata/simple_hashtable.h
  509. src/libnetdata/byteorder.h
  510. src/libnetdata/onewayalloc/onewayalloc.c
  511. src/libnetdata/onewayalloc/onewayalloc.h
  512. src/libnetdata/popen/popen.c
  513. src/libnetdata/popen/popen.h
  514. src/libnetdata/procfile/procfile.c
  515. src/libnetdata/procfile/procfile.h
  516. src/libnetdata/query_progress/progress.c
  517. src/libnetdata/query_progress/progress.h
  518. src/libnetdata/required_dummies.h
  519. src/libnetdata/socket/security.c
  520. src/libnetdata/socket/security.h
  521. src/libnetdata/simple_pattern/simple_pattern.c
  522. src/libnetdata/simple_pattern/simple_pattern.h
  523. src/libnetdata/socket/socket.c
  524. src/libnetdata/socket/socket.h
  525. src/libnetdata/statistical/statistical.c
  526. src/libnetdata/statistical/statistical.h
  527. src/libnetdata/storage_number/storage_number.c
  528. src/libnetdata/storage_number/storage_number.h
  529. src/libnetdata/string/string.c
  530. src/libnetdata/string/string.h
  531. src/libnetdata/threads/threads.c
  532. src/libnetdata/threads/threads.h
  533. src/libnetdata/url/url.c
  534. src/libnetdata/url/url.h
  535. src/libnetdata/uuid/uuid.c
  536. src/libnetdata/uuid/uuid.h
  537. src/libnetdata/string/utf8.h
  538. src/libnetdata/worker_utilization/worker_utilization.c
  539. src/libnetdata/worker_utilization/worker_utilization.h
  540. src/libnetdata/http/http_access.c
  541. src/libnetdata/http/http_access.h
  542. src/libnetdata/http/http_defs.c
  543. src/libnetdata/http/http_defs.h
  544. src/libnetdata/http/content_type.c
  545. src/libnetdata/http/content_type.h
  546. src/libnetdata/config/dyncfg.c
  547. src/libnetdata/config/dyncfg.h
  548. src/libnetdata/json/json-c-parser-inline.h
  549. src/libnetdata/template-enum.h
  550. src/libnetdata/dictionary/dictionary-internals.h
  551. src/libnetdata/dictionary/dictionary-unittest.c
  552. src/libnetdata/dictionary/thread-cache.c
  553. src/libnetdata/dictionary/thread-cache.h
  554. src/libnetdata/dictionary/dictionary-traversal.c
  555. src/libnetdata/dictionary/dictionary-statistics.h
  556. src/libnetdata/dictionary/dictionary-locks.h
  557. src/libnetdata/dictionary/dictionary-refcount.h
  558. src/libnetdata/dictionary/dictionary-hashtable.h
  559. src/libnetdata/dictionary/dictionary-item.h
  560. src/libnetdata/dictionary/dictionary-callbacks.h
  561. )
  562. if(ENABLE_PLUGIN_EBPF)
  563. list(APPEND LIBNETDATA_FILES
  564. src/libnetdata/ebpf/ebpf.c
  565. src/libnetdata/ebpf/ebpf.h
  566. )
  567. endif()
  568. set(LIBH2O_FILES
  569. src/web/server/h2o/libh2o/deps/cloexec/cloexec.c
  570. src/web/server/h2o/libh2o/deps/libgkc/gkc.c
  571. src/web/server/h2o/libh2o/deps/libyrmcds/close.c
  572. src/web/server/h2o/libh2o/deps/libyrmcds/connect.c
  573. src/web/server/h2o/libh2o/deps/libyrmcds/recv.c
  574. src/web/server/h2o/libh2o/deps/libyrmcds/send.c
  575. src/web/server/h2o/libh2o/deps/libyrmcds/send_text.c
  576. src/web/server/h2o/libh2o/deps/libyrmcds/socket.c
  577. src/web/server/h2o/libh2o/deps/libyrmcds/strerror.c
  578. src/web/server/h2o/libh2o/deps/libyrmcds/text_mode.c
  579. src/web/server/h2o/libh2o/deps/picohttpparser/picohttpparser.c
  580. src/web/server/h2o/libh2o/lib/common/cache.c
  581. src/web/server/h2o/libh2o/lib/common/file.c
  582. src/web/server/h2o/libh2o/lib/common/filecache.c
  583. src/web/server/h2o/libh2o/lib/common/hostinfo.c
  584. src/web/server/h2o/libh2o/lib/common/http1client.c
  585. src/web/server/h2o/libh2o/lib/common/memcached.c
  586. src/web/server/h2o/libh2o/lib/common/memory.c
  587. src/web/server/h2o/libh2o/lib/common/multithread.c
  588. src/web/server/h2o/libh2o/lib/common/serverutil.c
  589. src/web/server/h2o/libh2o/lib/common/socket.c
  590. src/web/server/h2o/libh2o/lib/common/socketpool.c
  591. src/web/server/h2o/libh2o/lib/common/string.c
  592. src/web/server/h2o/libh2o/lib/common/time.c
  593. src/web/server/h2o/libh2o/lib/common/timeout.c
  594. src/web/server/h2o/libh2o/lib/common/url.c
  595. src/web/server/h2o/libh2o/lib/core/config.c
  596. src/web/server/h2o/libh2o/lib/core/configurator.c
  597. src/web/server/h2o/libh2o/lib/core/context.c
  598. src/web/server/h2o/libh2o/lib/core/headers.c
  599. src/web/server/h2o/libh2o/lib/core/logconf.c
  600. src/web/server/h2o/libh2o/lib/core/proxy.c
  601. src/web/server/h2o/libh2o/lib/core/request.c
  602. src/web/server/h2o/libh2o/lib/core/token.c
  603. src/web/server/h2o/libh2o/lib/core/util.c
  604. src/web/server/h2o/libh2o/lib/handler/access_log.c
  605. src/web/server/h2o/libh2o/lib/handler/chunked.c
  606. src/web/server/h2o/libh2o/lib/handler/compress.c
  607. src/web/server/h2o/libh2o/lib/handler/compress/gzip.c
  608. src/web/server/h2o/libh2o/lib/handler/errordoc.c
  609. src/web/server/h2o/libh2o/lib/handler/expires.c
  610. src/web/server/h2o/libh2o/lib/handler/fastcgi.c
  611. src/web/server/h2o/libh2o/lib/handler/file.c
  612. src/web/server/h2o/libh2o/lib/handler/headers.c
  613. src/web/server/h2o/libh2o/lib/handler/mimemap.c
  614. src/web/server/h2o/libh2o/lib/handler/proxy.c
  615. src/web/server/h2o/libh2o/lib/handler/redirect.c
  616. src/web/server/h2o/libh2o/lib/handler/reproxy.c
  617. src/web/server/h2o/libh2o/lib/handler/throttle_resp.c
  618. src/web/server/h2o/libh2o/lib/handler/status.c
  619. src/web/server/h2o/libh2o/lib/handler/headers_util.c
  620. src/web/server/h2o/libh2o/lib/handler/status/events.c
  621. src/web/server/h2o/libh2o/lib/handler/status/requests.c
  622. src/web/server/h2o/libh2o/lib/handler/http2_debug_state.c
  623. src/web/server/h2o/libh2o/lib/handler/status/durations.c
  624. src/web/server/h2o/libh2o/lib/handler/configurator/access_log.c
  625. src/web/server/h2o/libh2o/lib/handler/configurator/compress.c
  626. src/web/server/h2o/libh2o/lib/handler/configurator/errordoc.c
  627. src/web/server/h2o/libh2o/lib/handler/configurator/expires.c
  628. src/web/server/h2o/libh2o/lib/handler/configurator/fastcgi.c
  629. src/web/server/h2o/libh2o/lib/handler/configurator/file.c
  630. src/web/server/h2o/libh2o/lib/handler/configurator/headers.c
  631. src/web/server/h2o/libh2o/lib/handler/configurator/proxy.c
  632. src/web/server/h2o/libh2o/lib/handler/configurator/redirect.c
  633. src/web/server/h2o/libh2o/lib/handler/configurator/reproxy.c
  634. src/web/server/h2o/libh2o/lib/handler/configurator/throttle_resp.c
  635. src/web/server/h2o/libh2o/lib/handler/configurator/status.c
  636. src/web/server/h2o/libh2o/lib/handler/configurator/http2_debug_state.c
  637. src/web/server/h2o/libh2o/lib/handler/configurator/headers_util.c
  638. src/web/server/h2o/libh2o/lib/http1.c
  639. src/web/server/h2o/libh2o/lib/tunnel.c
  640. src/web/server/h2o/libh2o/lib/http2/cache_digests.c
  641. src/web/server/h2o/libh2o/lib/http2/casper.c
  642. src/web/server/h2o/libh2o/lib/http2/connection.c
  643. src/web/server/h2o/libh2o/lib/http2/frame.c
  644. src/web/server/h2o/libh2o/lib/http2/hpack.c
  645. src/web/server/h2o/libh2o/lib/http2/scheduler.c
  646. src/web/server/h2o/libh2o/lib/http2/stream.c
  647. src/web/server/h2o/libh2o/lib/http2/http2_debug_state.c
  648. )
  649. set(DAEMON_FILES
  650. src/daemon/buildinfo.c
  651. src/daemon/buildinfo.h
  652. src/daemon/common.c
  653. src/daemon/common.h
  654. src/daemon/daemon.c
  655. src/daemon/daemon.h
  656. src/daemon/event_loop.c
  657. src/daemon/event_loop.h
  658. src/daemon/global_statistics.c
  659. src/daemon/global_statistics.h
  660. src/daemon/analytics.c
  661. src/daemon/analytics.h
  662. src/daemon/main.c
  663. src/daemon/main.h
  664. src/daemon/signals.c
  665. src/daemon/signals.h
  666. src/daemon/service.c
  667. src/daemon/watcher.c
  668. src/daemon/watcher.h
  669. src/daemon/static_threads.c
  670. src/daemon/static_threads.h
  671. src/daemon/commands.c
  672. src/daemon/commands.h
  673. src/daemon/pipename.c
  674. src/daemon/pipename.h
  675. src/daemon/unit_test.c
  676. src/daemon/unit_test.h
  677. src/daemon/config/dyncfg.c
  678. src/daemon/config/dyncfg.h
  679. src/daemon/config/dyncfg-files.c
  680. src/daemon/config/dyncfg-unittest.c
  681. src/daemon/config/dyncfg-inline.c
  682. src/daemon/config/dyncfg-echo.c
  683. src/daemon/config/dyncfg-internals.h
  684. src/daemon/config/dyncfg-intercept.c
  685. src/daemon/config/dyncfg-tree.c
  686. )
  687. set(H2O_FILES
  688. src/web/server/h2o/http_server.c
  689. src/web/server/h2o/http_server.h
  690. src/web/server/h2o/h2o_utils.c
  691. src/web/server/h2o/h2o_utils.h
  692. src/web/server/h2o/streaming.c
  693. src/web/server/h2o/streaming.h
  694. src/web/server/h2o/connlist.c
  695. src/web/server/h2o/connlist.h
  696. )
  697. if(ENABLE_H2O)
  698. list(APPEND DAEMON_FILES ${H2O_FILES})
  699. endif()
  700. set(API_PLUGIN_FILES
  701. src/web/api/web_api.c
  702. src/web/api/web_api.h
  703. src/web/api/web_api_v1.c
  704. src/web/api/web_api_v1.h
  705. src/web/api/web_api_v2.c
  706. src/web/api/web_api_v2.h
  707. src/web/api/http_auth.c
  708. src/web/api/http_auth.h
  709. src/web/api/http_header.c
  710. src/web/api/http_header.h
  711. src/web/api/badges/web_buffer_svg.c
  712. src/web/api/badges/web_buffer_svg.h
  713. src/web/api/exporters/allmetrics.c
  714. src/web/api/exporters/allmetrics.h
  715. src/web/api/exporters/shell/allmetrics_shell.c
  716. src/web/api/exporters/shell/allmetrics_shell.h
  717. src/web/api/queries/rrdr.c
  718. src/web/api/queries/rrdr.h
  719. src/web/api/queries/query.c
  720. src/web/api/queries/query.h
  721. src/web/api/queries/average/average.c
  722. src/web/api/queries/average/average.h
  723. src/web/api/queries/countif/countif.c
  724. src/web/api/queries/countif/countif.h
  725. src/web/api/queries/incremental_sum/incremental_sum.c
  726. src/web/api/queries/incremental_sum/incremental_sum.h
  727. src/web/api/queries/max/max.c
  728. src/web/api/queries/max/max.h
  729. src/web/api/queries/min/min.c
  730. src/web/api/queries/min/min.h
  731. src/web/api/queries/sum/sum.c
  732. src/web/api/queries/sum/sum.h
  733. src/web/api/queries/median/median.c
  734. src/web/api/queries/median/median.h
  735. src/web/api/queries/percentile/percentile.c
  736. src/web/api/queries/percentile/percentile.h
  737. src/web/api/queries/stddev/stddev.c
  738. src/web/api/queries/stddev/stddev.h
  739. src/web/api/queries/ses/ses.c
  740. src/web/api/queries/ses/ses.h
  741. src/web/api/queries/des/des.c
  742. src/web/api/queries/des/des.h
  743. src/web/api/queries/trimmed_mean/trimmed_mean.c
  744. src/web/api/queries/trimmed_mean/trimmed_mean.h
  745. src/web/api/queries/weights.c
  746. src/web/api/queries/weights.h
  747. src/web/api/formatters/rrd2json.c
  748. src/web/api/formatters/rrd2json.h
  749. src/web/api/formatters/csv/csv.c
  750. src/web/api/formatters/csv/csv.h
  751. src/web/api/formatters/json/json.c
  752. src/web/api/formatters/json/json.h
  753. src/web/api/formatters/ssv/ssv.c
  754. src/web/api/formatters/ssv/ssv.h
  755. src/web/api/formatters/value/value.c
  756. src/web/api/formatters/value/value.h
  757. src/web/api/formatters/json_wrapper.c
  758. src/web/api/formatters/json_wrapper.h
  759. src/web/api/formatters/charts2json.c
  760. src/web/api/formatters/charts2json.h
  761. src/web/api/formatters/rrdset2json.c
  762. src/web/api/formatters/rrdset2json.h
  763. src/web/api/ilove/ilove.c
  764. src/web/api/ilove/ilove.h
  765. src/web/rtc/webrtc.c
  766. src/web/rtc/webrtc.h
  767. )
  768. set(EXPORTING_ENGINE_FILES
  769. src/exporting/exporting_engine.c
  770. src/exporting/exporting_engine.h
  771. src/exporting/graphite/graphite.c
  772. src/exporting/graphite/graphite.h
  773. src/exporting/json/json.c
  774. src/exporting/json/json.h
  775. src/exporting/opentsdb/opentsdb.c
  776. src/exporting/opentsdb/opentsdb.h
  777. src/exporting/prometheus/prometheus.c
  778. src/exporting/prometheus/prometheus.h
  779. src/exporting/read_config.c
  780. src/exporting/clean_connectors.c
  781. src/exporting/init_connectors.c
  782. src/exporting/process_data.c
  783. src/exporting/check_filters.c
  784. src/exporting/send_data.c
  785. src/exporting/send_internal_metrics.c
  786. )
  787. set(HEALTH_PLUGIN_FILES
  788. src/health/health.c
  789. src/health/health.h
  790. src/health/health_config.c
  791. src/health/health_json.c
  792. src/health/health_log.c
  793. src/health/health_prototypes.c
  794. src/health/health_prototypes.h
  795. src/health/health_silencers.c
  796. src/health/health_silencers.h
  797. src/health/health_internals.h
  798. src/health/health_notifications.c
  799. src/health/health_event_loop.c
  800. src/health/health_dyncfg.c
  801. src/health/health_variable.c
  802. src/health/rrdcalc.c
  803. src/health/rrdcalc.h
  804. src/health/rrdvar.c
  805. src/health/rrdvar.h
  806. )
  807. set(IDLEJITTER_PLUGIN_FILES src/collectors/idlejitter.plugin/plugin_idlejitter.c)
  808. if(ENABLE_ML)
  809. set(ML_FILES
  810. src/ml/ad_charts.h
  811. src/ml/ad_charts.cc
  812. src/ml/Config.cc
  813. src/ml/dlib/dlib/all/source.cpp
  814. src/ml/ml.h
  815. src/ml/ml.cc
  816. src/ml/ml-private.h
  817. )
  818. else()
  819. set(ML_FILES
  820. src/ml/ml.h
  821. src/ml/ml-dummy.c
  822. )
  823. endif()
  824. set(PLUGINSD_PLUGIN_FILES
  825. src/collectors/plugins.d/plugins_d.c
  826. src/collectors/plugins.d/plugins_d.h
  827. src/collectors/plugins.d/pluginsd_dyncfg.c
  828. src/collectors/plugins.d/pluginsd_dyncfg.h
  829. src/collectors/plugins.d/pluginsd_functions.c
  830. src/collectors/plugins.d/pluginsd_functions.h
  831. src/collectors/plugins.d/pluginsd_internals.c
  832. src/collectors/plugins.d/pluginsd_internals.h
  833. src/collectors/plugins.d/pluginsd_parser.c
  834. src/collectors/plugins.d/pluginsd_parser.h
  835. src/collectors/plugins.d/pluginsd_replication.c
  836. src/collectors/plugins.d/pluginsd_replication.h
  837. )
  838. set(RRD_PLUGIN_FILES
  839. src/database/contexts/api_v1.c
  840. src/database/contexts/api_v2.c
  841. src/database/contexts/context.c
  842. src/database/contexts/instance.c
  843. src/database/contexts/internal.h
  844. src/database/contexts/metric.c
  845. src/database/contexts/query_scope.c
  846. src/database/contexts/query_target.c
  847. src/database/contexts/rrdcontext.c
  848. src/database/contexts/rrdcontext.h
  849. src/database/contexts/worker.c
  850. src/database/rrdcollector.c
  851. src/database/rrdcollector.h
  852. src/database/rrddim.c
  853. src/database/rrdfunctions.c
  854. src/database/rrdfunctions.h
  855. src/database/rrdfunctions-inline.c
  856. src/database/rrdfunctions-inline.h
  857. src/database/rrdfunctions-progress.c
  858. src/database/rrdfunctions-progress.h
  859. src/database/rrdfunctions-streaming.c
  860. src/database/rrdfunctions-streaming.h
  861. src/database/rrdhost.c
  862. src/database/rrdlabels.c
  863. src/database/rrd.c
  864. src/database/rrd.h
  865. src/database/rrdset.c
  866. src/database/storage_engine.c
  867. src/database/storage_engine.h
  868. src/database/ram/rrddim_mem.c
  869. src/database/ram/rrddim_mem.h
  870. src/database/sqlite/sqlite_metadata.c
  871. src/database/sqlite/sqlite_metadata.h
  872. src/database/sqlite/sqlite_functions.c
  873. src/database/sqlite/sqlite_functions.h
  874. src/database/sqlite/sqlite_context.c
  875. src/database/sqlite/sqlite_context.h
  876. src/database/sqlite/sqlite_db_migration.c
  877. src/database/sqlite/sqlite_db_migration.h
  878. src/database/sqlite/sqlite_aclk.c
  879. src/database/sqlite/sqlite_aclk.h
  880. src/database/sqlite/sqlite_health.c
  881. src/database/sqlite/sqlite_health.h
  882. src/database/sqlite/sqlite_aclk_node.c
  883. src/database/sqlite/sqlite_aclk_node.h
  884. src/database/sqlite/sqlite_aclk_alert.c
  885. src/database/sqlite/sqlite_aclk_alert.h
  886. src/database/sqlite/sqlite3.c
  887. src/database/sqlite/sqlite3.h
  888. src/database/sqlite/sqlite3recover.c
  889. src/database/sqlite/sqlite3recover.h
  890. src/database/sqlite/dbdata.c
  891. src/database/KolmogorovSmirnovDist.c
  892. src/database/KolmogorovSmirnovDist.h
  893. src/database/rrdfunctions-inflight.c
  894. src/database/rrdfunctions-inflight.h
  895. src/database/rrdfunctions-exporters.c
  896. src/database/rrdfunctions-exporters.h
  897. src/database/rrdfunctions-internals.h
  898. src/database/rrdcollector-internals.h
  899. )
  900. if(ENABLE_DBENGINE)
  901. list(APPEND RRD_PLUGIN_FILES
  902. src/database/engine/rrdengine.c
  903. src/database/engine/rrdengine.h
  904. src/database/engine/rrddiskprotocol.h
  905. src/database/engine/datafile.c
  906. src/database/engine/datafile.h
  907. src/database/engine/journalfile.c
  908. src/database/engine/journalfile.h
  909. src/database/engine/rrdenginelib.c
  910. src/database/engine/rrdenginelib.h
  911. src/database/engine/rrdengineapi.c
  912. src/database/engine/rrdengineapi.h
  913. src/database/engine/pagecache.c
  914. src/database/engine/pagecache.h
  915. src/database/engine/page_test.cc
  916. src/database/engine/page.c
  917. src/database/engine/page.h
  918. src/database/engine/cache.c
  919. src/database/engine/cache.h
  920. src/database/engine/metric.c
  921. src/database/engine/metric.h
  922. src/database/engine/pdc.c
  923. src/database/engine/pdc.h
  924. )
  925. endif()
  926. set(REGISTRY_PLUGIN_FILES
  927. src/registry/registry.c
  928. src/registry/registry.h
  929. src/registry/registry_db.c
  930. src/registry/registry_init.c
  931. src/registry/registry_internals.c
  932. src/registry/registry_internals.h
  933. src/registry/registry_log.c
  934. src/registry/registry_machine.c
  935. src/registry/registry_machine.h
  936. src/registry/registry_person.c
  937. src/registry/registry_person.h
  938. )
  939. set(STATSD_PLUGIN_FILES
  940. src/collectors/statsd.plugin/statsd.c
  941. )
  942. set(SYSTEMD_JOURNAL_PLUGIN_FILES
  943. src/collectors/systemd-journal.plugin/systemd-journal.c
  944. src/collectors/systemd-journal.plugin/systemd-internals.h
  945. src/collectors/systemd-journal.plugin/systemd-main.c
  946. src/collectors/systemd-journal.plugin/systemd-units.c
  947. src/collectors/systemd-journal.plugin/systemd-journal.c
  948. src/collectors/systemd-journal.plugin/systemd-journal-annotations.c
  949. src/collectors/systemd-journal.plugin/systemd-journal-files.c
  950. src/collectors/systemd-journal.plugin/systemd-journal-fstat.c
  951. src/collectors/systemd-journal.plugin/systemd-journal-watcher.c
  952. src/collectors/systemd-journal.plugin/systemd-journal-dyncfg.c
  953. src/libnetdata/maps/system-users.h
  954. src/libnetdata/maps/system-groups.h
  955. )
  956. set(STREAMING_PLUGIN_FILES
  957. src/streaming/rrdpush.c
  958. src/streaming/rrdpush.h
  959. src/streaming/compression.c
  960. src/streaming/compression.h
  961. src/streaming/compression_brotli.c
  962. src/streaming/compression_brotli.h
  963. src/streaming/compression_gzip.c
  964. src/streaming/compression_gzip.h
  965. src/streaming/compression_lz4.c
  966. src/streaming/compression_lz4.h
  967. src/streaming/compression_zstd.c
  968. src/streaming/compression_zstd.h
  969. src/streaming/receiver.c
  970. src/streaming/sender.c
  971. src/streaming/replication.c
  972. src/streaming/replication.h
  973. src/streaming/common.h
  974. )
  975. set(WEB_PLUGIN_FILES
  976. src/web/server/web_client.c
  977. src/web/server/web_client.h
  978. src/web/server/web_server.c
  979. src/web/server/web_server.h
  980. src/web/server/static/static-threaded.c
  981. src/web/server/static/static-threaded.h
  982. src/web/server/web_client_cache.c
  983. src/web/server/web_client_cache.h
  984. )
  985. set(CLAIM_PLUGIN_FILES
  986. src/claim/claim.c
  987. src/claim/claim.h
  988. )
  989. set(SPAWN_PLUGIN_FILES
  990. src/spawn/spawn.c
  991. src/spawn/spawn_server.c
  992. src/spawn/spawn_client.c
  993. src/spawn/spawn.h
  994. )
  995. set(ACLK_ALWAYS_BUILD
  996. src/aclk/aclk_rrdhost_state.h
  997. src/aclk/aclk_proxy.c
  998. src/aclk/aclk_proxy.h
  999. src/aclk/aclk.c
  1000. src/aclk/aclk.h
  1001. src/aclk/aclk_capas.c
  1002. src/aclk/aclk_capas.h
  1003. src/aclk/aclk_util.c
  1004. src/aclk/aclk_util.h
  1005. src/aclk/https_client.c
  1006. src/aclk/https_client.h
  1007. )
  1008. set(TIMEX_PLUGIN_FILES
  1009. src/collectors/timex.plugin/plugin_timex.c
  1010. )
  1011. set(PROFILE_PLUGIN_FILES
  1012. src/collectors/profile.plugin/plugin_profile.cc
  1013. )
  1014. set(CGROUPS_PLUGIN_FILES
  1015. src/collectors/cgroups.plugin/sys_fs_cgroup.c
  1016. src/collectors/cgroups.plugin/sys_fs_cgroup.h
  1017. src/collectors/cgroups.plugin/cgroup-internals.h
  1018. src/collectors/cgroups.plugin/cgroup-discovery.c
  1019. src/collectors/cgroups.plugin/cgroup-charts.c
  1020. src/collectors/cgroups.plugin/cgroup-top.c
  1021. )
  1022. set(DISKSPACE_PLUGIN_FILES
  1023. src/collectors/diskspace.plugin/plugin_diskspace.c
  1024. )
  1025. set(MACOS_PLUGIN_FILES
  1026. src/collectors/macos.plugin/plugin_macos.c
  1027. src/collectors/macos.plugin/plugin_macos.h
  1028. src/collectors/macos.plugin/macos_sysctl.c
  1029. src/collectors/macos.plugin/macos_mach_smi.c
  1030. src/collectors/macos.plugin/macos_fw.c
  1031. )
  1032. set(FREEBSD_PLUGIN_FILES
  1033. src/collectors/freebsd.plugin/plugin_freebsd.c
  1034. src/collectors/freebsd.plugin/plugin_freebsd.h
  1035. src/collectors/freebsd.plugin/freebsd_sysctl.c
  1036. src/collectors/freebsd.plugin/freebsd_getmntinfo.c
  1037. src/collectors/freebsd.plugin/freebsd_getifaddrs.c
  1038. src/collectors/freebsd.plugin/freebsd_devstat.c
  1039. src/collectors/freebsd.plugin/freebsd_kstat_zfs.c
  1040. src/collectors/freebsd.plugin/freebsd_ipfw.c
  1041. src/collectors/proc.plugin/zfs_common.c
  1042. src/collectors/proc.plugin/zfs_common.h
  1043. )
  1044. set(PROC_PLUGIN_FILES
  1045. src/collectors/proc.plugin/ipc.c
  1046. src/collectors/proc.plugin/plugin_proc.c
  1047. src/collectors/proc.plugin/plugin_proc.h
  1048. src/collectors/proc.plugin/proc_sys_fs_file_nr.c
  1049. src/collectors/proc.plugin/proc_diskstats.c
  1050. src/collectors/proc.plugin/proc_mdstat.c
  1051. src/collectors/proc.plugin/proc_interrupts.c
  1052. src/collectors/proc.plugin/proc_softirqs.c
  1053. src/collectors/proc.plugin/proc_loadavg.c
  1054. src/collectors/proc.plugin/proc_meminfo.c
  1055. src/collectors/proc.plugin/proc_pagetypeinfo.c
  1056. src/collectors/proc.plugin/proc_net_dev.c
  1057. src/collectors/proc.plugin/proc_net_dev_renames.c
  1058. src/collectors/proc.plugin/proc_net_dev_renames.h
  1059. src/collectors/proc.plugin/proc_net_wireless.c
  1060. src/collectors/proc.plugin/proc_net_ip_vs_stats.c
  1061. src/collectors/proc.plugin/proc_net_netstat.c
  1062. src/collectors/proc.plugin/proc_net_rpc_nfs.c
  1063. src/collectors/proc.plugin/proc_net_rpc_nfsd.c
  1064. src/collectors/proc.plugin/proc_net_sctp_snmp.c
  1065. src/collectors/proc.plugin/proc_net_sockstat.c
  1066. src/collectors/proc.plugin/proc_net_sockstat6.c
  1067. src/collectors/proc.plugin/proc_net_softnet_stat.c
  1068. src/collectors/proc.plugin/proc_net_stat_conntrack.c
  1069. src/collectors/proc.plugin/proc_net_stat_synproxy.c
  1070. src/collectors/proc.plugin/proc_self_mountinfo.c
  1071. src/collectors/proc.plugin/proc_self_mountinfo.h
  1072. src/collectors/proc.plugin/zfs_common.c
  1073. src/collectors/proc.plugin/zfs_common.h
  1074. src/collectors/proc.plugin/proc_spl_kstat_zfs.c
  1075. src/collectors/proc.plugin/proc_stat.c
  1076. src/collectors/proc.plugin/proc_sys_kernel_random_entropy_avail.c
  1077. src/collectors/proc.plugin/proc_vmstat.c
  1078. src/collectors/proc.plugin/proc_uptime.c
  1079. src/collectors/proc.plugin/proc_pressure.c
  1080. src/collectors/proc.plugin/proc_pressure.h
  1081. src/collectors/proc.plugin/sys_kernel_mm_ksm.c
  1082. src/collectors/proc.plugin/sys_block_zram.c
  1083. src/collectors/proc.plugin/sys_devices_system_edac_mc.c
  1084. src/collectors/proc.plugin/sys_devices_system_node.c
  1085. src/collectors/proc.plugin/sys_class_infiniband.c
  1086. src/collectors/proc.plugin/sys_fs_btrfs.c
  1087. src/collectors/proc.plugin/sys_class_power_supply.c
  1088. src/collectors/proc.plugin/sys_devices_pci_aer.c
  1089. src/collectors/proc.plugin/sys_class_drm.c
  1090. )
  1091. set(TC_PLUGIN_FILES
  1092. src/collectors/tc.plugin/plugin_tc.c
  1093. )
  1094. set(LOGS_MANAGEMENT_PLUGIN_FILES
  1095. src/logsmanagement/circular_buffer.c
  1096. src/logsmanagement/circular_buffer.h
  1097. src/logsmanagement/db_api.c
  1098. src/logsmanagement/db_api.h
  1099. src/logsmanagement/defaults.h
  1100. src/logsmanagement/file_info.h
  1101. src/logsmanagement/flb_plugin.c
  1102. src/logsmanagement/flb_plugin.h
  1103. src/logsmanagement/functions.c
  1104. src/logsmanagement/functions.h
  1105. src/logsmanagement/helper.h
  1106. src/logsmanagement/logsmanag_config.c
  1107. src/logsmanagement/logsmanag_config.h
  1108. src/logsmanagement/logsmanagement.c
  1109. src/logsmanagement/parser.c
  1110. src/logsmanagement/parser.h
  1111. src/logsmanagement/query.c
  1112. src/logsmanagement/query.h
  1113. src/logsmanagement/rrd_api/rrd_api_docker_ev.c
  1114. src/logsmanagement/rrd_api/rrd_api_docker_ev.h
  1115. src/logsmanagement/rrd_api/rrd_api_generic.c
  1116. src/logsmanagement/rrd_api/rrd_api_generic.h
  1117. src/logsmanagement/rrd_api/rrd_api_kernel.c
  1118. src/logsmanagement/rrd_api/rrd_api_kernel.h
  1119. src/logsmanagement/rrd_api/rrd_api_mqtt.c
  1120. src/logsmanagement/rrd_api/rrd_api_mqtt.h
  1121. src/logsmanagement/rrd_api/rrd_api_stats.c
  1122. src/logsmanagement/rrd_api/rrd_api_stats.h
  1123. src/logsmanagement/rrd_api/rrd_api_systemd.c
  1124. src/logsmanagement/rrd_api/rrd_api_systemd.h
  1125. src/logsmanagement/rrd_api/rrd_api_web_log.c
  1126. src/logsmanagement/rrd_api/rrd_api_web_log.h
  1127. src/logsmanagement/rrd_api/rrd_api.h
  1128. src/database/sqlite/sqlite3.c
  1129. src/database/sqlite/sqlite3.h
  1130. )
  1131. set(NETDATA_FILES
  1132. src/collectors/all.h
  1133. ${DAEMON_FILES}
  1134. ${API_PLUGIN_FILES}
  1135. ${EXPORTING_ENGINE_FILES}
  1136. ${HEALTH_PLUGIN_FILES}
  1137. ${IDLEJITTER_PLUGIN_FILES}
  1138. ${ML_FILES}
  1139. ${PLUGINSD_PLUGIN_FILES}
  1140. ${RRD_PLUGIN_FILES}
  1141. ${REGISTRY_PLUGIN_FILES}
  1142. ${STATSD_PLUGIN_FILES}
  1143. ${STREAMING_PLUGIN_FILES}
  1144. ${WEB_PLUGIN_FILES}
  1145. ${CLAIM_PLUGIN_FILES}
  1146. ${SPAWN_PLUGIN_FILES}
  1147. ${ACLK_ALWAYS_BUILD}
  1148. ${TIMEX_PLUGIN_FILES}
  1149. ${PROFILE_PLUGIN_FILES}
  1150. )
  1151. if(LINUX)
  1152. list(APPEND NETDATA_FILES
  1153. src/daemon/static_threads_linux.c
  1154. ${CGROUPS_PLUGIN_FILES}
  1155. ${DISKSPACE_PLUGIN_FILES}
  1156. ${PROC_PLUGIN_FILES}
  1157. ${TC_PLUGIN_FILES}
  1158. )
  1159. if(ENABLE_SENTRY)
  1160. list(APPEND NETDATA_FILES
  1161. src/daemon/sentry-native/sentry-native.c
  1162. src/daemon/sentry-native/sentry-native.h)
  1163. endif()
  1164. elseif(MACOS)
  1165. list(APPEND NETDATA_FILES
  1166. src/daemon/static_threads_macos.c
  1167. ${MACOS_PLUGIN_FILES}
  1168. )
  1169. elseif(FREEBSD)
  1170. list(APPEND NETDATA_FILES
  1171. src/daemon/static_threads_freebsd.c
  1172. ${FREEBSD_PLUGIN_FILES}
  1173. )
  1174. endif()
  1175. set(MQTT_WEBSOCKETS_FILES
  1176. src/aclk/mqtt_websockets/mqtt_wss_client.c
  1177. src/aclk/mqtt_websockets/mqtt_wss_client.h
  1178. src/aclk/mqtt_websockets/mqtt_wss_log.c
  1179. src/aclk/mqtt_websockets/mqtt_wss_log.h
  1180. src/aclk/mqtt_websockets/ws_client.c
  1181. src/aclk/mqtt_websockets/ws_client.h
  1182. src/aclk/mqtt_websockets/mqtt_ng.c
  1183. src/aclk/mqtt_websockets/mqtt_ng.h
  1184. src/aclk/mqtt_websockets/common_public.c
  1185. src/aclk/mqtt_websockets/common_public.h
  1186. src/aclk/mqtt_websockets/common_internal.h
  1187. src/aclk/mqtt_websockets/c-rbuf/cringbuffer.c
  1188. src/aclk/mqtt_websockets/c-rbuf/cringbuffer.h
  1189. src/aclk/mqtt_websockets/c-rbuf/cringbuffer_internal.h
  1190. src/aclk/mqtt_websockets/c_rhash/c_rhash.c
  1191. src/aclk/mqtt_websockets/c_rhash/c_rhash.h
  1192. src/aclk/mqtt_websockets/c_rhash/c_rhash_internal.h
  1193. )
  1194. set(ACLK_PROTO_DEFS
  1195. src/aclk/aclk-schemas/proto/aclk/v1/lib.proto
  1196. src/aclk/aclk-schemas/proto/agent/v1/disconnect.proto
  1197. src/aclk/aclk-schemas/proto/agent/v1/connection.proto
  1198. src/aclk/aclk-schemas/proto/alarm/v1/config.proto
  1199. src/aclk/aclk-schemas/proto/alarm/v1/stream.proto
  1200. src/aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto
  1201. src/aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto
  1202. src/aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto
  1203. src/aclk/aclk-schemas/proto/context/v1/context.proto
  1204. src/aclk/aclk-schemas/proto/context/v1/stream.proto
  1205. src/aclk/aclk-schemas/proto/agent/v1/cmds.proto
  1206. )
  1207. set(ACLK_FILES
  1208. src/aclk/aclk_stats.c
  1209. src/aclk/aclk_stats.h
  1210. src/aclk/aclk_query.c
  1211. src/aclk/aclk_query.h
  1212. src/aclk/aclk_query_queue.c
  1213. src/aclk/aclk_query_queue.h
  1214. src/aclk/aclk_otp.c
  1215. src/aclk/aclk_otp.h
  1216. src/aclk/aclk_tx_msgs.c
  1217. src/aclk/aclk_tx_msgs.h
  1218. src/aclk/aclk_rx_msgs.c
  1219. src/aclk/aclk_rx_msgs.h
  1220. src/aclk/aclk_alarm_api.c
  1221. src/aclk/aclk_alarm_api.h
  1222. src/aclk/aclk_contexts_api.c
  1223. src/aclk/aclk_contexts_api.h
  1224. src/aclk/schema-wrappers/connection.cc
  1225. src/aclk/schema-wrappers/connection.h
  1226. src/aclk/schema-wrappers/node_connection.cc
  1227. src/aclk/schema-wrappers/node_connection.h
  1228. src/aclk/schema-wrappers/node_creation.cc
  1229. src/aclk/schema-wrappers/node_creation.h
  1230. src/aclk/schema-wrappers/alarm_stream.cc
  1231. src/aclk/schema-wrappers/alarm_stream.h
  1232. src/aclk/schema-wrappers/alarm_config.cc
  1233. src/aclk/schema-wrappers/alarm_config.h
  1234. src/aclk/schema-wrappers/node_info.cc
  1235. src/aclk/schema-wrappers/node_info.h
  1236. src/aclk/schema-wrappers/capability.cc
  1237. src/aclk/schema-wrappers/capability.h
  1238. src/aclk/schema-wrappers/proto_2_json.cc
  1239. src/aclk/schema-wrappers/proto_2_json.h
  1240. src/aclk/schema-wrappers/context_stream.cc
  1241. src/aclk/schema-wrappers/context_stream.h
  1242. src/aclk/schema-wrappers/context.cc
  1243. src/aclk/schema-wrappers/context.h
  1244. src/aclk/schema-wrappers/schema_wrappers.h
  1245. src/aclk/schema-wrappers/schema_wrapper_utils.cc
  1246. src/aclk/schema-wrappers/schema_wrapper_utils.h
  1247. src/aclk/schema-wrappers/agent_cmds.cc
  1248. src/aclk/schema-wrappers/agent_cmds.h
  1249. src/aclk/helpers/mqtt_wss_pal.h
  1250. src/aclk/helpers/ringbuffer_pal.h
  1251. )
  1252. set(MONGODB_EXPORTING_FILES
  1253. src/exporting/mongodb/mongodb.c
  1254. src/exporting/mongodb/mongodb.h
  1255. )
  1256. set(PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1257. src/exporting/prometheus/remote_write/remote_write.c
  1258. src/exporting/prometheus/remote_write/remote_write.h
  1259. src/exporting/prometheus/remote_write/remote_write_request.cc
  1260. src/exporting/prometheus/remote_write/remote_write_request.h
  1261. )
  1262. #
  1263. # build h2o
  1264. #
  1265. if(ENABLE_H2O)
  1266. add_library(h2o STATIC ${LIBH2O_FILES})
  1267. target_include_directories(h2o BEFORE PUBLIC
  1268. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include"
  1269. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/cloexec"
  1270. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/brotli/enc"
  1271. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/golombset"
  1272. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libgkc"
  1273. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/libyrmcds"
  1274. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/klib"
  1275. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/neverbleed"
  1276. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picohttpparser"
  1277. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/picotest"
  1278. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yaml/include"
  1279. "${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/deps/yoml"
  1280. )
  1281. target_compile_options(h2o PRIVATE
  1282. -Wno-all -Wno-extra
  1283. -Wno-shadow
  1284. -Wno-deprecated-declarations
  1285. -Wformat
  1286. )
  1287. target_compile_options(h2o PUBLIC -DH2O_USE_LIBUV=0)
  1288. target_include_directories(h2o BEFORE PRIVATE ${OPENSSL_INCLUDE_DIRS})
  1289. target_compile_options(h2o PRIVATE ${OPENSSL_CFLAGS_OTHER})
  1290. target_link_libraries(h2o PRIVATE ${OPENSSL_LIBRARIES})
  1291. endif()
  1292. #
  1293. # build libjudy
  1294. #
  1295. add_library(judy STATIC ${LIBJUDY_SOURCES})
  1296. target_compile_options(judy PRIVATE
  1297. -Wno-all -Wno-extra
  1298. -Wno-shadow
  1299. -Wformat
  1300. )
  1301. target_compile_definitions(judy PRIVATE
  1302. JUDYL
  1303. $<$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>:JU_64BIT>
  1304. )
  1305. target_include_directories(judy PUBLIC
  1306. src/libnetdata/libjudy/src
  1307. src/libnetdata/libjudy/src/JudyCommon
  1308. )
  1309. set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV")
  1310. set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT")
  1311. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE")
  1312. set_source_files_properties(src/libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB")
  1313. set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/src/libnetdata/libjudy/src/JudyL")
  1314. #
  1315. # build libnetdata
  1316. #
  1317. include(NetdataDetectSystemd)
  1318. detect_systemd()
  1319. add_library(libnetdata STATIC ${LIBNETDATA_FILES})
  1320. target_include_directories(libnetdata BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src)
  1321. # pthread (FIXME: use find_package for this)
  1322. # set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
  1323. # set(THREADS_PREFER_PTHREAD_FLAG TRUE)
  1324. # find_package(Threads REQUIRED)
  1325. # add_executable(test test.cpp)
  1326. # target_link_libraries(test Threads::Threads)
  1327. target_link_libraries(libnetdata PUBLIC
  1328. "$<$<NOT:$<BOOL:${HAVE_BUILTIN_ATOMICS}>>:atomic>"
  1329. "$<$<OR:$<BOOL:${LINUX}>,$<BOOL:${FREEBSD}>>:pthread;rt>"
  1330. "$<$<BOOL:${LINK_LIBM}>:m>"
  1331. "${SYSTEMD_LDFLAGS}")
  1332. # ebpf
  1333. if(ENABLE_PLUGIN_EBPF)
  1334. target_link_libraries(libnetdata PUBLIC ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/libbpf.a)
  1335. target_include_directories(libnetdata BEFORE PUBLIC
  1336. ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/include
  1337. ${CMAKE_SOURCE_DIR}/externaldeps/libbpf/include/uapi
  1338. )
  1339. pkg_check_modules(ELF REQUIRED libelf)
  1340. target_include_directories(libnetdata BEFORE PUBLIC ${ELF_INCLUDE_DIRS})
  1341. target_compile_options(libnetdata PUBLIC ${ELF_CFLAGS_OTHER})
  1342. target_link_libraries(libnetdata PUBLIC ${ELF_LIBRARIES})
  1343. endif()
  1344. # judy
  1345. target_link_libraries(libnetdata PUBLIC judy)
  1346. # json-c
  1347. if(ENABLE_BUNDLED_JSONC)
  1348. add_library(jsonc STATIC IMPORTED)
  1349. set_property(TARGET jsonc PROPERTY
  1350. IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/externaldeps/jsonc/libjson-c.a")
  1351. target_include_directories(libnetdata BEFORE PUBLIC "${CMAKE_SOURCE_DIR}/externaldeps/jsonc")
  1352. target_link_libraries(libnetdata PUBLIC jsonc)
  1353. else()
  1354. pkg_check_modules(JSONC REQUIRED json-c)
  1355. target_include_directories(libnetdata BEFORE PUBLIC ${JSONC_INCLUDE_DIRS})
  1356. target_compile_definitions(libnetdata PUBLIC ${JSONC_CFLAGS_OTHER})
  1357. target_link_libraries(libnetdata PUBLIC ${JSONC_LDFLAGS})
  1358. endif()
  1359. # message(FATAL_ERROR "jsonc libraries: ${JSONC_LIBRARIES}")
  1360. # message(FATAL_ERROR "jsonc ldflags: ${JSONC_LDFLAGS}")
  1361. # yaml
  1362. set(HAVE_LIBYAML True)
  1363. if(ENABLE_BUNDLED_YAML)
  1364. add_library(yaml STATIC IMPORTED)
  1365. set_property(TARGET yaml PROPERTY
  1366. IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/externaldeps/libyaml/libyaml.a")
  1367. target_include_directories(libnetdata BEFORE PUBLIC "${CMAKE_SOURCE_DIR}/externaldeps/libyaml")
  1368. target_link_libraries(libnetdata PUBLIC yaml)
  1369. else()
  1370. pkg_check_modules(YAML REQUIRED yaml-0.1)
  1371. target_include_directories(libnetdata BEFORE PUBLIC ${YAML_INCLUDE_DIRS})
  1372. target_compile_definitions(libnetdata PUBLIC ${YAML_CFLAGS_OTHER})
  1373. target_link_libraries(libnetdata PUBLIC ${YAML_LDFLAGS})
  1374. endif()
  1375. # zlib
  1376. pkg_check_modules(ZLIB REQUIRED zlib)
  1377. target_include_directories(libnetdata BEFORE PUBLIC ${ZLIB_INCLUDE_DIRS})
  1378. target_compile_definitions(libnetdata PUBLIC ${ZLIB_CFLAGS_OTHER})
  1379. target_link_libraries(libnetdata PUBLIC ${ZLIB_LDFLAGS})
  1380. # lz4 - try to find a version that is compatible with streaming compression
  1381. # otherwise pick whichever one we can find to support dbengine but don't set
  1382. # ENABLE_LZ4.
  1383. pkg_check_modules(LIBLZ4 liblz4>=1.9.0)
  1384. if(LIBLZ4_FOUND)
  1385. set(ENABLE_LZ4 On)
  1386. else()
  1387. pkg_check_modules(LIBLZ4 REQUIRED liblz4)
  1388. endif()
  1389. target_include_directories(libnetdata BEFORE PUBLIC ${LIBLZ4_INCLUDE_DIRS})
  1390. target_compile_definitions(libnetdata PUBLIC ${LIBLZ4_CFLAGS_OTHER})
  1391. target_link_libraries(libnetdata PUBLIC ${LIBLZ4_LDFLAGS})
  1392. # zstd
  1393. pkg_check_modules(LIBZSTD libzstd)
  1394. if(LIBZSTD_FOUND)
  1395. set(ENABLE_ZSTD On)
  1396. target_include_directories(libnetdata BEFORE PUBLIC ${LIBZSTD_INCLUDE_DIRS})
  1397. target_compile_definitions(libnetdata PUBLIC ${LIBZSTD_CFLAGS_OTHER})
  1398. target_link_libraries(libnetdata PUBLIC ${LIBZSTD_LDFLAGS})
  1399. endif()
  1400. # brotli
  1401. pkg_check_modules(LIBBROTLI libbrotlidec libbrotlienc libbrotlicommon)
  1402. if(LIBBROTLI_FOUND)
  1403. set(ENABLE_BROTLI On)
  1404. target_include_directories(libnetdata BEFORE PUBLIC ${LIBBROTLI_INCLUDE_DIRS})
  1405. target_compile_definitions(libnetdata PUBLIC ${LIBBROTLI_CFLAGS_OTHER})
  1406. target_link_libraries(libnetdata PUBLIC ${LIBBROTLI_LDFLAGS})
  1407. endif()
  1408. # uuid
  1409. pkg_check_modules(UUID REQUIRED uuid)
  1410. target_include_directories(libnetdata BEFORE PUBLIC ${UUID_INCLUDE_DIRS})
  1411. target_compile_definitions(libnetdata PUBLIC ${UUID_CFLAGS_OTHER})
  1412. target_link_libraries(libnetdata PUBLIC ${UUID_LDFLAGS})
  1413. # uv
  1414. pkg_check_modules(LIBUV REQUIRED libuv)
  1415. target_include_directories(libnetdata BEFORE PUBLIC ${LIBUV_INCLUDE_DIRS})
  1416. target_compile_definitions(libnetdata PUBLIC ${LIBUV_CFLAGS_OTHER})
  1417. target_link_libraries(libnetdata PUBLIC ${LIBUV_LDFLAGS})
  1418. # crypto
  1419. target_include_directories(libnetdata BEFORE PUBLIC ${CRYPTO_INCLUDE_DIRS})
  1420. target_compile_options(libnetdata PUBLIC ${CRYPTO_CFLAGS_OTHER})
  1421. target_link_libraries(libnetdata PUBLIC ${CRYPTO_LDFLAGS})
  1422. # openssl
  1423. target_include_directories(libnetdata BEFORE PUBLIC ${OPENSSL_INCLUDE_DIRS})
  1424. target_compile_options(libnetdata PUBLIC ${OPENSSL_CFLAGS_OTHER})
  1425. target_link_libraries(libnetdata PUBLIC ${OPENSSL_LDFLAGS})
  1426. # mnl
  1427. pkg_check_modules(MNL libmnl)
  1428. if(MNL_FOUND)
  1429. set(HAVE_LIBMNL True)
  1430. endif()
  1431. #
  1432. # helper function to build protos
  1433. #
  1434. function(protoc_generate_cpp INC_DIR OUT_DIR SRCS HDRS)
  1435. if(NOT ARGN)
  1436. message(SEND_ERROR "Error: protoc_generate_cpp() called without any proto files")
  1437. return()
  1438. endif()
  1439. set(${INC_DIR})
  1440. set(${OUT_DIR})
  1441. set(${SRCS})
  1442. set(${HDRS})
  1443. foreach(FIL ${ARGN})
  1444. get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
  1445. get_filename_component(DIR ${ABS_FIL} DIRECTORY)
  1446. get_filename_component(FIL_WE ${FIL} NAME_WE)
  1447. set(GENERATED_PB_CC "${DIR}/${FIL_WE}.pb.cc")
  1448. list(APPEND ${SRCS} ${GENERATED_PB_CC})
  1449. set(GENERATED_PB_H "${DIR}/${FIL_WE}.pb.h")
  1450. list(APPEND ${HDRS} ${GENERATED_PB_H})
  1451. add_custom_command(OUTPUT ${GENERATED_PB_CC} ${GENERATED_PB_H}
  1452. COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ARGS -I=${INC_DIR} --cpp_out=${OUT_DIR} ${ABS_FIL}
  1453. DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
  1454. COMMENT "Running C++ protocol buffer compiler on ${FIL}"
  1455. VERBATIM)
  1456. endforeach()
  1457. set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE)
  1458. set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES COMPILE_OPTIONS -Wno-deprecated-declarations)
  1459. set(${SRCS} ${${SRCS}} PARENT_SCOPE)
  1460. set(${HDRS} ${${HDRS}} PARENT_SCOPE)
  1461. endfunction()
  1462. #
  1463. # mqtt library
  1464. #
  1465. if (ENABLE_H2O OR ENABLE_ACLK)
  1466. set(ENABLE_MQTTWEBSOCKETS True)
  1467. endif()
  1468. if(ENABLE_MQTTWEBSOCKETS)
  1469. # include_directories(BEFORE
  1470. # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/src/include
  1471. # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/c-rbuf/include
  1472. # ${CMAKE_SOURCE_DIR}/aclk/mqtt_websockets/c_rhash/include
  1473. # )
  1474. add_library(mqttwebsockets STATIC ${MQTT_WEBSOCKETS_FILES})
  1475. target_compile_options(mqttwebsockets PUBLIC -DMQTT_WSS_CUSTOM_ALLOC
  1476. -DRBUF_CUSTOM_MALLOC
  1477. -DMQTT_WSS_CPUSTATS)
  1478. target_include_directories(mqttwebsockets PUBLIC ${CMAKE_SOURCE_DIR}/aclk/helpers
  1479. ${CMAKE_SOURCE_DIR}/src/web/server/h2o/libh2o/include)
  1480. target_link_libraries(mqttwebsockets PRIVATE libnetdata)
  1481. endif()
  1482. if(ENABLE_ACLK)
  1483. #
  1484. # proto definitions
  1485. #
  1486. protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1487. "${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas"
  1488. ACLK_PROTO_BUILT_SRCS
  1489. ACLK_PROTO_BUILT_HDRS
  1490. ${ACLK_PROTO_DEFS})
  1491. list(APPEND ACLK_FILES ${ACLK_PROTO_BUILT_SRCS}
  1492. ${ACLK_PROTO_BUILT_HDRS})
  1493. endif()
  1494. #
  1495. # build plugins
  1496. #
  1497. if(ENABLE_PLUGIN_DEBUGFS)
  1498. pkg_check_modules(CAP QUIET libcap)
  1499. set(DEBUGFS_PLUGIN_FILES src/collectors/debugfs.plugin/debugfs_plugin.c
  1500. src/collectors/debugfs.plugin/debugfs_plugin.h
  1501. src/collectors/debugfs.plugin/debugfs_extfrag.c
  1502. src/collectors/debugfs.plugin/debugfs_zswap.c
  1503. src/collectors/debugfs.plugin/sys_devices_virtual_powercap.c)
  1504. add_executable(debugfs.plugin ${DEBUGFS_PLUGIN_FILES})
  1505. target_link_libraries(debugfs.plugin libnetdata ${CAP_LIBRARIES})
  1506. target_include_directories(debugfs.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1507. target_compile_options(debugfs.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1508. install(TARGETS debugfs.plugin
  1509. COMPONENT debugfs_plugin
  1510. DESTINATION usr/libexec/netdata/plugins.d)
  1511. endif()
  1512. if(ENABLE_PLUGIN_APPS)
  1513. pkg_check_modules(CAP QUIET libcap)
  1514. set(APPS_PLUGIN_FILES src/collectors/apps.plugin/apps_plugin.c)
  1515. add_executable(apps.plugin ${APPS_PLUGIN_FILES})
  1516. target_link_libraries(apps.plugin libnetdata ${CAP_LIBRARIES})
  1517. target_include_directories(apps.plugin PRIVATE ${CAP_INCLUDE_DIRS})
  1518. target_compile_options(apps.plugin PRIVATE ${CAP_CFLAGS_OTHER})
  1519. install(TARGETS apps.plugin
  1520. COMPONENT apps_plugin
  1521. DESTINATION usr/libexec/netdata/plugins.d)
  1522. install(FILES src/collectors/apps.plugin/apps_groups.conf
  1523. COMPONENT apps_plugin
  1524. DESTINATION usr/lib/netdata/conf.d)
  1525. endif()
  1526. if(CAP_FOUND)
  1527. set(HAVE_CAPABILITY True)
  1528. endif()
  1529. if(ENABLE_PLUGIN_FREEIPMI)
  1530. pkg_check_modules(IPMI REQUIRED libipmimonitoring)
  1531. set(FREEIPMI_PLUGIN_FILES src/collectors/freeipmi.plugin/freeipmi_plugin.c)
  1532. add_executable(freeipmi.plugin ${FREEIPMI_PLUGIN_FILES})
  1533. target_link_libraries (freeipmi.plugin libnetdata ${IPMI_LIBRARIES})
  1534. target_include_directories(freeipmi.plugin PRIVATE ${IPMI_INCLUDE_DIRS})
  1535. target_compile_options(freeipmi.plugin PRIVATE ${IPMI_CFLAGS_OTHER})
  1536. install(TARGETS freeipmi.plugin
  1537. COMPONENT freeipmi_plugin
  1538. DESTINATION usr/libexec/netdata/plugins.d)
  1539. endif()
  1540. if(ENABLE_PLUGIN_NFACCT)
  1541. if (NOT MNL_FOUND)
  1542. message(FATAL_ERROR "Can not build nfacct.plugin because MNL library could not be found.")
  1543. endif()
  1544. pkg_check_modules(NFACCT REQUIRED libnetfilter_acct)
  1545. set(NFACCT_PLUGIN_FILES src/collectors/nfacct.plugin/plugin_nfacct.c)
  1546. add_executable(nfacct.plugin ${NFACCT_PLUGIN_FILES})
  1547. target_link_libraries (nfacct.plugin libnetdata ${MNL_LIBRARIES} ${NFACCT_LIBRARIES})
  1548. target_include_directories(nfacct.plugin PRIVATE ${MNL_INCLUDE_DIRS} ${NFACCT_INCLUDE_DIRS})
  1549. target_compile_options(nfacct.plugin PRIVATE ${MNL_CFLAGS_OTHER} ${NFACCT_CFLAGS_OTHER})
  1550. install(TARGETS nfacct.plugin
  1551. COMPONENT nfacct_plugin
  1552. DESTINATION usr/libexec/netdata/plugins.d)
  1553. endif()
  1554. if(ENABLE_PLUGIN_XENSTAT)
  1555. pkg_check_modules(XENSTAT REQUIRED xenstat)
  1556. pkg_check_modules(XENLIGHT REQUIRED xenlight)
  1557. set(XENSTAT_PLUGIN_FILES src/collectors/xenstat.plugin/xenstat_plugin.c)
  1558. add_executable(xenstat.plugin ${XENSTAT_PLUGIN_FILES})
  1559. target_link_libraries (xenstat.plugin libnetdata ${XENLIGHT_LIBRARIES} ${XENSTAT_LIBRARIES})
  1560. target_include_directories(xenstat.plugin PRIVATE ${XENLIGHT_INCLUDE_DIRS} ${XENSTAT_INCLUDE_DIRS})
  1561. target_compile_options(xenstat.plugin PRIVATE ${XENLIGHT_CFLAGS_OTHER} ${XENSTAT_CFLAGS_OTHER})
  1562. install(TARGETS xenstat.plugin
  1563. COMPONENT xenstat_plugin
  1564. DESTINATION usr/libexec/netdata/plugins.d)
  1565. endif()
  1566. if(ENABLE_PLUGIN_PERF)
  1567. set(PERF_PLUGIN_FILES src/collectors/perf.plugin/perf_plugin.c)
  1568. add_executable(perf.plugin ${PERF_PLUGIN_FILES})
  1569. target_link_libraries(perf.plugin libnetdata)
  1570. install(TARGETS perf.plugin
  1571. COMPONENT perf_plugin
  1572. DESTINATION usr/libexec/netdata/plugins.d)
  1573. endif()
  1574. if(ENABLE_PLUGIN_SLABINFO)
  1575. set(SLABINFO_PLUGIN_FILES src/collectors/slabinfo.plugin/slabinfo.c)
  1576. add_executable(slabinfo.plugin ${SLABINFO_PLUGIN_FILES})
  1577. target_link_libraries(slabinfo.plugin libnetdata)
  1578. install(TARGETS slabinfo.plugin
  1579. COMPONENT slabinfo_plugin
  1580. DESTINATION usr/libexec/netdata/plugins.d)
  1581. endif()
  1582. if(ENABLE_PLUGIN_LOGS_MANAGEMENT)
  1583. set(ENABLE_LOGSMANAGEMENT True)
  1584. if(ENABLE_LOGS_MANAGEMENT_TESTS)
  1585. list(APPEND LOGS_MANAGEMENT_PLUGIN_FILES src/logsmanagement/unit_test/unit_test.c
  1586. src/logsmanagement/unit_test/unit_test.h)
  1587. set(ENABLE_LOGSMANAGEMENT_TESTS True)
  1588. endif()
  1589. add_executable(logs-management.plugin ${LOGS_MANAGEMENT_PLUGIN_FILES})
  1590. target_link_libraries(logs-management.plugin libnetdata)
  1591. install(TARGETS logs-management.plugin
  1592. COMPONENT logs_management_plugin
  1593. DESTINATION usr/libexec/netdata/plugins.d)
  1594. install(DIRECTORY src/logsmanagement/stock_conf/logsmanagement.d
  1595. COMPONENT logs_management_plugin
  1596. DESTINATION usr/lib/netdata/conf.d)
  1597. install(DIRECTORY DESTINATION etc/netdata/logsmanagement.d)
  1598. endif()
  1599. if(ENABLE_PLUGIN_CUPS)
  1600. pkg_check_modules(CUPS libcups)
  1601. if(NOT CUPS_LIBRARIES)
  1602. pkg_check_modules(CUPS cups)
  1603. if(NOT CUPS_LIBRARIES)
  1604. find_program(CUPS_CONFIG cups-config)
  1605. if(CUPS_CONFIG)
  1606. execute_process(COMMAND ${CUPS_CONFIG} --api-version OUTPUT_VARIABLE CUPS_API_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
  1607. if(CUPS_API_VERSION VERSION_LESS "1.7")
  1608. set(CUPS_FOUND False)
  1609. else()
  1610. execute_process(COMMAND ${CUPS_CONFIG} --cflags OUTPUT_VARIABLE CUPS_CFLAGS_OTHER OUTPUT_STRIP_TRAILING_WHITESPACE)
  1611. execute_process(COMMAND ${CUPS_CONFIG} --libs OUTPUT_VARIABLE CUPS_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
  1612. set(CUPS_FOUND True)
  1613. endif()
  1614. endif()
  1615. endif()
  1616. endif()
  1617. if(NOT CUPS_FOUND)
  1618. message(WARNING "Could not find cups cflags and libs.")
  1619. else()
  1620. set(CUPS_PLUGIN_FILES src/collectors/cups.plugin/cups_plugin.c)
  1621. add_executable(cups.plugin ${CUPS_PLUGIN_FILES})
  1622. target_link_libraries (cups.plugin libnetdata ${CUPS_LIBRARIES})
  1623. target_compile_options(cups.plugin PRIVATE ${CUPS_CFLAGS_OTHER})
  1624. install(TARGETS cups.plugin
  1625. COMPONENT cups_plugin
  1626. DESTINATION usr/libexec/netdata/plugins.d)
  1627. endif()
  1628. endif()
  1629. set(NDSUDO_FILES src/collectors/plugins.d/ndsudo.c)
  1630. add_executable(ndsudo ${NDSUDO_FILES})
  1631. install(TARGETS ndsudo
  1632. COMPONENT ndsudo
  1633. DESTINATION usr/libexec/netdata/plugins.d)
  1634. if(ENABLE_PLUGIN_CGROUP_NETWORK)
  1635. set(CGROUP_NETWORK_FILES src/collectors/cgroups.plugin/cgroup-network.c)
  1636. add_executable(cgroup-network ${CGROUP_NETWORK_FILES})
  1637. target_link_libraries(cgroup-network libnetdata)
  1638. install(TARGETS cgroup-network
  1639. COMPONENT cgroup_network_plugin
  1640. DESTINATION usr/libexec/netdata/plugins.d)
  1641. endif()
  1642. if(ENABLE_PLUGIN_SYSTEMD_JOURNAL)
  1643. add_executable(systemd-journal.plugin ${SYSTEMD_JOURNAL_PLUGIN_FILES})
  1644. target_link_libraries(systemd-journal.plugin libnetdata)
  1645. install(TARGETS systemd-journal.plugin
  1646. COMPONENT systemd_journal_plugin
  1647. DESTINATION usr/libexec/netdata/plugins.d)
  1648. endif()
  1649. if(ENABLE_PLUGIN_EBPF)
  1650. set(EBPF_PLUGIN_FILES
  1651. src/collectors/ebpf.plugin/ebpf.c
  1652. src/collectors/ebpf.plugin/ebpf.h
  1653. src/collectors/ebpf.plugin/ebpf_cachestat.c
  1654. src/collectors/ebpf.plugin/ebpf_cachestat.h
  1655. src/collectors/ebpf.plugin/ebpf_dcstat.c
  1656. src/collectors/ebpf.plugin/ebpf_dcstat.h
  1657. src/collectors/ebpf.plugin/ebpf_disk.c
  1658. src/collectors/ebpf.plugin/ebpf_disk.h
  1659. src/collectors/ebpf.plugin/ebpf_fd.c
  1660. src/collectors/ebpf.plugin/ebpf_fd.h
  1661. src/collectors/ebpf.plugin/ebpf_hardirq.c
  1662. src/collectors/ebpf.plugin/ebpf_hardirq.h
  1663. src/collectors/ebpf.plugin/ebpf_mdflush.c
  1664. src/collectors/ebpf.plugin/ebpf_mdflush.h
  1665. src/collectors/ebpf.plugin/ebpf_mount.c
  1666. src/collectors/ebpf.plugin/ebpf_mount.h
  1667. src/collectors/ebpf.plugin/ebpf_filesystem.c
  1668. src/collectors/ebpf.plugin/ebpf_filesystem.h
  1669. src/collectors/ebpf.plugin/ebpf_oomkill.c
  1670. src/collectors/ebpf.plugin/ebpf_oomkill.h
  1671. src/collectors/ebpf.plugin/ebpf_process.c
  1672. src/collectors/ebpf.plugin/ebpf_process.h
  1673. src/collectors/ebpf.plugin/ebpf_shm.c
  1674. src/collectors/ebpf.plugin/ebpf_shm.h
  1675. src/collectors/ebpf.plugin/ebpf_socket.c
  1676. src/collectors/ebpf.plugin/ebpf_socket.h
  1677. src/collectors/ebpf.plugin/ebpf_softirq.c
  1678. src/collectors/ebpf.plugin/ebpf_softirq.h
  1679. src/collectors/ebpf.plugin/ebpf_sync.c
  1680. src/collectors/ebpf.plugin/ebpf_sync.h
  1681. src/collectors/ebpf.plugin/ebpf_swap.c
  1682. src/collectors/ebpf.plugin/ebpf_swap.h
  1683. src/collectors/ebpf.plugin/ebpf_vfs.c
  1684. src/collectors/ebpf.plugin/ebpf_vfs.h
  1685. src/collectors/ebpf.plugin/ebpf_apps.c
  1686. src/collectors/ebpf.plugin/ebpf_apps.h
  1687. src/collectors/ebpf.plugin/ebpf_cgroup.c
  1688. src/collectors/ebpf.plugin/ebpf_cgroup.h
  1689. src/collectors/ebpf.plugin/ebpf_unittest.c
  1690. src/collectors/ebpf.plugin/ebpf_unittest.h
  1691. src/collectors/ebpf.plugin/ebpf_functions.c
  1692. src/collectors/ebpf.plugin/ebpf_functions.h
  1693. )
  1694. add_executable(ebpf.plugin ${EBPF_PLUGIN_FILES})
  1695. target_link_libraries(ebpf.plugin libnetdata)
  1696. install(TARGETS ebpf.plugin
  1697. COMPONENT ebpf_plugin
  1698. DESTINATION usr/libexec/netdata/plugins.d)
  1699. endif()
  1700. if(ENABLE_PLUGIN_LOCAL_LISTENERS)
  1701. set(LOCAL_LISTENERS_FILES
  1702. src/collectors/plugins.d/local_listeners.c
  1703. src/libnetdata/maps/local-sockets.h
  1704. )
  1705. add_executable(local-listeners ${LOCAL_LISTENERS_FILES})
  1706. target_compile_options(local-listeners PRIVATE
  1707. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1708. target_include_directories(local-listeners PRIVATE
  1709. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1710. target_link_libraries(local-listeners libnetdata
  1711. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1712. install(TARGETS local-listeners
  1713. COMPONENT local_listeners
  1714. DESTINATION usr/libexec/netdata/plugins.d)
  1715. endif()
  1716. if(ENABLE_PLUGIN_NETWORK_VIEWER)
  1717. set(NETWORK_VIEWER_FILES
  1718. src/libnetdata/maps/local-sockets.h
  1719. src/libnetdata/maps/system-users.h
  1720. src/collectors/network-viewer.plugin/network-viewer.c
  1721. )
  1722. add_executable(network-viewer.plugin ${NETWORK_VIEWER_FILES})
  1723. target_compile_options(network-viewer.plugin PRIVATE
  1724. "$<$<BOOL:${MNL_FOUND}>:${MNL_CFLAGS_OTHER}>")
  1725. target_include_directories(network-viewer.plugin PRIVATE
  1726. "$<$<BOOL:${MNL_FOUND}>:${MNL_INCLUDE_DIRS}>")
  1727. target_link_libraries(network-viewer.plugin libnetdata
  1728. "$<$<BOOL:${MNL_FOUND}>:${MNL_LIBRARIES}>")
  1729. install(TARGETS network-viewer.plugin
  1730. COMPONENT network_viewer_plugin
  1731. DESTINATION usr/libexec/netdata/plugins.d)
  1732. endif()
  1733. #
  1734. # exporters
  1735. #
  1736. if(ENABLE_EXPORTER_MONGODB)
  1737. pkg_check_modules(MONGOC libmongoc-1.0>=1.7)
  1738. if(MONGOC_FOUND)
  1739. SET(HAVE_MONGOC True)
  1740. else()
  1741. SET(ENABLE_EXPORTER_MONGODB False)
  1742. endif()
  1743. endif()
  1744. if(ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE)
  1745. pkg_check_modules(SNAPPY snappy)
  1746. if (NOT SNAPPY_FOUND)
  1747. if(HAVE_SNAPPY_LIB)
  1748. set(SNAPPY_INCLUDE_DIRS "")
  1749. set(SNAPPY_CFLAGS_OTHER "")
  1750. set(SNAPPY_LIBRARIES "-lsnappy")
  1751. else()
  1752. message(FATAL_ERROR "Could not find snappy libraries with pkg-config or internal cmake checks.")
  1753. endif()
  1754. endif()
  1755. protoc_generate_cpp("${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  1756. "${CMAKE_SOURCE_DIR}/src/exporting/prometheus/remote_write"
  1757. PROMETHEUS_REMOTE_WRITE_BUILT_SRCS
  1758. PROMETHEUS_REMOTE_WRITE_BUILT_HDRS
  1759. "src/exporting/prometheus/remote_write/remote_write.proto")
  1760. list(APPEND PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES
  1761. ${PROMETHEUS_REMOTE_WRITE_BUILT_SRCS}
  1762. ${PROMETHEUS_REMOTE_WRITE_BUILT_HDRS})
  1763. set(ENABLE_PROMETHEUS_REMOTE_WRITE True)
  1764. endif()
  1765. #
  1766. # build netdata (only Linux ATM)
  1767. #
  1768. add_executable(netdata
  1769. ${NETDATA_FILES}
  1770. "$<$<BOOL:${ENABLE_ACLK}>:${ACLK_FILES}>"
  1771. "$<$<BOOL:${ENABLE_H2O}>:${H2O_FILES}>"
  1772. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGODB_EXPORTING_FILES}>"
  1773. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${PROMETHEUS_REMOTE_WRITE_EXPORTING_FILES}>"
  1774. )
  1775. target_compile_definitions(netdata PRIVATE
  1776. "$<$<BOOL:${ENABLE_PROTOBUF}>:${PROTOBUF_CFLAGS_OTHER}>"
  1777. "$<$<BOOL:${ENABLE_ML}>:DLIB_NO_GUI_SUPPORT>"
  1778. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_CFLAGS_OTHER}>"
  1779. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_CFLAGS_OTHER}>"
  1780. )
  1781. target_include_directories(netdata PRIVATE
  1782. "$<$<BOOL:${ENABLE_PROTOBUF}>:${PROTOBUF_INCLUDE_DIRS}>"
  1783. "$<$<BOOL:${ENABLE_ACLK}>:${CMAKE_SOURCE_DIR}/src/aclk/aclk-schemas>"
  1784. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_INCLUDE_DIRS}>"
  1785. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_INCLUDE_DIRS}>"
  1786. )
  1787. target_link_libraries(netdata PRIVATE
  1788. m
  1789. libnetdata
  1790. "$<$<BOOL:${LINUX}>:rt>"
  1791. "$<$<BOOL:${ENABLE_MQTTWEBSOCKETS}>:mqttwebsockets>"
  1792. "$<$<BOOL:${ENABLE_PROTOBUF}>:${PROTOBUF_LIBRARIES}>"
  1793. "$<$<BOOL:${ENABLE_EXPORTER_MONGODB}>:${MONGOC_LIBRARIES}>"
  1794. "$<$<BOOL:${ENABLE_EXPORTER_PROMETHEUS_REMOTE_WRITE}>:${SNAPPY_LIBRARIES}>"
  1795. "$<$<BOOL:${MACOS}>:${IOKIT};${FOUNDATION}>"
  1796. "$<$<BOOL:${ENABLE_SENTRY}>:sentry>"
  1797. "$<$<BOOL:${ENABLE_WEBRTC}>:LibDataChannel::LibDataChannelStatic>"
  1798. "$<$<BOOL:${ENABLE_H2O}>:h2o>"
  1799. )
  1800. #
  1801. # build systemd-cat-native
  1802. #
  1803. set(SYSTEMD_CAT_NATIVE_FILES src/libnetdata/log/systemd-cat-native.c
  1804. src/libnetdata/log/systemd-cat-native.h)
  1805. add_executable(systemd-cat-native ${SYSTEMD_CAT_NATIVE_FILES})
  1806. target_link_libraries(systemd-cat-native libnetdata)
  1807. install(TARGETS systemd-cat-native
  1808. COMPONENT systemd-cat-native
  1809. DESTINATION usr/sbin)
  1810. #
  1811. # build log2journal
  1812. #
  1813. pkg_check_modules(PCRE2 libpcre2-8)
  1814. if(PCRE2_FOUND)
  1815. set(LOG2JOURNAL_FILES
  1816. ${CONFIG_H}
  1817. src/collectors/log2journal/log2journal.h
  1818. src/collectors/log2journal/log2journal.c
  1819. src/collectors/log2journal/log2journal-help.c
  1820. src/collectors/log2journal/log2journal-yaml.c
  1821. src/collectors/log2journal/log2journal-json.c
  1822. src/collectors/log2journal/log2journal-logfmt.c
  1823. src/collectors/log2journal/log2journal-pcre2.c
  1824. src/collectors/log2journal/log2journal-params.c
  1825. src/collectors/log2journal/log2journal-inject.c
  1826. src/collectors/log2journal/log2journal-pattern.c
  1827. src/collectors/log2journal/log2journal-replace.c
  1828. src/collectors/log2journal/log2journal-rename.c
  1829. src/collectors/log2journal/log2journal-rewrite.c
  1830. )
  1831. add_executable(log2journal ${LOG2JOURNAL_FILES})
  1832. target_include_directories(log2journal BEFORE PUBLIC ${CONFIG_H_DIR} ${CMAKE_SOURCE_DIR}/src ${PCRE2_INCLUDE_DIRS})
  1833. target_compile_definitions(log2journal PUBLIC ${PCRE2_CFLAGS_OTHER})
  1834. target_link_libraries(log2journal PUBLIC "${PCRE2_LDFLAGS}")
  1835. if(ENABLE_BUNDLED_YAML)
  1836. target_include_directories(log2journal BEFORE PUBLIC "${CMAKE_SOURCE_DIR}/externaldeps/libyaml")
  1837. target_link_libraries(log2journal PUBLIC yaml)
  1838. else()
  1839. target_include_directories(log2journal BEFORE PUBLIC ${YAML_INCLUDE_DIRS})
  1840. target_compile_definitions(log2journal PUBLIC ${YAML_CFLAGS_OTHER})
  1841. target_link_libraries(log2journal PUBLIC ${YAML_LDFLAGS})
  1842. endif()
  1843. install(TARGETS log2journal
  1844. COMPONENT log2journal
  1845. DESTINATION usr/sbin)
  1846. install(DIRECTORY src/collectors/log2journal/log2journal.d
  1847. COMPONENT log2journal
  1848. DESTINATION usr/lib/netdata/conf.d)
  1849. endif()
  1850. #
  1851. # build netdatacli
  1852. #
  1853. set(NETDATACLI_FILES
  1854. src/daemon/commands.h
  1855. src/daemon/pipename.c
  1856. src/daemon/pipename.h
  1857. src/cli/cli.c
  1858. )
  1859. add_executable(netdatacli ${NETDATACLI_FILES})
  1860. target_link_libraries(netdatacli libnetdata)
  1861. install(TARGETS netdatacli
  1862. COMPONENT netdatacli
  1863. DESTINATION usr/sbin)
  1864. #
  1865. # Generate config file
  1866. #
  1867. if(NOT CMAKE_INSTALL_PREFIX STREQUAL "")
  1868. string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
  1869. endif()
  1870. set(CACHE_DIR "${CMAKE_INSTALL_PREFIX}/var/cache/netdata")
  1871. set(CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/etc/netdata")
  1872. set(LIBCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/conf.d")
  1873. set(LOG_DIR "${CMAKE_INSTALL_PREFIX}/var/log/netdata")
  1874. set(PLUGINS_DIR "${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata/plugins.d")
  1875. set(VARLIB_DIR "${CMAKE_INSTALL_PREFIX}/var/lib/netdata")
  1876. # A non-default value is only used when building Debian packages (/var/lib/netdata/www)
  1877. if(NOT DEFINED WEB_DIR)
  1878. set(WEB_DIR "usr/share/netdata/web")
  1879. else()
  1880. string(REGEX REPLACE "^/" "" WEB_DIR "${WEB_DIR}")
  1881. endif()
  1882. set(WEB_DEST "${WEB_DIR}")
  1883. set(WEB_DIR "${CMAKE_INSTALL_PREFIX}/${WEB_DEST}")
  1884. set(CONFIGURE_COMMAND "dummy-configure-command")
  1885. if (NOT NETDATA_USER)
  1886. set(NETDATA_USER "netdata")
  1887. endif()
  1888. set(VERSION "${GIT_DESCRIBE_OUTPUT}")
  1889. configure_file(packaging/cmake/config.cmake.h.in config.h)
  1890. #
  1891. # install
  1892. #
  1893. install(TARGETS netdata DESTINATION usr/sbin)
  1894. install(DIRECTORY DESTINATION var/cache/netdata)
  1895. install(DIRECTORY DESTINATION var/log/netdata)
  1896. install(DIRECTORY DESTINATION var/lib/netdata/registry)
  1897. install(DIRECTORY DESTINATION var/lib/netdata/cloud.d)
  1898. install(DIRECTORY DESTINATION var/run)
  1899. install(DIRECTORY DESTINATION etc/netdata)
  1900. install(DIRECTORY DESTINATION etc/netdata/charts.d)
  1901. install(DIRECTORY DESTINATION etc/netdata/custom-plugins.d)
  1902. install(DIRECTORY DESTINATION etc/netdata/ebpf.d)
  1903. install(DIRECTORY DESTINATION etc/netdata/go.d)
  1904. install(DIRECTORY DESTINATION etc/netdata/health.d)
  1905. install(DIRECTORY DESTINATION etc/netdata/python.d)
  1906. install(DIRECTORY DESTINATION etc/netdata/ssl)
  1907. install(DIRECTORY DESTINATION etc/netdata/statsd.d)
  1908. install(DIRECTORY DESTINATION usr/lib/netdata/conf.d)
  1909. install(DIRECTORY DESTINATION usr/lib/netdata/conf.d/schema.d)
  1910. install(DIRECTORY DESTINATION usr/libexec/netdata/plugins.d)
  1911. install(DIRECTORY DESTINATION ${WEB_DEST})
  1912. set(libsysdir_POST "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/system")
  1913. set(pkglibexecdir_POST "${CMAKE_INSTALL_PREFIX}/usr/libexec/netdata")
  1914. set(localstatedir_POST "${CMAKE_INSTALL_PREFIX}/var")
  1915. set(sbindir_POST "${CMAKE_INSTALL_PREFIX}/usr/sbin")
  1916. set(configdir_POST "${CMAKE_INSTALL_PREFIX}/etc/netdata")
  1917. set(libconfigdir_POST "${CMAKE_INSTALL_PREFIX}/usr/lib/netdata/conf.d")
  1918. set(cachedir_POST "${CMAKE_INSTALL_PREFIX}/var/cache/netdata")
  1919. set(registrydir_POST "${CMAKE_INSTALL_PREFIX}/var/lib/netdata/registry")
  1920. set(varlibdir_POST "${CMAKE_INSTALL_PREFIX}/var/lib/netdata")
  1921. set(netdata_user_POST "${NETDATA_USER}")
  1922. # netdata-claim.sh
  1923. if(ENABLE_CLOUD)
  1924. set(enable_cloud_POST "yes")
  1925. else()
  1926. set(enable_cloud_POST "no")
  1927. endif()
  1928. if(ENABLE_ACLK)
  1929. set(enable_aclk_POST "yes")
  1930. else()
  1931. set(enable_aclk_POST "no")
  1932. endif()
  1933. configure_file(src/claim/netdata-claim.sh.in src/claim/netdata-claim.sh @ONLY)
  1934. install(PROGRAMS
  1935. ${CMAKE_BINARY_DIR}/src/claim/netdata-claim.sh
  1936. DESTINATION usr/sbin)
  1937. #
  1938. # We don't check ENABLE_PLUGIN_CGROUP_NETWORK because rpm builds assume
  1939. # the files exists unconditionally.
  1940. #
  1941. configure_file(src/collectors/cgroups.plugin/cgroup-network-helper.sh.in
  1942. src/collectors/cgroups.plugin/cgroup-network-helper.sh @ONLY)
  1943. install(PROGRAMS
  1944. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-network-helper.sh
  1945. COMPONENT cgroup_network_plugin
  1946. DESTINATION usr/libexec/netdata/plugins.d)
  1947. configure_file(src/collectors/cgroups.plugin/cgroup-name.sh.in
  1948. src/collectors/cgroups.plugin/cgroup-name.sh @ONLY)
  1949. install(PROGRAMS
  1950. ${CMAKE_BINARY_DIR}/src/collectors/cgroups.plugin/cgroup-name.sh
  1951. DESTINATION usr/libexec/netdata/plugins.d)
  1952. #
  1953. # statsd
  1954. #
  1955. install(FILES
  1956. src/collectors/statsd.plugin/asterisk.conf
  1957. src/collectors/statsd.plugin/example.conf
  1958. src/collectors/statsd.plugin/k6.conf
  1959. DESTINATION usr/lib/netdata/conf.d/statsd.d)
  1960. #
  1961. # exporting
  1962. #
  1963. install(FILES
  1964. src/exporting/exporting.conf
  1965. DESTINATION usr/lib/netdata/conf.d)
  1966. #
  1967. # ioping.plugin
  1968. #
  1969. install(FILES
  1970. src/collectors/ioping.plugin/ioping.conf
  1971. DESTINATION usr/lib/netdata/conf.d)
  1972. #
  1973. # streaming
  1974. #
  1975. install(FILES
  1976. src/streaming/stream.conf
  1977. DESTINATION usr/lib/netdata/conf.d)
  1978. #
  1979. # swagger
  1980. #
  1981. install(FILES
  1982. src/web/api/netdata-swagger.json
  1983. src/web/api/netdata-swagger.yaml
  1984. DESTINATION ${WEB_DEST})
  1985. #
  1986. # service files
  1987. #
  1988. configure_file(system/install-service.sh.in system/install-service.sh @ONLY)
  1989. install(PROGRAMS
  1990. ${CMAKE_BINARY_DIR}/system/install-service.sh
  1991. DESTINATION usr/libexec/netdata)
  1992. configure_file(system/cron/netdata-updater-daily.in system/cron/netdata-updater-daily @ONLY)
  1993. install(FILES
  1994. ${CMAKE_BINARY_DIR}/system/cron/netdata-updater-daily
  1995. DESTINATION usr/lib/netdata/system/cron)
  1996. configure_file(system/launchd/netdata.plist.in system/launchd/netdata.plist @ONLY)
  1997. install(FILES
  1998. ${CMAKE_BINARY_DIR}/system/launchd/netdata.plist
  1999. DESTINATION usr/lib/netdata/system/launchd)
  2000. configure_file(system/freebsd/rc.d/netdata.in system/freebsd/rc.d/netdata @ONLY)
  2001. install(PROGRAMS
  2002. ${CMAKE_BINARY_DIR}/system/freebsd/rc.d/netdata
  2003. DESTINATION usr/lib/netdata/system/freebsd/rc.d)
  2004. configure_file(system/initd/init.d/netdata.in system/initd/init.d/netdata @ONLY)
  2005. install(PROGRAMS
  2006. ${CMAKE_BINARY_DIR}/system/initd/init.d/netdata
  2007. DESTINATION usr/lib/netdata/system/initd/init.d)
  2008. configure_file(system/logrotate/netdata.in system/logrotate/netdata @ONLY)
  2009. install(FILES
  2010. ${CMAKE_BINARY_DIR}/system/logrotate/netdata
  2011. DESTINATION usr/lib/netdata/system/logrotate)
  2012. configure_file(system/lsb/init.d/netdata.in system/lsb/init.d/netdata @ONLY)
  2013. install(PROGRAMS
  2014. ${CMAKE_BINARY_DIR}/system/lsb/init.d/netdata
  2015. DESTINATION usr/lib/netdata/system/lsb/init.d)
  2016. configure_file(system/openrc/conf.d/netdata.in system/openrc/conf.d/netdata @ONLY)
  2017. install(FILES
  2018. ${CMAKE_BINARY_DIR}/system/openrc/conf.d/netdata
  2019. DESTINATION usr/lib/netdata/system/openrc/conf.d)
  2020. configure_file(system/openrc/init.d/netdata.in system/openrc/init.d/netdata @ONLY)
  2021. install(PROGRAMS
  2022. ${CMAKE_BINARY_DIR}/system/openrc/init.d/netdata
  2023. DESTINATION usr/lib/netdata/system/openrc/init.d)
  2024. configure_file(system/runit/run.in system/runit/run @ONLY)
  2025. install(PROGRAMS
  2026. ${CMAKE_BINARY_DIR}/system/runit/run
  2027. DESTINATION usr/lib/netdata/system/runit)
  2028. configure_file(system/systemd/netdata.service.in system/systemd/netdata.service @ONLY)
  2029. install(FILES
  2030. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service
  2031. DESTINATION usr/lib/netdata/system/systemd)
  2032. configure_file(system/systemd/netdata.service.v235.in system/systemd/netdata.service.v235 @ONLY)
  2033. install(FILES
  2034. ${CMAKE_BINARY_DIR}/system/systemd/netdata.service.v235
  2035. DESTINATION usr/lib/netdata/system/systemd)
  2036. configure_file(system/systemd/netdata-updater.service.in system/systemd/netdata-updater.service @ONLY)
  2037. install(FILES
  2038. ${CMAKE_BINARY_DIR}/system/systemd/netdata-updater.service
  2039. DESTINATION usr/lib/netdata/system/systemd)
  2040. install(FILES
  2041. system/systemd/netdata-updater.timer
  2042. DESTINATION usr/lib/netdata/system/systemd)
  2043. install(FILES
  2044. system/systemd/50-netdata.preset
  2045. DESTINATION usr/lib/netdata/system/systemd)
  2046. install(FILES
  2047. system/vnodes/vnodes.conf
  2048. DESTINATION usr/lib/netdata/conf.d/vnodes)
  2049. install(FILES
  2050. system/.install-type
  2051. DESTINATION etc/netdata)
  2052. install(FILES
  2053. system/netdata-updater.conf
  2054. DESTINATION etc/netdata)
  2055. install(PROGRAMS
  2056. system/edit-config
  2057. DESTINATION etc/netdata)
  2058. #
  2059. # TODO: check the following files for correct substitutions
  2060. #
  2061. configure_file(src/daemon/anonymous-statistics.sh.in src/daemon/anonymous-statistics.sh @ONLY)
  2062. install(PROGRAMS
  2063. ${CMAKE_BINARY_DIR}/src/daemon/anonymous-statistics.sh
  2064. DESTINATION usr/libexec/netdata/plugins.d)
  2065. configure_file(src/daemon/get-kubernetes-labels.sh.in src/daemon/get-kubernetes-labels.sh @ONLY)
  2066. install(PROGRAMS
  2067. ${CMAKE_BINARY_DIR}/src/daemon/get-kubernetes-labels.sh
  2068. DESTINATION usr/libexec/netdata/plugins.d)
  2069. install(PROGRAMS
  2070. src/daemon/system-info.sh
  2071. DESTINATION usr/libexec/netdata/plugins.d)
  2072. #
  2073. # health files
  2074. #
  2075. file(GLOB_RECURSE HEALTH_CONF_FILES "src/health/health.d/*.conf")
  2076. install(FILES
  2077. ${HEALTH_CONF_FILES}
  2078. DESTINATION usr/lib/netdata/conf.d/health.d)
  2079. configure_file(src/health/notifications/alarm-notify.sh.in src/health/notifications/alarm-notify.sh @ONLY)
  2080. install(PROGRAMS
  2081. ${CMAKE_BINARY_DIR}/src/health/notifications/alarm-notify.sh
  2082. DESTINATION usr/libexec/netdata/plugins.d)
  2083. install(PROGRAMS
  2084. src/health/notifications/alarm-email.sh
  2085. src/health/notifications/alarm-test.sh
  2086. DESTINATION usr/libexec/netdata/plugins.d)
  2087. install(FILES
  2088. src/health/notifications/health_alarm_notify.conf
  2089. src/health/notifications/health_email_recipients.conf
  2090. DESTINATION usr/lib/netdata/conf.d)
  2091. #
  2092. # test/ files
  2093. #
  2094. configure_file(tests/health_mgmtapi/health-cmdapi-test.sh.in tests/health_mgmtapi/health-cmdapi-test.sh @ONLY)
  2095. configure_file(tests/acls/acl.sh.in tests/acls/acl.sh @ONLY)
  2096. configure_file(tests/urls/request.sh.in tests/urls/request.sh @ONLY)
  2097. configure_file(tests/alarm_repetition/alarm.sh.in tests/alarm_repetition/alarm.sh @ONLY)
  2098. configure_file(tests/template_dimension/template_dim.sh.in tests/template_dimension/template_dim.sh @ONLY)
  2099. configure_file(tests/ebpf/ebpf_thread_function.sh.in tests/ebpf/ebpf_thread_function.sh @ONLY)
  2100. install(FILES
  2101. ${CMAKE_BINARY_DIR}/tests/health_mgmtapi/health-cmdapi-test.sh
  2102. ${CMAKE_BINARY_DIR}/tests/acls/acl.sh
  2103. ${CMAKE_BINARY_DIR}/tests/urls/request.sh
  2104. ${CMAKE_BINARY_DIR}/tests/alarm_repetition/alarm.sh
  2105. ${CMAKE_BINARY_DIR}/tests/template_dimension/template_dim.sh
  2106. ${CMAKE_BINARY_DIR}/tests/ebpf/ebpf_thread_function.sh
  2107. DESTINATION usr/libexec/netdata/plugins.d)
  2108. #
  2109. # charts.d files
  2110. #
  2111. configure_file(src/collectors/charts.d.plugin/charts.d.plugin.in src/collectors/charts.d.plugin/charts.d.plugin @ONLY)
  2112. install(PROGRAMS
  2113. ${CMAKE_BINARY_DIR}/src/collectors/charts.d.plugin/charts.d.plugin
  2114. DESTINATION usr/libexec/netdata/plugins.d)
  2115. install(FILES
  2116. src/collectors/charts.d.plugin/charts.d.dryrun-helper.sh
  2117. src/collectors/charts.d.plugin/loopsleepms.sh.inc
  2118. DESTINATION usr/libexec/netdata/plugins.d)
  2119. install(FILES
  2120. src/collectors/charts.d.plugin/charts.d.conf
  2121. DESTINATION usr/lib/netdata/conf.d)
  2122. #
  2123. # tc-qos-helper
  2124. #
  2125. configure_file(src/collectors/tc.plugin/tc-qos-helper.sh.in src/collectors/tc.plugin/tc-qos-helper.sh @ONLY)
  2126. install(PROGRAMS
  2127. ${CMAKE_BINARY_DIR}/src/collectors/tc.plugin/tc-qos-helper.sh
  2128. DESTINATION usr/libexec/netdata/plugins.d)
  2129. # scripts
  2130. install(FILES
  2131. src/collectors/charts.d.plugin/ap/ap.chart.sh
  2132. src/collectors/charts.d.plugin/apcupsd/apcupsd.chart.sh
  2133. src/collectors/charts.d.plugin/example/example.chart.sh
  2134. src/collectors/charts.d.plugin/libreswan/libreswan.chart.sh
  2135. src/collectors/charts.d.plugin/opensips/opensips.chart.sh
  2136. src/collectors/charts.d.plugin/sensors/sensors.chart.sh
  2137. DESTINATION usr/libexec/netdata/charts.d)
  2138. # confs
  2139. install(FILES
  2140. src/collectors/charts.d.plugin/ap/ap.conf
  2141. src/collectors/charts.d.plugin/apcupsd/apcupsd.conf
  2142. src/collectors/charts.d.plugin/example/example.conf
  2143. src/collectors/charts.d.plugin/libreswan/libreswan.conf
  2144. src/collectors/charts.d.plugin/opensips/opensips.conf
  2145. src/collectors/charts.d.plugin/sensors/sensors.conf
  2146. DESTINATION usr/lib/netdata/conf.d/charts.d)
  2147. install(FILES
  2148. src/collectors/systemd-journal.plugin/schema.d/systemd-journal:monitored-directories.json
  2149. src/health/schema.d/health:alert:prototype.json
  2150. DESTINATION usr/lib/netdata/conf.d/schema.d)
  2151. #
  2152. # ebpf files
  2153. #
  2154. if(ENABLE_PLUGIN_EBPF)
  2155. install(FILES
  2156. src/collectors/ebpf.plugin/ebpf.d.conf
  2157. DESTINATION usr/lib/netdata/conf.d)
  2158. install(FILES
  2159. src/collectors/ebpf.plugin/ebpf.d/cachestat.conf
  2160. src/collectors/ebpf.plugin/ebpf.d/dcstat.conf
  2161. src/collectors/ebpf.plugin/ebpf.d/disk.conf
  2162. src/collectors/ebpf.plugin/ebpf.d/ebpf_kernel_reject_list.txt
  2163. src/collectors/ebpf.plugin/ebpf.d/fd.conf
  2164. src/collectors/ebpf.plugin/ebpf.d/filesystem.conf
  2165. src/collectors/ebpf.plugin/ebpf.d/hardirq.conf
  2166. src/collectors/ebpf.plugin/ebpf.d/mdflush.conf
  2167. src/collectors/ebpf.plugin/ebpf.d/mount.conf
  2168. src/collectors/ebpf.plugin/ebpf.d/network.conf
  2169. src/collectors/ebpf.plugin/ebpf.d/oomkill.conf
  2170. src/collectors/ebpf.plugin/ebpf.d/process.conf
  2171. src/collectors/ebpf.plugin/ebpf.d/shm.conf
  2172. src/collectors/ebpf.plugin/ebpf.d/softirq.conf
  2173. src/collectors/ebpf.plugin/ebpf.d/swap.conf
  2174. src/collectors/ebpf.plugin/ebpf.d/sync.conf
  2175. src/collectors/ebpf.plugin/ebpf.d/vfs.conf
  2176. DESTINATION usr/lib/netdata/conf.d/ebpf.d)
  2177. endif()
  2178. #
  2179. # python.d files
  2180. #
  2181. configure_file(src/collectors/python.d.plugin/python.d.plugin.in src/collectors/python.d.plugin/python.d.plugin @ONLY)
  2182. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/python.d.plugin/python.d.plugin
  2183. DESTINATION usr/libexec/netdata/plugins.d)
  2184. install(DIRECTORY src/collectors/python.d.plugin/python_modules
  2185. DESTINATION usr/libexec/netdata/python.d)
  2186. install(FILES src/collectors/python.d.plugin/python.d.conf
  2187. DESTINATION usr/lib/netdata/conf.d)
  2188. # conf files
  2189. install(FILES
  2190. src/collectors/python.d.plugin/adaptec_raid/adaptec_raid.conf
  2191. src/collectors/python.d.plugin/alarms/alarms.conf
  2192. src/collectors/python.d.plugin/am2320/am2320.conf
  2193. src/collectors/python.d.plugin/anomalies/anomalies.conf
  2194. src/collectors/python.d.plugin/beanstalk/beanstalk.conf
  2195. src/collectors/python.d.plugin/bind_rndc/bind_rndc.conf
  2196. src/collectors/python.d.plugin/boinc/boinc.conf
  2197. src/collectors/python.d.plugin/ceph/ceph.conf
  2198. src/collectors/python.d.plugin/changefinder/changefinder.conf
  2199. src/collectors/python.d.plugin/dovecot/dovecot.conf
  2200. src/collectors/python.d.plugin/example/example.conf
  2201. src/collectors/python.d.plugin/exim/exim.conf
  2202. src/collectors/python.d.plugin/fail2ban/fail2ban.conf
  2203. src/collectors/python.d.plugin/gearman/gearman.conf
  2204. src/collectors/python.d.plugin/go_expvar/go_expvar.conf
  2205. src/collectors/python.d.plugin/haproxy/haproxy.conf
  2206. src/collectors/python.d.plugin/hddtemp/hddtemp.conf
  2207. src/collectors/python.d.plugin/hpssa/hpssa.conf
  2208. src/collectors/python.d.plugin/icecast/icecast.conf
  2209. src/collectors/python.d.plugin/ipfs/ipfs.conf
  2210. src/collectors/python.d.plugin/litespeed/litespeed.conf
  2211. src/collectors/python.d.plugin/megacli/megacli.conf
  2212. src/collectors/python.d.plugin/memcached/memcached.conf
  2213. src/collectors/python.d.plugin/monit/monit.conf
  2214. src/collectors/python.d.plugin/nsd/nsd.conf
  2215. src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.conf
  2216. src/collectors/python.d.plugin/openldap/openldap.conf
  2217. src/collectors/python.d.plugin/oracledb/oracledb.conf
  2218. src/collectors/python.d.plugin/pandas/pandas.conf
  2219. src/collectors/python.d.plugin/postfix/postfix.conf
  2220. src/collectors/python.d.plugin/puppet/puppet.conf
  2221. src/collectors/python.d.plugin/rethinkdbs/rethinkdbs.conf
  2222. src/collectors/python.d.plugin/retroshare/retroshare.conf
  2223. src/collectors/python.d.plugin/riakkv/riakkv.conf
  2224. src/collectors/python.d.plugin/samba/samba.conf
  2225. src/collectors/python.d.plugin/sensors/sensors.conf
  2226. src/collectors/python.d.plugin/smartd_log/smartd_log.conf
  2227. src/collectors/python.d.plugin/spigotmc/spigotmc.conf
  2228. src/collectors/python.d.plugin/squid/squid.conf
  2229. src/collectors/python.d.plugin/tomcat/tomcat.conf
  2230. src/collectors/python.d.plugin/tor/tor.conf
  2231. src/collectors/python.d.plugin/traefik/traefik.conf
  2232. src/collectors/python.d.plugin/uwsgi/uwsgi.conf
  2233. src/collectors/python.d.plugin/varnish/varnish.conf
  2234. src/collectors/python.d.plugin/w1sensor/w1sensor.conf
  2235. src/collectors/python.d.plugin/zscores/zscores.conf
  2236. DESTINATION usr/lib/netdata/conf.d/python.d)
  2237. # scripts
  2238. install(FILES
  2239. src/collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
  2240. src/collectors/python.d.plugin/alarms/alarms.chart.py
  2241. src/collectors/python.d.plugin/am2320/am2320.chart.py
  2242. src/collectors/python.d.plugin/anomalies/anomalies.chart.py
  2243. src/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
  2244. src/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
  2245. src/collectors/python.d.plugin/boinc/boinc.chart.py
  2246. src/collectors/python.d.plugin/ceph/ceph.chart.py
  2247. src/collectors/python.d.plugin/changefinder/changefinder.chart.py
  2248. src/collectors/python.d.plugin/dovecot/dovecot.chart.py
  2249. src/collectors/python.d.plugin/example/example.chart.py
  2250. src/collectors/python.d.plugin/exim/exim.chart.py
  2251. src/collectors/python.d.plugin/fail2ban/fail2ban.chart.py
  2252. src/collectors/python.d.plugin/gearman/gearman.chart.py
  2253. src/collectors/python.d.plugin/go_expvar/go_expvar.chart.py
  2254. src/collectors/python.d.plugin/haproxy/haproxy.chart.py
  2255. src/collectors/python.d.plugin/hddtemp/hddtemp.chart.py
  2256. src/collectors/python.d.plugin/hpssa/hpssa.chart.py
  2257. src/collectors/python.d.plugin/icecast/icecast.chart.py
  2258. src/collectors/python.d.plugin/ipfs/ipfs.chart.py
  2259. src/collectors/python.d.plugin/litespeed/litespeed.chart.py
  2260. src/collectors/python.d.plugin/megacli/megacli.chart.py
  2261. src/collectors/python.d.plugin/memcached/memcached.chart.py
  2262. src/collectors/python.d.plugin/monit/monit.chart.py
  2263. src/collectors/python.d.plugin/nsd/nsd.chart.py
  2264. src/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py
  2265. src/collectors/python.d.plugin/openldap/openldap.chart.py
  2266. src/collectors/python.d.plugin/oracledb/oracledb.chart.py
  2267. src/collectors/python.d.plugin/pandas/pandas.chart.py
  2268. src/collectors/python.d.plugin/postfix/postfix.chart.py
  2269. src/collectors/python.d.plugin/puppet/puppet.chart.py
  2270. src/collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py
  2271. src/collectors/python.d.plugin/retroshare/retroshare.chart.py
  2272. src/collectors/python.d.plugin/riakkv/riakkv.chart.py
  2273. src/collectors/python.d.plugin/samba/samba.chart.py
  2274. src/collectors/python.d.plugin/sensors/sensors.chart.py
  2275. src/collectors/python.d.plugin/smartd_log/smartd_log.chart.py
  2276. src/collectors/python.d.plugin/spigotmc/spigotmc.chart.py
  2277. src/collectors/python.d.plugin/squid/squid.chart.py
  2278. src/collectors/python.d.plugin/tomcat/tomcat.chart.py
  2279. src/collectors/python.d.plugin/tor/tor.chart.py
  2280. src/collectors/python.d.plugin/traefik/traefik.chart.py
  2281. src/collectors/python.d.plugin/uwsgi/uwsgi.chart.py
  2282. src/collectors/python.d.plugin/varnish/varnish.chart.py
  2283. src/collectors/python.d.plugin/w1sensor/w1sensor.chart.py
  2284. src/collectors/python.d.plugin/zscores/zscores.chart.py
  2285. DESTINATION usr/libexec/netdata/python.d)
  2286. # FIXME: don't install this unconditionally
  2287. configure_file(src/collectors/ioping.plugin/ioping.plugin.in src/collectors/ioping.plugin/ioping.plugin @ONLY)
  2288. install(PROGRAMS ${CMAKE_BINARY_DIR}/src/collectors/ioping.plugin/ioping.plugin DESTINATION usr/libexec/netdata/plugins.d)
  2289. #
  2290. # logs management
  2291. #
  2292. if (ENABLE_PLUGIN_LOGS_MANAGEMENT)
  2293. configure_file(src/logsmanagement/stock_conf/logsmanagement.d.conf.in src/logsmanagement/stock_conf/logsmanagement.d.conf @ONLY)
  2294. install(FILES ${CMAKE_BINARY_DIR}/src/logsmanagement/stock_conf/logsmanagement.d.conf
  2295. COMPONENT logs_management_plugin
  2296. DESTINATION usr/lib/netdata/conf.d)
  2297. endif()
  2298. #
  2299. # dashboard
  2300. #
  2301. include(src/web/gui/v1/dashboard_v1.cmake)
  2302. include(src/web/gui/v2/dashboard_v2.cmake)
  2303. include(src/web/gui/gui.cmake)
  2304. function(cat IN_FILE OUT_FILE)
  2305. file(READ ${IN_FILE} CONTENTS)
  2306. file(APPEND ${OUT_FILE} "${CONTENTS}")
  2307. endfunction()
  2308. file(WRITE ${CMAKE_BINARY_DIR}/src/web/gui/dashboard.js.in "")
  2309. foreach(JS_FILE ${DASHBOARD_JS_FILES})
  2310. cat(${JS_FILE} ${CMAKE_BINARY_DIR}/dashboard.js.in)
  2311. endforeach()
  2312. configure_file(${CMAKE_BINARY_DIR}/dashboard.js.in
  2313. ${CMAKE_BINARY_DIR}/dashboard.js COPYONLY)
  2314. install(FILES
  2315. ${CMAKE_BINARY_DIR}/dashboard.js
  2316. DESTINATION ${WEB_DEST})
  2317. install(FILES
  2318. src/web/gui/dashboard_info_custom_example.js
  2319. src/web/gui/dashboard_info.js
  2320. src/web/gui/index.html
  2321. src/web/gui/main.css
  2322. src/web/gui/main.js
  2323. src/web/gui/registry-access.html
  2324. src/web/gui/registry-alert-redirect.html
  2325. src/web/gui/registry-hello.html
  2326. src/web/gui/switch.html
  2327. src/web/gui/ilove.html
  2328. DESTINATION ${WEB_DEST})
  2329. install(FILES
  2330. src/web/gui/old/index.html
  2331. DESTINATION ${WEB_DEST}/old)
  2332. install(FILES
  2333. src/web/gui/static/img/netdata-logomark.svg
  2334. DESTINATION ${WEB_DEST}/static/img)
  2335. install(FILES
  2336. src/web/gui/css/morris-0.5.1.css
  2337. src/web/gui/css/c3-0.4.18.min.css
  2338. DESTINATION ${WEB_DEST}/css)
  2339. install(FILES
  2340. src/web/gui/.well-known/dnt/cookies
  2341. DESTINATION ${WEB_DEST}/.well-known/dnt)
  2342. # v0 dashboard
  2343. install(FILES
  2344. src/web/gui/v0/index.html
  2345. DESTINATION ${WEB_DEST}/v0)