1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00
imgui/CMakeLists.txt

100 lines
3.7 KiB
CMake

cmake_minimum_required (VERSION 3.10)
project(imgui VERSION 1.73.0 LANGUAGES CXX C)
set (CMAKE_CXX_STANDARD 11)
option (IMGUI_EXAMPLES "Build ImGui examples" ON)
option (IMGUI_DEMO "Include the ImGui demo window implementation in library" ON)
option (IMGUI_IMPL_SDL2 "Build the SDL implementation (only if supported)" ON)
option (IMGUI_IMPL_METAL "Build the Metal implementation (only if supported)" ${APPLE})
option (IMGUI_IMPL_OSX "Build the OSX implementation (only if supported)" ${APPLE})
option (IMGUI_IMPL_WIN32 "Build the Win32 (native winapi) implementation (only if supported)" ${WIN32})
option (IMGUI_IMPL_GLFW "Build the GLFW implementation (only if supported)" ON)
option (IMGUI_IMPL_GLUT "Build the GLUT implementation (only if supported)" ON)
option (IMGUI_IMPL_OPENGL "Build the OpenGL3 implementation (only if supported)" ON)
option (IMGUI_IMPL_OPENGL2 "Build the OpenGL2 (legacy) implementation (only if supported)" ${IMGUI_IMPL_OPENGL})
option (IMGUI_IMPL_DX9 "Build the DirectX 9 implementation (only if supported)" ${WIN32})
option (IMGUI_IMPL_DX10 "Build the DirectX 10 implementation (only if supported)" ${WIN32})
option (IMGUI_IMPL_DX11 "Build the DirectX 11 implementation (only if supported)" ${WIN32})
option (IMGUI_IMPL_DX12 "Build the DirectX 12 implementation (only if supported)" ${WIN32})
add_library (imgui
imgui.cpp
imgui_draw.cpp
imgui_tables.cpp
imgui_widgets.cpp
$<$<BOOL:IMGUI_DEMO>:imgui_demo.cpp>
)
add_library(imgui::imgui ALIAS imgui)
target_include_directories (imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
target_compile_features(imgui PRIVATE cxx_std_11)
if (IMGUI_EXAMPLES)
# Sets up polyfill libraries for Windows examples (e.g. GLFW)
include (examples/libs/glfw.cmake)
endif ()
if (NOT IMGUI_DEMO)
target_compile_definitions (imgui PUBLIC -DIMGUI_DISABLE_DEMO_WINDOWS=1)
endif ()
if (IMGUI_IMPL_SDL2)
include (backends/imgui_impl_sdl2.cmake)
endif ()
if (IMGUI_IMPL_METAL)
include (backends/imgui_impl_metal.cmake)
endif ()
if (IMGUI_IMPL_OSX)
include (backends/imgui_impl_osx.cmake)
endif ()
if (IMGUI_IMPL_WIN32)
include (backends/imgui_impl_win32.cmake)
endif ()
if (IMGUI_IMPL_GLFW)
include (backends/imgui_impl_glfw.cmake)
endif ()
if (IMGUI_IMPL_OPENGL OR IMGUI_IMPL_OPENGL2)
include (backends/imgui_impl_opengl.cmake)
endif ()
if (IMGUI_IMPL_GLUT)
include (backends/imgui_impl_glut.cmake)
endif ()
if (IMGUI_IMPL_DX9)
include (backends/imgui_impl_dx9.cmake)
endif ()
if (IMGUI_IMPL_DX10)
include (backends/imgui_impl_dx10.cmake)
endif ()
if (IMGUI_IMPL_DX11)
include (backends/imgui_impl_dx11.cmake)
endif ()
if (IMGUI_IMPL_DX12)
include (backends/imgui_impl_dx12.cmake)
endif ()
if (IMGUI_EXAMPLES)
set (IMGUI_EXAMPLE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
#add_subdirectory (examples/example_allegro5)
add_subdirectory (examples/example_apple_metal)
add_subdirectory (examples/example_apple_opengl2)
#add_subdirectory (examples/example_emscripten)
add_subdirectory (examples/example_glfw_metal)
add_subdirectory (examples/example_glfw_opengl2)
add_subdirectory (examples/example_glfw_opengl3)
#add_subdirectory (examples/example_glfw_vulkan)
add_subdirectory (examples/example_glut_opengl2)
add_subdirectory (examples/example_null)
#add_subdirectory (examples/example_sdl2_directx11)
add_subdirectory (examples/example_sdl2_metal)
add_subdirectory (examples/example_sdl2_opengl2)
add_subdirectory (examples/example_sdl2_opengl3)
#add_subdirectory (examples/example_sdl2_vulkan)
add_subdirectory (examples/example_win32_directx10)
add_subdirectory (examples/example_win32_directx11)
add_subdirectory (examples/example_win32_directx12)
add_subdirectory (examples/example_win32_directx9)
endif ()