-
-
Notifications
You must be signed in to change notification settings - Fork 576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazel support #717
Comments
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. |
@Icantjuddle is it pushed ? |
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"],
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've integrated the tracy client successfully into my organization's bazel setup. I'd like to add it back for anyone else who uses bazel. Is adding a third (fourth?) build system too much of a maintenance burden? Where would it be best to add it?
The text was updated successfully, but these errors were encountered: