xmake.lua 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. add_rules("mode.debug", "mode.release")
  2. add_rules("utils.install.cmake_importfiles")
  3. option("tracy_enable", {type = "boolean", default = true, description = "Enable profiling"})
  4. option("on_demand", {type = "boolean", default = false, description = "On-demand profiling"})
  5. option("enforce_callstack", {type = "boolean", default = false, description = "Enfore callstack collection for tracy regions"})
  6. option("callstack", {type = "boolean", default = false, description = "Enable all callstack related functionality"})
  7. option("callstack_inlines", {type = "boolean", default = false, description = "Enable the inline functions in callstacks"})
  8. option("only_localhost", {type = "boolean", default = false, description = "Only listen on the localhost interface"})
  9. option("broadcast", {type = "boolean", default = false, description = "Enable client discovery by broadcast to local network"})
  10. option("only_ipv4", {type = "boolean", default = false, description = "Tracy will only accept connections on IPv4 addresses (disable IPv6)"})
  11. option("code_transfer", {type = "boolean", default = false, description = "Enable collection of source code"})
  12. option("context_switch", {type = "boolean", default = false, description = "Enable capture of context switches"})
  13. option("exit", {type = "boolean", default = false, description = "Client executable does not exit until all profile data is sent to server"})
  14. option("sampling", {type = "boolean", default = false, description = "Enable call stack sampling"})
  15. option("verify", {type = "boolean", default = false, description = "Enable zone validation for C API"})
  16. option("vsync_capture", {type = "boolean", default = false, description = "Enable capture of hardware Vsync events"})
  17. option("frame_image", {type = "boolean", default = false, description = "Enable the frame image support and its thread"})
  18. option("system_tracing", {type = "boolean", default = false, description = "Enable systrace sampling"})
  19. option("patchable_nopsleds", {type = "boolean", default = false, description = "Enable nopsleds for efficient patching by system-level tools (e.g. rr)"})
  20. option("timer_fallback", {type = "boolean", default = false, description = "Use lower resolution timers"})
  21. option("libunwind_backtrace", {type = "boolean", default = false, description = "Use libunwind backtracing where supported"})
  22. option("symbol_offline_resolve", {type = "boolean", default = false, description = "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution"})
  23. option("libbacktrace_elf_dynload_support", {type = "boolean", default = false, description = "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation"})
  24. option("delayed_init", {type = "boolean", default = false, description = "Enable delayed initialization of the library (init on first call)"})
  25. option("manual_lifetime", {type = "boolean", default = false, description = "Enable the manual lifetime management of the profile"})
  26. option("fibers", {type = "boolean", default = true, description = "Enable fibers support"})
  27. option("crash_handler", {type = "boolean", default = false, description = "Enable crash handling"})
  28. option("verb", {type = "boolean", default = false, description = "Enable verbose logging"})
  29. if has_config("libunwind_backtrace") then
  30. add_requires("libunwind")
  31. end
  32. target("tracy")
  33. set_kind("$(kind)")
  34. set_languages("c++14")
  35. add_files("public/TracyClient.cpp")
  36. add_headerfiles("public/(tracy/**.h)", "public/(tracy/**.hpp)",
  37. "public/(client/**.h)", "public/(client/**.hpp)",
  38. "public/(common/**.h)", "public/(common/**.hpp)")
  39. if is_plat("windows", "mingw") then
  40. add_syslinks("ws2_32", "dbghelp")
  41. elseif is_plat("linux") then
  42. add_syslinks("pthread")
  43. elseif is_plat("bsd") then
  44. add_syslinks("pthread", "execinfo")
  45. end
  46. if has_config("tracy_enable") then
  47. add_defines("TRACY_ENABLE")
  48. end
  49. if has_config("on_demand") then
  50. add_defines("TRACY_ON_DEMAND")
  51. end
  52. if has_config("enforce_callstack") then
  53. add_defines("TRACY_CALLSTACK")
  54. end
  55. if has_config("callstack") then
  56. add_defines("TRACY_NO_CALLSTACK")
  57. end
  58. if has_config("callstack_inlines") then
  59. add_defines("TRACY_NO_CALLSTACK_INLINES")
  60. end
  61. if has_config("only_localhost") then
  62. add_defines("TRACY_ONLY_LOCALHOST")
  63. end
  64. if has_config("broadcast") then
  65. add_defines("TRACY_NO_BROADCAST")
  66. end
  67. if has_config("only_ipv4") then
  68. add_defines("TRACY_ONLY_IPV4")
  69. end
  70. if has_config("code_transfer") then
  71. add_defines("TRACY_NO_CODE_TRANSFER")
  72. end
  73. if has_config("context_switch") then
  74. add_defines("TRACY_NO_CONTEXT_SWITCH")
  75. end
  76. if has_config("exit") then
  77. add_defines("TRACY_NO_EXIT")
  78. end
  79. if has_config("sampling") then
  80. add_defines("TRACY_NO_SAMPLING")
  81. end
  82. if has_config("verify") then
  83. add_defines("TRACY_NO_VERIFY")
  84. end
  85. if has_config("vsync_capture") then
  86. add_defines("TRACY_NO_VSYNC_CAPTURE")
  87. end
  88. if has_config("frame_image") then
  89. add_defines("TRACY_NO_FRAME_IMAGE")
  90. end
  91. if has_config("system_tracing") then
  92. add_defines("TRACY_NO_SYSTEM_TRACING")
  93. end
  94. if has_config("patchable_nopsleds") then
  95. add_defines("TRACY_PATCHABLE_NOPSLEDS")
  96. end
  97. if has_config("delayed_init") then
  98. add_defines("TRACY_DELAYED_INIT")
  99. end
  100. if has_config("manual_lifetime") then
  101. add_defines("TRACY_MANUAL_LIFETIME")
  102. end
  103. if has_config("fibers") then
  104. add_defines("TRACY_FIBERS")
  105. end
  106. if has_config("timer_fallback") then
  107. add_defines("TRACY_TIMER_FALLBACK")
  108. end
  109. if has_config("crash_handler") then
  110. add_defines("TRACY_NO_CRASH_HANDLER")
  111. end
  112. if has_config("libunwind_backtrace") then
  113. add_defines("TRACY_LIBUNWIND_BACKTRACE")
  114. add_packages("libunwind")
  115. end
  116. if has_config("symbol_offline_resolve") then
  117. add_defines("TRACY_SYMBOL_OFFLINE_RESOLVE")
  118. end
  119. if has_config("libbacktrace_elf_dynload_support") then
  120. add_defines("TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT")
  121. end
  122. if has_config("verb") then
  123. add_defines("TRACY_VERBOSE")
  124. end
  125. if is_kind("shared") then
  126. add_defines("TRACY_EXPORTS")
  127. end
  128. if is_plat("windows", "mingw") then
  129. add_defines("_WIN32")
  130. end