@@ -26,12 +26,24 @@ if(NOT DEFINED SKBUILD_PROJECT_NAME)
26
26
endif ()
27
27
28
28
# Configuration options
29
- option (PYPYLON_USE_LIMITED_API "Use Python Limited API for stable ABI" ON )
29
+ option (PYPYLON_USE_LIMITED_API "Use Python Limited API for stable ABI" OFF )
30
30
option (PYPYLON_INCLUDE_DATA_PROCESSING "Include pylon data processing support" ON )
31
31
set (PYPYLON_MIN_LIMITED_API_VERSION "0x03090000" CACHE STRING "Minimum Python version for limited API" )
32
32
33
33
# Find required packages
34
34
find_package (Python REQUIRED COMPONENTS Interpreter Development.Module )
35
+
36
+ # For limited API builds, ensure we're using the correct Python library
37
+ if (PYPYLON_USE_LIMITED_API AND Python_VERSION VERSION_GREATER_EQUAL "3.9" )
38
+ # When using limited API, we need to ensure the Python library is correctly configured
39
+ if (TARGET Python::Module )
40
+ # Get the Python library path and ensure it's correct
41
+ get_target_property (PYTHON_LIBRARY Python::Module IMPORTED_LOCATION )
42
+ if (PYTHON_LIBRARY )
43
+ message (STATUS "Python library for limited API: ${PYTHON_LIBRARY} " )
44
+ endif ()
45
+ endif ()
46
+ endif ()
35
47
find_package (SWIG 4.3 REQUIRED )
36
48
37
49
# Include SWIG
@@ -116,6 +128,15 @@ if(PYPYLON_USE_LIMITED_API AND Python_VERSION VERSION_GREATER_EQUAL "3.9")
116
128
set (Python_LIMITED_API TRUE )
117
129
add_compile_definitions (Py_LIMITED_API=${PYPYLON_MIN_LIMITED_API_VERSION} )
118
130
message (STATUS "Using Python Limited API: ${PYPYLON_MIN_LIMITED_API_VERSION} " )
131
+
132
+ # For limited API builds, we might need to adjust the Python library configuration
133
+ if (TARGET Python::Module )
134
+ # Ensure the Python library is correctly set for limited API
135
+ get_target_property (PYTHON_LIBRARY Python::Module IMPORTED_LOCATION )
136
+ if (PYTHON_LIBRARY )
137
+ message (STATUS "Python library configured: ${PYTHON_LIBRARY} " )
138
+ endif ()
139
+ endif ()
119
140
endif ()
120
141
121
142
# Common compile definitions
0 commit comments