From bae5eda24f3d5e257a99bdffafc91d87e1e1278e Mon Sep 17 00:00:00 2001 From: Pablo Romero Date: Sun, 3 Oct 2021 07:48:39 +0200 Subject: [PATCH 1/4] tests: fix build issues on QNX This fixes #1164. Add required macros and libraries for QNX. This fixes #1165. Set required libraries to link for QNX. --- tests/benchdnn/CMakeLists.txt | 7 +++++-- tests/benchdnn/dnnl_common.cpp | 2 +- tests/gtests/gtest/CMakeLists.txt | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/benchdnn/CMakeLists.txt b/tests/benchdnn/CMakeLists.txt index c4d7e00ee..4ff1bd281 100644 --- a/tests/benchdnn/CMakeLists.txt +++ b/tests/benchdnn/CMakeLists.txt @@ -35,10 +35,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") append_if(UNIX CMAKE_CXX_FLAGS "-prec-div -prec-sqrt -fp-model precise") endif() -if(UNIX AND NOT APPLE) +if(UNIX AND NOT APPLE AND NOT QNXNTO) find_library(LIBRT rt) +elseif(QNXNTO) + find_library(LIBREGEX regex) + find_library(LIBSOCKET socket) endif() -register_exe(benchdnn "${SOURCES}" "" "${LIBRT}") +register_exe(benchdnn "${SOURCES}" "" "${LIBRT};${LIBREGEX};${LIBSOCKET}") file(COPY inputs DESTINATION .) diff --git a/tests/benchdnn/dnnl_common.cpp b/tests/benchdnn/dnnl_common.cpp index 18af190e7..244583bd1 100644 --- a/tests/benchdnn/dnnl_common.cpp +++ b/tests/benchdnn/dnnl_common.cpp @@ -460,7 +460,7 @@ static size_t get_cpu_ram_size() { GlobalMemoryStatusEx(&s); return s.ullTotalPhys; } -#elif defined(__APPLE__) || defined(__FreeBSD__) +#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__QNXNTO__) #include #include diff --git a/tests/gtests/gtest/CMakeLists.txt b/tests/gtests/gtest/CMakeLists.txt index eacac64f1..2fb7b4f4f 100644 --- a/tests/gtests/gtest/CMakeLists.txt +++ b/tests/gtests/gtest/CMakeLists.txt @@ -13,6 +13,8 @@ add_library(${TARGET_NAME} STATIC ${MAIN_SRC}) # In that case FindThreads module may skip adding any flags for pthread library # because they are not needed for C compiler but this may led to issues with # C++ compiler which is not checked. -if(UNIX OR MINGW) +if((UNIX AND NOT QNXNTO) OR MINGW) target_link_libraries(${TARGET_NAME} pthread) +elseif(QNXNTO) + target_link_libraries(${TARGET_NAME} regex) endif() -- 2.17.1