mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Building profiler UI and utitily executables with CMake.
Tracy UI server app. `csvexport` utitily executable. `capture` utitily executable. `update` utitily executable.
This commit is contained in:
parent
a4c200d242
commit
9ecda53ba3
@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(Tracy LANGUAGES CXX)
|
||||
project(Tracy LANGUAGES C CXX)
|
||||
|
||||
if(${BUILD_SHARED_LIBS})
|
||||
set(DEFAULT_STATIC OFF)
|
||||
@ -130,7 +130,22 @@ set(common_includes
|
||||
${TRACY_PUBLIC_DIR}/common/TracyUwp.hpp
|
||||
${TRACY_PUBLIC_DIR}/common/TracyYield.hpp)
|
||||
|
||||
install(TARGETS TracyClient
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||
include(defaults)
|
||||
|
||||
add_subdirectory(capture)
|
||||
add_subdirectory(csvexport)
|
||||
add_subdirectory(getopt)
|
||||
# TODO: consider using external imgui package.
|
||||
add_subdirectory(imgui)
|
||||
add_subdirectory(nfd)
|
||||
add_subdirectory(profiler)
|
||||
add_subdirectory(public)
|
||||
add_subdirectory(server)
|
||||
add_subdirectory(update)
|
||||
add_subdirectory(zstd)
|
||||
|
||||
install(TARGETS TracyClient Tracy update capture csvexport
|
||||
EXPORT TracyConfig
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
||||
5
capture/CMakeLists.txt
Normal file
5
capture/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(capture src/capture.cpp)
|
||||
|
||||
set_default_compile_options(capture)
|
||||
|
||||
target_link_libraries(capture PRIVATE server getopt)
|
||||
22
cmake/defaults.cmake
Normal file
22
cmake/defaults.cmake
Normal file
@ -0,0 +1,22 @@
|
||||
function(set_default_compile_options TARGET_NAME)
|
||||
# Set the C++ standard version.
|
||||
target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17)
|
||||
|
||||
target_compile_definitions(
|
||||
${TARGET_NAME}
|
||||
PRIVATE # Avoid `min|max` macros declared in windows.h from stamping over
|
||||
# `std::numeric_limits<T>::min|max()` declared in <limits>.
|
||||
$<$<PLATFORM_ID:Windows>:NOMINMAX>)
|
||||
|
||||
# Set rpath
|
||||
get_target_property(_target_type ${TARGET_NAME} TYPE)
|
||||
if(_target_type STREQUAL "EXECUTABLE")
|
||||
if(APPLE)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH
|
||||
"@executable_path")
|
||||
elseif(UNIX)
|
||||
set_target_properties(${TARGET_NAME} PROPERTIES INSTALL_RPATH
|
||||
"$ORIGIN;$ORIGIN/../lib")
|
||||
endif()
|
||||
endif()
|
||||
endfunction(set_default_compile_options)
|
||||
5
csvexport/CMakeLists.txt
Normal file
5
csvexport/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(csvexport src/csvexport.cpp)
|
||||
|
||||
set_default_compile_options(csvexport)
|
||||
|
||||
target_link_libraries(csvexport PRIVATE server getopt)
|
||||
1
getopt/CMakeLists.txt
Normal file
1
getopt/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_library(getopt STATIC getopt.c)
|
||||
11
imgui/CMakeLists.txt
Normal file
11
imgui/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
add_library(
|
||||
imgui STATIC misc/freetype/imgui_freetype.cpp imgui_widgets.cpp imgui.cpp
|
||||
imgui_tables.cpp imgui_demo.cpp imgui_draw.cpp)
|
||||
|
||||
set_default_compile_options(imgui)
|
||||
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_SOURCE_DIR}/imgui")
|
||||
|
||||
find_package(Freetype REQUIRED)
|
||||
|
||||
target_link_libraries(imgui PUBLIC public.common Freetype::Freetype)
|
||||
18
nfd/CMakeLists.txt
Normal file
18
nfd/CMakeLists.txt
Normal file
@ -0,0 +1,18 @@
|
||||
add_library(
|
||||
nfd STATIC
|
||||
$<$<PLATFORM_ID:Windows>:nfd_win.cpp>
|
||||
$<$<PLATFORM_ID:Darwin>:nfd_cocoa.m>
|
||||
# To use Linux native file dialog based on freedesktop portal, you need to
|
||||
# have one of the portal implementation installed, e.g.
|
||||
# `xdg-desktop-portal-gtk`
|
||||
$<$<PLATFORM_ID:Linux>:nfd_portal.cpp>)
|
||||
|
||||
set_default_compile_options(nfd)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(dbus REQUIRED dbus-1)
|
||||
|
||||
target_link_libraries(nfd PRIVATE ${dbus_LIBRARIES})
|
||||
target_include_directories(nfd PRIVATE ${dbus_INCLUDE_DIRS})
|
||||
endif()
|
||||
38
profiler/CMakeLists.txt
Normal file
38
profiler/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
||||
add_executable(
|
||||
Tracy WIN32
|
||||
src/WindowPosition.cpp
|
||||
src/ConnectionHistory.cpp
|
||||
src/RunQueue.cpp
|
||||
src/BackendGlfw.cpp
|
||||
src/Fonts.cpp
|
||||
src/imgui/imgui_impl_opengl3.cpp
|
||||
src/imgui/imgui_impl_glfw.cpp
|
||||
src/winmainArchDiscovery.cpp
|
||||
src/winmain.cpp
|
||||
src/ResolvService.cpp
|
||||
src/Filters.cpp
|
||||
src/ImGuiContext.cpp
|
||||
src/main.cpp
|
||||
src/HttpRequest.cpp
|
||||
build/win32/Tracy.rc)
|
||||
|
||||
set_default_compile_options(Tracy)
|
||||
|
||||
find_package(glfw REQUIRED)
|
||||
|
||||
target_link_libraries(Tracy PRIVATE server glfw::glfw imgui nfd)
|
||||
|
||||
if(APPLE)
|
||||
find_library(FRAMEWORK_COREFOUNDATION CoreFoundation REQUIRED)
|
||||
find_library(FRAMEWORK_APPKIT AppKit REQUIRED)
|
||||
# Available from macOS 11.0+
|
||||
find_library(FRAMEWORK_UTI UniformTypeIdentifiers)
|
||||
|
||||
target_link_libraries(
|
||||
Tracy
|
||||
PRIVATE
|
||||
${FRAMEWORK_COREFOUNDATION}
|
||||
${FRAMEWORK_APPKIT}
|
||||
$<$<VERSION_GREATER_EQUAL:${CMAKE_OSX_DEPLOYMENT_TARGET},11.0>:${FRAMEWORK_UTI}>
|
||||
)
|
||||
endif()
|
||||
1
public/CMakeLists.txt
Normal file
1
public/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
add_subdirectory(common)
|
||||
10
public/common/CMakeLists.txt
Normal file
10
public/common/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
add_library(public.common STATIC tracy_lz4.cpp tracy_lz4hc.cpp TracySocket.cpp
|
||||
TracyStackFrames.cpp TracySystem.cpp)
|
||||
|
||||
set_default_compile_options(public.common)
|
||||
|
||||
if(WIN32)
|
||||
find_library(Wsock32 wsock32 REQUIRED)
|
||||
find_library(Ws2_32 ws2_32 REQUIRED)
|
||||
target_link_libraries(public.common PUBLIC Wsock32 Ws2_32)
|
||||
endif()
|
||||
74
server/CMakeLists.txt
Normal file
74
server/CMakeLists.txt
Normal file
@ -0,0 +1,74 @@
|
||||
add_library(
|
||||
server STATIC
|
||||
TracyBadVersion.cpp
|
||||
TracyColor.cpp
|
||||
TracyEventDebug.cpp
|
||||
TracyFileselector.cpp
|
||||
TracyFilesystem.cpp
|
||||
TracyImGui.cpp
|
||||
TracyMemory.cpp
|
||||
TracyMicroArchitecture.cpp
|
||||
TracyMmap.cpp
|
||||
TracyMouse.cpp
|
||||
TracyPrint.cpp
|
||||
TracyProtoHistory.cpp
|
||||
TracySourceContents.cpp
|
||||
TracySourceTokenizer.cpp
|
||||
TracySourceView.cpp
|
||||
TracyStorage.cpp
|
||||
TracyTaskDispatch.cpp
|
||||
TracyTexture.cpp
|
||||
TracyTextureCompression.cpp
|
||||
TracyThreadCompress.cpp
|
||||
TracyTimelineController.cpp
|
||||
TracyTimelineItem.cpp
|
||||
TracyTimelineItemCpuData.cpp
|
||||
TracyTimelineItemGpu.cpp
|
||||
TracyTimelineItemPlot.cpp
|
||||
TracyTimelineItemThread.cpp
|
||||
TracyUserData.cpp
|
||||
TracyUtility.cpp
|
||||
TracyView.cpp
|
||||
TracyView_Annotations.cpp
|
||||
TracyView_Callstack.cpp
|
||||
TracyView_Compare.cpp
|
||||
TracyView_ConnectionState.cpp
|
||||
TracyView_ContextSwitch.cpp
|
||||
TracyView_CpuData.cpp
|
||||
TracyView_FindZone.cpp
|
||||
TracyView_FrameOverview.cpp
|
||||
TracyView_FrameTimeline.cpp
|
||||
TracyView_FrameTree.cpp
|
||||
TracyView_GpuTimeline.cpp
|
||||
TracyView_Locks.cpp
|
||||
TracyView_Memory.cpp
|
||||
TracyView_Messages.cpp
|
||||
TracyView_Navigation.cpp
|
||||
TracyView_NotificationArea.cpp
|
||||
TracyView_Options.cpp
|
||||
TracyView_Playback.cpp
|
||||
TracyView_Plots.cpp
|
||||
TracyView_Ranges.cpp
|
||||
TracyView_Samples.cpp
|
||||
TracyView_Statistics.cpp
|
||||
TracyView_Timeline.cpp
|
||||
TracyView_TraceInfo.cpp
|
||||
TracyView_Utility.cpp
|
||||
TracyView_ZoneInfo.cpp
|
||||
TracyView_ZoneTimeline.cpp
|
||||
TracyWeb.cpp
|
||||
TracyWorker.cpp)
|
||||
|
||||
set_default_compile_options(server)
|
||||
|
||||
find_package(Capstone REQUIRED)
|
||||
|
||||
target_include_directories(server PUBLIC "${CMAKE_SOURCE_DIR}/imgui")
|
||||
target_link_libraries(server PUBLIC capstone::capstone zstd public.common)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# On Linux std algorithms use tbb
|
||||
find_package(TBB REQUIRED COMPONENTS tbb)
|
||||
|
||||
target_link_libraries(server PUBLIC TBB::tbb Threads::Threads)
|
||||
endif()
|
||||
@ -2,7 +2,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <capstone.h>
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "TracyCharUtil.hpp"
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <capstone.h>
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
#define ZDICT_STATIC_LINKING_ONLY
|
||||
#include "../zstd/zdict.h"
|
||||
|
||||
5
update/CMakeLists.txt
Normal file
5
update/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_executable(update src/update.cpp)
|
||||
|
||||
set_default_compile_options(update)
|
||||
|
||||
target_link_libraries(update PRIVATE server getopt)
|
||||
12
zstd/CMakeLists.txt
Normal file
12
zstd/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
add_subdirectory(common)
|
||||
|
||||
add_subdirectory(compress)
|
||||
|
||||
add_subdirectory(decompress)
|
||||
|
||||
add_subdirectory(dictBuilder)
|
||||
|
||||
add_library(zstd INTERFACE)
|
||||
|
||||
target_link_libraries(zstd INTERFACE zstd.compress zstd.decompress
|
||||
zstd.dictBuilder)
|
||||
12
zstd/common/CMakeLists.txt
Normal file
12
zstd/common/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
||||
add_library(
|
||||
zstd.common STATIC
|
||||
entropy_common.c
|
||||
fse_decompress.c
|
||||
debug.c
|
||||
xxhash.c
|
||||
pool.c
|
||||
threading.c
|
||||
zstd_common.c
|
||||
error_private.c)
|
||||
|
||||
set_default_compile_options(zstd.common)
|
||||
19
zstd/compress/CMakeLists.txt
Normal file
19
zstd/compress/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
add_library(
|
||||
zstd.compress STATIC
|
||||
zstd_compress_superblock.c
|
||||
zstdmt_compress.c
|
||||
zstd_double_fast.c
|
||||
zstd_fast.c
|
||||
zstd_compress_sequences.c
|
||||
zstd_ldm.c
|
||||
hist.c
|
||||
zstd_compress.c
|
||||
zstd_lazy.c
|
||||
zstd_compress_literals.c
|
||||
huf_compress.c
|
||||
zstd_opt.c
|
||||
fse_compress.c)
|
||||
|
||||
set_default_compile_options(zstd.compress)
|
||||
|
||||
target_link_libraries(zstd.compress PUBLIC zstd.common)
|
||||
10
zstd/decompress/CMakeLists.txt
Normal file
10
zstd/decompress/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
||||
enable_language(ASM)
|
||||
|
||||
add_library(
|
||||
zstd.decompress STATIC
|
||||
zstd_ddict.c huf_decompress.c zstd_decompress.c zstd_decompress_block.c
|
||||
$<$<PLATFORM_ID:Darwin,Linux>:huf_decompress_amd64.S>)
|
||||
|
||||
set_default_compile_options(zstd.decompress)
|
||||
|
||||
target_link_libraries(zstd.decompress PUBLIC zstd.common)
|
||||
5
zstd/dictBuilder/CMakeLists.txt
Normal file
5
zstd/dictBuilder/CMakeLists.txt
Normal file
@ -0,0 +1,5 @@
|
||||
add_library(zstd.dictBuilder STATIC cover.c divsufsort.c fastcover.c zdict.c)
|
||||
|
||||
set_default_compile_options(zstd.dictBuilder)
|
||||
|
||||
target_link_libraries(zstd.dictBuilder PUBLIC zstd.common)
|
||||
Loading…
x
Reference in New Issue
Block a user