forked from eProsima/Fast-DDS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
4,516 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
############################################################################### | ||
# CMake build rules for FastRTPS | ||
############################################################################### | ||
cmake_minimum_required(VERSION 2.8.7) | ||
|
||
# Set CMAKE_BUILD_TYPE to Release by default. | ||
if(DEFINED CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING | ||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." | ||
) | ||
else() | ||
set(CMAKE_BUILD_TYPE Release CACHE STRING | ||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." | ||
) | ||
endif() | ||
|
||
project("fastrtps") | ||
set(PROJECT_NAME_STYLED "FastRTPS") | ||
set(PROJECT_NAME_LARGE "Fast RTPS") | ||
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER) | ||
set(${PROJECT_NAME}_DESCRIPTION_SUMMARY "C++ library implementation of RTPS protocol") | ||
set(${PROJECT_NAME}_DESCRIPTION "eProsima ${PROJECT_NAME_LARGE} library provides publication/subscription communication using RTPS protocol.") | ||
|
||
message(STATUS "Configuring ${PROJECT_NAME_LAGE}") | ||
|
||
############################################################################### | ||
# Version information # | ||
############################################################################### | ||
|
||
#If not set, copy over FastCDR version from configure.ac | ||
if(NOT PROJECT_MAJOR_VERSION) | ||
file(STRINGS | ||
${PROJECT_SOURCE_DIR}/configure.ac | ||
PROJECT_MAJOR_VERSION_TMP | ||
REGEX "^m4_define\\(\\[?version_major\\]?, *\\[?[0-9]+\\]?\\)" | ||
) | ||
file(STRINGS | ||
${PROJECT_SOURCE_DIR}/configure.ac | ||
PROJECT_MINOR_VERSION_TMP | ||
REGEX "^m4_define\\(\\[?version_minor\\]?, *\\[?[0-9]+\\]?\\)" | ||
) | ||
file(STRINGS | ||
${PROJECT_SOURCE_DIR}/configure.ac | ||
PROJECT_MICRO_VERSION_TMP | ||
REGEX "^m4_define\\(\\[?version_micro\\]?, *\\[?[0-9]+\\]?\\)" | ||
) | ||
|
||
string(REGEX REPLACE "m4_define\\(\\[?version_major\\]?, *\\[?([0-9]+)\\]?\\)" | ||
"\\1" | ||
PROJECT_MAJOR_VERSION | ||
${PROJECT_MAJOR_VERSION_TMP} | ||
) | ||
string(REGEX REPLACE "m4_define\\(\\[?version_minor\\]?, *\\[?([0-9]+)\\]?\\)" | ||
"\\1" | ||
PROJECT_MINOR_VERSION | ||
${PROJECT_MINOR_VERSION_TMP} | ||
) | ||
string(REGEX REPLACE "m4_define\\(\\[?version_micro\\]?, *\\[?([0-9]+)\\]?\\)" | ||
"\\1" | ||
PROJECT_MICRO_VERSION | ||
${PROJECT_MICRO_VERSION_TMP} | ||
) | ||
endif() | ||
|
||
set(PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_MICRO_VERSION}) | ||
|
||
message(STATUS "Version: ${PROJECT_VERSION}") | ||
message(STATUS "To change de version modify the file configure.ac") | ||
|
||
############################################################################### | ||
# Load external eProsima projects. | ||
############################################################################### | ||
|
||
option(EPROSIMA_BUILD "Activate the use of internal thirdparties" OFF) | ||
if(EPROSIMA_BUILD) | ||
|
||
# Verify thirdparties | ||
include(${PROJECT_SOURCE_DIR}/cmake/dev/thirdparty.cmake) | ||
message(STATUS "Checking thirdparties...") | ||
check_thirdparties() | ||
|
||
include(ExternalProject) | ||
|
||
ExternalProject_Add(fastcdr | ||
CONFIGURE_COMMAND ${CMAKE_COMMAND} | ||
${PROJECT_SOURCE_DIR}/thirdparty/fastcdr | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR}/external-install | ||
SOURCE_DIR ${PROJECT_SOURCE_DIR}/thirdparty/fastcdr | ||
BINARY_DIR ${PROJECT_BINARY_DIR}/external-build | ||
) | ||
|
||
else() | ||
|
||
find_package(fastcdr) | ||
|
||
endif() | ||
|
||
|
||
############################################################################### | ||
# Generation of windows installers. | ||
############################################################################### | ||
if(WIN32) | ||
option(EPROSIMA_INSTALLER "Activate the creation of a build to create windows installers" OFF) | ||
endif() | ||
|
||
############################################################################### | ||
# Test system configuration | ||
############################################################################### | ||
include(${PROJECT_SOURCE_DIR}/cmake/dev/check_configuration.cmake) | ||
check_stdcxx() | ||
check_endianness() | ||
|
||
############################################################################### | ||
# Check MSVC architecture | ||
############################################################################### | ||
if(MSVC OR MSVC_IDE) | ||
check_msvc_arch() | ||
endif() | ||
|
||
############################################################################### | ||
# Check libraries | ||
############################################################################### | ||
check_boost(thread system date_time) | ||
|
||
############################################################################### | ||
# Installation paths | ||
############################################################################### | ||
set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for C++ headers") | ||
set(LIB_INSTALL_DIR lib/ CACHE PATH "Installation directory for libraries") | ||
|
||
############################################################################### | ||
# Compile FastCDR library. | ||
############################################################################### | ||
add_subdirectory(src/cpp) | ||
|
||
############################################################################### | ||
# Testing | ||
############################################################################### | ||
#enable_testing() | ||
#include(CTest) | ||
#add_subdirectory(test) | ||
|
||
############################################################################### | ||
# Packaging | ||
############################################################################### | ||
include(${PROJECT_SOURCE_DIR}/cmake/packaging/eProsimaPackaging.cmake) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
SUBDIRS = include src/cpp | ||
|
||
@PROJECT_NAME@_licenciasdir = $(datadir)/doc/fastcdr | ||
@PROJECT_NAME@_licencias_DATA = @PROJECT_NAME_UPPER@_LIBRARY_LICENSE.txt LGPLv3_LICENSE.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
macro(check_stdcxx) | ||
# Check C++11 | ||
include(CheckCXXCompilerFlag) | ||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG) | ||
check_cxx_compiler_flag(--std=c++11 SUPPORTS_CXX11) | ||
if(SUPPORTS_CXX11) | ||
add_compile_options(--std=c++11) | ||
set(HAVE_CXX11 1) | ||
endif() | ||
else() | ||
set(HAVE_CXX11 1) | ||
endif() | ||
endmacro() | ||
|
||
macro(check_endianness) | ||
# Test endianness | ||
include(TestBigEndian) | ||
test_big_endian(BIG_ENDIAN) | ||
set(__BIG_ENDIAN__ ${BIG_ENDIAN}) | ||
endmacro() | ||
|
||
macro(check_msvc_arch) | ||
if(MSVC10) | ||
if(CMAKE_CL_64) | ||
set(MSVC_ARCH "x64Win64VS2010") | ||
else() | ||
set(MSVC_ARCH "i86Win32VS2010") | ||
endif() | ||
elseif(MSVC11) | ||
if(CMAKE_CL_64) | ||
set(MSVC_ARCH "x64Win64VS2012") | ||
else() | ||
set(MSVC_ARCH "i86Win32VS2012") | ||
endif() | ||
elseif(MSVC12) | ||
if(CMAKE_CL_64) | ||
set(MSVC_ARCH "x64Win64VS2013") | ||
else() | ||
set(MSVC_ARCH "i86Win32VS2013") | ||
endif() | ||
endif() | ||
endmacro() | ||
|
||
macro(check_boost) | ||
# Find package Boost | ||
set(Boost_USE_STATIC_LIBS OFF) | ||
set(Boost_USE_MULTITHREADED ON) | ||
set(Boost_USE_STATIC_RUNTIME OFF) | ||
set(BOOST_ALL_DYN_LINK ON) | ||
if(WIN32 AND EPROSIMA_BUILD) | ||
set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR}/${MSVC_ARCH}) | ||
endif() | ||
find_package(Boost COMPONENTS ${ARGN}) | ||
if(!Boost_FOUND) | ||
message(FATAL_ERROR "Cannot find Boost libraries") | ||
endif() | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
macro(set_sources) | ||
set(${PROJECT_NAME}_SOURCES | ||
${ARGN} | ||
) | ||
|
||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_SOURCES_PROPERTY ${${PROJECT_NAME}_SOURCES}) | ||
endmacro() | ||
|
||
macro(set_public_headers_directory abs_directory rel_directory) | ||
|
||
install(DIRECTORY ${abs_directory}/${rel_directory} | ||
${ARGN} | ||
FILES_MATCHING | ||
PATTERN "*.h" | ||
PATTERN "*.hpp" | ||
) | ||
|
||
get_property(${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES_PROPERTY) | ||
set(${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES ${${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES} ${abs_directory}) | ||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES_PROPERTY ${${PROJECT_NAME}_PUBLIC_HEADERS_DIRECTORIES}) | ||
|
||
endmacro() | ||
|
||
macro(set_public_header directory file) | ||
install(FILES ${directory}/${file} | ||
${ARGN} | ||
) | ||
|
||
get_property(${PROJECT_NAME}_PUBLIC_HEADERS_FILES GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_FILES_PROPERTY) | ||
set(${PROJECT_NAME}_PUBLIC_HEADERS_FILES ${${PROJECT_NAME}_PUBLIC_HEADERS_FILES} ${file}) | ||
set_property(GLOBAL PROPERTY ${PROJECT_NAME}_PUBLIC_HEADERS_FILES_PROPERTY ${${PROJECT_NAME}_PUBLIC_HEADERS_FILES}) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
macro(check_thirdparties) | ||
execute_process(COMMAND git submodule update --recursive --init | ||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} | ||
) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
set(@PROJECT_NAME@_VERSION @PROJECT_VERSION@) | ||
|
||
@PACKAGE_INIT@ | ||
|
||
set_and_check(@PROJECT_NAME@_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@") | ||
set_and_check(@PROJECT_NAME@_LIB_DIR "@PACKAGE_LIB_INSTALL_DIR@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
############################################################################### | ||
# Set common CPACK variables. | ||
############################################################################### | ||
|
||
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) | ||
|
||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_NAME} - ${${PROJECT_NAME}_DESCRIPTION_SUMMARY}") | ||
|
||
set(CPACK_PACKAGE_DESCRIPTION "${${PROJECT_NAME}_DESCRIPTION}") | ||
|
||
set(CPACK_PACKAGE_VENDOR "eProsima") | ||
set(CPACK_PACKAGE_CONTACT "eProsima Support <[email protected]>") | ||
|
||
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_MAJOR_VERSION}) | ||
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_MINOR_VERSION}) | ||
set(CPACK_PACKAGE_VERSION_PATH ${PROJECT_MICRO_VERSION}) | ||
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) | ||
|
||
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/${PROJECT_NAME_UPPER}_LIBRARY_LICENSE.txt") | ||
|
||
############################################################################### | ||
# Create CMake package config file | ||
############################################################################### | ||
if(NOT EPROSIMA_INSTALLER) | ||
export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_BINARY_DIR}/cmake/packaging/${PROJECT_NAME}Targets.cmake) | ||
install(EXPORT ${PROJECT_NAME}Targets | ||
DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake | ||
) | ||
endif() | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/packaging/Config.cmake.in | ||
${PROJECT_BINARY_DIR}/cmake/packaging/${PROJECT_NAME}Config.cmake | ||
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake | ||
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR | ||
) | ||
write_basic_package_version_file(${PROJECT_BINARY_DIR}/cmake/packaging/${PROJECT_NAME}ConfigVersion.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
install(FILES ${PROJECT_BINARY_DIR}/cmake/packaging/${PROJECT_NAME}Config.cmake | ||
${PROJECT_BINARY_DIR}/cmake/packaging/${PROJECT_NAME}ConfigVersion.cmake | ||
DESTINATION ${LIB_INSTALL_DIR}/${PROJECT_NAME}/cmake | ||
) | ||
|
||
############################################################################### | ||
# Platform and architecture dependant | ||
############################################################################### | ||
if(WIN32) | ||
set(CPACK_GENERATOR NSIS) | ||
|
||
# Generate all libraries. | ||
if((MSVC OR MSVC_IDE) AND EPROSIMA_INSTALLER) | ||
include(${PROJECT_SOURCE_DIR}/cmake/packaging/windows/generate_msvc_libraries.cmake) | ||
generate_msvc_libraries(i86Win32VS2010) | ||
generate_msvc_libraries(x64Win64VS2010) | ||
generate_msvc_libraries(i86Win32VS2013) | ||
generate_msvc_libraries(x64Win64VS2013) | ||
endif() | ||
|
||
configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/windows/WindowsPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/windows/WindowsPackaging.cmake @ONLY) | ||
configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/windows/NSISPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/windows/NSISPackaging.cmake @ONLY) | ||
|
||
# Update CMAKE_MODULE_PATH to find NSIS.template.in | ||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/packaging/windows") | ||
|
||
# Set cpack project config file. | ||
set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/cmake/packaging/windows/WindowsPackaging.cmake) | ||
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
set(CPACK_GENERATOR TGZ) | ||
set(CPACK_SOURCE_GENERATOR TGZ) | ||
|
||
# Prepare specific cmake scripts | ||
configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/LinuxPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/LinuxPackaging.cmake @ONLY) | ||
configure_file(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/AutotoolsPackaging.cmake.in ${PROJECT_BINARY_DIR}/cmake/packaging/linux/AutotoolsPackaging.cmake @ONLY) | ||
|
||
# Prepare scripts for autotools | ||
include(${PROJECT_SOURCE_DIR}/cmake/packaging/linux/autotools_generator_utility.cmake) | ||
generate_autotools_generator_script() | ||
|
||
# Ignore not source files | ||
set(CPACK_SOURCE_IGNORE_FILES "~$" ".txt$" ".swp$") | ||
# Define source directories | ||
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${PROJECT_SOURCE_DIR}/src/cpp;src/cpp;${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME};include/${PROJECT_NAME}") | ||
|
||
# Set cpack project config file. | ||
set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/cmake/packaging/linux/LinuxPackaging.cmake) | ||
endif() | ||
|
||
include(CPack) |
Oops, something went wrong.