From f33f7c054e061678e0d78a5c0ad45ef51601d251 Mon Sep 17 00:00:00 2001 From: Juan Jose Casafranca Date: Tue, 13 Dec 2022 08:49:50 +0100 Subject: [PATCH] Add tracy options --- recipes/tracy/all/conanfile.py | 27 +++++++++++++++---- .../tracy/all/test_package/test_package.cpp | 2 +- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/recipes/tracy/all/conanfile.py b/recipes/tracy/all/conanfile.py index 46fb7f4931376..bdb852b534295 100644 --- a/recipes/tracy/all/conanfile.py +++ b/recipes/tracy/all/conanfile.py @@ -19,16 +19,22 @@ class TracyConan(ConanFile): # Existing CMake tracy options with default value _tracy_options = { "enable": ([True, False], True), + "on_demand": ([True, False], False), "callstack": ([True, False], False), + "no_callstack": ([True, False], False), + "no_callstack_inlines": ([True, False], False), "only_localhost": ([True, False], False), "no_broadcast": ([True, False], False), + "only_ipv": ([True, False], False), "no_code_transfer": ([True, False], False), "no_context_switch": ([True, False], False), "no_exit": ([True, False], False), - "no_frame_image": ([True, False], False), "no_sampling": ([True, False], False), "no_verify": ([True, False], False), "no_vsync_capture": ([True, False], False), + "no_frame_image": ([True, False], False), + "no_system_tracing": ([True, False], False), + "delayed_init": ([True, False], False), } options = { "shared": [True, False], @@ -76,7 +82,8 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "share")) @@ -87,15 +94,25 @@ def package_info(self): # TODO: back to global scope in conan v2 self.cpp_info.components["tracyclient"].libs = ["TracyClient"] if self.options.shared: - self.cpp_info.components["tracyclient"].defines.append("TRACY_IMPORTS") + self.cpp_info.components["tracyclient"].defines.append( + "TRACY_IMPORTS") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["tracyclient"].system_libs.append("pthread") + self.cpp_info.components["tracyclient"].system_libs.append( + "pthread") if self.settings.os == "Linux": self.cpp_info.components["tracyclient"].system_libs.append("dl") + # Tracy CMake adds options set to ON as public + for opt in self._tracy_options.keys(): + switch = getattr(self.options, opt) + opt = f"TRACY_{opt.upper()}" + if switch: + self.cpp_info.components["tracyclient"].defines.append(opt) + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Tracy" self.cpp_info.names["cmake_find_package_multi"] = "Tracy" self.cpp_info.components["tracyclient"].names["cmake_find_package"] = "TracyClient" self.cpp_info.components["tracyclient"].names["cmake_find_package_multi"] = "TracyClient" - self.cpp_info.components["tracyclient"].set_property("cmake_target_name", "Tracy::TracyClient") + self.cpp_info.components["tracyclient"].set_property( + "cmake_target_name", "Tracy::TracyClient") diff --git a/recipes/tracy/all/test_package/test_package.cpp b/recipes/tracy/all/test_package/test_package.cpp index 7d1382592d76d..3063aab0b6e28 100644 --- a/recipes/tracy/all/test_package/test_package.cpp +++ b/recipes/tracy/all/test_package/test_package.cpp @@ -5,7 +5,7 @@ #endif int main(int argc, char **argv) { - ZoneScopedN("main") + ZoneScopedN("main"); return 0; }