Skip to content

Commit e7ac6d4

Browse files
KeaneWongKeane WongDanipizaMiguelCompany
authored andcommitted
Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207)
* Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files. * [#23543] Added cmake option and default suffix for platforms Signed-off-by: danipiza <dpizarrogallego@gmail.com> * [#23543] Added cmake option for Python test and examples Signed-off-by: danipiza <dpizarrogallego@gmail.com> * [#23543] Default value for Windows OS Signed-off-by: danipiza <dpizarrogallego@gmail.com> * [#23543] Review changes Signed-off-by: danipiza <dpizarrogallego@gmail.com> * Refs #23543. Regenerate code with Fast DDS Gen from related PR. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> --------- Signed-off-by: danipiza <dpizarrogallego@gmail.com> Signed-off-by: Miguel Company <MiguelCompany@eprosima.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> (cherry picked from commit 57a5541)
1 parent b27ee70 commit e7ac6d4

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.3.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
@@ -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
test_included_modulesTypeObjectSupport.cxx
@@ -146,6 +153,13 @@ find_package(fastdds 3 REQUIRED)
146153

147154
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
148155

156+
if(NOT WIN32)
157+
# Default values for shared library suffix in MacOS
158+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
159+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
160+
endif()
161+
endif()
162+
149163
#Create library for C++ types
150164
add_library(${PROJECT_NAME} SHARED
151165
test_modulesTypeObjectSupport.cxx
@@ -251,6 +265,13 @@ find_package(fastdds 3 REQUIRED)
251265

252266
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
253267

268+
if(NOT WIN32)
269+
# Default values for shared library suffix in MacOS
270+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
271+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
272+
endif()
273+
endif()
274+
254275
#Create library for C++ types
255276
add_library(${PROJECT_NAME} SHARED
256277
test_completeTypeObjectSupport.cxx

fastdds_python/test/types/test_complete.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

@@ -444,6 +449,11 @@ namespace swig {
444449
eprosima::fastcdr::fixed_string<16> tmp(value);
445450
$self->fixed_string_field(tmp);
446451
}
452+
453+
std::string fixed_string_field_str() const
454+
{
455+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
456+
}
447457
}
448458

449459

@@ -1699,6 +1709,11 @@ namespace swig {
16991709
eprosima::fastcdr::fixed_string<16> tmp(value);
17001710
$self->fixed_string_field(tmp);
17011711
}
1712+
1713+
std::string fixed_string_field_str() const
1714+
{
1715+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1716+
}
17021717
}
17031718

17041719

fastdds_python/test/types/test_modules.i

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

237242

@@ -432,6 +437,11 @@ namespace swig {
432437
eprosima::fastcdr::fixed_string<16> tmp(value);
433438
$self->fixed_string_field(tmp);
434439
}
440+
441+
std::string fixed_string_field_str() const
442+
{
443+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
444+
}
435445
}
436446

437447

@@ -1687,6 +1697,11 @@ namespace swig {
16871697
eprosima::fastcdr::fixed_string<16> tmp(value);
16881698
$self->fixed_string_field(tmp);
16891699
}
1700+
1701+
std::string fixed_string_field_str() const
1702+
{
1703+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1704+
}
16901705
}
16911706

16921707

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)