Skip to content

Commit 4ee6ecf

Browse files
mergify[bot]KeaneWongKeane WongDanipizaMiguelCompany
authored
Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207) (#258)
* Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files. * [#23543] Added cmake option and default suffix for platforms * [#23543] Added cmake option for Python test and examples * [#23543] Default value for Windows OS * [#23543] Review changes * Refs #23543. Regenerate code with Fast DDS Gen from related PR. --------- (cherry picked from commit 57a5541) Signed-off-by: danipiza <dpizarrogallego@gmail.com> Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Co-authored-by: Keane Dixon Wong <Keanewong913@gmail.com> Co-authored-by: Keane Wong <kwong@FELT241.FluxErgy.local> Co-authored-by: danipiza <dpizarrogallego@gmail.com> Co-authored-by: Miguel Company <MiguelCompany@eprosima.com>
1 parent 26df2a7 commit 4ee6ecf

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

fastdds_python/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ endif()
2626

2727
project(fastdds_python VERSION 2.2.0)
2828

29+
if(NOT WIN32)
30+
# Default values for shared library suffix in MacOS
31+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
32+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
33+
endif()
34+
endif()
35+
2936
# Set BUILD_TESTING to OFF by default.
3037
if(NOT BUILD_TESTING)
3138
message(STATUS "Tests not compiled by default")

fastdds_python/test/types/CMakeLists.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ find_package(fastdds 3 REQUIRED)
2727

2828
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
2929

30+
if(NOT WIN32)
31+
# Default values for shared library suffix in MacOS
32+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
33+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
34+
endif()
35+
endif()
36+
3037
#Create library for C++ types
3138
add_library(${PROJECT_NAME} SHARED
3239
test_included_modulesTypeObjectSupport.cxx
@@ -132,6 +139,13 @@ find_package(fastdds 3 REQUIRED)
132139

133140
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
134141

142+
if(NOT WIN32)
143+
# Default values for shared library suffix in MacOS
144+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
145+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
146+
endif()
147+
endif()
148+
135149
#Create library for C++ types
136150
add_library(${PROJECT_NAME} SHARED
137151
test_modulesTypeObjectSupport.cxx
@@ -237,6 +251,13 @@ find_package(fastdds 3 REQUIRED)
237251

238252
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
239253

254+
if(NOT WIN32)
255+
# Default values for shared library suffix in MacOS
256+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
257+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
258+
endif()
259+
endif()
260+
240261
#Create library for C++ types
241262
add_library(${PROJECT_NAME} SHARED
242263
test_completeTypeObjectSupport.cxx

fastdds_python/test/types/test_complete.i

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,11 @@ namespace swig {
234234
eprosima::fastcdr::fixed_string<16> tmp(value);
235235
$self->fixed_string_field(tmp);
236236
}
237+
238+
std::string fixed_string_field_str() const
239+
{
240+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
241+
}
237242
}
238243

239244

@@ -445,6 +450,11 @@ namespace swig {
445450
eprosima::fastcdr::fixed_string<16> tmp(value);
446451
$self->fixed_string_field(tmp);
447452
}
453+
454+
std::string fixed_string_field_str() const
455+
{
456+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
457+
}
448458
}
449459

450460

@@ -1700,6 +1710,11 @@ namespace swig {
17001710
eprosima::fastcdr::fixed_string<16> tmp(value);
17011711
$self->fixed_string_field(tmp);
17021712
}
1713+
1714+
std::string fixed_string_field_str() const
1715+
{
1716+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1717+
}
17031718
}
17041719

17051720

fastdds_python/test/types/test_modules.i

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ namespace swig {
233233
eprosima::fastcdr::fixed_string<16> tmp(value);
234234
$self->fixed_string_field(tmp);
235235
}
236+
237+
std::string fixed_string_field_str() const
238+
{
239+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
240+
}
236241
}
237242

238243

@@ -433,6 +438,11 @@ namespace swig {
433438
eprosima::fastcdr::fixed_string<16> tmp(value);
434439
$self->fixed_string_field(tmp);
435440
}
441+
442+
std::string fixed_string_field_str() const
443+
{
444+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
445+
}
436446
}
437447

438448

@@ -1688,6 +1698,11 @@ namespace swig {
16881698
eprosima::fastcdr::fixed_string<16> tmp(value);
16891699
$self->fixed_string_field(tmp);
16901700
}
1701+
1702+
std::string fixed_string_field_str() const
1703+
{
1704+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1705+
}
16911706
}
16921707

16931708

fastdds_python_examples/HelloWorldExample/generated_code/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ find_package(fastdds 3 REQUIRED)
4141

4242
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4343

44+
if(NOT WIN32)
45+
# Default values for shared library suffix in MacOS
46+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
47+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
48+
endif()
49+
endif()
50+
4451
#Create library for C++ types
4552
add_library(${PROJECT_NAME} SHARED
4653
HelloWorldTypeObjectSupport.cxx

fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ find_package(fastdds 3 REQUIRED)
4141

4242
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
4343

44+
if(NOT WIN32)
45+
# Default values for shared library suffix in MacOS
46+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
47+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
48+
endif()
49+
endif()
50+
4451
#Create library for C++ types
4552
add_library(${PROJECT_NAME} SHARED
4653
calculatorTypeObjectSupport.cxx

0 commit comments

Comments
 (0)