mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
[build-system] Migrate test/ directory to CMakeLists
- remove MakeFile, replaced with equivalent CMakeLists.txt - add advanced option TRACY_DEMANGLE in client for CI testing
This commit is contained in:
parent
9688152505
commit
9cf61d6597
26
.github/workflows/linux.yml
vendored
26
.github/workflows/linux.yml
vendored
@ -42,12 +42,26 @@ jobs:
|
||||
run: meson setup -Dprefix=$GITHUB_WORKSPACE/bin/lib build && meson compile -C build && meson install -C build
|
||||
- name: Test application
|
||||
run: |
|
||||
make -j`nproc` -C test
|
||||
make -j`nproc` -C test clean
|
||||
make -j`nproc` -C test TRACYFLAGS=-DTRACY_ON_DEMAND
|
||||
make -j`nproc` -C test clean
|
||||
make -j`nproc` -C test TRACYFLAGS="-DTRACY_DELAYED_INIT -DTRACY_MANUAL_LIFETIME"
|
||||
make -C test -B ../public/TracyClient.o DEFINES='-DTRACY_DEMANGLE'
|
||||
# test compilation with different flags
|
||||
# we clean the build folder to reset cached variables between runs
|
||||
cmake -B test/build -S test -DCMAKE_BUILD_TYPE=Release
|
||||
cmake --build test/build --parallel
|
||||
rm -rf test/build
|
||||
|
||||
# same with TRACY_ON_DEMAND
|
||||
cmake -B test/build -S test -DCMAKE_BUILD_TYPE=Release -DTRACY_ON_DEMAND=ON .
|
||||
cmake --build test/build --parallel
|
||||
rm -rf test/build
|
||||
|
||||
# same with TRACY_DELAYED_INIT TRACY_MANUAL_LIFETIME
|
||||
cmake -B test/build -S test -DCMAKE_BUILD_TYPE=Release -DTRACY_DELAYED_INIT=ON -DTRACY_MANUAL_LIFETIME=ON .
|
||||
cmake --build test/build --parallel
|
||||
rm -rf test/build
|
||||
|
||||
# same with TRACY_DEMANGLE
|
||||
cmake -B test/build -S test -DCMAKE_BUILD_TYPE=Release -DTRACY_DEMANGLE=ON .
|
||||
cmake --build test/build --parallel
|
||||
rm -rf test/build
|
||||
- name: Find Artifacts
|
||||
id: find_artifacts
|
||||
run: |
|
||||
|
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -7,6 +7,7 @@
|
||||
"${workspaceFolder}/import-chrome",
|
||||
"${workspaceFolder}/import-fuchsia",
|
||||
"${workspaceFolder}/update",
|
||||
"${workspaceFolder}/test",
|
||||
"${workspaceFolder}",
|
||||
],
|
||||
"cmake.buildDirectory": "${sourceDirectory}/build",
|
||||
|
@ -83,6 +83,10 @@ set_option(TRACY_LIBUNWIND_BACKTRACE "Use libunwind backtracing where supported"
|
||||
set_option(TRACY_SYMBOL_OFFLINE_RESOLVE "Instead of full runtime symbol resolution, only resolve the image path and offset to enable offline symbol resolution" OFF)
|
||||
set_option(TRACY_LIBBACKTRACE_ELF_DYNLOAD_SUPPORT "Enable libbacktrace to support dynamically loaded elfs in symbol resolution resolution after the first symbol resolve operation" OFF)
|
||||
|
||||
# advanced
|
||||
set_option(TRACY_DEMANGLE "[advanced] Don't use default demangling function - You'll need to provide your own" OFF)
|
||||
mark_as_advanced(TRACY_DEMANGLE)
|
||||
|
||||
if(NOT TRACY_STATIC)
|
||||
target_compile_definitions(TracyClient PRIVATE TRACY_EXPORTS)
|
||||
target_compile_definitions(TracyClient PUBLIC TRACY_IMPORTS)
|
||||
|
37
test/CMakeLists.txt
Normal file
37
test/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
option(USE_DEBUGINFOD "Compile with debuginfod integration" OFF)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cmake/version.cmake)
|
||||
|
||||
# we target C++11 for the client part
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
project(
|
||||
tracy-test
|
||||
LANGUAGES C CXX
|
||||
VERSION ${TRACY_VERSION_STRING})
|
||||
|
||||
# a bit weird but works: include the client cmake config coming from top-level
|
||||
# cmake needs us to specify the build subfolder -> client/ this way we can
|
||||
# simply link the test executable against TracyClient
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/.. client/)
|
||||
|
||||
add_executable(tracy-test test.cpp)
|
||||
target_link_options(tracy-test PRIVATE -rdynamic)
|
||||
target_link_libraries(tracy-test TracyClient)
|
||||
|
||||
# OS-specific options
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND USE_DEBUGINFOD)
|
||||
target_compile_definitions(tracy-test PRIVATE TRACY_DEBUGINFOD)
|
||||
target_link_libraries(tracy-test "debuginfod")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||
target_link_libraries(tracy-test "execinfo")
|
||||
endif()
|
||||
|
||||
|
||||
# copy image file in build folder
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/image.jpg image.jpg COPYONLY)
|
@ -1,47 +0,0 @@
|
||||
OPTFLAGS := -g3 -fmerge-constants
|
||||
CFLAGS := $(OPTFLAGS) -Wall -DTRACY_ENABLE
|
||||
CXXFLAGS := $(CFLAGS) -std=gnu++11
|
||||
DEFINES +=
|
||||
INCLUDES := -I../public/tracy
|
||||
LIBS := -lpthread -ldl
|
||||
LDFLAGS := -rdynamic
|
||||
IMAGE := tracy_test
|
||||
|
||||
SRC := \
|
||||
test.cpp \
|
||||
../public/TracyClient.cpp
|
||||
|
||||
OBJ := $(SRC:%.cpp=%.o)
|
||||
|
||||
ifeq ($(shell uname -o),FreeBSD)
|
||||
LIBS += -lexecinfo
|
||||
endif
|
||||
|
||||
ifeq ($(shell uname),Linux)
|
||||
DEFINES += -DTRACY_DEBUGINFOD
|
||||
LIBS += -ldebuginfod
|
||||
endif
|
||||
|
||||
all: $(IMAGE)
|
||||
|
||||
%.o: %.cpp
|
||||
$(CXX) -c $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< -o $@
|
||||
|
||||
%.d : %.cpp
|
||||
@echo Resolving dependencies of $<
|
||||
@mkdir -p $(@D)
|
||||
@$(CXX) -MM $(INCLUDES) $(CXXFLAGS) $(DEFINES) $< > $@.$$$$; \
|
||||
sed 's,.*\.o[ :]*,$(<:.cpp=.o) $@ : ,g' < $@.$$$$ > $@; \
|
||||
rm -f $@.$$$$
|
||||
|
||||
$(IMAGE): $(OBJ)
|
||||
$(CXX) $(CXXFLAGS) $(DEFINES) $(OBJ) $(LIBS) $(LDFLAGS) -o $@
|
||||
|
||||
ifneq "$(MAKECMDGOALS)" "clean"
|
||||
-include $(SRC:.cpp=.d)
|
||||
endif
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) $(SRC:.cpp=.d) $(IMAGE)
|
||||
|
||||
.PHONY: clean all
|
@ -1,9 +1,9 @@
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <stdlib.h>
|
||||
#include "Tracy.hpp"
|
||||
#include "../common/TracySystem.hpp"
|
||||
#include "tracy/Tracy.hpp"
|
||||
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#define STBI_ONLY_JPEG
|
||||
@ -328,7 +328,10 @@ int main()
|
||||
|
||||
int x, y;
|
||||
auto image = stbi_load( "image.jpg", &x, &y, nullptr, 4 );
|
||||
|
||||
if(image == nullptr)
|
||||
{
|
||||
std::cerr << "Could not find image.jpg in the current working directory, skipping" << std::endl;
|
||||
}
|
||||
for(;;)
|
||||
{
|
||||
TracyMessageL( "Tick" );
|
||||
@ -337,7 +340,10 @@ int main()
|
||||
ZoneScoped;
|
||||
std::this_thread::sleep_for( std::chrono::milliseconds( 2 ) );
|
||||
}
|
||||
if(image != nullptr)
|
||||
{
|
||||
FrameImage( image, x, y, 0, false );
|
||||
}
|
||||
FrameMark;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user