1
0
mirror of https://github.com/wolfpld/tracy synced 2025-04-29 04:23:51 +00:00

Add documentation for CMake integration

This commit is contained in:
Lukas Berbuer 2021-08-01 12:46:29 +02:00
parent 0fe755fc85
commit 958386709f
2 changed files with 22 additions and 8 deletions

View File

@ -55,10 +55,3 @@ set_option(TRACY_NO_FRAME_IMAGE)
set_option(TRACE_NO_SAMPLING)
set_option(TRACY_NO_VERIFY)
set_option(TRACY_NO_VSYNC_CAPTURE)
if(NOT TRACY_PORT)
set(TRACY_PORT 8086)
endif()
message(STATUS "TRACY_PORT: ${TRACY_PORT}")
target_compile_definitions(TracyClient PUBLIC TRACY_PORT=${TRACY_PORT})

View File

@ -425,6 +425,27 @@ The application you want to profile should be compiled with all the usual optimi
Finally, on Unix make sure that the application is linked with libraries \texttt{libpthread} and \texttt{libdl}. BSD systems will also need to be linked with \texttt{libexecinfo}.
\begin{bclogo}[
noborder=true,
couleur=black!5,
logo=\bclampe
]{CMake integration}
You can integrate Tracy easily with CMake by adding the git submodule folder as a subdirectory.
\begin{lstlisting}
# set options before add_subdirectory
# available options: TRACY_ENABLE, TRACY_ON_DEMAND, TRACY_NO_BROADCAST, TRACY_NO_CODE_TRANSFER, ...
option(TRACY_ENABLE "" ON)
option(TRACY_ON_DEMAND "" ON)
add_subdirectory(3rdparty/tracy) # target: TracyClient or alias Tracy::TracyClient
\end{lstlisting}
Link \texttt{Tracy::TracyClient} to any target where you use Tracy for profiling:
\begin{lstlisting}
target_link_libraries(<TARGET> PUBLIC Tracy::TracyClient)
\end{lstlisting}
\end{bclogo}
\begin{bclogo}[
noborder=true,
@ -448,7 +469,7 @@ FetchContent_MakeAvailable(tracy)
Then add this to any target where you use tracy for profiling:
\begin{lstlisting}
target_link_libraries(${_target} PUBLIC TracyClient)
target_link_libraries(<TARGET> PUBLIC TracyClient)
\end{lstlisting}
\end{bclogo}