Skip to content

Commit

Permalink
Replace IMGUI_BUNDLE_WITH_GLFW by HELLOIMGUI_USE_GLFW_OPENGL3
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Dec 31, 2023
1 parent 5ea4082 commit 4920344
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
32 changes: 16 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,36 @@ else()
endif()


# Glfw backend
# Glfw+OpenGL3 backend
# -----------------------------------------------------------------------------
#
# The GLFW backend is activated via IMGUI_BUNDLE_WITH_GLFW
# It is activated by default on desktop platforms (Windows, Linux, macOS)
# but disabled under emscripten, android, and ios.
# Activated via HELLOIMGUI_USE_GLFW_OPENGL3
# Notes:
# - It is activated by default on desktop platforms (Windows, Linux, macOS), but you can deactivate it
# - It is activated by default when building the python bindings (and cannot be deactivated)
# - It is not available under emscripten, android, and ios.
#
# Notes:
# - Glfw3 may be downloaded automatically if not found as a system library:
# set HELLOIMGUI_DOWNLOAD_GLFW_IF_NEEDED to OFF to disable this behavior
# (HELLOIMGUI_DOWNLOAD_GLFW_IF_NEEDED is OFF by default under Linux)
# - If (and only if) IMGUI_BUNDLE_BUILD_PYTHON is ON, glfw will be built from
# the submodule external/glfw/glfw
if (NOT EMSCRIPTEN AND NOT ANDROID AND NOT IOS)
option(IMGUI_BUNDLE_WITH_GLFW "Add GLFW backend" ON)
# - If (and only if) IMGUI_BUNDLE_BUILD_PYTHON is ON, glfw will be built from the submodule external/glfw/glfw
if (EMSCRIPTEN OR ANDROID OR IOS)
set(HELLOIMGUI_USE_GLFW_OPENGL3 OFF CACHE BOOL "" FORCE)
elseif(IMGUI_BUNDLE_BUILD_PYTHON)
set(HELLOIMGUI_USE_GLFW_OPENGL3 ON CACHE BOOL "" FORCE)
else()
set(IMGUI_BUNDLE_WITH_GLFW OFF)
option(HELLOIMGUI_USE_GLFW_OPENGL3 "Use GLFW+OpenGL3 backend" ON)
endif()


# SDL+OpenGl3 Backend
# -----------------------------------------------------------------------------
# Activated via HELLOIMGUI_USE_SDL_OPENGL3
# Notes:
# - under emscripten, iOS and Android, this is the default backend (and you cannot change it)
# - under windows, linux, and macOS, it is disabled by default, but you can activate it
# - not available for python bindings (you can use the full python SDL backend instead)
# - It is disabled by default on desktop platforms (Windows, Linux, macOS), but you can activate it
# - It is not available when building the python bindings (you can use the full python SDL backend instead)
# - It is activated by default under emscripten, iOS and Android (and you cannot change it)
#
# SDL2 may be downloaded automatically if not found as a system library:
# set HELLOIMGUI_DOWNLOAD_SDL_IF_NEEDED to OFF to disable this behavior.
Expand All @@ -72,7 +75,7 @@ if (EMSCRIPTEN OR ANDROID OR IOS)
elseif(IMGUI_BUNDLE_BUILD_PYTHON)
set(HELLOIMGUI_USE_SDL_OPENGL3 OFF CACHE BOOL "" FORCE)
else()
option(HELLOIMGUI_USE_SDL_OPENGL3 "Add SDL+OpenGL3 backend" OFF)
option(HELLOIMGUI_USE_SDL_OPENGL3 "Use SDL+OpenGL3 backend" OFF)
endif()


Expand Down Expand Up @@ -231,8 +234,6 @@ set(CMAKE_CXX_STANDARD 17)
if (IMGUI_BUNDLE_BUILD_PYTHON)
add_compile_definitions(IMGUI_BUNDLE_BUILD_PYTHON)
add_compile_definitions(IMGUI_BUNDLE_PYTHON_API)
# When building python bindings, glfw is always built as a shared library (see cmake/add_glfw.cmake)
set(IMGUI_BUNDLE_WITH_GLFW ON CACHE BOOL "" FORCE)
endif()

# IMGUI_BUNDLE_WITH_TEST_ENGINE is propagated to HELLOIMGUI_WITH_TEST_ENGINE
Expand Down Expand Up @@ -366,7 +367,6 @@ endif()
if (NOT IMGUI_BUNDLE_WITH_IMMVISION)
set(IMGUI_BUNDLE_WITH_IMMVISION OFF)
endif()
# IMGUI_BUNDLE_WITH_GLFW: HelloImGui will use Glfw if no backend is specified

message(STATUS "imgui_bundle build options:
Backends:
Expand Down
7 changes: 2 additions & 5 deletions cmake/add_hello_imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ function (add_hello_imgui)
endif()

# 2. Use glfw submodule for python bindings
# When building python bindings, glfw is always built as a shared library (see cmake/add_glfw.cmake)
if (IMGUI_BUNDLE_BUILD_PYTHON)
add_glfw_submodule()
endif()

# 3. Configure hello-imgui with the following options:
# i. use glfw
if (IMGUI_BUNDLE_WITH_GLFW)
set(HELLOIMGUI_USE_GLFW_OPENGL3 ON CACHE BOOL "" FORCE)
endif()
# iii. use provided imgui version
# i. use our own imgui submodule
set(imgui_dir ${CMAKE_CURRENT_LIST_DIR}/imgui/imgui)
set(HELLOIMGUI_BUILD_IMGUI OFF CACHE BOOL "" FORCE)
set(HELLOIMGUI_IMGUI_SOURCE_DIR ${imgui_dir} CACHE STRING "" FORCE)
Expand Down

0 comments on commit 4920344

Please sign in to comment.