Skip to content

Commit 4525e61

Browse files
committed
Trying to fix android so i could finally put this to test
1 parent 53a6def commit 4525e61

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ if (ANDROID)
2727
# We try to find the specific library version
2828
find_library(PYTHON_LIB NAMES python3.11 python3 PATHS "${PREBUILT_PYTHON_PATH}/lib" NO_DEFAULT_PATH)
2929
if (NOT PYTHON_LIB)
30-
message(FATAL_ERROR "Could not find Python library in ${PREBUILT_PYTHON_PATH}/lib")
30+
message(FATAL_ERROR "Could not find Python library in ${PREBUILT_PYTHON_PATH}/lib. Please ensure PREBUILT_PYTHON_PATH is correctly set to a Python installation for Android.")
3131
endif()
3232

3333
target_link_libraries(Python3_Mobile INTERFACE ${PYTHON_LIB})
3434
set(PYTHON_TARGET Python3_Mobile)
3535
else()
36-
message(WARNING "Neither PREBUILT_PYTHON_PATH nor Python3_ROOT_DIR is set for Android. Build might fail.")
37-
find_package(Python3 REQUIRED COMPONENTS Development.Embed)
38-
set(PYTHON_TARGET Python3::Python)
36+
# The fallback find_package(Python3) is unlikely to work for Android NDK compilation
37+
# without specific toolchain configurations. It's best to provide PREBUILT_PYTHON_PATH.
38+
message(FATAL_ERROR "PREBUILT_PYTHON_PATH is not set for Android. Please set this variable to the path of your Android-compiled Python installation (e.g., its 'include' and 'lib' directories). Without it, the build will likely fail.")
39+
# The following line will now likely not be reached due to the FATAL_ERROR above.
40+
# find_package(Python3 REQUIRED COMPONENTS Development.Embed)
41+
# set(PYTHON_TARGET Python3::Python)
3942
endif()
4043
else()
4144
# On desktop platforms, standard discovery is usually fine.
@@ -44,6 +47,7 @@ else()
4447
message(STATUS "Found Python: ${Python3_VERSION} at ${Python3_EXECUTABLE}")
4548
endif()
4649

50+
4751
# --- Project Setup ---
4852
project(PythonRuntime VERSION 1.0.0)
4953

0 commit comments

Comments
 (0)