Skip to content

Restructure directories add 2.3.4 #8561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ sources:
"2.3.3":
url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.3.3.tar.gz"
sha256: "5EBF27D810C6AB68EEF7D42937CD421D85E50509AE96883239979A1B3A2F4F82"
"2.3.4":
url: "https://github.com/eProsima/Fast-DDS/archive/refs/tags/v2.3.4.tar.gz"
sha256: "B1B2322DE0CA55A16495666E3FBDA8ACA32B888BBFAECDA29F2FFC4B072EF7AC"
patches:
"2.3.2":
- base_path: "source_subfolder"
patch_file: "patches/2.3.2-0001-fix-find-asio-and-tinyxml2.patch"
"2.3.3":
- base_path: "source_subfolder"
patch_file: "patches/2.3.3-0001-fix-find-asio-and-tinyxml2.patch"
patch_file: "patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch"
"2.3.4":
- base_path: "source_subfolder"
patch_file: "patches/2.3.X-0001-fix-find-asio-and-tinyxml2.patch"
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ def validate(self):
# This combination leads to an fast-dds error when linking
# linking dynamic '*.dll' and static MT runtime
raise ConanInvalidConfiguration("Mixing a dll {} library with a static runtime is a bad idea".format(self.name))

elif self.settings.os == "Macos":
# FIXME: Testing currently fails with MacOS - see https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/8561/1-configs/macos-clang/fast-dds/2.3.2//summary.json
# dyld: Library not loaded: libfastrtps.2.3.dylib --> Reason: image not found
raise ConanInvalidConfiguration("Macos currently not supported")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not aware of any change on the Macos machines, this should work as it was working before 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also extremely strange to me - but have no Mac - so cannot check reason ....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried locally and it worked for me (apple-clang 13). I'll investigate it in a different PR here in CCI

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is the link: #8566. I'm also upgrading dependencies, to apply some meaningful change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgsogo thanks for supporting here :)

Copy link
Contributor

@SpaceIm SpaceIm Dec 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No but your test package is likely broken, you don't inject DYLD_LIBRARY_PATH by not relying on self.run with environment=True, so yes shared on Macos breaks obviously.
Why is it so complex now? test_package is not supposed to be a functional test of the library.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1st thanks for pointing it out - yes -.- i forgot i start them with popen now -.- will adapt tomorrow.
2nd The reason for this huge test is a bug hard to detect but happened when one dependency (foonathan memory) was set with wrong default options. then sending messages from one thread to one other inside same process works fine but the communication between 2 process crash on runtime. Basically i want to check if 1 message can be sent by one process and received by 1 process. i dont want accidentally again a package with this misbehavior.


def build(self):
self._patch_sources()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a9cb0209..400c681e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -225,8 +225,8 @@ if(NOT BUILD_SHARED_LIBS)
endif()

eprosima_find_package(fastcdr REQUIRED)
-eprosima_find_thirdparty(Asio asio VERSION 1.10.8)
-eprosima_find_thirdparty(TinyXML2 tinyxml2)
+eprosima_find_thirdparty(asio REQUIRED)
+eprosima_find_thirdparty(tinyxml2 REQUIRED)

find_package(foonathan_memory REQUIRED)
message(STATUS "Found foonathan_memory: ${foonathan_memory_DIR}")
diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
index d26915242..f00e36ea6 100644
--- a/src/cpp/CMakeLists.txt
+++ b/src/cpp/CMakeLists.txt
@@ -456,7 +456,7 @@ elseif(NOT EPROSIMA_INSTALLER)
# Link library to external libraries.
target_link_libraries(${PROJECT_NAME} ${PRIVACY} fastcdr foonathan_memory
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}
- ${TINYXML2_LIBRARY}
+ tinyxml2::tinyxml2
$<$<BOOL:${LINK_SSL}>:OpenSSL::SSL$<SEMICOLON>OpenSSL::Crypto$<$<BOOL:${WIN32}>:$<SEMICOLON>crypt32.lib>>
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
${THIRDPARTY_BOOST_LINK_LIBS}
36 changes: 36 additions & 0 deletions recipes/fast-dds/2.3.X/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cmake_minimum_required(VERSION 3.1)
project(HelloWorldExample)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

find_package(fastdds REQUIRED)

include_directories(msg)

add_executable(test_pub
HelloWorld_pub.cpp
msg/HelloWorld.cxx
msg/HelloWorldPublisher.cpp
msg/HelloWorldPubSubTypes.cxx
msg/HelloWorldSubscriber.cpp
)

add_executable(test_sub
HelloWorld_sub.cpp
msg/HelloWorld.cxx
msg/HelloWorldPublisher.cpp
msg/HelloWorldPubSubTypes.cxx
msg/HelloWorldSubscriber.cpp
)

set_property(TARGET test_sub PROPERTY CXX_STANDARD 11)
set_property(TARGET test_pub PROPERTY CXX_STANDARD 11)

target_link_libraries(test_sub
fastrtps
)

target_link_libraries(test_pub
fastrtps
)
48 changes: 48 additions & 0 deletions recipes/fast-dds/2.3.X/test_package/HelloWorld_pub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @file HelloWorld_main.cpp
*
*/

#include "HelloWorldPublisher.h"
#include "HelloWorldSubscriber.h"

#include <fastrtps/Domain.h>
#include <fastrtps/log/Log.h>

using namespace eprosima;
using namespace fastrtps;
using namespace rtps;
int main(int argc, char** argv)
{
std::cout << "Starting "<< std::endl;

int count = 5;
long sleep = 100;

HelloWorldPublisher mypub;
if(mypub.init())
{
mypub.run(count, sleep);
}
else
{
std::cout << "problems ... init didnt work" << std::endl;
}
Domain::stopAll();
Log::Reset();
return 0;
}
48 changes: 48 additions & 0 deletions recipes/fast-dds/2.3.X/test_package/HelloWorld_sub.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @file HelloWorld_main.cpp
*
*/

#include "HelloWorldPublisher.h"
#include "HelloWorldSubscriber.h"

#include <fastrtps/Domain.h>
#include <fastrtps/log/Log.h>

using namespace eprosima;
using namespace fastrtps;
using namespace rtps;
int main(int argc, char** argv)
{
std::cout << "Starting "<< std::endl;

int count = 5;
long sleep = 100;

HelloWorldSubscriber mysub;
if(mysub.init())
{
mysub.run(count);
}
else
{
std::cout << "problems ... init didnt work" << std::endl;
}
Domain::stopAll();
Log::Reset();
return 0;
}
27 changes: 27 additions & 0 deletions recipes/fast-dds/2.3.X/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import subprocess
from conans import ConanFile, CMake, tools
import os
from subprocess import Popen

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake", "cmake_find_package"

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
bin_sub_cmd = os.path.join("bin", "test_sub")
bin_pub_cmd = os.path.join("bin", "test_pub")
sub_process = Popen([bin_sub_cmd],stdout=subprocess.PIPE)
pub_process = Popen([bin_pub_cmd],stdout=subprocess.PIPE)
sub_process.wait(30)
pub_process.wait(30)
msg_send = 'Message: HelloWorld with index: 5 SENT' in str(pub_process.stdout.read())
msg_received = 'HelloWorld 5 RECEIVED' in str(sub_process.stdout.read())
assert msg_send
assert msg_received

167 changes: 167 additions & 0 deletions recipes/fast-dds/2.3.X/test_package/msg/HelloWorldPublisher.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @file HelloWorldPublisher.cpp
*
*/

#include "HelloWorldPublisher.h"
#include <fastrtps/participant/Participant.h>
#include <fastrtps/attributes/ParticipantAttributes.h>
#include <fastrtps/attributes/PublisherAttributes.h>
#include <fastrtps/publisher/Publisher.h>
#include <fastrtps/Domain.h>

#include <thread>

using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;

HelloWorldPublisher::HelloWorldPublisher()
: mp_participant(nullptr)
, mp_publisher(nullptr)
{
}

bool HelloWorldPublisher::init()
{
m_Hello.index(0);
m_Hello.message("HelloWorld");
ParticipantAttributes PParam;
PParam.rtps.builtin.discovery_config.discoveryProtocol = DiscoveryProtocol_t::SIMPLE;
PParam.rtps.builtin.discovery_config.use_SIMPLE_EndpointDiscoveryProtocol = true;
PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationReaderANDSubscriptionWriter = true;
PParam.rtps.builtin.discovery_config.m_simpleEDP.use_PublicationWriterANDSubscriptionReader = true;
PParam.rtps.builtin.discovery_config.leaseDuration = c_TimeInfinite;
PParam.rtps.setName("Participant_pub");
mp_participant = Domain::createParticipant(PParam);

if (mp_participant == nullptr)
{
return false;
}
//REGISTER THE TYPE

Domain::registerType(mp_participant, &m_type);

//CREATE THE PUBLISHER
PublisherAttributes Wparam;
Wparam.topic.topicKind = NO_KEY;
Wparam.topic.topicDataType = "HelloWorld";
Wparam.topic.topicName = "HelloWorldTopic";
Wparam.topic.historyQos.kind = KEEP_LAST_HISTORY_QOS;
Wparam.topic.historyQos.depth = 30;
Wparam.topic.resourceLimitsQos.max_samples = 50;
Wparam.topic.resourceLimitsQos.allocated_samples = 20;
Wparam.times.heartbeatPeriod.seconds = 2;
Wparam.times.heartbeatPeriod.nanosec = 200 * 1000 * 1000;
Wparam.qos.m_reliability.kind = RELIABLE_RELIABILITY_QOS;
mp_publisher = Domain::createPublisher(mp_participant, Wparam, (PublisherListener*)&m_listener);
if (mp_publisher == nullptr)
{
return false;
}

return true;

}

HelloWorldPublisher::~HelloWorldPublisher()
{
// TODO Auto-generated destructor stub
Domain::removeParticipant(mp_participant);
}

void HelloWorldPublisher::PubListener::onPublicationMatched(
Publisher* /*pub*/,
MatchingInfo& info)
{
if (info.status == MATCHED_MATCHING)
{
n_matched++;
firstConnected = true;
std::cout << "Publisher matched" << std::endl;
}
else
{
n_matched--;
std::cout << "Publisher unmatched" << std::endl;
}
}

void HelloWorldPublisher::runThread(
uint32_t samples,
uint32_t sleep)
{
if (samples == 0)
{
while (!stop)
{
if (publish(false))
{
std::cout << "Message: " << m_Hello.message() << " with index: " << m_Hello.index() << " SENT" <<
std::endl;
}
std::this_thread::sleep_for(std::chrono::milliseconds(sleep));
}
}
else
{
for (uint32_t i = 0; i < samples; ++i)
{
if (!publish())
{
--i;
}
else
{
std::cout << "Message: " << m_Hello.message() << " with index: " << m_Hello.index() << " SENT" <<
std::endl;
}
std::this_thread::sleep_for(std::chrono::milliseconds(sleep));
}
}
}

void HelloWorldPublisher::run(
uint32_t samples,
uint32_t sleep)
{
stop = false;
std::thread thread(&HelloWorldPublisher::runThread, this, samples, sleep);
if (samples == 0)
{
std::cout << "Publisher running. Please press enter to stop the Publisher at any time." << std::endl;
std::cin.ignore();
stop = true;
}
else
{
std::cout << "Publisher running " << samples << " samples." << std::endl;
}
thread.join();
}

bool HelloWorldPublisher::publish(
bool waitForListener)
{
if (m_listener.firstConnected || !waitForListener || m_listener.n_matched > 0)
{
m_Hello.index(m_Hello.index() + 1);
mp_publisher->write((void*)&m_Hello);
return true;
}
return false;
}
Loading