GithubHelp home page GithubHelp logo

Bazel support about tracy HOT 4 OPEN

Icantjuddle avatar Icantjuddle commented on May 20, 2024
Bazel support

from tracy.

Comments (4)

Icantjuddle avatar Icantjuddle commented on May 20, 2024 1

can i have the bazel build files/? you can create a new branch called bazel, I guess it wont have any conflicts

Sure I'll push it sometime today.

from tracy.

Icantjuddle avatar Icantjuddle commented on May 20, 2024 1
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

bool_flag(
    name = "enable_tracy",
    build_setting_default = False,
)

config_setting(
    name = "do_enable_tracy",
    flag_values = {":enable_tracy": "True"},
)

_TRACY_SOURCE_FILES = [
    "public/TracyClient.cpp",
    "public/client/TracyArmCpuTable.hpp",
    "public/client/TracyCallstack.hpp",
    "public/client/TracyCpuid.hpp",
    "public/client/TracyDebug.hpp",
    "public/client/TracyDxt1.hpp",
    "public/client/TracyFastVector.hpp",
    "public/client/TracyLock.hpp",
    "public/client/TracyProfiler.hpp",
    "public/client/TracyRingBuffer.hpp",
    "public/client/TracyScoped.hpp",
    "public/client/TracyStringHelpers.hpp",
    "public/client/TracySysPower.hpp",
    "public/client/TracySysTime.hpp",
    "public/client/TracySysTrace.hpp",
    "public/client/TracyThread.hpp",
    "public/client/tracy_rpmalloc.hpp",
    "public/common/TracyAlign.hpp",
    "public/common/TracyAlloc.hpp",
    "public/common/TracyColor.hpp",
    "public/common/TracyForceInline.hpp",
    "public/common/TracyMutex.hpp",
    "public/common/TracyProtocol.hpp",
    "public/common/TracyQueue.hpp",
    "public/common/TracySocket.hpp",
    "public/common/TracyStackFrames.hpp",
    "public/common/TracySystem.hpp",
    "public/common/TracyUwp.hpp",
    "public/common/TracyVersion.hpp",
    "public/common/TracyYield.hpp",
    "public/common/tracy_lz4.hpp",
    "public/common/tracy_lz4hc.hpp",
    "public/libbacktrace/backtrace.hpp",
    "public/libbacktrace/filenames.hpp",
    "public/libbacktrace/internal.hpp",
    "public/tracy/TracyD3D11.hpp",
    "public/tracy/TracyD3D12.hpp",
    "public/tracy/TracyLua.hpp",
    "public/tracy/TracyOpenCL.hpp",
    "public/tracy/TracyOpenGL.hpp",
]

# .cpp files are included, we need a local_hdrs to better hide them
_TRACY_HEADER_FILES = [
    "public/client/TracyAlloc.cpp",
    "public/client/TracyCallstack.cpp",
    "public/client/TracyCallstack.h",
    "public/client/TracyDxt1.cpp",
    "public/client/TracyOverride.cpp",
    "public/client/TracyProfiler.cpp",
    "public/client/TracySysPower.cpp",
    "public/client/TracySysTime.cpp",
    "public/client/TracySysTrace.cpp",
    "public/client/tracy_SPSCQueue.h",
    "public/client/tracy_concurrentqueue.h",
    "public/client/tracy_rpmalloc.cpp",
    "public/common/TracyApi.h",
    "public/common/TracySocket.cpp",
    "public/common/TracyStackFrames.cpp",
    "public/common/TracySystem.cpp",
    "public/common/tracy_lz4.cpp",
    "public/common/tracy_lz4hc.cpp",
    "public/libbacktrace/alloc.cpp",
    "public/libbacktrace/config.h",
    "public/libbacktrace/dwarf.cpp",
    "public/libbacktrace/elf.cpp",
    "public/libbacktrace/fileline.cpp",
    "public/libbacktrace/macho.cpp",
    "public/libbacktrace/mmapio.cpp",
    "public/libbacktrace/posix.cpp",
    "public/libbacktrace/sort.cpp",
    "public/libbacktrace/state.cpp",
    "public/tracy/Tracy.hpp",  # This is the one public header.
    "public/tracy/TracyC.h",
]

# This list defines the features that Tracy will support. At a minimum,
# TRACY_ENABLE needs to be defined in order to support any instrumentation.
TRACY_ENABLED_FEATURES = [
    # Variables can only be set/unset, value doesn't matter, uncomment to
    # set to a non-default.
    #"TRACY_ON_DEMAND",
    #"TRACY_CALLSTACK",
    #"TRACY_NO_CALLSTACK",
    #"TRACY_NO_CALLSTACK_INLINES",
    #"TRACY_ONLY_LOCALHOST",
    #"TRACY_NO_BROADCAST",
    #"TRACY_ONLY_IPV4",
    #"TRACY_NO_CODE_TRANSFER",
    #"TRACY_NO_CONTEXT_SWITCH",
    #"TRACY_NO_EXIT",
    #"TRACY_NO_SAMPLING",
    #"TRACY_NO_VERIFY",
    #"TRACY_NO_VSYNC_CAPTURE",
    #"TRACY_NO_FRAME_IMAGE",
    #"TRACY_NO_SYSTEM_TRACING",
    #"TRACY_PATCHABLE_NOPSLEDS",
    #"TRACY_DELAYED_INIT",
    #"TRACY_MANUAL_LIFETIME",
    #"TRACY_FIBERS",
    #"TRACY_NO_CRASH_HANDLER",
    #"TRACY_TIMER_FALLBACK",
    "TRACY_ENABLE",
]

# Include this library as a dependency if you have a target (like a unit test)
# that needs to always include support for Tracy without having to rely on a
# flag being passed. Prefer to use ":client" whenever possible; see the
# documents associated with that target for more
# details.
cc_library(
    name = "client_enabled",
    srcs = TRACY_SOURCE_FILES,
    hdrs = TRACY_HEADER_FILES,
    defines = TRACY_ENABLED_FEATURES,
    includes = ["public"],
    linkopts = ["-ldl"],
    visibility = ["//visibility:public"],
)

cc_library(
    name = "client_disabled",
    srcs = TRACY_SOURCE_FILES,
    hdrs = TRACY_HEADER_FILES,
    includes = ["public"],
    linkopts = ["-ldl"],
    visibility = ["//visibility:public"],
)

# The ":client_enabled" project will be picked as a dependency if The
# `--@com_github_tracy//:enable_tracy=True` flag is specified; if the flag is
# set to False or omitted, ":client_disabled" will be picked instead.
cc_library(
    name = "client",
    linkopts = ["-ldl"],
    visibility = ["//visibility:public"],
    deps = select({
        ":do_enable_tracy": [":client_enabled"],
        "//conditions:default": [":client_disabled"],
    }),
)

You'll also need a workspace rule which can be included as:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def tracy_workspace():
    http_archive(
        name = "com_github_tracy",
        build_file = "//third_party/tracy:tracy.BUILD",
        sha256 = "de182a4ddd9850f0f4fa584cb0b6306be4995c1b42a4bcdee780041afcfa7834",
        strip_prefix = "tracy-0.10",
        urls = ["https://github.com/wolfpld/tracy/archive/refs/tags/v0.10.zip"],
    )

from tracy.

sibi-venti avatar sibi-venti commented on May 20, 2024

can i have the bazel build files/? you can create a new branch called bazel, I guess it wont have any conflicts

from tracy.

sibi-venti avatar sibi-venti commented on May 20, 2024

@Icantjuddle is it pushed ?

from tracy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.