Skip to content

Commit

Permalink
Add support for QNX io-sock stack
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Vostrikov <[email protected]>
  • Loading branch information
avostrik committed Jul 3, 2024
1 parent 1e4c48e commit b831ba2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cmake/NNGHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ function(nng_include_directories)
target_include_directories(nng_testing PRIVATE ${ARGN})
endfunction()

# nng_include_directories adds system include directories.
function(nng_include_system_directories)
target_include_directories(nng SYSTEM BEFORE PUBLIC ${ARGN})
target_include_directories(nng_testing SYSTEM BEFORE PUBLIC ${ARGN})
endfunction()

# nng_sources_if adds the sources unconditionally to the test library,
# but conditionally to the production library. This allows us to get
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ configure_package_config_file(${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
PATH_VARS INCLUDE_INSTALL_DIRS)

install(FILES "${project_config}" "${version_config}" ${PROJECT_SOURCE_DIR}/cmake/FindmbedTLS.cmake
install(FILES "${project_config}" "${version_config}" ${PROJECT_SOURCE_DIR}/cmake/FindMbedTLS.cmake
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT Library)
24 changes: 23 additions & 1 deletion src/platform/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,29 @@ if (NNG_PLATFORM_POSIX)
nng_check_lib(pthread pthread_set_name_np NNG_HAVE_PTHREAD_SET_NAME_NP)
nng_check_lib(pthread pthread_setname_np NNG_HAVE_PTHREAD_SETNAME_NP)
nng_check_lib(nsl gethostbyname NNG_HAVE_LIBNSL)
nng_check_lib(socket socket NNG_HAVE_LIBSOCKET)
if (CMAKE_SYSTEM_NAME STREQUAL "QNX" AND USE_QNX_IO_SOCK)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
set(IO_SOCK_PATH "${CMAKE_SYSROOT}/aarch64le/io-sock/lib")
else()
set(IO_SOCK_PATH "${CMAKE_SYSROOT}/${CMAKE_SYSTEM_PROCESSOR}/io-sock/lib")
endif()

find_library(IO_SOCK_LIBRARY
socket
PATHS ${IO_SOCK_PATH}
NO_DEFAULT_PATH
REQUIRED
)

nng_include_system_directories(
"$<BUILD_INTERFACE:${CMAKE_SYSROOT}/usr/include/devs>"
"$<BUILD_INTERFACE:${CMAKE_SYSROOT}/usr/include/devs/include_${CMAKE_SYSTEM_PROCESSOR}>"
"$<BUILD_INTERFACE:${CMAKE_SYSROOT}/usr/include/io-sock>")

nng_link_libraries(${IO_SOCK_LIBRARY})
else()
nng_check_lib(socket socket NNG_HAVE_LIBSOCKET)
endif()

# GCC needs libatomic on some architectures (e.g. ARM) because the
# underlying architecture may lack the necessary atomic primitives.
Expand Down

0 comments on commit b831ba2

Please sign in to comment.