2023-12-18 20:03:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2024-03-17 11:55:48 +00:00
|
|
|
option(NO_FILESELECTOR "Disable the file selector" OFF)
|
|
|
|
option(GTK_FILESELECTOR "Use the GTK file selector on Linux instead of the xdg-portal one" OFF)
|
|
|
|
option(LEGACY "Instead of Wayland, use the legacy X11 backend on Linux" OFF)
|
|
|
|
option(NO_ISA_EXTENSIONS "Disable ISA extensions (don't pass -march=native or -mcpu=native to the compiler)" OFF)
|
|
|
|
option(NO_STATISTICS "Disable calculation of statistics" OFF)
|
2024-06-04 00:22:35 +00:00
|
|
|
option(SELF_PROFILE "Enable self-profiling" OFF)
|
2024-06-07 22:20:12 +00:00
|
|
|
option(NO_PARALLEL_STL "Disable parallel STL" OFF)
|
2023-12-18 20:03:15 +00:00
|
|
|
|
2024-03-16 13:29:39 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake)
|
2023-12-18 20:03:15 +00:00
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
|
|
|
project(
|
|
|
|
tracy-profiler
|
2024-04-30 11:44:07 +00:00
|
|
|
LANGUAGES C CXX
|
2023-12-18 20:03:15 +00:00
|
|
|
VERSION ${TRACY_VERSION_STRING}
|
|
|
|
)
|
|
|
|
|
2024-03-17 12:25:29 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/config.cmake)
|
2024-03-16 13:29:39 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/vendor.cmake)
|
2024-03-17 11:55:48 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/server.cmake)
|
2023-12-18 20:03:15 +00:00
|
|
|
|
|
|
|
set(SERVER_FILES
|
2024-06-07 20:47:56 +00:00
|
|
|
TracyAchievementData.cpp
|
2024-06-06 16:06:15 +00:00
|
|
|
TracyAchievements.cpp
|
2024-03-17 12:15:54 +00:00
|
|
|
TracyBadVersion.cpp
|
|
|
|
TracyColor.cpp
|
|
|
|
TracyEventDebug.cpp
|
|
|
|
TracyFileselector.cpp
|
|
|
|
TracyFilesystem.cpp
|
|
|
|
TracyImGui.cpp
|
|
|
|
TracyMicroArchitecture.cpp
|
|
|
|
TracyMouse.cpp
|
|
|
|
TracyProtoHistory.cpp
|
|
|
|
TracySourceContents.cpp
|
|
|
|
TracySourceTokenizer.cpp
|
|
|
|
TracySourceView.cpp
|
|
|
|
TracyStorage.cpp
|
|
|
|
TracyTexture.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
|
2024-09-07 16:05:36 +00:00
|
|
|
TracyView_FlameGraph.cpp
|
2024-03-17 12:15:54 +00:00
|
|
|
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
|
2023-12-18 20:03:15 +00:00
|
|
|
)
|
|
|
|
|
2024-03-17 12:15:54 +00:00
|
|
|
list(TRANSFORM SERVER_FILES PREPEND "src/profiler/")
|
|
|
|
|
2023-12-18 20:03:15 +00:00
|
|
|
set(PROFILER_FILES
|
|
|
|
src/imgui/imgui_impl_opengl3.cpp
|
|
|
|
src/ConnectionHistory.cpp
|
|
|
|
src/Filters.cpp
|
|
|
|
src/Fonts.cpp
|
|
|
|
src/HttpRequest.cpp
|
|
|
|
src/ImGuiContext.cpp
|
|
|
|
src/ini.c
|
|
|
|
src/IsElevated.cpp
|
|
|
|
src/main.cpp
|
|
|
|
src/ResolvService.cpp
|
|
|
|
src/RunQueue.cpp
|
|
|
|
src/WindowPosition.cpp
|
|
|
|
src/winmain.cpp
|
|
|
|
src/winmainArchDiscovery.cpp
|
|
|
|
)
|
|
|
|
|
2024-09-08 12:52:57 +00:00
|
|
|
set(INCLUDES "${CMAKE_CURRENT_BINARY_DIR}")
|
2023-12-18 20:03:15 +00:00
|
|
|
set(LIBS "")
|
|
|
|
|
2024-03-16 17:13:02 +00:00
|
|
|
if(USE_WAYLAND)
|
2023-12-18 20:03:15 +00:00
|
|
|
pkg_check_modules(WAYLAND REQUIRED egl wayland-egl wayland-cursor xkbcommon)
|
|
|
|
set(LIBS "${LIBS};${WAYLAND_LIBRARIES}")
|
|
|
|
set(PROFILER_FILES ${PROFILER_FILES}
|
|
|
|
src/BackendWayland.cpp
|
2024-03-19 21:14:12 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/FindWaylandScanner.cmake)
|
|
|
|
|
2024-09-13 20:30:19 +00:00
|
|
|
CPMAddPackage(
|
|
|
|
NAME wayland-protocols
|
|
|
|
GIT_REPOSITORY https://gitlab.freedesktop.org/wayland/wayland-protocols.git
|
|
|
|
GIT_TAG 1.37
|
|
|
|
DOWNLOAD_ONLY YES
|
|
|
|
)
|
2024-03-19 21:14:12 +00:00
|
|
|
|
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/stable/xdg-shell/xdg-shell.xml
|
2024-03-19 21:14:12 +00:00
|
|
|
BASENAME xdg-shell
|
|
|
|
)
|
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/staging/xdg-activation/xdg-activation-v1.xml
|
2024-03-19 21:14:12 +00:00
|
|
|
BASENAME xdg-activation
|
|
|
|
)
|
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
|
2024-03-19 21:14:12 +00:00
|
|
|
BASENAME xdg-decoration
|
2023-12-18 20:03:15 +00:00
|
|
|
)
|
2024-03-23 17:39:25 +00:00
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/staging/fractional-scale/fractional-scale-v1.xml
|
2024-03-23 17:39:25 +00:00
|
|
|
BASENAME fractional-scale
|
|
|
|
)
|
2024-03-23 20:22:01 +00:00
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/stable/viewporter/viewporter.xml
|
2024-03-23 20:22:01 +00:00
|
|
|
BASENAME viewporter
|
|
|
|
)
|
2024-03-24 00:22:57 +00:00
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/staging/cursor-shape/cursor-shape-v1.xml
|
2024-03-24 00:22:57 +00:00
|
|
|
BASENAME cursor-shape
|
|
|
|
)
|
|
|
|
ecm_add_wayland_client_protocol(PROFILER_FILES
|
2024-09-13 20:30:19 +00:00
|
|
|
PROTOCOL ${wayland-protocols_SOURCE_DIR}/unstable/tablet/tablet-unstable-v2.xml
|
2024-03-24 00:22:57 +00:00
|
|
|
BASENAME tablet
|
|
|
|
)
|
2024-03-16 17:13:02 +00:00
|
|
|
else()
|
|
|
|
set(PROFILER_FILES ${PROFILER_FILES}
|
|
|
|
src/BackendGlfw.cpp
|
|
|
|
src/imgui/imgui_impl_glfw.cpp
|
|
|
|
)
|
2023-12-18 20:03:15 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(${INCLUDES})
|
|
|
|
link_libraries(${LIBS})
|
|
|
|
|
2024-06-04 00:22:35 +00:00
|
|
|
if(SELF_PROFILE)
|
|
|
|
add_definitions(-DTRACY_ENABLE)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O3 -fno-omit-frame-pointer")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O3 -fno-omit-frame-pointer")
|
|
|
|
set(PROFILER_FILES ${PROFILER_FILES}
|
|
|
|
../public/TracyClient.cpp
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-16 17:30:43 +00:00
|
|
|
if(WIN32)
|
|
|
|
set(PROFILER_FILES ${PROFILER_FILES}
|
|
|
|
win32/Tracy.manifest
|
|
|
|
win32/Tracy.rc
|
|
|
|
)
|
|
|
|
add_executable(${PROJECT_NAME} WIN32 ${PROFILER_FILES} ${COMMON_FILES} ${SERVER_FILES})
|
2024-04-14 16:13:51 +00:00
|
|
|
set_property(DIRECTORY ${CMAKE_CURRENT_LIST_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
|
2024-03-16 17:30:43 +00:00
|
|
|
else()
|
|
|
|
add_executable(${PROJECT_NAME} ${PROFILER_FILES} ${COMMON_FILES} ${SERVER_FILES})
|
|
|
|
endif()
|
|
|
|
|
2024-03-20 21:25:24 +00:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE TracyServer TracyImGui)
|
|
|
|
|
2024-09-08 12:17:11 +00:00
|
|
|
add_custom_target(git-ref
|
|
|
|
COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/../extra/git-ref.py
|
|
|
|
BYPRODUCTS GitRef.hpp
|
|
|
|
)
|
|
|
|
add_dependencies(${PROJECT_NAME} git-ref)
|
|
|
|
|
2024-03-20 21:25:24 +00:00
|
|
|
if(NOT EMSCRIPTEN)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE TracyNfd)
|
|
|
|
if (NOT USE_WAYLAND)
|
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE TracyGlfw3)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EMSCRIPTEN)
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_FLAGS "-sUSE_FREETYPE=1 -pthread -DIMGUI_IMPL_OPENGL_ES2")
|
|
|
|
set_property(TARGET ${PROJECT_NAME} PROPERTY LINK_FLAGS "-sASSERTIONS=0 -sUSE_GLFW=3 -sINITIAL_MEMORY=384mb -sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=4gb -sWASM_BIGINT=1 -sPTHREAD_POOL_SIZE=4 -sEXPORTED_FUNCTIONS=_main,_nativeResize,_nativeOpenFile -sEXPORTED_RUNTIME_METHODS=ccall -sENVIRONMENT=web,worker --preload-file embed.tracy")
|
|
|
|
|
|
|
|
file(DOWNLOAD https://share.nereid.pl/i/embed.tracy ${CMAKE_CURRENT_BINARY_DIR}/embed.tracy EXPECTED_MD5 ca0fa4f01e7b8ca5581daa16b16c768d)
|
|
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/wasm/index.html DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
file(COPY ${CMAKE_CURRENT_LIST_DIR}/wasm/httpd.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif()
|
2024-02-05 17:46:55 +00:00
|
|
|
|
|
|
|
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|