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: 12 additions & 2 deletions imgui_bundle_cmake/internal/add_imgui_bundle_bindings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,18 @@ function(add_imgui_bundle_bindings)

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

# Link with OpenGL (necessary for nanobind)
if (NOT EMSCRIPTEN)
# 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)
endif()
Expand Down
29 changes: 29 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,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 @@ -202,6 +211,26 @@ before-all = "apk add xorg-server-dev libxcursor-dev libxi-dev libxinerama-dev l
[tool.cibuildwheel.windows]
skip = ["*win32"]

#------------------------------------
# android wheels options
#------------------------------------
[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