Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1287 Use iox_add_library for iceoryx hoofs platform
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff committed May 9, 2022
1 parent b5deb52 commit 836900a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 48 deletions.
16 changes: 7 additions & 9 deletions iceoryx_hoofs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,13 @@ add_subdirectory(platform)
#

iox_add_library(
TARGET iceoryx_hoofs
ALIAS iceoryx_hoofs::iceoryx_hoofs
RPATH "${CMAKE_INSTALL_PREFIX}/lib123"
PUBLIC_LINKS
iceoryx_hoofs::iceoryx_platform
PRIVATE_LINKS
${ICEORYX_SANITIZER_FLAGS}
PRIVATE_LINKS_LINUX
acl atomic ${CODE_COVERAGE_LIBS}
TARGET iceoryx_hoofs
ALIAS iceoryx_hoofs::iceoryx_hoofs
RPATH "${CMAKE_INSTALL_PREFIX}/lib123"
PUBLIC_LINKS iceoryx_hoofs::iceoryx_platform
PRIVATE_LINKS ${ICEORYX_SANITIZER_FLAGS}
PRIVATE_LINKS_LINUX acl atomic ${CODE_COVERAGE_LIBS}
INSTALL_INTERFACE ${PROJECT_SOURCE_DIR}/include
FILES
source/concurrent/active_object.cpp
source/concurrent/loffli.cpp
Expand Down
17 changes: 14 additions & 3 deletions iceoryx_hoofs/cmake/IceoryxPackageHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,10 @@ Macro(install_package_files_and_export)
endMacro()

Macro(iox_add_library)
set(arguments TARGET RPATH FILES PUBLIC_LINKS PRIVATE_LINKS PRIVATE_LINKS_LINUX ALIAS)
set(arguments TARGET RPATH FILES PUBLIC_LINKS PRIVATE_LINKS ALIAS INSTALL_INTERFACE
PUBLIC_LINKS_LINUX PRIVATE_LINKS_LINUX PUBLIC_LINKS_QNX PRIVATE_LINKS_QNX
PUBLIC_LINKS_UNIX PRIVATE_LINKS_UNIX PUBLIC_LINKS_WIN32 PRIVATE_LINKS_WIN32
PUBLIC_LINKS_APPLE PRIVATE_LINKS_APPLE)
cmake_parse_arguments(IOX "" "" "${arguments}" ${ARGN} )

add_library( ${IOX_TARGET} ${IOX_FILES} )
Expand All @@ -136,7 +139,15 @@ Macro(iox_add_library)
)

if ( LINUX )
target_link_libraries(${IOX_TARGET} PRIVATE ${IOX_PRIVATE_LINKS_LINUX})
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LINKS_LINUX} PRIVATE ${IOX_PRIVATE_LINKS_LINUX})
elseif ( QNX )
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LINKS_QNX} PRIVATE ${IOX_PRIVATE_LINKS_QNX})
elseif ( UNIX )
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LINKS_UNIX} PRIVATE ${IOX_PRIVATE_LINKS_UNIX})
elseif ( WIN32 )
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LINKS_WIN32} PRIVATE ${IOX_PRIVATE_LINKS_WIN32})
elseif ( APPLE )
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LINKS_APPLE} PRIVATE ${IOX_PRIVATE_LINKS_APPLE})
endif ( LINUX )

if ( LINUX OR UNIX )
Expand Down Expand Up @@ -165,7 +176,7 @@ Macro(iox_add_library)

target_include_directories(${IOX_TARGET}
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${IOX_INSTALL_INTERFACE}>
$<INSTALL_INTERFACE:include/${PREFIX}>
)
endMacro()
45 changes: 9 additions & 36 deletions iceoryx_hoofs/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,13 @@ file ( GLOB_RECURSE ICEORYX_PLATFORM_FILES
${ICEORYX_PLATFORM}/source/*.cpp
)

add_library(iceoryx_platform ${ICEORYX_PLATFORM_FILES})
add_library(iceoryx_hoofs::iceoryx_platform ALIAS iceoryx_platform)
target_include_directories(iceoryx_platform
PUBLIC
$<BUILD_INTERFACE:${ICEORYX_PLATFORM}/include/>
$<INSTALL_INTERFACE:include/${PREFIX}>
)
set_target_properties(iceoryx_platform PROPERTIES
CXX_STANDARD_REQUIRED ON
CXX_STANDARD ${ICEORYX_CXX_STANDARD}
POSITION_INDEPENDENT_CODE ON
)

target_link_libraries(iceoryx_platform PRIVATE ${ICEORYX_SANITIZER_FLAGS})

target_compile_options(iceoryx_platform PRIVATE ${ICEORYX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})

if(LINUX)
target_link_libraries(iceoryx_platform
PUBLIC
rt
pthread
iox_add_library(
TARGET iceoryx_platform
ALIAS iceoryx_hoofs::iceoryx_platform
INSTALL_INTERFACE ${ICEORYX_PLATFORM}/include
PRIVATE_LINKS ${ICEORYX_SANITIZER_FLAGS}
PUBLIC_LINKS_LINUX rt pthread
PUBLIC_LINKS_UNIX rt pthread
PRIVATE_LINKS_QNX socket
FILES ${ICEORYX_PLATFORM_FILES}
)
elseif(QNX)
target_link_libraries(iceoryx_platform
PRIVATE
socket
)
elseif(APPLE)
elseif(WIN32)
elseif(UNIX)
target_link_libraries(iceoryx_platform
PUBLIC
rt
pthread
)
endif()

0 comments on commit 836900a

Please sign in to comment.