CC: fixed issue with rebuild when only CC header is changed (#4370)

* CC: fixed issue with rebuild when only CC header is changed

* Updated submodule as well
This commit is contained in:
Ilya Lavrenov 2021-02-17 15:41:54 +03:00 committed by GitHub
parent f670b7cb3a
commit dd79dd755c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 7 deletions

View File

@ -222,6 +222,21 @@ if(ENABLE_FUZZING)
enable_fuzzing()
endif()
# macro to mark target as conditionally compiled
function(ie_mark_target_as_cc TARGET_NAME)
if(NOT (SELECTIVE_BUILD STREQUAL "ON"))
return()
endif()
if(NOT TARGET ${TARGET_NAME})
message(FATAL_ERROR "${TARGET_NAME} does not represent target")
endif()
get_target_property(sources ${TARGET_NAME} SOURCES)
set_source_files_properties(${sources} PROPERTIES OBJECT_DEPENDS ${GENERATED_HEADER})
endfunction()
# Code style utils
include(cpplint/cpplint)

View File

@ -136,7 +136,7 @@ ie_add_vs_version_file(NAME ${TARGET_NAME}
set_ie_threading_interface_for(${TARGET_NAME})
target_link_libraries(${TARGET_NAME} PRIVATE pugixml openvino::itt openvino::conditional_compilation ${CMAKE_DL_LIBS} Threads::Threads
target_link_libraries(${TARGET_NAME} PRIVATE pugixml openvino::itt ${CMAKE_DL_LIBS} Threads::Threads
${NGRAPH_LIBRARIES} inference_engine_transformations)
target_include_directories(${TARGET_NAME} INTERFACE ${PUBLIC_HEADERS_DIR}
@ -171,7 +171,7 @@ if(WIN32)
set_target_properties(${TARGET_NAME}_s PROPERTIES COMPILE_PDB_NAME ${TARGET_NAME}_s)
endif()
target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt openvino::conditional_compilation ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES}
target_link_libraries(${TARGET_NAME}_s PRIVATE openvino::itt ${CMAKE_DL_LIBS} ${NGRAPH_LIBRARIES}
inference_engine_transformations pugixml)
target_compile_definitions(${TARGET_NAME}_s PUBLIC USE_STATIC_IE)

View File

@ -40,10 +40,12 @@ ie_add_plugin(NAME ${TARGET_NAME}
set_ie_threading_interface_for(${TARGET_NAME})
ie_mark_target_as_cc(${TARGET_NAME})
if(SELECTIVE_BUILD STREQUAL "ON")
# After disabling a block of code, some variables might be unused.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
OR CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
target_compile_options(${TARGET_NAME} PRIVATE -Wno-unused-variable)
endif()
endif()

View File

@ -1,4 +1,4 @@
# Copyright (C) 2018-2019 Intel Corporation
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
@ -37,6 +37,8 @@ add_cpplint_target(${TARGET_NAME}_cpplint FOR_TARGETS ${TARGET_NAME})
ie_add_api_validator_post_build_step(TARGET ${TARGET_NAME})
ie_mark_target_as_cc(${TARGET_NAME})
# LTO
set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE ${ENABLE_LTO})

@ -1 +1 @@
Subproject commit e8879c1c30daaf85a9aab6323a167138b59653fa
Subproject commit 975ccfbdf84798a3d068a9ed142417bb5b05fbc7

View File

@ -53,6 +53,8 @@ endif()
target_link_libraries(ngraph PRIVATE openvino::conditional_compilation openvino::itt ngraph::builder ngraph::reference)
ie_mark_target_as_cc(ngraph)
if(NGRAPH_ADDRESS_SANITIZER)
message(STATUS "Enable Address Sanitizer")
add_compile_options(-g -fsanitize=address -fno-omit-frame-pointer)

View File

@ -49,7 +49,7 @@ elseif(SELECTIVE_BUILD STREQUAL "ON")
-Wunused-local-typedefs)
endif()
set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/conditional_compilation_gen.h)
set(GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/conditional_compilation_gen.h CACHE FILEPATH "")
set(GENERATOR ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ccheader.py)
add_custom_command(OUTPUT ${GENERATED_HEADER}