From f505c50770abdb2527a1696ec01cd3e0ddc86e2d Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Wed, 18 May 2022 03:10:45 +0200 Subject: Add tracy (#30588) Co-authored-by: Mikael Simberg --- var/spack/repos/builtin/packages/glfw/package.py | 4 ++ .../repos/builtin/packages/tracy-client/package.py | 77 ++++++++++++++++++++++ var/spack/repos/builtin/packages/tracy/package.py | 46 +++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 var/spack/repos/builtin/packages/tracy-client/package.py create mode 100644 var/spack/repos/builtin/packages/tracy/package.py (limited to 'var') diff --git a/var/spack/repos/builtin/packages/glfw/package.py b/var/spack/repos/builtin/packages/glfw/package.py index 6e2d7a2780..83dd74ad45 100644 --- a/var/spack/repos/builtin/packages/glfw/package.py +++ b/var/spack/repos/builtin/packages/glfw/package.py @@ -27,6 +27,7 @@ class Glfw(CMakePackage): version('3.0.3', sha256='7a182047ba6b1fdcda778b79aac249bb2328b6d141188cb5df29560715d01693') variant("doc", default=False, description="Build documentation") + variant("shared", default=False, description="Builds a shared version of the library") # dependencies depends_on('doxygen', type='build', when="+doc") @@ -42,3 +43,6 @@ class Glfw(CMakePackage): depends_on('freetype', when='platform=linux') depends_on('fontconfig', when='platform=linux') depends_on('pkgconfig', type='build', when='platform=linux') + + def cmake_args(self): + return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")] diff --git a/var/spack/repos/builtin/packages/tracy-client/package.py b/var/spack/repos/builtin/packages/tracy-client/package.py new file mode 100644 index 0000000000..c8b84f2fff --- /dev/null +++ b/var/spack/repos/builtin/packages/tracy-client/package.py @@ -0,0 +1,77 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class TracyClient(CMakePackage): + """A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling + profiler for games and other applications. Client library.""" + + homepage = "https://github.com/wolfpld/tracy" + url = "https://github.com/wolfpld/tracy/archive/v0.0.0.tar.gz" + maintainers = ["msimberg"] + + version("master", git="https://github.com/wolfpld/tracy.git", branch="master") + version( + "0.8.1", + sha256="004992012b2dc879a9f6d143cbf94d7ea30e88135db3ef08951605d214892891", + ) + + variant( + "shared", + default=True, + description="Build the client library as a shared library", + ) + + variants = { + "enable": (True, "Enable profiling"), + "on_demand": (False, "On-demand profiling"), + "callstack": (False, "Enfore callstack collection for tracy regions"), + "no_callstack": (False, "Disable all callstack related functionality"), + "no_callstack_inlines": (False, "Disables the inline functions in callstacks"), + "only_localhost": (False, "Only listen on the localhost interface"), + "no_broadcast": ( + False, + "Disable client discovery by broadcast to local network", + ), + "only_ipv4": ( + False, + "Tracy will only accept connections on IPv4 addresses (disable IPv6)", + ), + "no_code_transfer": (False, "Disable collection of source code"), + "no_context_switch": (False, "Disable capture of context switches"), + "no_exit": ( + False, + "Client executable does not exit until all profile data is sent to server", + ), + "no_sampling": (False, "Disable call stack sampling"), + "no_verify": (False, "Disable zone validation for C API"), + "no_vsync_capture": (False, "Disable capture of hardware Vsync events"), + "no_frame_image": (False, "Disable the frame image support and its thread"), + "no_system_tracing": (False, "Disable systrace sampling"), + "delayed_init": ( + False, + "Enable delayed initialization of the library (init on first call)", + ), + "manual_lifetime": ( + False, + "Enable the manual lifetime management of the profile", + ), + "fibers": (False, "Enable fibers support"), + "no_crash_handler": (False, "Disable crash handling"), + "timer_fallback": (False, "Use lower resolution timers"), + } + + for k, v in variants.items(): + variant(k, default=v[0], description=v[1]) + + def cmake_args(self): + args = [ + self.define_from_variant("TRACY_%s" + k.upper(), v[0]) + for k, v in variants.items() + ] + args.append(self.define_from_variant("BUILD_SHARED_LIBS", "shared")) + return args diff --git a/var/spack/repos/builtin/packages/tracy/package.py b/var/spack/repos/builtin/packages/tracy/package.py new file mode 100644 index 0000000000..51f39b0e5d --- /dev/null +++ b/var/spack/repos/builtin/packages/tracy/package.py @@ -0,0 +1,46 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Tracy(MakefilePackage): + """A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling + profiler for games and other applications. Server applications.""" + + homepage = "https://github.com/wolfpld/tracy" + url = "https://github.com/wolfpld/tracy/archive/v0.0.0.tar.gz" + maintainers = ["msimberg"] + + version("master", git="https://github.com/wolfpld/tracy.git", branch="master") + version( + "0.8.1", + sha256="004992012b2dc879a9f6d143cbf94d7ea30e88135db3ef08951605d214892891", + ) + + depends_on("capstone") + depends_on("dbus") + depends_on("freetype") + # Linking fails unless glfw is built as a shared library: + # https://github.com/wolfpld/tracy/issues/110 + depends_on("glfw +shared") + + def build(self, spec, prefix): + with working_dir(join_path(self.build_directory, "capture/build/unix")): + make() + + with working_dir(join_path(self.build_directory, "profiler/build/unix")): + make() + + def install(self, spec, prefix): + mkdir(prefix.bin) + install( + join_path(self.build_directory, "capture/build/unix/capture-release"), + prefix.bin, + ) + install( + join_path(self.build_directory, "profiler/build/unix/Tracy-release"), + prefix.bin, + ) -- cgit v1.2.3-70-g09d2