update tracy from 11.0 to 13.1 and fix build with tracy enabled
This commit is contained in:
@@ -1,8 +1 @@
|
||||
*.dylib
|
||||
*.so.*
|
||||
build
|
||||
dist
|
||||
tracy_client.egg-info
|
||||
client
|
||||
common
|
||||
tracy
|
||||
*.whl
|
||||
|
||||
@@ -7,7 +7,7 @@ if(EXTERNAL_PYBIND11)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(pybind11 GIT_REPOSITORY "https://github.com/pybind/pybind11.git" GIT_TAG "v2.11.1" GIT_SHALLOW ON TEST_BEFORE_INSTALL ON)
|
||||
FetchContent_Declare(pybind11 GIT_REPOSITORY "https://github.com/pybind/pybind11.git" GIT_TAG "v2.13.6" GIT_SHALLOW ON)
|
||||
FetchContent_MakeAvailable(pybind11)
|
||||
endif()
|
||||
|
||||
@@ -20,44 +20,13 @@ target_link_libraries(TracyClientBindings PUBLIC ${Python_LIBRARIES})
|
||||
target_compile_definitions(TracyClientBindings PUBLIC BUFFER_SIZE=${BUFFER_SIZE})
|
||||
target_compile_definitions(TracyClientBindings PUBLIC NAME_LENGTH=${NAME_LENGTH})
|
||||
|
||||
set(TRACY_PYTHON_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tracy_client)
|
||||
set(TRACY_LIB_SYMLINK $<TARGET_FILE_PREFIX:TracyClient>$<TARGET_FILE_BASE_NAME:TracyClient>$<TARGET_FILE_SUFFIX:TracyClient>)
|
||||
if (UNIX)
|
||||
set_target_properties(TracyClientBindings PROPERTIES
|
||||
BUILD_RPATH_USE_ORIGIN TRUE
|
||||
INSTALL_RPATH "\$ORIGIN/lib")
|
||||
endif ()
|
||||
|
||||
list(TRANSFORM client_includes REPLACE "^${TRACY_PUBLIC_DIR}" "${TRACY_PYTHON_DIR}" OUTPUT_VARIABLE python_client_includes)
|
||||
list(TRANSFORM common_includes REPLACE "^${TRACY_PUBLIC_DIR}" "${TRACY_PYTHON_DIR}" OUTPUT_VARIABLE python_common_includes)
|
||||
list(TRANSFORM tracy_includes REPLACE "^${TRACY_PUBLIC_DIR}" "${TRACY_PYTHON_DIR}" OUTPUT_VARIABLE python_tracy_includes)
|
||||
|
||||
add_custom_command(TARGET TracyClient TracyClientBindings POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TRACY_PYTHON_DIR}/client
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${client_includes} ${TRACY_PYTHON_DIR}/client
|
||||
COMMAND ${CMAKE_COMMAND} -DFOLDER=${TRACY_PYTHON_DIR}/client -P ${CMAKE_CURRENT_SOURCE_DIR}/HeaderFixer.txt
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TRACY_PYTHON_DIR}/common
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${common_includes} ${TRACY_PYTHON_DIR}/common
|
||||
COMMAND ${CMAKE_COMMAND} -DFOLDER=${TRACY_PYTHON_DIR}/common -P ${CMAKE_CURRENT_SOURCE_DIR}/HeaderFixer.txt
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TRACY_PYTHON_DIR}/tracy
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${tracy_includes} ${TRACY_PYTHON_DIR}/tracy
|
||||
COMMAND ${CMAKE_COMMAND} -DFOLDER=${TRACY_PYTHON_DIR}/tracy -P ${CMAKE_CURRENT_SOURCE_DIR}/HeaderFixer.txt
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:TracyClientBindings> ${TRACY_PYTHON_DIR}/
|
||||
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:TracyClient> ${TRACY_PYTHON_DIR}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/../${TRACY_LIB_SYMLINK} ${TRACY_PYTHON_DIR}/
|
||||
|
||||
BYPRODUCTS ${python_client_includes} ${python_common_includes} ${python_tracy_includes} ${TRACY_PYTHON_DIR}/client ${TRACY_PYTHON_DIR}/common ${TRACY_PYTHON_DIR}/tracy
|
||||
install(TARGETS TracyClientBindings
|
||||
RUNTIME DESTINATION .
|
||||
LIBRARY DESTINATION .
|
||||
)
|
||||
|
||||
set(TRACY_CLIENT_PYTHON_TARGET "" CACHE STRING "Optional directory to copy python files to")
|
||||
|
||||
if(NOT TRACY_CLIENT_PYTHON_TARGET STREQUAL "")
|
||||
file(GLOB_RECURSE TRACY_CLIENT_PYTHON_FILES ${TRACY_PYTHON_DIR}/*.py*)
|
||||
list(TRANSFORM TRACY_CLIENT_PYTHON_FILES REPLACE "^${TRACY_PYTHON_DIR}" "${TRACY_CLIENT_PYTHON_TARGET}" OUTPUT_VARIABLE TRACY_CLIENT_TARGET_PYTHON_FILES)
|
||||
|
||||
add_custom_command(TARGET TracyClientBindings POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${TRACY_CLIENT_PYTHON_TARGET}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:TracyClientBindings> ${TRACY_CLIENT_PYTHON_TARGET}/
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${TRACY_CLIENT_PYTHON_FILES} ${TRACY_CLIENT_PYTHON_TARGET}/
|
||||
BYPRODUCTS ${TRACY_CLIENT_TARGET_PYTHON_FILES}
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
function(fix_header FILE)
|
||||
file(READ ${FILE} FILE_CONTENT)
|
||||
string(REPLACE "../client" "client" FILE_CONTENT "${FILE_CONTENT}")
|
||||
string(REPLACE "../common" "common" FILE_CONTENT "${FILE_CONTENT}")
|
||||
string(REPLACE "../tracy" "tracy" FILE_CONTENT "${FILE_CONTENT}")
|
||||
file(WRITE ${FILE} "${FILE_CONTENT}")
|
||||
endfunction()
|
||||
|
||||
function(fix_headers FOLDER)
|
||||
file(GLOB FILES "${FOLDER}/*.h*")
|
||||
foreach(FILE ${FILES})
|
||||
fix_header(${FILE})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
fix_headers(${FOLDER})
|
||||
@@ -7,7 +7,7 @@ namespace py = pybind11;
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
using OptionalString = std::optional<std::string>;
|
||||
using OptionalInt = std::optional<int>;
|
||||
using OptionalInt = std::optional<int32_t>;
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
template <typename Type = uint64_t>
|
||||
|
||||
@@ -820,7 +820,7 @@ PYBIND11_MODULE(TracyClientBindings, m) {
|
||||
|
||||
m.def(
|
||||
"_plot_config",
|
||||
[](const std::string &name, int type, bool step, bool fill,
|
||||
[](const std::string &name, int32_t type, bool step, bool fill,
|
||||
uint32_t color = 0) {
|
||||
if (!tracy::IsEnabled()) return static_cast<OptionalNumber>(0ul);
|
||||
auto entry = NameBuffer::Add(name);
|
||||
|
||||
@@ -27,7 +27,7 @@ bool SetText(const std::string& text, tracy::ScopedZone* zone) {
|
||||
class PyScopedZone {
|
||||
public:
|
||||
PyScopedZone(const std::optional<std::string>& name, uint32_t color,
|
||||
std::optional<int> depth, bool active,
|
||||
std::optional<int32_t> depth, bool active,
|
||||
const std::string& function, const std::string& source,
|
||||
uint32_t line)
|
||||
: m_name(name),
|
||||
@@ -77,7 +77,7 @@ class PyScopedZone {
|
||||
m_zone = new tracy::ScopedZone(
|
||||
m_line, m_source.c_str(), m_source.size(), m_function.c_str(),
|
||||
m_function.size(), m_name ? m_name->c_str() : nullptr,
|
||||
m_name ? m_name->size() : 0ul, m_color, m_active);
|
||||
m_name ? m_name->size() : 0ul, m_color, -1, m_active);
|
||||
}
|
||||
|
||||
void Exit() {
|
||||
@@ -88,7 +88,7 @@ class PyScopedZone {
|
||||
private:
|
||||
std::optional<std::string> m_name;
|
||||
uint32_t m_color;
|
||||
std::optional<int> m_depth;
|
||||
std::optional<int32_t> m_depth;
|
||||
bool m_active;
|
||||
|
||||
std::string m_function;
|
||||
@@ -101,7 +101,7 @@ class PyScopedZone {
|
||||
|
||||
class PyScopedZone {
|
||||
public:
|
||||
PyScopedZone(const std::optional<std::string>&, uint32_t, std::optional<int>,
|
||||
PyScopedZone(const std::optional<std::string>&, uint32_t, std::optional<int32_t>,
|
||||
bool, const std::string&, const std::string&, uint32_t line) {}
|
||||
virtual ~PyScopedZone(){};
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
[build-system]
|
||||
requires = ["scikit-build-core>=0.11"]
|
||||
build-backend = "scikit_build_core.build"
|
||||
|
||||
[project]
|
||||
name = "tracy_client"
|
||||
version = "0.13.1"
|
||||
description = "A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications."
|
||||
authors = [
|
||||
{ name = "Bartosz Taudul", email = "wolf@nereid.pl" },
|
||||
]
|
||||
requires-python = ">=3.10"
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/wolfpld/tracy"
|
||||
source = "https://github.com/wolfpld/tracy"
|
||||
|
||||
[tool.scikit-build]
|
||||
cmake.version = ">=3.15.0"
|
||||
ninja.version = ">=1.11"
|
||||
cmake.source-dir = ".."
|
||||
cmake.build-type = "Release"
|
||||
wheel.install-dir = "tracy_client"
|
||||
wheel.packages = ["tracy_client"]
|
||||
|
||||
[tool.scikit-build.cmake.define]
|
||||
TRACY_CLIENT_PYTHON = "ON"
|
||||
TRACY_STATIC = "OFF"
|
||||
CMAKE_INSTALL_BINDIR = ""
|
||||
@@ -1,57 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
|
||||
from typing import List
|
||||
|
||||
from setuptools import setup, find_namespace_packages, Extension
|
||||
from setuptools.command.build_ext import build_ext
|
||||
|
||||
MODULE_NAME = "tracy_client"
|
||||
|
||||
|
||||
def find_files(pattern: str) -> List[str]:
|
||||
return glob.glob(os.path.join(MODULE_NAME, pattern), recursive=True)
|
||||
|
||||
|
||||
class ManualExtension(Extension):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(name=MODULE_NAME, sources=[])
|
||||
|
||||
|
||||
class DummyBuild(build_ext):
|
||||
def build_extension(self, ext) -> None:
|
||||
extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name)))
|
||||
extdir = os.path.join(extdir, MODULE_NAME)
|
||||
|
||||
for entry in find_files("*cpython*"):
|
||||
shutil.copy(
|
||||
os.path.abspath(entry),
|
||||
os.path.join(extdir, os.path.basename(entry)),
|
||||
)
|
||||
|
||||
|
||||
setup(
|
||||
name=MODULE_NAME,
|
||||
version="0.10.0",
|
||||
author="Bartosz Taudul",
|
||||
author_email="wolf@nereid.pl",
|
||||
description="A real time, nanosecond resolution, remote telemetry, hybrid frame and sampling profiler for games and other applications.",
|
||||
long_description="This package contains the client code only. See the documentation for further details.",
|
||||
url="https://github.com/wolfpld/tracy",
|
||||
ext_modules=[ManualExtension()],
|
||||
cmdclass={"build_ext": DummyBuild},
|
||||
package_dir={"": "."},
|
||||
packages=find_namespace_packages(where="."),
|
||||
package_data={"": ["py.typed"]},
|
||||
data_files=[
|
||||
("lib", find_files("lib*")),
|
||||
("include/client", find_files("client/*.h*")),
|
||||
("include/common", find_files("common/*.h*")),
|
||||
("include/tracy", find_files("tracy/*.h*")),
|
||||
],
|
||||
include_package_data=True,
|
||||
zip_safe=False,
|
||||
)
|
||||
Reference in New Issue
Block a user