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 2 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 @@ -24,6 +24,7 @@ class FastDDSConan(ConanFile):
}
generators = "cmake", "cmake_find_package"
_cmake = None
exports_sources = ["patches/**", "CMakeLists.txt"]

@property
def _pkg_share(self):
Expand Down Expand Up @@ -93,6 +94,12 @@ def _patch_sources(self):
for patch in self.conan_data["patches"][self.version]:
tools.patch(**patch)

def validate(self):
# FIXME: Foonathan dependency currently not proper working with cross compile
# see https://github.com/conan-io/conan-center-index/pull/7632#discussion_r730445887
if hasattr(self, "settings_build") and tools.cross_building(self):
raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome.")

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.

to remove, there is already a validate() method. It seems you have reverted all the fixes of another PR, correct?

Copy link
Contributor Author

@dotChris90 dotChris90 Dec 28, 2021

Choose a reason for hiding this comment

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

yes - adapted and try again

def configure(self):
if self.options.shared:
del self.options.fPIC
Expand All @@ -118,12 +125,7 @@ def requirements(self):
self.requires("foonathan-memory/0.7.0")
self.requires("boost/1.73.0")
if self.options.with_ssl:
self.requires("openssl/1.1.1m")

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])
Copy link
Contributor

Choose a reason for hiding this comment

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

why it it removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clicked wrong button .... sorry for that will soon add again

self.requires("openssl/1.1.1k")
Copy link
Contributor

Choose a reason for hiding this comment

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

why this downgrade?


def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True,
Expand Down Expand Up @@ -176,10 +178,10 @@ def package(self):

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "fastdds"
self.cpp_info.names["cmake_find_package_multi"] = "fastdds"
self.cpp_info.names["cmake_find_multi_package"] = "fastdds"
Copy link
Contributor

Choose a reason for hiding this comment

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

no

# component fastrtps
self.cpp_info.components["fastrtps"].names["cmake_find_package"] = "fastrtps"
self.cpp_info.components["fastrtps"].names["cmake_find_package_multi"] = "fastrtps"
self.cpp_info.components["fastrtps"].names["cmake_find_multi_package"] = "fastrtps"
self.cpp_info.components["fastrtps"].libs = tools.collect_libs(self)
self.cpp_info.components["fastrtps"].requires = [
"fast-cdr::fast-cdr",
Expand All @@ -203,14 +205,14 @@ def package_info(self):
self.cpp_info.components["fastrtps"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path]
# component fast-discovery
self.cpp_info.components["fast-discovery-server"].names["cmake_find_package"] = "fast-discovery-server"
self.cpp_info.components["fast-discovery-server"].names["cmake_find_package_multi"] = "fast-discovery-server"
self.cpp_info.components["fast-discovery-server"].names["cmake_find_multi_package"] = "fast-discovery-server"
self.cpp_info.components["fast-discovery-server"].bindirs = ["bin"]
bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH env var for fast-dds::fast-discovery-server with : {}".format(bin_path)),
self.env_info.PATH.append(bin_path)
# component tools
self.cpp_info.components["tools"].names["cmake_find_package"] = "tools"
self.cpp_info.components["tools"].names["cmake_find_package_multi"] = "tools"
self.cpp_info.components["tools"].names["cmake_find_multi_package"] = "tools"
self.cpp_info.components["tools"].bindirs = [os.path.join("bin","tools")]
bin_path = os.path.join(self._pkg_bin, "tools")
self.output.info("Appending PATH env var for fast-dds::tools with : {}".format(bin_path)),
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(5)
pub_process.wait(5)
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

Loading