Skip to content

Commit 4ad24b8

Browse files
Danipizarichiware
authored andcommitted
[#23483] Added STABLE_ABI configuration to python_examples + modified calculator.i
Signed-off-by: danipiza <dpizarrogallego@gmail.com>
1 parent 4b46d88 commit 4ad24b8

2 files changed

Lines changed: 32 additions & 2 deletions

File tree

fastdds_python_examples/HelloWorldExample/generated_code/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,23 @@ if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
114114
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
115115
endif()
116116

117+
if(MSVC OR MSVC_IDE)
118+
if(USE_PYTHON_STABLE_ABI)
119+
target_compile_definitions(${${PROJECT_NAME}_MODULE}
120+
PRIVATE
121+
NOMINMAX
122+
Py_LIMITED_API=0x03040000
123+
)
124+
endif()
125+
endif()
126+
127+
if(USE_PYTHON_STABLE_ABI)
128+
target_link_libraries(${${PROJECT_NAME}_MODULE} Python3::SABIModule)
129+
else()
130+
target_link_libraries(${${PROJECT_NAME}_MODULE} Python3::Module)
131+
endif()
132+
117133
target_link_libraries(${${PROJECT_NAME}_MODULE}
118-
Python3::Module
119134
fastdds
120135
${PROJECT_NAME}
121136
)

fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,23 @@ if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
109109
set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64)
110110
endif()
111111

112+
if(MSVC OR MSVC_IDE)
113+
if(USE_PYTHON_STABLE_ABI)
114+
target_compile_definitions(${${PROJECT_NAME}_MODULE}
115+
PRIVATE
116+
NOMINMAX
117+
Py_LIMITED_API=0x03040000
118+
)
119+
endif()
120+
endif()
121+
122+
if(USE_PYTHON_STABLE_ABI)
123+
target_link_libraries(${${PROJECT_NAME}_MODULE} Python3::SABIModule)
124+
else()
125+
target_link_libraries(${${PROJECT_NAME}_MODULE} Python3::Module)
126+
endif()
127+
112128
target_link_libraries(${${PROJECT_NAME}_MODULE}
113-
Python3::Module
114129
fastdds
115130
${PROJECT_NAME}
116131
)

0 commit comments

Comments
 (0)