Skip to content

Commit 5301ef2

Browse files
authored
Merge pull request #26 from esteve/cpp11-android
Removed Boost and ported to C++11. Added support for Android and iOS
2 parents 4ae016f + 7ce6235 commit 5301ef2

File tree

203 files changed

+5176
-4134
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

203 files changed

+5176
-4134
lines changed

.gitmodules

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1+
[submodule "thirdparty/android-ifaddrs"]
2+
path = thirdparty/android-ifaddrs
3+
url = https://github.com/michalsrb/android-ifaddrs.git
4+
[submodule "thirdparty/asio"]
5+
path = thirdparty/asio
6+
url = https://github.com/chriskohlhoff/asio.git
17
[submodule "thirdparty/fastcdr"]
28
path = thirdparty/fastcdr
39
url = https://github.com/eProsima/Fast-CDR.git
410
[submodule "thirdparty/idl"]
511
path = thirdparty/idl
612
url = https://github.com/eProsima/IDL-Parser.git
13+
[submodule "thirdparty/tinyxml2"]
14+
path = thirdparty/tinyxml2
15+
url = https://github.com/leethomason/tinyxml2.git

CMakeLists.txt

+29-14
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
###############################################################################
16-
# CMake build rules for FastRTPS
16+
# CMake build rules for FastRTPS
1717
###############################################################################
1818
cmake_minimum_required(VERSION 2.8.12)
1919

@@ -99,7 +99,19 @@ if(MSVC OR MSVC_IDE)
9999
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
100100
endif()
101101
else()
102-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-unknown-pragmas")
102+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Wno-unknown-pragmas -std=c++11")
103+
endif()
104+
105+
add_definitions(
106+
-DBOOST_ASIO_STANDALONE
107+
-DASIO_STANDALONE
108+
)
109+
110+
if(ANDROID)
111+
add_definitions(
112+
-DASIO_DISABLE_MOVE
113+
-DASIO_DISABLE_STD_STRING_VIEW
114+
)
103115
endif()
104116

105117
###############################################################################
@@ -165,6 +177,7 @@ if(EPROSIMA_BUILD AND NOT EPROSIMA_INSTALLER_MINION)
165177
set(INTERNAL_DEBUG ON)
166178
endif()
167179

180+
168181
###############################################################################
169182
# Performance tests
170183
###############################################################################
@@ -175,18 +188,18 @@ option(PERFORMANCE_TESTS "Activate the building and execution of performance tes
175188
###############################################################################
176189
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)
177190

191+
178192
###############################################################################
179-
# Check libraries
193+
# Default shared libraries
180194
###############################################################################
181-
include(${PROJECT_SOURCE_DIR}/cmake/dev/boost_libraries.cmake)
182-
set(BOOST_LIBRARIES_DEFAULT thread system date_time chrono regex atomic)
183-
if(PERFORMANCE_TESTS)
184-
set(BOOST_LIBRARIES_DEFAULT ${BOOST_LIBRARIES_DEFAULT} program_options)
185-
endif()
186-
check_boost(${BOOST_LIBRARIES_DEFAULT})
195+
option(BUILD_SHARED_LIBS
196+
"Global flag to cause add_library() to create shared libraries if on. \
197+
If set to true, this will cause all libraries to be built shared \
198+
unless the library was explicitly added as a static library."
199+
ON)
187200

188201
###############################################################################
189-
# Load external eProsima projects.
202+
# Load external projects.
190203
###############################################################################
191204
option(THIRDPARTY "Activate the use of internal thirdparties" OFF)
192205

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

199212
find_eprosima_package(fastcdr)
213+
find_eprosima_thirdparty(asio)
214+
find_eprosima_thirdparty(tinyxml2)
215+
find_eprosima_thirdparty(android-ifaddrs)
200216

201217
###############################################################################
202218
# Java application
@@ -224,14 +240,14 @@ add_subdirectory(src/cpp)
224240
###############################################################################
225241
# Testing
226242
###############################################################################
227-
if(NOT EPROSIMA_INSTALLER AND NOT EPROSIMA_INSTALLER_MINION)
243+
if(EPROSIMA_BUILD_TESTS AND NOT EPROSIMA_INSTALLER AND NOT EPROSIMA_INSTALLER_MINION)
228244
enable_testing()
229245
include(CTest)
230246
add_subdirectory(test)
231247
endif()
232248

233249
###############################################################################
234-
# Examples
250+
# Examples
235251
###############################################################################
236252
option(COMPILE_EXAMPLES "Build example" OFF)
237253
if(COMPILE_EXAMPLES)
@@ -314,7 +330,7 @@ if(BUILD_DOCUMENTATION)
314330
endif()
315331

316332
add_custom_target(libreoffice
317-
COMMAND "${LIBREOFFICE_EXE}" --headless ${LIBREOFFICE_CONVERT_README_MACRO}
333+
COMMAND "${LIBREOFFICE_EXE}" --headless ${LIBREOFFICE_CONVERT_README_MACRO}
318334
COMMAND ${CMAKE_COMMAND} -E rename "${PROJECT_SOURCE_DIR}/doc/README.html" "${README_LOCATION}/README.html"
319335
DEPENDS
320336
"${PROJECT_SOURCE_DIR}/doc/README.odt"
@@ -345,7 +361,6 @@ endif()
345361
###############################################################################
346362
# Install external eprosima libraries
347363
install_eprosima_libraries()
348-
install_boost(ALL thread system date_time chrono regex atomic)
349364

350365
# Install licenses
351366
install(FILES ${PROJECT_SOURCE_DIR}/LICENSE

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ You can get either a binary distribution of *eprosima Fast RTPS* or compile the
3131
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>.
3232

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

3737
$ git clone https://github.com/eProsima/Fast-RTPS

cmake/dev/boost_libraries.cmake

-120
This file was deleted.

cmake/dev/check_configuration.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ macro(check_stdcxx)
1919
CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2020
check_cxx_compiler_flag(--std=c++11 SUPPORTS_CXX11)
2121
if(SUPPORTS_CXX11)
22-
add_compile_options(--std=c++11)
22+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "" FORCE)
2323
set(HAVE_CXX11 1)
2424
set(HAVE_CXX0X 1)
2525
else()
2626
set(HAVE_CXX11 0)
2727
check_cxx_compiler_flag(--std=c++0x SUPPORTS_CXX0X)
2828
if(SUPPORTS_CXX0X)
29-
add_compile_options(--std=c++0x)
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" CACHE STRING "" FORCE)
3030
set(HAVE_CXX0X 1)
3131
else()
3232
set(HAVE_CXX0X 0)

cmake/dev/compile_example.cmake

-9
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,6 @@
1515
macro(compile_example example example_directory)
1616
if(NOT ((EPROSIMA_INSTALLER OR EPROSIMA_INSTALLER_MINION) AND (MSVC OR MSVC_IDE)))
1717

18-
# Check if example use boost
19-
set(USE_BOOST_ "")
20-
foreach(arg ${ARGN})
21-
if("${arg}" STREQUAL "USE_BOOST")
22-
set(USE_BOOST_ "-DBOOST_ROOT:PATH=${BOOST_ROOT}" "-DBOOST_LIBRARYDIR:PATH=${BOOST_LIBRARYDIR}")
23-
endif()
24-
endforeach()
25-
2618
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/config/fastrtpsConfig.cmake
2719
"include(\"${PROJECT_BINARY_DIR}/cmake/config/fastrtpsTargets.cmake\")\n"
2820
)
@@ -32,7 +24,6 @@ macro(compile_example example example_directory)
3224
set(${example}_CMAKE_ARGS
3325
"-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}"
3426
"-DCMAKE_PREFIX_PATH=${CMAKE_CURRENT_BINARY_DIR}/config|${CMAKE_PREFIX_PATH_}"
35-
${USE_BOOST_}
3627
"-DBIN_INSTALL_DIR:PATH=${BIN_INSTALL_DIR}")
3728
list(APPEND ${example}_CMAKE_ARGS LIST_SEPARATOR "|")
3829

cmake/dev/eprosima_libraries.cmake

+19-8
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,6 @@
1515
macro(find_eprosima_package package)
1616
if(NOT (EPROSIMA_INSTALLER AND (MSVC OR MSVC_IDE)))
1717
if(THIRDPARTY)
18-
set(USE_BOOST_ "")
19-
foreach(arg ${ARGN})
20-
if("${arg}" STREQUAL "USE_BOOST")
21-
set(USE_BOOST_ "-DEPROSIMA_BOOST=${EPROSIMA_BOOST}")
22-
endif()
23-
endforeach()
24-
2518
set(${package}ExternalDir ${PROJECT_BINARY_DIR}/external/${package})
2619

2720
if(MINION)
@@ -37,7 +30,6 @@ macro(find_eprosima_package package)
3730
"\${GENERATOR_}"
3831
${BUILD_OPTION}
3932
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
40-
${USE_BOOST_}
4133
"-DMINION=ON"
4234
"-DEPROSIMA_INSTALLER_MINION=${EPROSIMA_INSTALLER_MINION}"
4335
"-DBIN_INSTALL_DIR:PATH=${BIN_INSTALL_DIR}"
@@ -126,6 +118,25 @@ macro(find_eprosima_package package)
126118
endif()
127119
endmacro()
128120

121+
macro(find_eprosima_thirdparty package)
122+
if(NOT (EPROSIMA_INSTALLER AND (MSVC OR MSVC_IDE)))
123+
if(THIRDPARTY)
124+
125+
execute_process(
126+
COMMAND git submodule update --recursive --init "thirdparty/${package}"
127+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
128+
RESULT_VARIABLE EXECUTE_RESULT
129+
)
130+
131+
if(NOT EXECUTE_RESULT EQUAL 0)
132+
message(FATAL_ERROR "Cannot configure Git submodule ${package}")
133+
endif()
134+
135+
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_INSTALL_PREFIX_})
136+
endif()
137+
endif()
138+
endmacro()
139+
129140
macro(install_eprosima_libraries)
130141
if((MSVC OR MSVC_IDE) AND EPROSIMA_BUILD AND NOT MINION)
131142
if(EPROSIMA_INSTALLER)

cmake/dev/gtest.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ macro(add_gtest test)
8888
# Add environment
8989
if(WIN32)
9090
set_tests_properties(${GTEST_GROUP_NAME}.${GTEST_NAME} PROPERTIES ENVIRONMENT
91-
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;${BOOST_LIBRARYDIR}\\;$ENV{PATH}")
91+
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;$ENV{PATH}")
9292
endif()
9393
endforeach()
9494
endforeach()
@@ -97,7 +97,7 @@ macro(add_gtest test)
9797
# Add environment
9898
if(WIN32)
9999
set_tests_properties(${test} PROPERTIES ENVIRONMENT
100-
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;${BOOST_LIBRARYDIR}\\;$ENV{PATH}")
100+
"PATH=$<TARGET_FILE_DIR:${PROJECT_NAME}>\\;$<TARGET_FILE_DIR:fastcdr>\\;$ENV{PATH}")
101101
endif()
102102
endif()
103103
endmacro()

examples/C++/ClientServerTest/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CFLAGS = $(COMMON_CFLAGS) -O2
3434

3535
INCLUDES= -I.
3636

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

3939
DIRECTORIES= output.dir bin.dir
4040

examples/C++/Configurability/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ message(STATUS "Configuring UseCaseDemonstrator example...")
3535
file(GLOB USECASEDEMONSTRATOR_EXAMPLE_SOURCES "*.cxx")
3636

3737
add_executable(UseCasePublisher ${USECASEDEMONSTRATOR_EXAMPLE_SOURCES} UseCasePublisher.cpp)
38-
target_link_libraries(UseCasePublisher fastrtps fastcdr ${Boost_LIBRARIES})
38+
target_link_libraries(UseCasePublisher fastrtps fastcdr)
3939
install(TARGETS UseCasePublisher
4040
RUNTIME DESTINATION examples/C++/UseCaseDemonstrator/${BIN_INSTALL_DIR}
4141
)
4242

4343
add_executable(UseCaseSubscriber ${USECASEDEMONSTRATOR_EXAMPLE_SOURCES} UseCaseSubscriber.cpp)
44-
target_link_libraries(UseCaseSubscriber fastrtps fastcdr ${Boost_LIBRARIES})
44+
target_link_libraries(UseCaseSubscriber fastrtps fastcdr)
4545
install(TARGETS UseCaseSubscriber
4646
RUNTIME DESTINATION examples/C++/UseCaseDemonstrator/${BIN_INSTALL_DIR}
4747
)

examples/C++/Configurability/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ CFLAGS = $(COMMON_CFLAGS) -O2
3434

3535
INCLUDES= -I.
3636

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

3939
DIRECTORIES= output.dir bin.dir
4040

0 commit comments

Comments
 (0)