1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-21 01:44:21 +00:00

Update for recent versions. C++11. Backends moved to backends/ folder. Renamed reference to SDL to SDL2.

This commit is contained in:
ocornut 2025-05-02 17:35:03 +02:00
parent a67c7cf77e
commit 55402fdcf4
18 changed files with 78 additions and 100 deletions

View file

@ -2,10 +2,7 @@ if (TARGET imgui-metal AND TARGET imgui-osx)
# TODO proper bundling of assets for macOS and iOS
add_executable (imgui_example_apple_metal
Shared/main.m
Shared/AppDelegate.m
Shared/Renderer.mm
Shared/ViewController.mm
main.mm
)
target_link_libraries (imgui_example_apple_metal

View file

@ -1,11 +1,11 @@
if (TARGET imgui-sdl AND TARGET imgui-metal)
add_executable (imgui_example_sdl_metal main.mm)
if (TARGET imgui-sdl2 AND TARGET imgui-metal)
add_executable (imgui_example_sdl2_metal main.mm)
target_link_libraries (imgui_example_sdl_metal
imgui-sdl imgui-metal
target_link_libraries (imgui_example_sdl2_metal
imgui-sdl2 imgui-metal
)
set_target_properties (imgui_example_sdl_metal
set_target_properties (imgui_example_sdl2_metal
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}"
)
endif ()

View file

@ -1,11 +1,11 @@
if (TARGET imgui-sdl AND TARGET imgui-opengl2)
add_executable (imgui_example_sdl_opengl2 WIN32 main.cpp)
if (TARGET imgui-sdl2 AND TARGET imgui-opengl2)
add_executable (imgui_example_sdl2_opengl2 WIN32 main.cpp)
target_link_libraries (imgui_example_sdl_opengl2
imgui-sdl imgui-opengl2
target_link_libraries (imgui_example_sdl2_opengl2
imgui-sdl2 imgui-opengl2
)
set_target_properties (imgui_example_sdl_opengl2
set_target_properties (imgui_example_sdl2_opengl2
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}"
)
endif ()

View file

@ -1,11 +1,11 @@
if (TARGET imgui-sdl AND TARGET imgui-opengl)
add_executable (imgui_example_sdl_opengl3 main.cpp)
if (TARGET imgui-sdl2 AND TARGET imgui-opengl)
add_executable (imgui_example_sdl2_opengl3 main.cpp)
target_link_libraries (imgui_example_sdl_opengl3
imgui-sdl imgui-opengl
target_link_libraries (imgui_example_sdl2_opengl3
imgui-sdl2 imgui-opengl
)
set_target_properties (imgui_example_sdl_opengl3
set_target_properties (imgui_example_sdl2_opengl3
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}"
)
endif ()

View file

@ -1,26 +0,0 @@
if (WIN32)
find_library (D3D10_LIBRARY "d3d10")
if (NOT D3D10_LIBRARY)
message (WARNING "IMGUI_IMPL_DX10 set to ON but d3d10.dll not found")
endif ()
find_library (DXGI_LIBRARY "dxgi")
if (NOT DXGI_LIBRARY)
message (WARNING "IMGUI_IMPL_DX10 set to ON but dxgi.dll not found")
endif ()
if (D3D10_LIBRARY AND DXGI_LIBRARY)
add_library (imgui-dx10 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_dx10.cpp"
)
target_link_libraries (imgui-dx10 PUBLIC
imgui
${D3D10_LIBRARY} ${DXGI_LIBRARY}
)
target_include_directories (imgui-dx10 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
endif ()
else ()
message (WARNING "IMGUI_IMPL_DX10 set to ON but platform is not Win32")
endif ()

View file

@ -1,26 +0,0 @@
if (WIN32)
find_library (D3D11_LIBRARY "d3d11")
if (NOT D3D11_LIBRARY)
message (WARNING "IMGUI_IMPL_DX11 set to ON but d3d11.dll not found")
endif ()
find_library (DXGI_LIBRARY "dxgi")
if (NOT DXGI_LIBRARY)
message (WARNING "IMGUI_IMPL_DX11 set to ON but dxgi.dll not found")
endif ()
if (D3D11_LIBRARY AND DXGI_LIBRARY)
add_library (imgui-dx11 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_dx11.cpp"
)
target_link_libraries (imgui-dx11 PUBLIC
imgui
${D3D11_LIBRARY} ${DXGI_LIBRARY}
)
target_include_directories (imgui-dx11 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
endif ()
else ()
message (WARNING "IMGUI_IMPL_DX11 set to ON but platform is not Win32")
endif ()

View file

@ -1,26 +0,0 @@
if (WIN32)
find_library (D3D12_LIBRARY "d3d12")
if (NOT D3D12_LIBRARY)
message (WARNING "IMGUI_IMPL_DX12 set to ON but d3d12.dll not found")
endif ()
find_library (DXGI_LIBRARY "dxgi")
if (NOT DXGI_LIBRARY)
message (WARNING "IMGUI_IMPL_DX12 set to ON but dxgi.dll not found")
endif ()
if (D3D12_LIBRARY AND DXGI_LIBRARY)
add_library (imgui-dx12 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_dx12.cpp"
)
target_link_libraries (imgui-dx12 PUBLIC
imgui
${D3D12_LIBRARY} ${DXGI_LIBRARY}
)
target_include_directories (imgui-dx12 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
endif ()
else ()
message (WARNING "IMGUI_IMPL_DX12 set to ON but platform is not Win32")
endif ()

View file

@ -1,19 +0,0 @@
if (WIN32)
find_library (D3D9_LIBRARY "d3d9")
if (D3D9_LIBRARY)
add_library (imgui-dx9 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_dx9.cpp"
)
target_link_libraries (imgui-dx9 PUBLIC
imgui
${D3D9_LIBRARY}
)
target_include_directories (imgui-dx9 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
else ()
message (WARNING "IMGUI_IMPL_DX9 set to ON but d3d9.dll not found")
endif ()
else ()
message (WARNING "IMGUI_IMPL_DX9 set to ON but platform is not Win32")
endif ()

View file

@ -1,14 +0,0 @@
if (NOT TARGET glfw)
find_package (GLFW3 QUIET)
endif ()
if (TARGET glfw OR GLFW3_DIR)
add_library (imgui-glfw OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_glfw.cpp"
)
target_link_libraries (imgui-glfw PUBLIC imgui glfw)
target_include_directories (imgui-glfw PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
else ()
message (WARNING "IMGUI_IMPL_GLFW set to ON but glfw3 could not be located")
endif ()

View file

@ -1,26 +0,0 @@
find_package (GLUT QUIET)
if (GLUT_glut_LIBRARY)
add_library (imgui-glut OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_glut.cpp"
)
target_link_libraries (imgui-glut PUBLIC
imgui
"${GLUT_glut_LIBRARY}"
)
if (APPLE)
target_link_libraries (imgui-glut PUBLIC
"${GLUT_cocoa_LIBRARY}"
)
endif ()
target_include_directories (imgui-glut PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
target_include_directories (imgui-glut SYSTEM PUBLIC
"${GLUT_INCLUDE_DIR}"
)
else ()
message (WARNING "IMGUI_IMPL_GLUT set to ON but GLUT could not be found")
endif ()

View file

@ -1,19 +0,0 @@
if (APPLE)
add_library (imgui-metal OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_metal.mm"
)
target_link_libraries (imgui-metal PUBLIC
imgui
"-framework Cocoa" "-framework Metal" "-framework QuartzCore"
)
target_include_directories (imgui-metal PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
set_property (
TARGET imgui-metal
APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc"
)
else ()
message (WARNING "IMGUI_IMPL_METAL set to ON but platform is not Apple")
endif ()

View file

@ -1,40 +0,0 @@
find_package (OpenGL QUIET)
if (OPENGL_gl_LIBRARY)
if (IMGUI_IMPL_OPENGL2)
add_library (imgui-opengl2 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_opengl2.cpp"
)
target_link_libraries (imgui-opengl2 PUBLIC
imgui
"${OPENGL_gl_LIBRARY}"
)
target_include_directories (imgui-opengl2 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
target_include_directories (imgui-opengl2 SYSTEM PUBLIC "${OPENGL_INCLUDE_DIR}")
endif ()
if (IMGUI_IMPL_OPENGL)
find_package (GLEW)
if (GLEW_DIR)
add_library (imgui-opengl OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_opengl3.cpp"
)
target_link_libraries (imgui-opengl PUBLIC
imgui
"${OPENGL_gl_LIBRARY}"
glew
)
target_include_directories (imgui-opengl PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
target_include_directories (imgui-opengl SYSTEM PUBLIC "${OPENGL_INCLUDE_DIR}")
else ()
message (WARNING "IMGUI_IMPL_OPENGL set to ON but GLEW could not be found")
endif ()
endif ()
else ()
message (WARNING "IMGUI_IMPL_OPENGL and/or IMGUI_IMPL_OPENGL2 set to ON but OpenGL could not be found")
endif ()

View file

@ -1,15 +0,0 @@
if (APPLE)
add_library (imgui-osx OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_osx.mm"
)
target_link_libraries (imgui-osx PUBLIC imgui "-framework Cocoa" "-framework AppKit")
target_include_directories (imgui-osx PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
set_property (
TARGET imgui-osx
APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc"
)
else ()
message (WARNING "IMGUI_IMPL_OSX set to ON but platform is not Apple")
endif ()

View file

@ -1,19 +0,0 @@
find_package (SDL2 QUIET)
if (SDL2_DIR)
add_library (imgui-sdl OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_sdl.cpp"
)
target_link_libraries (imgui-sdl PUBLIC imgui sdl2)
target_include_directories (imgui-sdl PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
# Fixes a strange inclusion problem on MacOS due to an unconventional
# SDL installation with Homebrew. Innocuous if SDL is being pulled in
# from somewhere else.
if (APPLE)
target_include_directories (imgui-sdl SYSTEM PUBLIC "/usr/local/include/SDL2")
endif ()
else ()
message (WARNING "IMGUI_IMPL_SDL set to ON but SDL2 not found on system or in project")
endif ()

View file

@ -1,11 +0,0 @@
if (WIN32)
add_library (imgui-win32 OBJECT
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_win32.cpp"
)
target_link_libraries (imgui-win32 PUBLIC imgui)
target_include_directories (imgui-win32 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
else ()
message (WARNING "IMGUI_IMPL_WIN32 set to ON but platform is not Win32")
endif ()