Skip to content

Commit 57a94e1

Browse files
committed
test windows linker issue
1 parent 312ba20 commit 57a94e1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

CMakeLists.txt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,24 @@ if(NOT DEFINED SKBUILD_PROJECT_NAME)
2626
endif()
2727

2828
# 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)
3030
option(PYPYLON_INCLUDE_DATA_PROCESSING "Include pylon data processing support" ON)
3131
set(PYPYLON_MIN_LIMITED_API_VERSION "0x03090000" CACHE STRING "Minimum Python version for limited API")
3232

3333
# Find required packages
3434
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()
3547
find_package(SWIG 4.3 REQUIRED)
3648

3749
# Include SWIG
@@ -116,6 +128,17 @@ if(PYPYLON_USE_LIMITED_API AND Python_VERSION VERSION_GREATER_EQUAL "3.9")
116128
set(Python_LIMITED_API TRUE)
117129
add_compile_definitions(Py_LIMITED_API=${PYPYLON_MIN_LIMITED_API_VERSION})
118130
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()
140+
else()
141+
message(STATUS "Python Limited API disabled")
119142
endif()
120143

121144
# Common compile definitions

0 commit comments

Comments
 (0)