Skip to content

Commit 72c1331

Browse files
committed
disable cpplint by default; upd .clang-format; add checks for python extensions
1 parent 5fcb83a commit 72c1331

File tree

7 files changed

+49
-30
lines changed

7 files changed

+49
-30
lines changed

cmake/cpplint/cpplint_run.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ if(NOT SKIP_RETURN_CODE)
4848
if(NOT result EQUAL "0")
4949
# Display the cpplint output to console (to parse it form IDE)
5050
message("${output}")
51-
message(WARNING "[cpplint] Code style check failed for : ${INPUT_FILE}")
51+
message(FATAL_ERROR "[cpplint] Code style check failed for : ${INPUT_FILE}")
5252
endif()
5353
endif()

demos/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ project(Demos)
1818
include (CMakeDependentOption)
1919

2020
cmake_dependent_option(ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ON "UNIX" OFF)
21-
option(ENABLE_CPPLINT "Enable cpplint checks during the build" ON)
21+
option(ENABLE_CPPLINT "Enable cpplint checks during the build" OFF)
2222
option(ENABLE_PYTHON "Whether to build extension modules for Python demos" OFF)
2323
option(MULTICHANNEL_DEMO_USE_TBB "Use TBB-based threading in multichannel demos" OFF)
2424
option(MULTICHANNEL_DEMO_USE_NATIVE_CAM "Use native camera api in multichannel demos" OFF)

demos/classification_benchmark_demo/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ file(GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
88
add_demo(NAME classification_benchmark_demo
99
SOURCES ${SOURCES}
1010
HEADERS ${HEADERS}
11-
DEPENDENCIES monitors models pipelines)
11+
DEPENDENCIES monitors models pipelines)
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
# Copyright (C) 2018-2019 Intel Corporation
1+
# Copyright (C) 2018-2022 Intel Corporation
22
# SPDX-License-Identifier: Apache-2.0
33
#
44

5+
set(TARGET_NAME "monitors_extension")
6+
57
find_package(OpenCV 4 REQUIRED COMPONENTS core)
68

7-
add_library(monitors_extension MODULE monitors_extension.cpp)
8-
target_include_directories(monitors_extension PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
9-
target_link_libraries(monitors_extension PRIVATE ${PYTHON_LIBRARIES} opencv_core monitors utils)
10-
set_target_properties(monitors_extension PROPERTIES PREFIX "")
9+
add_library(${TARGET_NAME} MODULE ${CMAKE_CURRENT_SOURCE_DIR}/monitors_extension.cpp)
10+
11+
check_code_style(NAME ${TARGET_NAME}
12+
CLANG_FORMAT ${ENABLE_CLANG_FORMAT}
13+
CPPLINT ${ENABLE_CPPLINT})
14+
15+
target_include_directories(${TARGET_NAME} PRIVATE ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
16+
target_link_libraries(${TARGET_NAME} PRIVATE ${PYTHON_LIBRARIES} opencv_core monitors utils)
17+
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
1118
if(WIN32)
12-
set_target_properties(monitors_extension PROPERTIES SUFFIX ".pyd")
19+
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
1320
endif()

demos/crossroad_camera_demo/cpp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ file(GLOB_RECURSE HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)
88
add_demo(NAME crossroad_camera_demo
99
SOURCES "${SOURCES}"
1010
HEADERS "${HEADERS}"
11-
DEPENDENCIES monitors)
11+
DEPENDENCIES monitors)

demos/human_pose_estimation_3d_demo/python/pose_extractor/CMakeLists.txt

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44

55
find_package(OpenCV 4 REQUIRED COMPONENTS core imgproc)
66

7-
set(target_name pose_extractor)
8-
add_library(${target_name} MODULE wrapper.cpp
9-
src/extract_poses.hpp src/extract_poses.cpp
10-
src/human_pose.hpp src/human_pose.cpp
11-
src/peak.hpp src/peak.cpp)
12-
target_include_directories(${target_name} PRIVATE src/ ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
13-
target_link_libraries(${target_name} ${PYTHON_LIBRARIES} opencv_core opencv_imgproc)
14-
set_target_properties(${target_name} PROPERTIES PREFIX "")
7+
set(TARGET_NAME pose_extractor)
8+
add_library(${TARGET_NAME} MODULE ${CMAKE_CURRENT_SOURCE_DIR}/wrapper.cpp
9+
${CMAKE_CURRENT_SOURCE_DIR}/src/extract_poses.hpp
10+
${CMAKE_CURRENT_SOURCE_DIR}/src/extract_poses.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/src/human_pose.hpp
12+
${CMAKE_CURRENT_SOURCE_DIR}/src/human_pose.cpp
13+
${CMAKE_CURRENT_SOURCE_DIR}/src/peak.hpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/src/peak.cpp)
15+
16+
check_code_style(NAME ${TARGET_NAME}
17+
CLANG_FORMAT ${ENABLE_CLANG_FORMAT}
18+
CPPLINT ${ENABLE_CPPLINT})
19+
20+
target_include_directories(${TARGET_NAME} PRIVATE src/ ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
21+
target_link_libraries(${TARGET_NAME} ${PYTHON_LIBRARIES} opencv_core opencv_imgproc)
22+
set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "")
1523
if(WIN32)
16-
set_target_properties(${target_name} PROPERTIES SUFFIX ".pyd")
24+
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
1725
endif()

demos/speech_recognition_deepspeech_demo/python/ctcdecode-numpy/CMakeLists.txt

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33
#
44

5-
set(target_name ctcdecode_numpy_impl)
5+
set(TARGET_NAME ctcdecode_numpy_impl)
66

77
file(GLOB_RECURSE HEADERS
88
"${CMAKE_CURRENT_SOURCE_DIR}/*.h" "${CMAKE_CURRENT_SOURCE_DIR}/*.hpp")
@@ -11,31 +11,35 @@ file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
1111
source_group("include" FILES ${HEADERS})
1212
source_group("src" FILES ${SOURCES})
1313

14-
add_library(${target_name} MODULE ${HEADERS} ${SOURCES})
14+
add_library(${TARGET_NAME} MODULE ${HEADERS} ${SOURCES})
1515

16-
target_include_directories(${target_name} PRIVATE
16+
# check_code_style(NAME ${TARGET_NAME}
17+
# CLANG_FORMAT ${ENABLE_CLANG_FORMAT}
18+
# CPPLINT ${ENABLE_CPPLINT})
19+
20+
target_include_directories(${TARGET_NAME} PRIVATE
1721
${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR} third_party/ThreadPool)
18-
target_link_libraries(${target_name} ${PYTHON_LIBRARIES})
22+
target_link_libraries(${TARGET_NAME} ${PYTHON_LIBRARIES})
1923

20-
set_target_properties(${target_name} PROPERTIES
24+
set_target_properties(${TARGET_NAME} PROPERTIES
2125
PREFIX ""
2226
OUTPUT_NAME _impl
2327
)
2428

2529
if(WIN32)
26-
set_target_properties(${target_name} PROPERTIES SUFFIX ".pyd")
30+
set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ".pyd")
2731
endif()
2832

2933
foreach(artifact IN ITEMS ARCHIVE LIBRARY PDB RUNTIME)
30-
set_property(TARGET ${target_name} APPEND_STRING
34+
set_property(TARGET ${TARGET_NAME} APPEND_STRING
3135
PROPERTY "${artifact}_OUTPUT_DIRECTORY" "/ctcdecode_numpy")
3236
endforeach()
3337

3438
# SWIG-generated code causes some warnings; disable them.
3539
if(COMPILER_IS_GCC_LIKE)
36-
target_compile_options(${target_name} PRIVATE -Wno-narrowing)
40+
target_compile_options(${TARGET_NAME} PRIVATE -Wno-narrowing)
3741
elseif(MSVC)
38-
target_compile_options(${target_name} PRIVATE
42+
target_compile_options(${TARGET_NAME} PRIVATE
3943
/wd4244 # Disable conversion warning =
4044
/wd4838 # Disable conversion warning in aggregate or list initialization
4145
)
@@ -52,8 +56,8 @@ add_custom_target(ctcdecode_numpy ALL
5256
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
5357
"${CMAKE_CURRENT_SOURCE_DIR}/ctcdecode_numpy/__init__.py"
5458
"${CMAKE_CURRENT_SOURCE_DIR}/ctcdecode_numpy/impl.py"
55-
"$<TARGET_FILE_DIR:${target_name}>"
59+
"$<TARGET_FILE_DIR:${TARGET_NAME}>"
5660
VERBATIM
5761
)
5862

59-
add_dependencies(ctcdecode_numpy ${target_name})
63+
add_dependencies(ctcdecode_numpy ${TARGET_NAME})

0 commit comments

Comments
 (0)