mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 01:20:55 +01:00
add basic CMake implementation for integrating imgui in other CMake
projects or extensions of imgui depending on it.
This commit is contained in:
parent
52886872f1
commit
256d5e5448
9
CMakeLists.txt
Normal file
9
CMakeLists.txt
Normal file
@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(imgui LANGUAGES C CXX)
|
||||
|
||||
add_library(imgui imgui.cpp imgui_draw.cpp imgui_tables.cpp imgui_widgets.cpp)
|
||||
target_include_directories(imgui PUBLIC .)
|
||||
|
||||
add_subdirectory(backends)
|
||||
add_subdirectory(misc/cpp)
|
||||
|
133
backends/CMakeLists.txt
Normal file
133
backends/CMakeLists.txt
Normal file
@ -0,0 +1,133 @@
|
||||
|
||||
option(IMGUI_BACKEND_ALLEGRO "Enable the Allegro backend" OFF)
|
||||
if(IMGUI_BACKEND_ALLEGRO)
|
||||
add_library(imgui_backend_allegro imgui_impl_allegro5.cpp)
|
||||
target_include_directories(imgui_backend_allegro PUBLIC .)
|
||||
target_link_libraries(imgui_backend_allegro PUBLIC imgui)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_ANDROID "Enable the Android backend" OFF)
|
||||
if(IMGUI_BACKEND_ANDROID)
|
||||
add_library(imgui_backend_android imgui_impl_android.cpp)
|
||||
target_include_directories(imgui_backend_android PUBLIC .)
|
||||
target_link_libraries(imgui_backend_android PUBLIC android imgui)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_DX10 "Enable the DirectX 10 backend" OFF)
|
||||
if(IMGUI_BACKEND_DX10)
|
||||
add_library(imgui_backend_dx10 imgui_impl_dx10.cpp)
|
||||
target_include_directories(imgui_backend_dx10 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_dx10 PUBLIC imgui d3d10.lib d3dcompiler.lib)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_DX11 "Enable the DirectX 11 backend" OFF)
|
||||
if(IMGUI_BACKEND_DX11)
|
||||
add_library(imgui_backend_dx11 imgui_impl_dx11.cpp)
|
||||
target_include_directories(imgui_backend_dx11 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_dx11 PUBLIC imgui d3d11.lib d3dcompiler.lib)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_DX12 "Enable the DirectX 12 backend" OFF)
|
||||
if(IMGUI_BACKEND_DX12)
|
||||
add_library(imgui_backend_dx12 imgui_impl_dx12.cpp)
|
||||
target_include_directories(imgui_backend_dx12 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_dx12 PUBLIC imgui d3d12.lib d3dcompiler.lib dxgi.lib)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_DX9 "Enable the DirectX 9 backend" OFF)
|
||||
if(IMGUI_BACKEND_DX9)
|
||||
add_library(imgui_backend_dx9 imgui_impl_dx9.cpp)
|
||||
target_include_directories(imgui_backend_dx9 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_dx9 PUBLIC imgui d3d9.lib)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_GLFW "Enable the GLFW backends" OFF)
|
||||
if(IMGUI_BACKEND_GLFW)
|
||||
find_package(glfw3 REQUIRED)
|
||||
add_library(imgui_backend_glfw imgui_impl_glfw.cpp)
|
||||
target_include_directories(imgui_backend_glfw PUBLIC .)
|
||||
target_link_libraries(imgui_backend_glfw PUBLIC imgui glfw)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_GLUT "Enable the GLUT backend" OFF)
|
||||
if(IMGUI_BACKEND_GLUT)
|
||||
find_package(glut REQUIRED)
|
||||
add_library(imgui_backend_glut imgui_impl_glut.cpp)
|
||||
target_include_directories(imgui_backend_glut PUBLIC .)
|
||||
target_link_libraries(imgui_backend_glut PUBLIC imgui glut)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_METAL "Enable the Metal backend" OFF)
|
||||
if(IMGUI_BACKEND_METAL)
|
||||
add_library(imgui_backend_metal imgui_impl_metal.mm)
|
||||
target_include_directories(imgui_backend_metal PUBLIC .)
|
||||
target_link_libraries(imgui_backend_metal PUBLIC imgui "-framework Metal -framework MetalKit -framework QuartzCore")
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_OPENGL "Enable the OpenGL backends" OFF)
|
||||
if(IMGUI_BACKEND_OPENGL)
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
add_library(imgui_backend_opengl2 imgui_impl_opengl2.cpp)
|
||||
target_include_directories(imgui_backend_opengl2 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_opengl2 PUBLIC imgui OpenGL::OpenGL)
|
||||
|
||||
add_library(imgui_backend_opengl3 imgui_impl_opengl3.cpp)
|
||||
target_include_directories(imgui_backend_opengl3 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_opengl3 PUBLIC imgui OpenGL::OpenGL)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_OSX "Enable the OSX backend" OFF)
|
||||
if(IMGUI_BACKEND_OSX)
|
||||
add_library(imgui_backend_osx imgui_impl_osx.mm)
|
||||
target_include_directories(imgui_backend_osx PUBLIC .)
|
||||
target_link_libraries(imgui_backend_osx PUBLIC imgui "-framework Cocoa")
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_SDL2 "Enable the SDL2 backends" OFF)
|
||||
if(IMGUI_BACKEND_SDL2)
|
||||
find_package(SDL2 REQUIRED)
|
||||
|
||||
add_library(imgui_backend_sdl2 imgui_impl_sdl2.cpp)
|
||||
target_include_directories(imgui_backend_sdl2 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_sdl2 PUBLIC imgui SDL2::SDL2main SDL2::SDL2)
|
||||
|
||||
add_library(imgui_backend_sdlrenderer2 imgui_impl_sdlrenderer2.cpp)
|
||||
target_include_directories(imgui_backend_sdlrenderer2 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_sdlrenderer2 PUBLIC imgui SDL2::SDL2main SDL2::SDL2)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_SDL3 "Enable the SDL3 backends" OFF)
|
||||
if(IMGUI_BACKEND_SDL3)
|
||||
find_package(SDL3 REQUIRED)
|
||||
add_library(imgui_backend_sdl3 imgui_impl_sdl3.cpp)
|
||||
target_include_directories(imgui_backend_sdl3 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_sdl3 PUBLIC imgui SDL3::SDL3)
|
||||
|
||||
add_library(imgui_backend_sdlrenderer3 imgui_impl_sdlrenderer3.cpp)
|
||||
target_include_directories(imgui_backend_sdlrenderer3 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_sdlrenderer3 PUBLIC imgui SDL3::SDL3)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_VULKAN "Enable the Vulkan backends" OFF)
|
||||
if(IMGUI_BACKEND_VULKAN)
|
||||
find_package(Vulkan REQUIRED)
|
||||
add_library(imgui_backend_vulkan imgui_impl_vulkan.cpp)
|
||||
target_include_directories(imgui_backend_vulkan PUBLIC .)
|
||||
target_link_libraries(imgui_backend_vulkan PUBLIC imgui Vulkan::Vulkan)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_WGPU "Enable the WGPU backends" OFF)
|
||||
if(IMGUI_BACKEND_WGPU)
|
||||
find_package(wgpu REQUIRED)
|
||||
add_library(imgui_backend_wgpu imgui_impl_wgpu.cpp)
|
||||
target_include_directories(imgui_backend_wgpu PUBLIC .)
|
||||
target_link_libraries(imgui_backend_wgpu PUBLIC imgui wgpu)
|
||||
endif()
|
||||
|
||||
option(IMGUI_BACKEND_WIN32 "Enable the Win32 backend" OFF)
|
||||
if(IMGUI_BACKEND_WIN32)
|
||||
add_library(imgui_backend_win32 imgui_impl_win32.cpp)
|
||||
target_include_directories(imgui_backend_win32 PUBLIC .)
|
||||
target_link_libraries(imgui_backend_win32 PUBLIC imgui)
|
||||
endif()
|
3
misc/cpp/CMakeLists.txt
Normal file
3
misc/cpp/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
add_library(imgui_stdlib imgui_stdlib.cpp)
|
||||
target_include_directories(imgui_stdlib PUBLIC .)
|
||||
target_link_libraries(imgui_stdlib PUBLIC imgui)
|
Loading…
Reference in New Issue
Block a user