1
# Copyright (C) 2018-2019 Intel Corporation
2
# SPDX-License-Identifier: Apache-2.0
5
set(TARGET_NAME "ie_cpu_extension")
7
if (NOT(IE_MAIN_SOURCE_DIR))
8
list (APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
11
# to use C++11 if samples are built outside of IE repo
12
set (CMAKE_CXX_STANDARD 11)
13
set (CMAKE_CXX_STANDARD_REQUIRED ON)
14
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
15
set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
19
# treating warnings as errors
21
if (TREAT_WARNING_AS_ERROR)
22
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
24
if (${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC)
25
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4275 /wd4267") #disable some warnings
28
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
31
if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)
32
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
35
file(GLOB_RECURSE SRC *.cpp)
36
file(GLOB_RECURSE HDR *.hpp)
38
add_definitions(-DIMPLEMENT_INFERENCE_ENGINE_API)
40
include_directories (PRIVATE
41
${CMAKE_CURRENT_SOURCE_DIR}/common
42
${InferenceEngine_INCLUDE_DIRS}
45
add_library(${TARGET_NAME} SHARED ${SRC} ${HDR})
46
set_ie_threading_interface_for(${TARGET_NAME})
48
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "cpu_extension")
50
target_link_libraries(${TARGET_NAME} PRIVATE ${InferenceEngine_LIBRARIES})
52
target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
53
set_target_properties(${TARGET_NAME} PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME})
55
set_target_cpu_flags(${TARGET_NAME})
57
if (IE_MAIN_SOURCE_DIR)
58
export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets.cmake")
61
export(TARGETS ${TARGET_NAME} NAMESPACE IE:: APPEND FILE "${CMAKE_BINARY_DIR}/targets_developer.cmake")