CMakeLists.txt 120 KB

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