Merge pull request #98 from eboasson/master
Fix ARM builds and "make install"
This commit is contained in:
commit
b91513aec5
4 changed files with 34 additions and 29 deletions
23
.travis.yml
23
.travis.yml
|
@ -30,17 +30,17 @@ osx_xcode94: &osx_xcode94
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- <<: *linux_gcc8
|
- <<: *linux_gcc8
|
||||||
env: [ BUILD_TYPE=Debug, C_COMPILER=gcc-8, CXX_COMPILER=g++-8 ]
|
env: [ BUILD_TYPE=Debug, C_COMPILER=gcc-8, CXX_COMPILER=g++-8, USE_SANITIZER=none ]
|
||||||
- <<: *linux_gcc8
|
- <<: *linux_gcc8
|
||||||
env: [ BUILD_TYPE=Release, C_COMPILER=gcc-8, CXX_COMPILER=g++-8 ]
|
env: [ BUILD_TYPE=Release, C_COMPILER=gcc-8, CXX_COMPILER=g++-8, USE_SANITIZER=none ]
|
||||||
- <<: *linux_clang60
|
- <<: *linux_clang60
|
||||||
env: [ BUILD_TYPE=Debug, C_COMPILER=clang-6.0, CXX_COMPILER=clang++-6.0 ]
|
env: [ BUILD_TYPE=Debug, C_COMPILER=clang-6.0, CXX_COMPILER=clang++-6.0, USE_SANITIZER=address ]
|
||||||
- <<: *linux_clang60
|
- <<: *linux_clang60
|
||||||
env: [ BUILT_TYPE=Release, C_COMPILER=clang-6.0, CXX_COMPILER=clang++-6.0 ]
|
env: [ BUILT_TYPE=Release, C_COMPILER=clang-6.0, CXX_COMPILER=clang++-6.0, USE_SANITIZER=none ]
|
||||||
- <<: *osx_xcode94
|
- <<: *osx_xcode94
|
||||||
env: [ BUILD_TYPE=Debug, C_COMPILER=clang, CXX_COMPILER=clang++ ]
|
env: [ BUILD_TYPE=Debug, C_COMPILER=clang, CXX_COMPILER=clang++, USE_SANITIZER=address ]
|
||||||
- <<: *osx_xcode94
|
- <<: *osx_xcode94
|
||||||
env: [ BUILD_TYPE=Release, C_COMPILER=clang, CXX_COMPILER=clang++ ]
|
env: [ BUILD_TYPE=Release, C_COMPILER=clang, CXX_COMPILER=clang++, USE_SANITIZER=none ]
|
||||||
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
|
@ -67,7 +67,12 @@ script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- conan install ..
|
- conan install ..
|
||||||
- cmake -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ../src
|
- cmake -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DUSE_SANITIZER=${USE_SANITIZER} -DCMAKE_INSTALL_PREFIX=${PWD}/install ../src
|
||||||
- cmake --build .
|
- cmake --build . --target install
|
||||||
|
- mkdir install/share/CycloneDDS/examples/helloworld/build
|
||||||
|
- if [ "$USE_SANITIZER" = "none" ]; then
|
||||||
|
(cd install/share/CycloneDDS/examples/helloworld/build && cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. && cmake --build .) ;
|
||||||
|
else
|
||||||
|
(cd install/share/CycloneDDS/examples/helloworld/build && cmake -DCMAKE_C_FLAGS=-fsanitize=address -DCMAKE_LINKER_FLAGS=-fsanitize=address -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. && cmake --build .) ;
|
||||||
|
fi
|
||||||
- ctest -T test
|
- ctest -T test
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,14 @@ build_script:
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- conan install -s arch=%ARCH% -s build_type=%CONFIGURATION% ..
|
- conan install -s arch=%ARCH% -s build_type=%CONFIGURATION% ..
|
||||||
- cmake -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%GENERATOR%" ../src
|
- cmake -DBUILD_TESTING=on -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_INSTALL_PREFIX=%CD%/install -G "%GENERATOR%" ../src
|
||||||
|
- cmake --build . --config %CONFIGURATION% --target install
|
||||||
|
- cd install/share/CycloneDDS/examples/helloworld
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake -DCMAKE_BUILD_TYPE=%CONFIGURATION% -G "%GENERATOR%" ..
|
||||||
- cmake --build . --config %CONFIGURATION%
|
- cmake --build . --config %CONFIGURATION%
|
||||||
|
- cd ../../../../../..
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- ctest --test-action test --build-config %CONFIGURATION%
|
- ctest --test-action test --build-config %CONFIGURATION%
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ add_library(OSAPI ${sources})
|
||||||
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
target_link_libraries(OSAPI INTERFACE Threads::Threads)
|
target_link_libraries(OSAPI INTERFACE Threads::Threads)
|
||||||
|
set_property(TARGET OSAPI PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# Link with Win32 core-libraries
|
# Link with Win32 core-libraries
|
||||||
|
@ -73,17 +74,13 @@ if(WIN32)
|
||||||
target_compile_definitions(OSAPI PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
|
target_compile_definitions(OSAPI PRIVATE _WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||||
# Disable warnings for deprecated POSIX names.
|
# Disable warnings for deprecated POSIX names.
|
||||||
target_compile_definitions(OSAPI PRIVATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
target_compile_definitions(OSAPI PRIVATE -D_CRT_NONSTDC_NO_DEPRECATE)
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX)
|
||||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
|
||||||
# Shared libs will have this by default. Static libs need it too on x86_64.
|
|
||||||
set_property(TARGET OSAPI PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
|
check_library_exists(c clock_gettime "" HAVE_CLOCK_GETTIME)
|
||||||
if(NOT HAVE_CLOCK_GETTIME)
|
if(NOT HAVE_CLOCK_GETTIME)
|
||||||
# Before glibc 2.17, clock_gettime was in librt.
|
# Before glibc 2.17, clock_gettime was in librt.
|
||||||
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
check_library_exists(rt clock_gettime "time.h" HAVE_CLOCK_GETTIME_RT)
|
||||||
if(HAVE_CLOCK_GETTIME)
|
if(HAVE_CLOCK_GETTIME_RT)
|
||||||
|
set(HAVE_CLOCK_GETTIME "${HAVE_CLOCK_GETTIME_RT}")
|
||||||
target_link_libraries(OSAPI INTERFACE rt)
|
target_link_libraries(OSAPI INTERFACE rt)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -95,7 +92,6 @@ endif()
|
||||||
|
|
||||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
|
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
|
||||||
target_link_libraries(OSAPI INTERFACE -lsocket -lnsl)
|
target_link_libraries(OSAPI INTERFACE -lsocket -lnsl)
|
||||||
add_definitions(-KPIC)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Determine if platform is big or little endian.
|
# Determine if platform is big or little endian.
|
||||||
|
@ -124,12 +120,18 @@ if(BUILD_TESTING)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h")
|
||||||
|
set(os_platform_public_h "${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h")
|
||||||
|
else()
|
||||||
|
set(os_platform_public_h "${CMAKE_CURRENT_SOURCE_DIR}/include/os/posix/os_platform_public.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_public.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_public.h"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes.h"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes_sal.h"
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/os_decl_attributes_sal.h"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/include/os/${system_name}/os_platform_public.h"
|
"${os_platform_public_h}"
|
||||||
DESTINATION
|
DESTINATION
|
||||||
"${CMAKE_INSTALL_INCLUDEDIR}/ddsc/os"
|
"${CMAKE_INSTALL_INCLUDEDIR}/ddsc/os"
|
||||||
COMPONENT
|
COMPONENT
|
||||||
|
|
|
@ -19,10 +19,7 @@ add_library(util ${srcs_util})
|
||||||
generate_export_header(util EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/exports/util/ut_export.h")
|
generate_export_header(util EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/exports/util/ut_export.h")
|
||||||
target_link_libraries(util PUBLIC OSAPI)
|
target_link_libraries(util PUBLIC OSAPI)
|
||||||
|
|
||||||
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
|
|
||||||
# Shared libs will have this by default. Static libs need it too on x86_64.
|
|
||||||
set_property(TARGET util PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
set_property(TARGET util PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
util PUBLIC
|
util PUBLIC
|
||||||
|
@ -31,10 +28,6 @@ target_include_directories(
|
||||||
"$<INSTALL_INTERFACE:${INSTALL_PREFIX}/include/>"
|
"$<INSTALL_INTERFACE:${INSTALL_PREFIX}/include/>"
|
||||||
"$<INSTALL_INTERFACE:${INSTALL_PREFIX}/exports/>")
|
"$<INSTALL_INTERFACE:${INSTALL_PREFIX}/exports/>")
|
||||||
|
|
||||||
if(${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
|
|
||||||
add_definitions(-KPIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# TODO: improve test inclusion.
|
# TODO: improve test inclusion.
|
||||||
if((BUILD_TESTING) AND ((NOT DEFINED MSVC_VERSION) OR (MSVC_VERSION GREATER "1800")))
|
if((BUILD_TESTING) AND ((NOT DEFINED MSVC_VERSION) OR (MSVC_VERSION GREATER "1800")))
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue