Skip to content

Commit e2e4fbe

Browse files
committed
Refs #23483. Improve
Signed-off-by: Ricardo González <ricardo@richiware.dev>
1 parent 56c5df6 commit e2e4fbe

3 files changed

Lines changed: 6 additions & 22 deletions

File tree

fastdds_python/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ endif()
5353
include(${SWIG_USE_FILE})
5454
set(CMAKE_SWIG_FLAGS "")
5555

56+
option(USE_PYTHON_STABLE_ABI "Generate Fast DDS python against Python Stable ABI" OFF)
57+
5658
if(USE_PYTHON_STABLE_ABI)
5759
find_package(Python3 COMPONENTS Interpreter Development.SABIModule REQUIRED)
5860
else()

fastdds_python/src/swig/CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,8 @@ if(MSVC OR MSVC_IDE)
7070

7171
endif()
7272

73-
if(USE_PYTHON_STABLE_ABI)
74-
target_link_libraries(${PROJECT_NAME} Python3::SABIModule)
75-
else()
76-
target_link_libraries(${PROJECT_NAME} Python3::Module)
77-
endif()
78-
7973
target_link_libraries(${PROJECT_NAME}
74+
$<IF:$<BOOL:${USE_PYTHON_STABLE_ABI}>, Python3::SABIModule, Python3::Module>
8075
fastcdr
8176
fastdds
8277
)

fastdds_python/test/types/CMakeLists.txt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ endif()
7878
include(${SWIG_USE_FILE})
7979
set(CMAKE_SWIG_FLAGS "")
8080

81-
if(USE_PYTHON_STABLE_ABI)
82-
find_package(Python3 COMPONENTS Interpreter Development.SABIModule REQUIRED)
83-
else()
84-
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
85-
endif()
81+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
8682

8783
set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
8884
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
@@ -195,11 +191,7 @@ endif()
195191
include(${SWIG_USE_FILE})
196192
set(CMAKE_SWIG_FLAGS "")
197193

198-
if(USE_PYTHON_STABLE_ABI)
199-
find_package(Python3 COMPONENTS Interpreter Development.SABIModule REQUIRED)
200-
else()
201-
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
202-
endif()
194+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
203195

204196
set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
205197
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
@@ -313,12 +305,7 @@ endif()
313305
include(${SWIG_USE_FILE})
314306
set(CMAKE_SWIG_FLAGS "")
315307

316-
317-
if(USE_PYTHON_STABLE_ABI)
318-
find_package(Python3 COMPONENTS Interpreter Development.SABIModule REQUIRED)
319-
else()
320-
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
321-
endif()
308+
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
322309

323310
set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS})
324311
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})

0 commit comments

Comments
 (0)