Skip to content
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

Removed Boost and ported to C++11. Added support for Android and iOS #26

Merged
merged 7 commits into from
Mar 7, 2017
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
[submodule "thirdparty/android-ifaddrs"]
path = thirdparty/android-ifaddrs
url = https://github.com/michalsrb/android-ifaddrs.git
[submodule "thirdparty/asio"]
path = thirdparty/asio
url = https://github.com/chriskohlhoff/asio.git
[submodule "thirdparty/fastcdr"]
path = thirdparty/fastcdr
url = https://github.com/eProsima/Fast-CDR.git
[submodule "thirdparty/idl"]
path = thirdparty/idl
url = https://github.com/eProsima/IDL-Parser.git
[submodule "thirdparty/tinyxml2"]
path = thirdparty/tinyxml2
url = https://github.com/leethomason/tinyxml2.git
43 changes: 29 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

###############################################################################
# CMake build rules for FastRTPS
# CMake build rules for FastRTPS
###############################################################################
cmake_minimum_required(VERSION 2.8.12)

Expand Down Expand Up @@ -99,7 +99,19 @@ if(MSVC OR MSVC_IDE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-unknown-pragmas -std=c++11")
endif()

add_definitions(
-DBOOST_ASIO_STANDALONE
-DASIO_STANDALONE
)

if(ANDROID)
add_definitions(
-DASIO_DISABLE_MOVE
-DASIO_DISABLE_STD_STRING_VIEW
)
endif()

###############################################################################
Expand Down Expand Up @@ -165,6 +177,7 @@ if(EPROSIMA_BUILD AND NOT EPROSIMA_INSTALLER_MINION)
set(INTERNAL_DEBUG ON)
endif()


###############################################################################
# Performance tests
###############################################################################
Expand All @@ -175,18 +188,18 @@ option(PERFORMANCE_TESTS "Activate the building and execution of performance tes
###############################################################################
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)


###############################################################################
# Check libraries
# Default shared libraries
###############################################################################
include(${PROJECT_SOURCE_DIR}/cmake/dev/boost_libraries.cmake)
set(BOOST_LIBRARIES_DEFAULT thread system date_time chrono regex atomic)
if(PERFORMANCE_TESTS)
set(BOOST_LIBRARIES_DEFAULT ${BOOST_LIBRARIES_DEFAULT} program_options)
endif()
check_boost(${BOOST_LIBRARIES_DEFAULT})
option(BUILD_SHARED_LIBS
"Global flag to cause add_library() to create shared libraries if on. \
If set to true, this will cause all libraries to be built shared \
unless the library was explicitly added as a static library."
ON)

###############################################################################
# Load external eProsima projects.
# Load external projects.
###############################################################################
option(THIRDPARTY "Activate the use of internal thirdparties" OFF)

Expand All @@ -197,6 +210,9 @@ endif()
include(${PROJECT_SOURCE_DIR}/cmake/dev/eprosima_libraries.cmake)

find_eprosima_package(fastcdr)
find_eprosima_thirdparty(asio)
find_eprosima_thirdparty(tinyxml2)
find_eprosima_thirdparty(android-ifaddrs)

###############################################################################
# Java application
Expand Down Expand Up @@ -224,14 +240,14 @@ add_subdirectory(src/cpp)
###############################################################################
# Testing
###############################################################################
if(NOT EPROSIMA_INSTALLER AND NOT EPROSIMA_INSTALLER_MINION)
if(EPROSIMA_BUILD_TESTS AND NOT EPROSIMA_INSTALLER AND NOT EPROSIMA_INSTALLER_MINION)
enable_testing()
include(CTest)
add_subdirectory(test)
endif()

###############################################################################
# Examples
# Examples
###############################################################################
option(COMPILE_EXAMPLES "Build example" OFF)
if(COMPILE_EXAMPLES)
Expand Down Expand Up @@ -314,7 +330,7 @@ if(BUILD_DOCUMENTATION)
endif()

add_custom_target(libreoffice
COMMAND "${LIBREOFFICE_EXE}" --headless ${LIBREOFFICE_CONVERT_README_MACRO}
COMMAND "${LIBREOFFICE_EXE}" --headless ${LIBREOFFICE_CONVERT_README_MACRO}
COMMAND ${CMAKE_COMMAND} -E rename "${PROJECT_SOURCE_DIR}/doc/README.html" "${README_LOCATION}/README.html"
DEPENDS
"${PROJECT_SOURCE_DIR}/doc/README.odt"
Expand Down Expand Up @@ -345,7 +361,6 @@ endif()
###############################################################################
# Install external eprosima libraries
install_eprosima_libraries()
install_boost(ALL thread system date_time chrono regex atomic)

# Install licenses
install(FILES ${PROJECT_SOURCE_DIR}/LICENSE
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ You can get either a binary distribution of *eprosima Fast RTPS* or compile the
The latest, up to date binary release of *eprosima Fast RTPS* can be obtained from the <a href='http://www.eprosima.com'>company website</a>.

### Installation from Source
To compile *eprosima Fast RTPS* from source, at least Cmake version 2.8.12 and Boost 1.61 are needed.
To compile *eprosima Fast RTPS* from source, at least Cmake version 2.8.12 is needed.
Clone the project from GitHub:

$ git clone https://github.com/eProsima/Fast-RTPS
Expand Down
120 changes: 0 additions & 120 deletions cmake/dev/boost_libraries.cmake

This file was deleted.

4 changes: 2 additions & 2 deletions cmake/dev/check_configuration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ macro(check_stdcxx)
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
check_cxx_compiler_flag(--std=c++11 SUPPORTS_CXX11)
if(SUPPORTS_CXX11)
add_compile_options(--std=c++11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "" FORCE)
set(HAVE_CXX11 1)
set(HAVE_CXX0X 1)
else()
set(HAVE_CXX11 0)
check_cxx_compiler_flag(--std=c++0x SUPPORTS_CXX0X)
if(SUPPORTS_CXX0X)
add_compile_options(--std=c++0x)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "" FORCE)
set(HAVE_CXX0X 1)
else()
set(HAVE_CXX0X 0)
Expand Down
9 changes: 0 additions & 9 deletions cmake/dev/compile_example.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
macro(compile_example example example_directory)
if(NOT ((EPROSIMA_INSTALLER OR EPROSIMA_INSTALLER_MINION) AND (MSVC OR MSVC_IDE)))

# Check if example use boost
set(USE_BOOST_ "")
foreach(arg ${ARGN})
if("${arg}" STREQUAL "USE_BOOST")
set(USE_BOOST_ "-DBOOST_ROOT:PATH=${BOOST_ROOT}" "-DBOOST_LIBRARYDIR:PATH=${BOOST_LIBRARYDIR}")
endif()
endforeach()

file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/fastrtpsConfig.cmake
"include(\"${PROJECT_BINARY_DIR}/cmake/config/fastrtpsTargets.cmake\")\n"
)
Expand All @@ -32,7 +24,6 @@ macro(compile_example example example_directory)
set(${example}_CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}"
"-DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/config|${CMAKE_PREFIX_PATH_}"
${USE_BOOST_}
"-DBIN_INSTALL_DIR:PATH=${BIN_INSTALL_DIR}")
list(APPEND ${example}_CMAKE_ARGS LIST_SEPARATOR "|")

Expand Down
27 changes: 19 additions & 8 deletions cmake/dev/eprosima_libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@
macro(find_eprosima_package package)
if(NOT (EPROSIMA_INSTALLER AND (MSVC OR MSVC_IDE)))
if(THIRDPARTY)
set(USE_BOOST_ "")
foreach(arg ${ARGN})
if("${arg}" STREQUAL "USE_BOOST")
set(USE_BOOST_ "-DEPROSIMA_BOOST=${EPROSIMA_BOOST}")
endif()
endforeach()

set(${package}ExternalDir ${PROJECT_BINARY_DIR}/external/${package})

if(MINION)
Expand All @@ -37,7 +30,6 @@ macro(find_eprosima_package package)
"\${GENERATOR_}"
${BUILD_OPTION}
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
${USE_BOOST_}
"-DMINION=ON"
"-DEPROSIMA_INSTALLER_MINION=${EPROSIMA_INSTALLER_MINION}"
"-DBIN_INSTALL_DIR:PATH=${BIN_INSTALL_DIR}"
Expand Down Expand Up @@ -126,6 +118,25 @@ macro(find_eprosima_package package)
endif()
endmacro()

macro(find_eprosima_thirdparty package)
if(NOT (EPROSIMA_INSTALLER AND (MSVC OR MSVC_IDE)))
if(THIRDPARTY)

execute_process(
COMMAND git submodule update --recursive --init "thirdparty/${package}"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE EXECUTE_RESULT
)

if(NOT EXECUTE_RESULT EQUAL 0)
message(FATAL_ERROR "Cannot configure Git submodule ${package}")
endif()

set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX_})
endif()
endif()
endmacro()

macro(install_eprosima_libraries)
if((MSVC OR MSVC_IDE) AND EPROSIMA_BUILD AND NOT MINION)
if(EPROSIMA_INSTALLER)
Expand Down
4 changes: 2 additions & 2 deletions cmake/dev/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ macro(add_gtest test)
# Add environment
if(WIN32)
set_tests_properties(${GTEST_GROUP_NAME}.${GTEST_NAME} PROPERTIES ENVIRONMENT
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;${BOOST_LIBRARYDIR}\\;$ENV{PATH}")
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;$ENV{PATH}")
endif()
endforeach()
endforeach()
Expand All @@ -97,7 +97,7 @@ macro(add_gtest test)
# Add environment
if(WIN32)
set_tests_properties(${test} PROPERTIES ENVIRONMENT
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;${BOOST_LIBRARYDIR}\\;$ENV{PATH}")
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;$ENV{PATH}")
endif()
endif()
endmacro()
Expand Down
2 changes: 1 addition & 1 deletion examples/C++/ClientServerTest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CFLAGS = $(COMMON_CFLAGS) -O2

INCLUDES= -I.

LIBS = -lfastcdr -lfastrtps -lboost_system -lboost_thread -lboost_date_time $(SYSLIBS)
LIBS = -lfastcdr -lfastrtps $(SYSLIBS)

DIRECTORIES= output.dir bin.dir

Expand Down
4 changes: 2 additions & 2 deletions examples/C++/Configurability/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ message(STATUS "Configuring UseCaseDemonstrator example...")
file(GLOB USECASEDEMONSTRATOR_EXAMPLE_SOURCES "*.cxx")

add_executable(UseCasePublisher ${USECASEDEMONSTRATOR_EXAMPLE_SOURCES} UseCasePublisher.cpp)
target_link_libraries(UseCasePublisher fastrtps fastcdr ${Boost_LIBRARIES})
target_link_libraries(UseCasePublisher fastrtps fastcdr)
install(TARGETS UseCasePublisher
RUNTIME DESTINATION examples/C++/UseCaseDemonstrator/${BIN_INSTALL_DIR}
)

add_executable(UseCaseSubscriber ${USECASEDEMONSTRATOR_EXAMPLE_SOURCES} UseCaseSubscriber.cpp)
target_link_libraries(UseCaseSubscriber fastrtps fastcdr ${Boost_LIBRARIES})
target_link_libraries(UseCaseSubscriber fastrtps fastcdr)
install(TARGETS UseCaseSubscriber
RUNTIME DESTINATION examples/C++/UseCaseDemonstrator/${BIN_INSTALL_DIR}
)
2 changes: 1 addition & 1 deletion examples/C++/Configurability/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CFLAGS = $(COMMON_CFLAGS) -O2

INCLUDES= -I.

LIBS = -lfastcdr -lfastrtps -lboost_system -lboost_thread -lboost_date_time $(SYSLIBS)
LIBS = -lfastcdr -lfastrtps $(SYSLIBS)

DIRECTORIES= output.dir bin.dir

Expand Down
Loading