Skip to content

Commit

Permalink
Changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Nov 21, 2024
1 parent b7a73b2 commit 03c560f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Version numbers are synced between hello_imgui and imgui_bundle.
* Node theme colors will try to be coherent with the main theme

### ImGuiMd
* Add ImGuiMd: add ImFont* GetFont(const MarkdownFontSpec& fontSpec);
* Add ImGuiMd::GetFont(const MarkdownFontSpec& fontSpec)

### ImmApp
* Add namespace Immapp::ManualRender: functions allowing fine-grained control over the rendering process

### ImmVision
- **Breaking Change - October 2024**: Color Order Must Be Set
Expand All @@ -37,6 +40,8 @@ Version numbers are synced between hello_imgui and imgui_bundle.
### Python bindings
#### **Switched binding library from pybind11 to nanobind - Nov 2024**:
This change should be almost transparent to users. However, if you encounter any issues, please report them.
#### Support Python 3.13
* Binary wheels are provided for Python 3.11, 3.12, and 3.13 (3.10 is still supported, building from source)
#### Other
* python glfw_backend: updated clipboard handling to new api
* enum Key bindings: remove prefix im_gui_ in values
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ project(imgui_bundle VERSION "1.6.0") # 1.6.0 beta1 Remember to mirror changes t
# imgui_bundle_build_lib contains the main logic to build imgui_bundle
set(IMGUI_BUNDLE_PATH ${CMAKE_CURRENT_LIST_DIR} CACHE STRING "" FORCE)
include(imgui_bundle_cmake/imgui_bundle_build_lib.cmake)
include(imgui_bundle_cmake/imgui_bundle_pyodide.cmake)

# -----------------------------------------------------------------------------
# About imgui_bundle_add_app:
Expand Down Expand Up @@ -37,6 +38,10 @@ ibd_clone_submodules_if_needed()
include(${CMAKE_CURRENT_LIST_DIR}/external/hello_imgui/hello_imgui/hello_imgui_cmake/utils/cache_hello_imgui_paths.cmake)
include(${HELLOIMGUI_CMAKE_PATH}/hello_imgui_build_lib.cmake)

# Pyodide
# -----------------------------------------------------------------------------
ibd_pyodide_set_build_options_if_needed()


# Backends
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -95,8 +100,10 @@ else()
set(IMGUI_BUNDLE_BUILD_CPP ON)
endif()


# For python bindings, we force the usage of Glfw+OpenGL3
if(IMGUI_BUNDLE_BUILD_PYTHON)
# (pyodide is handled by hello_imgui_pyodide.cmake)
if(IMGUI_BUNDLE_BUILD_PYTHON AND NOT IMGUI_BUNDLE_BUILD_PYODIDE)
set(HELLOIMGUI_USE_GLFW3 ON CACHE BOOL "" FORCE)
set(HELLOIMGUI_HAS_OPENGL3 ON CACHE BOOL "" FORCE)

Expand Down Expand Up @@ -448,6 +455,7 @@ message(STATUS "
IMGUI_BUNDLE_WITH_IMMVISION: ${IMGUI_BUNDLE_WITH_IMMVISION} (IMMVISION_FETCH_OPENCV: ${IMMVISION_FETCH_OPENCV})
IMGUI_BUNDLE_WITH_TEST_ENGINE: ${IMGUI_BUNDLE_WITH_TEST_ENGINE}
IMGUI_BUNDLE_BUILD_PYTHON: ${IMGUI_BUNDLE_BUILD_PYTHON}
IMGUI_BUNDLE_BUILD_PYODIDE: ${IMGUI_BUNDLE_BUILD_PYODIDE}
IMGUI_BUNDLE_BUILD_DEMOS: ${IMGUI_BUNDLE_BUILD_DEMOS}
IMGUI_BUNDLE_BUILD_DOC: ${IMGUI_BUNDLE_BUILD_DOC}
")
81 changes: 81 additions & 0 deletions imgui_bundle_cmake/imgui_bundle_pyodide.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
###################################################################################################
# Specific build options for pyodide
###################################################################################################

function(ibd_pyodide_set_build_options_if_needed)
# Determine if we need to build pyodide
if (SKBUILD AND EMSCRIPTEN)
message(STATUS "Building for pyodide! IMGUI_BUNDLE_BUILD_PYODIDE=${IMGUI_BUNDLE_BUILD_PYODIDE}")
set(IMGUI_BUNDLE_BUILD_PYODIDE ON CACHE BOOL "" FORCE)
endif()

# If so, set the build options (backend selection, lib selection, etc.)
if(IMGUI_BUNDLE_BUILD_PYODIDE)
_ibd_pyodide_set_build_options()
else()
set(IMGUI_BUNDLE_BUILD_PYODIDE OFF CACHE BOOL "" FORCE)
endif()
endfunction()


function(ibd_pyodide_manually_link_sdl_to_bindings)
# Important: SDL2 link notes
# ==========================
# SDL2 must be linked to the native bindings _imgui_bundle.
# For whatever reason, this does not work with find_package.
# This has something to do with the fact that this is a SIDE library, with dynamic linking.
# Also, libsdl2.a is not in the default search path, so we need to specify the path to it.

# This will not work:
# find_package(SDL2 REQUIRED)
# target_link_libraries(_imgui_bundle PUBLIC SDL2::SDL2)

# instead we link manually libSDL2.a:
if(IMGUI_BUNDLE_BUILD_PYODIDE AND EMSCRIPTEN)
set(sdl_lib_path ${EMSCRIPTEN_SYSROOT}/lib/wasm32-emscripten/lto/)
target_link_directories(_imgui_bundle PUBLIC ${sdl_lib_path})
target_link_libraries(_imgui_bundle PUBLIC SDL2)
target_link_libraries(_imgui_bundle PUBLIC html5) # cf https://github.com/pyodide/pyodide/issues/5029: emscripten_compute_dom_pk_code is in html5.a (not html5.js)
endif()
endfunction()


function(_ibd_pyodide_set_build_options)
if (NOT IMGUI_BUNDLE_BUILD_PYODIDE)
message(FATAL_ERROR "ibd_pyodide_set_build_options: IMGUI_BUNDLE_BUILD_PYODIDE is not set")
endif()

# No native demos for pyodide
set(IMGUI_BUNDLE_BUILD_DEMOS OFF CACHE BOOL "" FORCE)

# FreeType
set(HELLOIMGUI_USE_FREETYPE ON CACHE BOOL "" FORCE)

# Backend selection
set(HELLOIMGUI_USE_SDL2 ON CACHE BOOL "" FORCE)
set(HELLOIMGUI_HAS_OPENGL3 ON CACHE BOOL "" FORCE)
set(HELLOIMGUI_USE_GLFW3 OFF CACHE BOOL "" FORCE)

# test engine for pyodide
set(HELLOIMGUI_EMSCRIPTEN_PTHREAD ON CACHE BOOL "" FORCE)
set(IMGUI_BUNDLE_WITH_TEST_ENGINE ON CACHE BOOL "" FORCE)

# Disable some features
set(IMGUI_BUNDLE_DISABLE_IMFILEDIALOG ON CACHE BOOL "" FORCE)

# Those features are now available in pyodide
# set(IMGUI_BUNDLE_DISABLE_IMMVISION OFF CACHE BOOL "" FORCE)
# set(IMGUI_BUNDLE_DISABLE_IMPLOT ON CACHE BOOL "" FORCE)
# set(IMGUI_BUNDLE_DISABLE_IMGUI_NODE_EDITOR ON CACHE BOOL "" FORCE)
# set(IMGUI_BUNDLE_DISABLE_IMGUIZMO ON CACHE BOOL "" FORCE)
# set(IMGUI_BUNDLE_DISABLE_IMGUI_TEX_INSPECT ON CACHE BOOL "" FORCE)
# set(IMGUI_BUNDLE_DISABLE_NANOVG ON CACHE BOOL "" FORCE)

# Failed attempts to try to reduce the link time for pyodide (which takes 10 minutes, be patient...)
# add_link_options("-flto=auto") # run link time optimization on several threads (no clear benefit)
# add_link_options("-fno-lto") # disable link time optimization
# if (CMAKE_BUILD_TYPE STREQUAL "Release")
# add_compile_options("-O0")
# add_link_options("-O0")
# endif()
endfunction()
2 changes: 1 addition & 1 deletion imgui_bundle_cmake/internal/add_hello_imgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function (add_hello_imgui)
# ii. enable null backend
# iii. Build our own glfw as a shared library (see cmake/add_glfw.cmake)
# (the reason is that we need to deploy this library with the python bindings)
if (IMGUI_BUNDLE_BUILD_PYTHON)
if (IMGUI_BUNDLE_BUILD_PYTHON AND NOT IMGUI_BUNDLE_BUILD_PYODIDE)
# i. Use Opengl3 + glfw backend
set(HELLOIMGUI_USE_GLFW3 ON CACHE BOOL "" FORCE)
set(HELLOIMGUI_HAS_OPENGL3 ON CACHE BOOL "" FORCE)
Expand Down
4 changes: 4 additions & 0 deletions imgui_bundle_cmake/internal/add_imgui_bundle_bindings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ function(add_imgui_bundle_bindings)
_target_set_rpath(${python_native_module_name} ".")
endif()

if (IMGUI_BUNDLE_BUILD_PYODIDE)
ibd_pyodide_manually_link_sdl_to_bindings()
endif()

target_link_libraries(${python_native_module_name} PUBLIC ${bound_library})

# Link with OpenGL (necessary for nanobind)
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ wheel.expand-macos-universal-tags = true
wheel.packages = ["bindings/imgui_bundle"]

cmake.version = ">=3.26.1"
# cmake.verbose = true
# logging.level = "INFO"
cmake.verbose = true
logging.level = "INFO"


[tool.isort]
Expand Down

0 comments on commit 03c560f

Please sign in to comment.