1 #===============================================================================
2 # Copyright 2016-2018 Intel Corporation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #===============================================================================
22 cmake_policy(SET CMP0065 NEW)
25 # propagate TEST specific flags
26 append(CMAKE_C_FLAGS "${CMAKE_TEST_CCXX_FLAGS}")
27 append(CMAKE_CXX_FLAGS "${CMAKE_TEST_CCXX_FLAGS}")
29 set(CMAKE_TEST_CCXX_NOWARN_FLAGS)
31 # propagate no warning flags
32 append(CMAKE_TEST_CCXX_NOWARN_FLAGS "${CMAKE_CCXX_NOWARN_FLAGS}")
34 # propagate sanitizer flags
35 append(CMAKE_C_FLAGS "${CMAKE_CCXX_SANITIZER_FLAGS}")
36 append(CMAKE_CXX_FLAGS "${CMAKE_CCXX_SANITIZER_FLAGS}")
38 # allow tests to include internal header files with, e.g.
39 # include "src/common/mkldnn_thread.hpp"
40 include_directories(${PROJECT_SOURCE_DIR})
43 # workaround for Intel Compiler 16.0 that doesn't suppress warning on
44 # deprecation with "-Wno-deprecated" compiler flag
45 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.0")
46 append(CMAKE_TEST_CCXX_NOWARN_FLAGS "-diag-disable:1478")
48 append(CMAKE_TEST_CCXX_NOWARN_FLAGS "-Wno-deprecated-declarations")
50 elseif(WIN32 AND NOT MINGW)
51 if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
52 # 1478, 1786: deprecated functions
53 append(CMAKE_TEST_CCXX_NOWARN_FLAGS "/Qdiag-disable:1478 /Qdiag-disable:1786")
55 # c4244: conversion with possible loss of data
56 # c4996: unsafe / deprecated functions
57 append(CMAKE_TEST_CCXX_NOWARN_FLAGS "/wd4996 /wd4244")
61 append(CMAKE_C_FLAGS "${CMAKE_TEST_CCXX_NOWARN_FLAGS}")
62 append(CMAKE_CXX_FLAGS "${CMAKE_TEST_CCXX_NOWARN_FLAGS}")
64 register_exe(api-c api.c "test")
67 set(test_c_symbols "${CMAKE_CURRENT_BINARY_DIR}/test_c_symbols.c")
69 OUTPUT ${test_c_symbols}
70 COMMAND /bin/bash ${CMAKE_CURRENT_SOURCE_DIR}/generate_c_symbols_refs.sh
71 ${CMAKE_CURRENT_SOURCE_DIR}/.. ${PROJECT_BINARY_DIR}/include ${test_c_symbols}
73 register_exe(test_c_symbols-c ${test_c_symbols} "test")
75 # No Windows support for: test_c_symbols.c
78 add_subdirectory(gtests)
79 add_subdirectory(benchdnn)