From 8f128909f9fa4d053b552ca55a68ee8569705d33 Mon Sep 17 00:00:00 2001 From: guanshoukui Date: Sat, 17 Aug 2024 04:16:17 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpython=E7=89=88=E6=9C=AC3.9?= =?UTF-8?q?=E4=BB=A5=E4=B8=8A,cyber=5Fchannel=E6=97=A0=E6=B3=95=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cyber/python/internal/CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cyber/python/internal/CMakeLists.txt b/cyber/python/internal/CMakeLists.txt index 8a0bd0f..2bc8ff9 100644 --- a/cyber/python/internal/CMakeLists.txt +++ b/cyber/python/internal/CMakeLists.txt @@ -1,6 +1,17 @@ add_library(_cyber_wrapper SHARED py_cyber.cc ) + +# Extract major and minor versions +string(REPLACE "." ";" VERSION_LIST "${Python_VERSION}") +list(GET VERSION_LIST 0 PYTHON_VERSION_MAJOR) +list(GET VERSION_LIST 1 PYTHON_VERSION_MINOR) + +# Define PY_SSIZE_T_CLEAN if Python version is 3.9 or greater +if(PYTHON_VERSION_MAJOR GREATER_EQUAL 3 AND PYTHON_VERSION_MINOR GREATER_EQUAL 9) + target_compile_definitions(_cyber_wrapper PRIVATE PY_SSIZE_T_CLEAN) +endif() + target_link_libraries(_cyber_wrapper ${TARGET_NAME} # ${CYBER_PYTHON_LIB}