Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions imgui_bundle_cmake/internal/add_imgui_bundle_bindings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ function(add_imgui_bundle_bindings)

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

# On Android, explicitly link against the Python library
if(ANDROID)
if(DEFINED ENV{ANDROID_PYTHON_LIBRARY})
message(STATUS "Android: Linking ${python_native_module_name} against Python library: $ENV{ANDROID_PYTHON_LIBRARY}")
target_link_libraries(${python_native_module_name} PRIVATE "$ENV{ANDROID_PYTHON_LIBRARY}")
else()
message(WARNING "Android: ANDROID_PYTHON_LIBRARY environment variable not set!")
endif()
endif()

# Link with OpenGL (necessary for nanobind on desktop platforms)
if (NOT EMSCRIPTEN AND NOT ANDROID)
find_package(OpenGL REQUIRED)
target_link_libraries(${python_native_module_name} PUBLIC OpenGL::GL)
# Link with OpenGL (necessary for nanobind)
if (NOT EMSCRIPTEN)
if (APPLE)
Expand Down
31 changes: 27 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ cmake.version = ">=3.26.1"
build.verbose = true
logging.level = "INFO"

[[tool.scikit-build.overrides]]
if.platform-system = "android"
cmake.args = [
"-DPython_FIND_STRATEGY=LOCATION",
"-DIMGUI_BUNDLE_WITH_HELLO_IMGUI=OFF",
"-DIMGUI_BUNDLE_PYTHON_DISABLE_OPENGL2=ON",
"-DIMGUI_BUNDLE_PYTHON_DISABLE_OPENGL3=ON",
]


[tool.isort]
profile = "black"
Expand Down Expand Up @@ -199,11 +208,25 @@ before-all = "apk add xorg-server-dev libxcursor-dev libxi-dev libxinerama-dev l
skip = ["*win32"]

#------------------------------------
# android wheels
# android wheels options
#------------------------------------
# Android wheel support is experimental, and available in a separate branch (not officially supported at the moment)
# See: https://github.com/pthom/imgui_bundle/tree/android-wheel
# Related PR: https://github.com/pthom/imgui_bundle/pull/438
[tool.cibuildwheel.android]
build = "cp313-*"
archs = ["arm64_v8a"]

[tool.cibuildwheel.android.environment]
ANDROID_API_LEVEL = "31"
ANDROID_ABI = "arm64-v8a"
IMGUI_BUNDLE_WITH_HELLO_IMGUI = "OFF"
IMGUI_BUNDLE_WITH_IMMAPP = "OFF"
IMGUI_BUNDLE_WITH_IMMVISION = "OFF"
IMGUI_BUNDLE_WITH_IMFILEDIALOG = "OFF"
IMGUI_BUNDLE_WITH_IMGUI_TEX_INSPECT = "OFF"
IMGUI_BUNDLE_WITH_IMGUI_TEST_ENGINE = "OFF"
IMGUI_BUNDLE_PYTHON_DISABLE_OPENGL2 = "ON"
IMGUI_BUNDLE_PYTHON_DISABLE_OPENGL3 = "ON"
ANDROID_PYTHON_LIBRARY = "$(python -c 'from pathlib import Path; import os; tf = Path(os.environ[\"CMAKE_TOOLCHAIN_FILE\"]); print(next((tf.parent / \"python\" / \"prefix\" / \"lib\").glob(\"libpython3.*.so\")))')"


# ═══════════════════════════════════════════════════════════════════════════
# Custom Build Configurations
Expand Down
Loading