|
| 1 | +project (imgui) |
| 2 | +cmake_minimum_required (VERSION 3.2) |
| 3 | + |
| 4 | +option (IMGUI_EXAMPLES "Build ImGui examples" ON) |
| 5 | +option (IMGUI_DEMO "Include the ImGui demo window implementation in library" ON) |
| 6 | + |
| 7 | +option (IMGUI_IMPL_SDL "Build the SDL implementation (only if supported)" ON) |
| 8 | +option (IMGUI_IMPL_METAL "Build the Metal implementation (only if supported)" ON) |
| 9 | +option (IMGUI_IMPL_OSX "Build the OSX implementation (only if supported)" ON) |
| 10 | +option (IMGUI_IMPL_GLFW "Build the GLFW implementation (only if supported)" ON) |
| 11 | +option (IMGUI_IMPL_GLUT "Build the GLUT implementation (only if supported)" ON) |
| 12 | +option (IMGUI_IMPL_OPENGL "Build the OpenGL implementation (only if supported)" ON) |
| 13 | +option (IMGUI_IMPL_OPENGL2 "Build the OpenGL 2 (legacy) implementation (only if supported)" ${IMGUI_IMPL_OPENGL}) |
| 14 | + |
| 15 | +set (CMAKE_CXX_STANDARD 11) |
| 16 | + |
| 17 | +if (IMGUI_DEMO) |
| 18 | + set (IMGUI_DEMO_SRC imgui_demo.cpp) |
| 19 | +endif () |
| 20 | + |
| 21 | +add_library (imgui STATIC |
| 22 | + imgui.cpp |
| 23 | + imgui_draw.cpp |
| 24 | + imgui_widgets.cpp |
| 25 | + ${IMGUI_DEMO_SRC} |
| 26 | +) |
| 27 | + |
| 28 | +target_include_directories (imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") |
| 29 | + |
| 30 | +if (NOT IMGUI_DEMO) |
| 31 | + target_compile_definitions (imgui PUBLIC -DIMGUI_DISABLE_DEMO_WINDOWS=1) |
| 32 | +endif () |
| 33 | + |
| 34 | +if (IMGUI_IMPL_SDL) |
| 35 | + include (examples/imgui_impl_sdl.cmake) |
| 36 | +endif () |
| 37 | +if (IMGUI_IMPL_METAL) |
| 38 | + include (examples/imgui_impl_metal.cmake) |
| 39 | +endif () |
| 40 | +if (IMGUI_IMPL_OSX) |
| 41 | + include (examples/imgui_impl_osx.cmake) |
| 42 | +endif () |
| 43 | +if (IMGUI_IMPL_GLFW) |
| 44 | + include (examples/imgui_impl_glfw.cmake) |
| 45 | +endif () |
| 46 | +if (IMGUI_IMPL_OPENGL OR IMGUI_IMPL_OPENGL2) |
| 47 | + include (examples/imgui_impl_opengl.cmake) |
| 48 | +endif () |
| 49 | +if (IMGUI_IMPL_GLUT) |
| 50 | + include (examples/imgui_impl_glut.cmake) |
| 51 | +endif () |
| 52 | + |
| 53 | +if (IMGUI_EXAMPLES) |
| 54 | + set (IMGUI_EXAMPLE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") |
| 55 | + |
| 56 | + #add_subdirectory (examples/example_allegro5) |
| 57 | + add_subdirectory (examples/example_apple_metal) |
| 58 | + #add_subdirectory (examples/example_apple_opengl2) |
| 59 | + #add_subdirectory (examples/example_emscripten) |
| 60 | + add_subdirectory (examples/example_glfw_metal) |
| 61 | + add_subdirectory (examples/example_glfw_opengl2) |
| 62 | + add_subdirectory (examples/example_glfw_opengl3) |
| 63 | + #add_subdirectory (examples/example_glfw_vulkan) |
| 64 | + add_subdirectory (examples/example_glut_opengl2) |
| 65 | + #add_subdirectory (examples/example_marmalade) |
| 66 | + add_subdirectory (examples/example_null) |
| 67 | + #add_subdirectory (examples/example_sdl_directx11) |
| 68 | + add_subdirectory (examples/example_sdl_metal) |
| 69 | + add_subdirectory (examples/example_sdl_opengl2) |
| 70 | + add_subdirectory (examples/example_sdl_opengl3) |
| 71 | + #add_subdirectory (examples/example_sdl_vulkan) |
| 72 | + #add_subdirectory (examples/example_win32_directx10) |
| 73 | + #add_subdirectory (examples/example_win32_directx11) |
| 74 | + #add_subdirectory (examples/example_win32_directx12) |
| 75 | + #add_subdirectory (examples/example_win32_directx9) |
| 76 | +endif () |
0 commit comments