Skip to content

Commit a7b2e9b

Browse files
KeaneWongmergify[bot]
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) # Conflicts: # fastdds_python/test/types/test_complete.i # fastdds_python/test/types/test_modules.i # fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt
1 parent 3685455 commit a7b2e9b

File tree

6 files changed

+350
-0
lines changed

6 files changed

+350
-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 1.4.3)
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(fastrtps 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_modules.cxx
@@ -135,6 +142,13 @@ find_package(fastrtps REQUIRED)
135142

136143
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
137144

145+
if(NOT WIN32)
146+
# Default values for shared library suffix in MacOS
147+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
148+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
149+
endif()
150+
endif()
151+
138152
#Create library for C++ types
139153
add_library(${PROJECT_NAME} SHARED
140154
test_modules.cxx
@@ -243,6 +257,13 @@ find_package(fastrtps REQUIRED)
243257

244258
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
245259

260+
if(NOT WIN32)
261+
# Default values for shared library suffix in MacOS
262+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
263+
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
264+
endif()
265+
endif()
266+
246267
#Create library for C++ types
247268
add_library(${PROJECT_NAME} SHARED
248269
test_complete.cxx

fastdds_python/test/types/test_complete.i

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,35 @@ namespace swig {
212212

213213

214214

215+
<<<<<<< HEAD
216+
=======
217+
%ignore StructType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
218+
219+
220+
// Overloaded getter methods shadow each other and are equivalent in python
221+
// Const accesors produced constant enums instead of arrays/dictionaries when used
222+
// We ignore them to prevent this
223+
%ignore StructType::fixed_string_field();
224+
%rename("%s") StructType::fixed_string_field() const;
225+
226+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
227+
%extend StructType
228+
{
229+
void fixed_string_field(const std::string& value)
230+
{
231+
eprosima::fastcdr::fixed_string<16> tmp(value);
232+
$self->fixed_string_field(tmp);
233+
}
234+
235+
std::string fixed_string_field_str() const
236+
{
237+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
238+
}
239+
}
240+
241+
242+
243+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
215244
%ignore StructType::enum_field(Color&&);
216245

217246

@@ -410,6 +439,35 @@ namespace swig {
410439

411440

412441

442+
<<<<<<< HEAD
443+
=======
444+
%ignore CompleteTestType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
445+
446+
447+
// Overloaded getter methods shadow each other and are equivalent in python
448+
// Const accesors produced constant enums instead of arrays/dictionaries when used
449+
// We ignore them to prevent this
450+
%ignore CompleteTestType::fixed_string_field();
451+
%rename("%s") CompleteTestType::fixed_string_field() const;
452+
453+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
454+
%extend CompleteTestType
455+
{
456+
void fixed_string_field(const std::string& value)
457+
{
458+
eprosima::fastcdr::fixed_string<16> tmp(value);
459+
$self->fixed_string_field(tmp);
460+
}
461+
462+
std::string fixed_string_field_str() const
463+
{
464+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
465+
}
466+
}
467+
468+
469+
470+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
413471
%ignore CompleteTestType::enum_field(Color&&);
414472

415473

@@ -1708,6 +1766,35 @@ namespace swig {
17081766

17091767

17101768

1769+
<<<<<<< HEAD
1770+
=======
1771+
%ignore KeyedCompleteTestType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
1772+
1773+
1774+
// Overloaded getter methods shadow each other and are equivalent in python
1775+
// Const accesors produced constant enums instead of arrays/dictionaries when used
1776+
// We ignore them to prevent this
1777+
%ignore KeyedCompleteTestType::fixed_string_field();
1778+
%rename("%s") KeyedCompleteTestType::fixed_string_field() const;
1779+
1780+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
1781+
%extend KeyedCompleteTestType
1782+
{
1783+
void fixed_string_field(const std::string& value)
1784+
{
1785+
eprosima::fastcdr::fixed_string<16> tmp(value);
1786+
$self->fixed_string_field(tmp);
1787+
}
1788+
1789+
std::string fixed_string_field_str() const
1790+
{
1791+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1792+
}
1793+
}
1794+
1795+
1796+
1797+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
17111798
%ignore KeyedCompleteTestType::enum_field(Color&&);
17121799

17131800

fastdds_python/test/types/test_modules.i

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,35 @@ namespace swig {
211211

212212

213213

214+
<<<<<<< HEAD
215+
=======
216+
%ignore eprosima::test::StructType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
217+
218+
219+
// Overloaded getter methods shadow each other and are equivalent in python
220+
// Const accesors produced constant enums instead of arrays/dictionaries when used
221+
// We ignore them to prevent this
222+
%ignore eprosima::test::StructType::fixed_string_field();
223+
%rename("%s") eprosima::test::StructType::fixed_string_field() const;
224+
225+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
226+
%extend eprosima::test::StructType
227+
{
228+
void fixed_string_field(const std::string& value)
229+
{
230+
eprosima::fastcdr::fixed_string<16> tmp(value);
231+
$self->fixed_string_field(tmp);
232+
}
233+
234+
std::string fixed_string_field_str() const
235+
{
236+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
237+
}
238+
}
239+
240+
241+
242+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
214243
%ignore eprosima::test::StructType::enum_field(eprosima::test::Color&&);
215244

216245

@@ -398,6 +427,35 @@ namespace swig {
398427

399428

400429

430+
<<<<<<< HEAD
431+
=======
432+
%ignore eprosima::test::CompleteTestType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
433+
434+
435+
// Overloaded getter methods shadow each other and are equivalent in python
436+
// Const accesors produced constant enums instead of arrays/dictionaries when used
437+
// We ignore them to prevent this
438+
%ignore eprosima::test::CompleteTestType::fixed_string_field();
439+
%rename("%s") eprosima::test::CompleteTestType::fixed_string_field() const;
440+
441+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
442+
%extend eprosima::test::CompleteTestType
443+
{
444+
void fixed_string_field(const std::string& value)
445+
{
446+
eprosima::fastcdr::fixed_string<16> tmp(value);
447+
$self->fixed_string_field(tmp);
448+
}
449+
450+
std::string fixed_string_field_str() const
451+
{
452+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
453+
}
454+
}
455+
456+
457+
458+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
401459
%ignore eprosima::test::CompleteTestType::enum_field(eprosima::test::Color&&);
402460

403461

@@ -1696,6 +1754,35 @@ namespace swig {
16961754

16971755

16981756

1757+
<<<<<<< HEAD
1758+
=======
1759+
%ignore eprosima::test::KeyedCompleteTestType::fixed_string_field(eprosima::fastcdr::fixed_string<16>&&);
1760+
1761+
1762+
// Overloaded getter methods shadow each other and are equivalent in python
1763+
// Const accesors produced constant enums instead of arrays/dictionaries when used
1764+
// We ignore them to prevent this
1765+
%ignore eprosima::test::KeyedCompleteTestType::fixed_string_field();
1766+
%rename("%s") eprosima::test::KeyedCompleteTestType::fixed_string_field() const;
1767+
1768+
%template(fixed_string_16) eprosima::fastcdr::fixed_string<16>;
1769+
%extend eprosima::test::KeyedCompleteTestType
1770+
{
1771+
void fixed_string_field(const std::string& value)
1772+
{
1773+
eprosima::fastcdr::fixed_string<16> tmp(value);
1774+
$self->fixed_string_field(tmp);
1775+
}
1776+
1777+
std::string fixed_string_field_str() const
1778+
{
1779+
return std::string($self->fixed_string_field(), strnlen($self->fixed_string_field(), 16));
1780+
}
1781+
}
1782+
1783+
1784+
1785+
>>>>>>> 57a5541 (Set CMAKE_SHARED_LIBRARY_SUFFIX to always create .so files (#207))
16991786
%ignore eprosima::test::KeyedCompleteTestType::enum_field(eprosima::test::Color&&);
17001787

17011788

fastdds_python_examples/HelloWorldExample/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ find_package(fastrtps 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
HelloWorld.cxx

0 commit comments

Comments
 (0)