Files
allwpilib/thirdparty/imgui_suite/CMakeLists.txt
Tyler Veness af7d68e993 [wpiutil] Use C++23 stacktrace library on Windows (#6839)
This lets us remove the unmaintained StackWalker library and its hacky
upstream_utils script.

@Gold856 reported that StackWalker gives blank stacktraces:
https://discord.com/channels/176186766946992128/368993897495527424/1261940029287301150.
They also reported an earlier version of this PR giving the following
stacktrace instead:
```
D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(18): developerRobotCpp!Robot::RobotInit+0xB6
D:\allwpilib\wpilibc\src\main\native\cpp\TimedRobot.cpp(22): wpilibcd!frc::TimedRobot::StartCompetition+0x4F
D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(36): developerRobotCpp!frc::impl::RunRobot<Robot>+0xC8
D:\allwpilib\wpilibc\src\main\native\include\frc\RobotBase.h(106): developerRobotCpp!frc::StartRobot<Robot>+0x17E
D:\allwpilib\developerRobot\src\main\native\cpp\Robot.cpp(60): developerRobotCpp!main+0xB
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(79): developerRobotCpp!invoke_main+0x39
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(288): developerRobotCpp!__scrt_common_main_seh+0x132
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl(331): developerRobotCpp!__scrt_common_main+0xE
D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_main.cpp(17): developerRobotCpp!mainCRTStartup+0xE
KERNEL32!BaseThreadInitThunk+0x1D
ntdll!RtlUserThreadStart+0x28
```
2026-04-26 00:15:39 -07:00

62 lines
2.2 KiB
CMake

include(LinkMacOSGUI)
set(SAVE_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
set(GLFW_INSTALL OFF)
add_subdirectory("glfw")
set(BUILD_SHARED_LIBS ${SAVE_BUILD_SHARED_LIBS})
export(TARGETS glfw FILE glfw.cmake NAMESPACE glfw::)
# Add imgui directly to our build.
file(GLOB imgui_sources imgui/cpp/*.cpp imgui/cpp/misc/cpp/*.cpp)
file(GLOB implot_sources implot/cpp/*.cpp)
file(GLOB fonts_sources generated/fonts/src/*.cpp)
set(imgui_all_sources
${imgui_sources}
${implot_sources}
${fonts_sources}
imgui/cpp/backends/imgui_impl_glfw.cpp
imgui/cpp/backends/imgui_impl_opengl3.cpp
generated/gl3w/src/gl3w.c
stb/cpp/stb_image.cpp
)
if(MSVC)
add_library(imgui STATIC ${imgui_all_sources})
else()
add_library(imgui ${imgui_all_sources})
endif()
target_compile_definitions(imgui PUBLIC IMGUI_IMPL_OPENGL_LOADER_GL3W)
if(MSVC)
target_sources(imgui PRIVATE imgui/cpp/backends/imgui_impl_dx11.cpp)
else()
if(APPLE)
target_compile_options(imgui PRIVATE -fobjc-arc)
wpilib_link_macos_gui(imgui)
target_sources(imgui PRIVATE imgui/cpp/backends/imgui_impl_metal.mm)
else()
#target_sources(imgui PRIVATE imgui/cpp/backends/imgui_impl_opengl3.cpp)
endif()
endif()
target_link_libraries(imgui PUBLIC glfw)
target_include_directories(
imgui
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/imgui/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/imgui/include/misc/cpp>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/imgui/include/backends>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/implot/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/generated/gl3w/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/generated/fonts/include>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/stb/include>"
PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
)
target_compile_features(imgui PUBLIC cxx_std_23)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0)
target_compile_options(imgui PUBLIC -Wno-nontrivial-memcall)
endif()
install(TARGETS imgui EXPORT imgui)
export(TARGETS imgui FILE imgui.cmake NAMESPACE imgui::)