-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
project (imgui) | ||
cmake_minimum_required (VERSION 3.2) | ||
|
||
option (IMGUI_EXAMPLES "Build ImGui examples" ON) | ||
option (IMGUI_DEMO "Include the ImGui demo window implementation in library" ON) | ||
|
||
option (IMGUI_IMPL_SDL "Build the SDL implementation (only if supported)" ON) | ||
option (IMGUI_IMPL_METAL "Build the Metal implementation (only if supported)" ON) | ||
option (IMGUI_IMPL_OSX "Build the OSX implementation (only if supported)" ON) | ||
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 OpenGL implementation (only if supported)" ON) | ||
option (IMGUI_IMPL_OPENGL2 "Build the OpenGL 2 (legacy) implementation (only if supported)" ${IMGUI_IMPL_OPENGL}) | ||
|
||
set (CMAKE_CXX_STANDARD 11) | ||
|
||
if (IMGUI_DEMO) | ||
set (IMGUI_DEMO_SRC imgui_demo.cpp) | ||
endif () | ||
|
||
add_library (imgui STATIC | ||
imgui.cpp | ||
imgui_draw.cpp | ||
imgui_widgets.cpp | ||
${IMGUI_DEMO_SRC} | ||
) | ||
|
||
target_include_directories (imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") | ||
|
||
if (NOT IMGUI_DEMO) | ||
target_compile_definitions (imgui PUBLIC -DIMGUI_DISABLE_DEMO_WINDOWS=1) | ||
endif () | ||
|
||
if (IMGUI_IMPL_SDL) | ||
include (examples/imgui_impl_sdl.cmake) | ||
endif () | ||
if (IMGUI_IMPL_METAL) | ||
include (examples/imgui_impl_metal.cmake) | ||
endif () | ||
if (IMGUI_IMPL_OSX) | ||
include (examples/imgui_impl_osx.cmake) | ||
endif () | ||
if (IMGUI_IMPL_GLFW) | ||
include (examples/imgui_impl_glfw.cmake) | ||
endif () | ||
if (IMGUI_IMPL_OPENGL OR IMGUI_IMPL_OPENGL2) | ||
include (examples/imgui_impl_opengl.cmake) | ||
endif () | ||
if (IMGUI_IMPL_GLUT) | ||
include (examples/imgui_impl_glut.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_marmalade) | ||
add_subdirectory (examples/example_null) | ||
#add_subdirectory (examples/example_sdl_directx11) | ||
add_subdirectory (examples/example_sdl_metal) | ||
add_subdirectory (examples/example_sdl_opengl2) | ||
add_subdirectory (examples/example_sdl_opengl3) | ||
#add_subdirectory (examples/example_sdl_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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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 | ||
) | ||
|
||
target_link_libraries (imgui_example_apple_metal | ||
imgui-metal imgui-osx | ||
) | ||
|
||
set_target_properties (imgui_example_apple_metal | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-glfw AND TARGET imgui-metal) | ||
add_executable (imgui_example_glfw_metal main.mm) | ||
|
||
target_link_libraries (imgui_example_glfw_metal | ||
imgui-glfw imgui-metal | ||
) | ||
|
||
set_target_properties (imgui_example_glfw_metal | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-glfw AND TARGET imgui-opengl2) | ||
add_executable (imgui_example_glfw_opengl2 main.cpp) | ||
|
||
target_link_libraries (imgui_example_glfw_opengl2 | ||
imgui-glfw imgui-opengl2 | ||
) | ||
|
||
set_target_properties (imgui_example_glfw_opengl2 | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-glfw AND TARGET imgui-opengl) | ||
add_executable (imgui_example_glfw_opengl3 main.cpp) | ||
|
||
target_link_libraries (imgui_example_glfw_opengl3 | ||
imgui-glfw imgui-opengl | ||
) | ||
|
||
set_target_properties (imgui_example_glfw_opengl3 | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-glut AND TARGET imgui-opengl2) | ||
add_executable (imgui_example_glut_opengl2 main.cpp) | ||
|
||
target_link_libraries (imgui_example_glut_opengl2 | ||
imgui-glut imgui-opengl2 | ||
) | ||
|
||
set_target_properties (imgui_example_glut_opengl2 | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
add_executable (imgui_example_null main.cpp) | ||
target_link_libraries (imgui_example_null imgui) | ||
|
||
set_target_properties (imgui_example_null | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-sdl AND TARGET imgui-metal) | ||
add_executable (imgui_example_sdl_metal main.mm) | ||
|
||
target_link_libraries (imgui_example_sdl_metal | ||
imgui-sdl imgui-metal | ||
) | ||
|
||
set_target_properties (imgui_example_sdl_metal | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-sdl AND TARGET imgui-opengl2) | ||
add_executable (imgui_example_sdl_opengl2 main.cpp) | ||
|
||
target_link_libraries (imgui_example_sdl_opengl2 | ||
imgui-sdl imgui-opengl2 | ||
) | ||
|
||
set_target_properties (imgui_example_sdl_opengl2 | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if (TARGET imgui-sdl AND TARGET imgui-opengl) | ||
add_executable (imgui_example_sdl_opengl3 main.cpp) | ||
|
||
target_link_libraries (imgui_example_sdl_opengl3 | ||
imgui-sdl imgui-opengl | ||
) | ||
|
||
set_target_properties (imgui_example_sdl_opengl3 | ||
PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMGUI_EXAMPLE_OUTPUT_DIR}" | ||
) | ||
endif () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
find_package (GLFW3) | ||
|
||
if (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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
find_package (GLUT) | ||
|
||
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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
find_package (OpenGL) | ||
|
||
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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
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 () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
find_package (SDL2) | ||
|
||
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 () |