-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Export Dear ImGui as CMake's ImGui package. Options: - ImGui_USER_CONFIG; - ImGui_EXAMPLES; - ImGui_BACKENDS; - ImGui_MISC; - ImGui_3RDPARTY; - ImGui_OPENGL_LOADER; - ImGui_FREETYPE; - ImGui_TOOLS; - ImGui_PACKAGE. Export targets: - ImGui::Core; - ImGui::ImplGLUT; - ImGui::ImplSDL2; - ImGui::ImplGlfw; - ImGui::ImplOpenGL2; - ImGui::ImplOpenGL3; - ImGui::ImplVulkan; - ImGui::FreeType; - ImGui::StdLib; - ImGui::BinaryToCompressedC. Import targets from: - build directory; - installed package. Examples: - example_null; - example_emscripten_opengl3; - example_glut_opengl2 - example_sdl2_opengl2; - example_sdl2_opengl3; - example_sdl2_vulkan; - example_glfw_opengl2; - example_glfw_opengl3; - example_glfw_vulkan.
- Loading branch information
Showing
13 changed files
with
729 additions
and
40 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,92 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
|
||
# Fetching version from header file | ||
file(STRINGS ../imgui.h ImGui_VERSION_NUM_HEADER_STRING | ||
REGEX "#define[ \t]+IMGUI_VERSION_NUM[ \t]+([0-9]+)" | ||
LIMIT_COUNT 1) | ||
string(REGEX REPLACE "#define[ \t]+IMGUI_VERSION_NUM[ \t]+([0-9]+)" "\\1" | ||
IMGUI_VERSION_NUM "${ImGui_VERSION_NUM_HEADER_STRING}") | ||
math(EXPR IMGUI_VERSION_MAJOR "${IMGUI_VERSION_NUM} / 10000") | ||
math(EXPR IMGUI_VERSION_MINOR "(${IMGUI_VERSION_NUM} % 10000) / 100") | ||
math(EXPR IMGUI_VERSION_PATCH "${IMGUI_VERSION_NUM} % 100") | ||
|
||
project(imgui_examples | ||
VERSION "${IMGUI_VERSION_MAJOR}.${IMGUI_VERSION_MINOR}.${IMGUI_VERSION_PATCH}" | ||
LANGUAGES CXX) | ||
|
||
get_filename_component(ImGui_SRCDIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/ImGuiModule.cmake") | ||
|
||
set(ImGui_OPTIONS) | ||
|
||
imgui_option(USER_CONFIG "Dear ImGui user config for include" "" STRING) | ||
imgui_option(EXAMPLES "Dear ImGui example applications" ON) | ||
imgui_option(BACKENDS "Dear ImGui platform and render backends" ON) | ||
imgui_option(MISC "Dear ImGui misc features" ON) | ||
imgui_option(3RDPARTY "Dear ImGui example dependencies" ON) | ||
if(EMSCRIPTEN) | ||
set(ImGui_OPENGL_LOADER_DEFAULT "GLEW") | ||
else() | ||
set(ImGui_OPENGL_LOADER_DEFAULT "GL3W") | ||
endif() | ||
imgui_option(OPENGL_LOADER | ||
"Dear ImGui OpenGL loader (GL3W, GLEW, GLAD or custom header)" | ||
"${ImGui_OPENGL_LOADER_DEFAULT}" | ||
STRINGS "GL3W" "GLEW" "GLAD") | ||
imgui_option(FREETYPE "Dear ImGui will build font atlases using FreeType instead of stb_truetype" OFF) | ||
imgui_option(TOOLS "Dear ImGui auxiliary applications" OFF) | ||
imgui_option(PACKAGE "Dear ImGui packaging" OFF) | ||
|
||
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ImGuiOptions.cmake" | ||
CONTENT "${ImGui_OPTIONS_CMAKE}") | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/ImGuiTargets.cmake") | ||
|
||
set(ImGui_DIR "${CMAKE_CURRENT_LIST_DIR}") | ||
|
||
imgui_example(example_null | ||
TARGETS Core) | ||
|
||
if(EMSCRIPTEN) | ||
imgui_example(example_emscripten_opengl3 | ||
BACKENDS ImplSDL2 ImplOpenGL3) | ||
else() | ||
imgui_example(example_glut_opengl2 | ||
BACKENDS ImplGLUT ImplOpenGL2) | ||
|
||
imgui_example(example_sdl2_opengl2 | ||
BACKENDS ImplSDL2 ImplOpenGL2) | ||
|
||
imgui_example(example_sdl2_opengl3 | ||
BACKENDS ImplSDL2 ImplOpenGL3) | ||
|
||
imgui_example(example_sdl2_vulkan | ||
BACKENDS ImplSDL2 ImplVulkan) | ||
|
||
imgui_example(example_glfw_opengl2 | ||
BACKENDS ImplGlfw ImplOpenGL2) | ||
|
||
imgui_example(example_glfw_opengl3 | ||
BACKENDS ImplGlfw ImplOpenGL3) | ||
|
||
imgui_example(example_glfw_vulkan | ||
BACKENDS ImplGlfw ImplVulkan) | ||
endif() | ||
|
||
if(NOT "${CMAKE_CURRENT_LIST_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}") | ||
foreach(FILE ImGuiConfig.cmake ImGuiModule.cmake ImGuiTargets.cmake) | ||
configure_file(${FILE} ${FILE} COPYONLY) | ||
endforeach() | ||
endif() | ||
|
||
install(FILES ImGuiConfig.cmake ImGuiModule.cmake ImGuiTargets.cmake | ||
"${CMAKE_CURRENT_BINARY_DIR}/ImGuiOptions.cmake" | ||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/imgui) | ||
|
||
if(ImGui_PACKAGE) | ||
if(NOT DEFINED CPACK_PACKAGE_NAME) | ||
set(CPACK_PACKAGE_NAME "dear-imgui") | ||
endif() | ||
include(CPack) | ||
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,21 @@ | ||
if(NOT DEFINED ImGui_FIND_COMPONENTS) | ||
set(ImGui_FIND_COMPONENTS Core) | ||
endif() | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/ImGuiTargets.cmake") | ||
|
||
foreach(COMPONENT ${ImGui_FIND_COMPONENTS}) | ||
if(NOT ";${ImGui_AVAILABLE_COMPONENTS};" MATCHES ";${COMPONENT};") | ||
set(ImGui_FOUND FALSE) | ||
set(ImGui_NOT_FOUND_MESSAGE "Unavailable component: ${COMPONENT}.") | ||
endif() | ||
if(NOT ";${ImGui_SUPPORTED_COMPONENTS};" MATCHES ";${COMPONENT};") | ||
set(ImGui_FOUND FALSE) | ||
set(ImGui_NOT_FOUND_MESSAGE "Unsupported component: ${COMPONENT}.") | ||
endif() | ||
endforeach() | ||
|
||
if(NOT ImGui_FOUND) | ||
set(ImGui_NOT_FOUND_MESSAGE "${ImGui_NOT_FOUND_MESSAGE}\nSupported components: ${ImGui_SUPPORTED_COMPONENTS}.") | ||
set(ImGui_NOT_FOUND_MESSAGE "${ImGui_NOT_FOUND_MESSAGE}\nAvailable components: ${ImGui_AVAILABLE_COMPONENTS}.") | ||
endif() |
Oops, something went wrong.