2024-11-20 03:48:50 +00:00
|
|
|
project(imgui)
|
|
|
|
|
|
|
|
# Silence Warnings
|
|
|
|
add_compile_options(-w)
|
|
|
|
|
|
|
|
## ImGui
|
|
|
|
|
|
|
|
# Build
|
|
|
|
add_library(imgui SHARED
|
|
|
|
src/imgui.cpp
|
|
|
|
src/imgui_draw.cpp
|
|
|
|
src/imgui_tables.cpp
|
|
|
|
src/imgui_widgets.cpp
|
2024-11-21 07:16:25 +00:00
|
|
|
src/misc/cpp/imgui_stdlib.cpp
|
2024-11-20 03:48:50 +00:00
|
|
|
src/backends/imgui_impl_glfw.cpp
|
|
|
|
src/backends/imgui_impl_opengl2.cpp
|
|
|
|
)
|
|
|
|
setup_header_dirs(imgui
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/backends"
|
2024-11-21 07:16:25 +00:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/misc/cpp"
|
2024-11-20 03:48:50 +00:00
|
|
|
)
|
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
target_link_libraries(imgui PUBLIC glfw OpenGL::GL)
|
|
|
|
|
2024-11-20 06:00:25 +00:00
|
|
|
# Fonts
|
|
|
|
embed_resource(imgui src/misc/fonts/Roboto-Medium.ttf)
|
|
|
|
embed_resource(imgui src/misc/fonts/Cousine-Regular.ttf)
|
|
|
|
|
2024-11-20 17:36:34 +00:00
|
|
|
# Configure
|
|
|
|
target_compile_definitions(imgui PUBLIC
|
|
|
|
IMGUI_DISABLE_DEMO_WINDOWS
|
|
|
|
IMGUI_DISABLE_DEBUG_TOOLS
|
|
|
|
IMGUI_DISABLE_DEFAULT_FONT
|
2024-11-21 08:29:37 +00:00
|
|
|
IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
2024-11-20 17:36:34 +00:00
|
|
|
)
|
|
|
|
|
2024-11-20 03:48:50 +00:00
|
|
|
# Patch
|
2024-11-20 06:00:25 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND "patch" "-p1" "--forward" "--reject-file=-"
|
|
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src"
|
|
|
|
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/fix-hidpi.patch"
|
|
|
|
OUTPUT_QUIET
|
|
|
|
)
|
2024-11-20 03:48:50 +00:00
|
|
|
|
|
|
|
# Install
|
|
|
|
setup_library(imgui TRUE TRUE)
|
|
|
|
|
|
|
|
# License
|
2024-11-20 06:00:25 +00:00
|
|
|
install(FILES src/LICENSE.txt src/docs/FONTS.md DESTINATION "${MCPI_LEGAL_DIR}/ImGui")
|