#===============================================================================
# Copyright 2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================

if(NOT DNNL_GRAPH_BUILD_COMPILER_BACKEND)
    message(STATUS "Graph compiler backend is disabled.")
    return()
endif()

file(GLOB_RECURSE SOURCES_BENCHDNNGRAPH
    ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
    )

file(GLOB SOURCES_BENCHDNN
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/common.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/dnnl_common.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/dnnl_graph_common.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/dnnl_debug_autogenerated.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/dnnl_memory.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/dnn_types.cpp
    ${CMAKE_CURRENT_SOURCE_DIR}/../benchdnn/utils/*.cpp
    )
set(SOURCES ${SOURCES_BENCHDNNGRAPH} ${SOURCES_BENCHDNN})

list(APPEND SOURCES ${TEST_THREAD})
include_directories_with_host_compiler(
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/third_party/oneDNN
    ${PROJECT_SOURCE_DIR}/third_party/oneDNN/src
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/tests/benchdnn
    ${PROJECT_SOURCE_DIR}/tests/benchdnn/utils
    )

file(COPY inputs DESTINATION .)

register_exe(benchdnn_graph "${SOURCES}" "" "${LIBRT};${LIBREGEX};${LIBSOCKET}")
