Skip to content

Commit 55402fd

Browse files
committed
Update for recent versions. C++11. Backends moved to backends/ folder. Renamed reference to SDL to SDL2.
1 parent a67c7cf commit 55402fd

18 files changed

+78
-100
lines changed

CMakeLists.txt

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
cmake_minimum_required (VERSION 3.8.2)
1+
cmake_minimum_required (VERSION 3.10)
22
project(imgui VERSION 1.73.0 LANGUAGES CXX C)
3+
set (CMAKE_CXX_STANDARD 11)
34

45
option (IMGUI_EXAMPLES "Build ImGui examples" ON)
56
option (IMGUI_DEMO "Include the ImGui demo window implementation in library" ON)
67

7-
option (IMGUI_IMPL_SDL "Build the SDL implementation (only if supported)" ON)
8+
option (IMGUI_IMPL_SDL2 "Build the SDL implementation (only if supported)" ON)
89
option (IMGUI_IMPL_METAL "Build the Metal implementation (only if supported)" ${APPLE})
910
option (IMGUI_IMPL_OSX "Build the OSX implementation (only if supported)" ${APPLE})
1011
option (IMGUI_IMPL_WIN32 "Build the Win32 (native winapi) implementation (only if supported)" ${WIN32})
1112
option (IMGUI_IMPL_GLFW "Build the GLFW implementation (only if supported)" ON)
1213
option (IMGUI_IMPL_GLUT "Build the GLUT implementation (only if supported)" ON)
13-
option (IMGUI_IMPL_OPENGL "Build the OpenGL implementation (only if supported)" ON)
14-
option (IMGUI_IMPL_OPENGL2 "Build the OpenGL 2 (legacy) implementation (only if supported)" ${IMGUI_IMPL_OPENGL})
14+
option (IMGUI_IMPL_OPENGL "Build the OpenGL3 implementation (only if supported)" ON)
15+
option (IMGUI_IMPL_OPENGL2 "Build the OpenGL2 (legacy) implementation (only if supported)" ${IMGUI_IMPL_OPENGL})
1516
option (IMGUI_IMPL_DX9 "Build the DirectX 9 implementation (only if supported)" ${WIN32})
1617
option (IMGUI_IMPL_DX10 "Build the DirectX 10 implementation (only if supported)" ${WIN32})
1718
option (IMGUI_IMPL_DX11 "Build the DirectX 11 implementation (only if supported)" ${WIN32})
@@ -20,6 +21,7 @@ option (IMGUI_IMPL_DX12 "Build the DirectX 12 implementation (only if supported)
2021
add_library (imgui
2122
imgui.cpp
2223
imgui_draw.cpp
24+
imgui_tables.cpp
2325
imgui_widgets.cpp
2426
$<$<BOOL:IMGUI_DEMO>:imgui_demo.cpp>
2527
)
@@ -28,7 +30,7 @@ add_library(imgui::imgui ALIAS imgui)
2830

2931
target_include_directories (imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
3032

31-
target_compile_features(imgui PRIVATE cxx_std_98)
33+
target_compile_features(imgui PRIVATE cxx_std_11)
3234

3335
if (IMGUI_EXAMPLES)
3436
# Sets up polyfill libraries for Windows examples (e.g. GLFW)
@@ -39,38 +41,38 @@ if (NOT IMGUI_DEMO)
3941
target_compile_definitions (imgui PUBLIC -DIMGUI_DISABLE_DEMO_WINDOWS=1)
4042
endif ()
4143

42-
if (IMGUI_IMPL_SDL)
43-
include (examples/imgui_impl_sdl.cmake)
44+
if (IMGUI_IMPL_SDL2)
45+
include (backends/imgui_impl_sdl2.cmake)
4446
endif ()
4547
if (IMGUI_IMPL_METAL)
46-
include (examples/imgui_impl_metal.cmake)
48+
include (backends/imgui_impl_metal.cmake)
4749
endif ()
4850
if (IMGUI_IMPL_OSX)
49-
include (examples/imgui_impl_osx.cmake)
51+
include (backends/imgui_impl_osx.cmake)
5052
endif ()
5153
if (IMGUI_IMPL_WIN32)
52-
include (examples/imgui_impl_win32.cmake)
54+
include (backends/imgui_impl_win32.cmake)
5355
endif ()
5456
if (IMGUI_IMPL_GLFW)
55-
include (examples/imgui_impl_glfw.cmake)
57+
include (backends/imgui_impl_glfw.cmake)
5658
endif ()
5759
if (IMGUI_IMPL_OPENGL OR IMGUI_IMPL_OPENGL2)
58-
include (examples/imgui_impl_opengl.cmake)
60+
include (backends/imgui_impl_opengl.cmake)
5961
endif ()
6062
if (IMGUI_IMPL_GLUT)
61-
include (examples/imgui_impl_glut.cmake)
63+
include (backends/imgui_impl_glut.cmake)
6264
endif ()
6365
if (IMGUI_IMPL_DX9)
64-
include (examples/imgui_impl_dx9.cmake)
66+
include (backends/imgui_impl_dx9.cmake)
6567
endif ()
6668
if (IMGUI_IMPL_DX10)
67-
include (examples/imgui_impl_dx10.cmake)
69+
include (backends/imgui_impl_dx10.cmake)
6870
endif ()
6971
if (IMGUI_IMPL_DX11)
70-
include (examples/imgui_impl_dx11.cmake)
72+
include (backends/imgui_impl_dx11.cmake)
7173
endif ()
7274
if (IMGUI_IMPL_DX12)
73-
include (examples/imgui_impl_dx12.cmake)
75+
include (backends/imgui_impl_dx12.cmake)
7476
endif ()
7577

7678
if (IMGUI_EXAMPLES)
@@ -86,11 +88,11 @@ if (IMGUI_EXAMPLES)
8688
#add_subdirectory (examples/example_glfw_vulkan)
8789
add_subdirectory (examples/example_glut_opengl2)
8890
add_subdirectory (examples/example_null)
89-
#add_subdirectory (examples/example_sdl_directx11)
90-
add_subdirectory (examples/example_sdl_metal)
91-
add_subdirectory (examples/example_sdl_opengl2)
92-
add_subdirectory (examples/example_sdl_opengl3)
93-
#add_subdirectory (examples/example_sdl_vulkan)
91+
#add_subdirectory (examples/example_sdl2_directx11)
92+
add_subdirectory (examples/example_sdl2_metal)
93+
add_subdirectory (examples/example_sdl2_opengl2)
94+
add_subdirectory (examples/example_sdl2_opengl3)
95+
#add_subdirectory (examples/example_sdl2_vulkan)
9496
add_subdirectory (examples/example_win32_directx10)
9597
add_subdirectory (examples/example_win32_directx11)
9698
add_subdirectory (examples/example_win32_directx12)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

backends/imgui_impl_opengl.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
find_package (OpenGL QUIET)
2+
3+
if (OPENGL_gl_LIBRARY)
4+
if (IMGUI_IMPL_OPENGL2)
5+
add_library (imgui-opengl2 OBJECT
6+
"${CMAKE_CURRENT_LIST_DIR}/imgui_impl_opengl2.cpp"
7+
)
8+
9+
target_link_libraries (imgui-opengl2 PUBLIC
10+
imgui
11+
"${OPENGL_gl_LIBRARY}"
12+
)
13+
14+
target_include_directories (imgui-opengl2 PUBLIC "${CMAKE_CURRENT_LIST_DIR}")
15+
target_include_directories (imgui-opengl2 SYSTEM PUBLIC "${OPENGL_INCLUDE_DIR}")
16+
endif ()
17+
else ()
18+
message (WARNING "IMGUI_IMPL_OPENGL and/or IMGUI_IMPL_OPENGL2 set to ON but OpenGL could not be found")
19+
endif ()
File renamed without changes.

0 commit comments

Comments
 (0)