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

On macOS, tracy-profiler is being launched from command line and from Xcode debugger #920

Open
alecazam opened this issue Nov 6, 2024 · 2 comments

Comments

@alecazam
Copy link

alecazam commented Nov 6, 2024

I'm not sure where this is happening, but cmake seems to launch the tracy-profiler while the debugger does the same thing. So then get two copies of tracy-profiler. Killing the first process (from debugger) ends the debugging session, but the second one (spawned from terminal) is left running. Killing only the second, and then pausing the first, causes another tracy-profiler app to launch when the first is resumed.

This is the output I see in terminal:

% abspathfoo/build/_deps/tracy-build/profiler/Debug/tracy-profiler ; exit;

@alecazam
Copy link
Author

alecazam commented Nov 7, 2024

This seems to be the fix. Any graphical app (like tracy-profiler) needs to enable the macOS bundle. This allows the app to run from the debugger without launching multiple copies.

CMakeLists.txt on tracy-profiler

elseif(APPLE)
    # adding MACOSX_BUNDLE here seemed to fix the multiple launches
    add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${PROFILER_FILES} ${COMMON_FILES} ${SERVER_FILES})
else()
    add_executable(${PROJECT_NAME} MACOSX_BUNDLE ${PROFILER_FILES} ${COMMON_FILES} ${SERVER_FILES})
endif()

Also add this, but above seemed to fix the issue.  I just have BUNDLE set on all my other CMake files for macOS apps.

if(APPLE)
# added BUNDLE here
install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

@alecazam
Copy link
Author

alecazam commented Nov 7, 2024

Also this prevents an runtime error on macOS which doesn't have window icons.

main.cpp, line 387 on tracy-profiler

#ifndef __APPLE__
    backend.SetIcon( iconPx, iconX, iconY );
#endif

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

No branches or pull requests

2 participants
@alecazam and others