Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IDE] migrate test folder to CMake configuration #824

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

Arpafaucon
Copy link
Contributor

@Arpafaucon Arpafaucon commented Jul 3, 2024

As discussed via discord, here's a proposed PR to migrate test.

Some notes

  • I kept DEBUGINFOD enabled by default on linux platforms like in the MakeFile
  • we "include" the top-level CmakeLists.txt to get the TracyClient target - that's a bit unorthodox but seems to work well
  • on my Ubuntu machine, I don't need to link explicitly against pthread but IIRC some other Linux need it, so I kept it explicit for everyone
  • -ldl link option seems implicitly added by CMake, so I don't mention it explictly
  • updated std= option from gnu++11 to gnu++20 to align with other projects
  • due to the way CMake works, the -Wall -g3 -fmerge-constants options are not propagated anymore to TracyClient.cpp (because it's a different library) - people will have to add them explicitly for debugging if needed.

For comparison, here are the new compilation lines (I had disabled DEBUGINFOD for this run)

/usr/bin/c++ -DTRACY_ENABLE -isystem /home/gregoire.roussel/dev/perf/tracy/public -std=gnu++20 -MD -MT client/CMakeFiles/TracyClient.dir/public/TracyClient.cpp.o -MF CMakeFiles/TracyClient.dir/public/TracyClient.cpp.o.d -o CMakeFiles/TracyClient.dir/public/TracyClient.cpp.o -c /home/gregoire.roussel/dev/perf/tracy/public/TracyClient.cpp
/usr/bin/c++ -DTRACY_ENABLE -isystem /home/gregoire.roussel/dev/perf/tracy/public -Wall -g3 -fmerge-constants -std=gnu++20 -MD -MT CMakeFiles/tracy-test.dir/test.cpp.o -MF CMakeFiles/tracy-test.dir/test.cpp.o.d -o CMakeFiles/tracy-test.dir/test.cpp.o -c /home/gregoire.roussel/dev/perf/tracy/test/test.cpp
/usr/bin/c++ -rdynamic CMakeFiles/tracy-test.dir/test.cpp.o -o tracy-test  client/libTracyClient.a -lpthread -ldl

and the compilation lines of the makefile on master

g++ -c -I../public/tracy -g3 -fmerge-constants -Wall -DTRACY_ENABLE -std=gnu++11  test.cpp -o test.o
g++ -c -I../public/tracy -g3 -fmerge-constants -Wall -DTRACY_ENABLE -std=gnu++11  ../public/TracyClient.cpp -o ../public/TracyClient.o
g++ -g3 -fmerge-constants -Wall -DTRACY_ENABLE -std=gnu++11  test.o ../public/TracyClient.o -lpthread -ldl -rdynamic -o tracy_test

Additional changes

I also added a safeguard around the use of the image to detect when the loading failed. It took me some time to understand I was not running the executable from the right location; I hope error lines will help the next dev :)

test/CMakeLists.txt Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/CMakeLists.txt Outdated Show resolved Hide resolved
test/test.cpp Outdated Show resolved Hide resolved
@Arpafaucon
Copy link
Contributor Author

Like always, I forgot about the CI configuration. I updated it for CMake, and I had to add the advanced option TRACY_DEMANGLE to match the existing test

- remove MakeFile, replaced with equivalent CMakeLists.txt
- add advanced option TRACY_DEMANGLE in client for CI testing
@Arpafaucon Arpafaucon requested a review from wolfpld July 3, 2024 12:28
@wolfpld wolfpld merged commit 6d1deb5 into wolfpld:master Jul 3, 2024
4 checks passed
@Arpafaucon Arpafaucon deleted the cmake-config-test branch July 3, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants