Skip to content

Commit

Permalink
Improved NCC process of clang search
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-lavrenov committed Aug 14, 2022
1 parent 8ff4b12 commit 016083c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 26 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ on: [push, pull_request]

jobs:
clang-format:
runs-on: ubuntu-22.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Install clang-format
- name: Install clang-format-9
run: |
sudo apt update
sudo apt --assume-yes install clang-format-14
sudo apt --assume-yes install clang-format-9
- name: Install dependencies
run: |
Expand Down Expand Up @@ -66,14 +66,14 @@ jobs:
run: |
mkdir build
cd build
cmake -DENABLE_INTEL_MYRIAD_COMMON=OFF ..
cmake ..
- name: ShellCheck
run: cmake --build . --target ie_shellcheck -j8
working-directory: build

NamingConventionCheck:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -82,8 +82,8 @@ jobs:
- name: Install Clang dependency
run: |
sudo apt update
sudo apt --assume-yes remove clang-7 clang-8 clang-9 clang-10 clang-11
sudo apt --assume-yes install libclang-12-dev
sudo apt --assume-yes remove clang-7 clang-8 clang-9 clang-10 clang-11 clang-12 clang-13
sudo apt --assume-yes install libclang-14-dev
- name: Install Python-based dependencies
run: python3 -m pip install -r cmake/developer_package/ncc_naming_style/requirements_dev.txt
Expand All @@ -92,7 +92,7 @@ jobs:
run: |
mkdir build
cd build
cmake -DENABLE_INTEL_MYRIAD_COMMON=OFF ..
cmake ..
- name: Naming convention check
run: cmake --build . --target ncc_all -j8
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/files_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
Check_Files_Size:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
Pylint-UT:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/py_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
- 'samples/python/**'
jobs:
linters:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- name: Code checkout
uses: actions/checkout@v2
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.6'
python-version: '3.10'
- name: Install dependencies
run: python -m pip install -r src/bindings/python/requirements_test.txt
# samples code-style
Expand Down
36 changes: 23 additions & 13 deletions cmake/developer_package/ncc_naming_style/ncc_naming_style.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,40 @@ endif()
set(ncc_style_dir "${IEDevScripts_DIR}/ncc_naming_style")
set(ncc_style_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/ncc_naming_style")

# find python3

find_package(PythonInterp 3 QUIET)
if(NOT PYTHONINTERP_FOUND)
message(WARNING "Python3 interpreter was not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()

if(PYTHON_VERSION_MINOR EQUAL 6)
set(clang_version 10)
elseif(PYTHON_VERSION_MINOR EQUAL 8)
set(clang_version 12)
elseif(PYTHON_VERSION_MINOR EQUAL 9)
set(clang_version 12)
elseif(PYTHON_VERSION_MINOR EQUAL 10)
set(clang_version 14)
endif()


if(ENABLE_NCC_STYLE)
# try to find_package(Clang QUIET)
# ClangConfig.cmake contains bug that if libclang-XX-dev is not
# installed, then find_package fails with errors even in QUIET mode
configure_file("${ncc_style_dir}/try_find_clang.cmake"
"${ncc_style_bin_dir}/source/CMakeLists.txt" COPYONLY)
execute_process(
COMMAND
"${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source"
-B "${ncc_style_bin_dir}/build"
COMMAND "${CMAKE_COMMAND}" -S "${ncc_style_bin_dir}/source"
-B "${ncc_style_bin_dir}/build"
RESULT_VARIABLE clang_find_result
OUTPUT_VARIABLE output_var
ERROR_VARIABLE error_var)

if(NOT clang_find_result EQUAL "0")
message(WARNING "Please, install clang-[N] libclang-[N]-dev package (required for ncc naming style check)")
message(WARNING "Please, install `apt-get install clang-${clang_version} libclang-${clang_version}-dev` package (required for ncc naming style check)")
message(WARNING "find_package(Clang) output: ${output_var}")
message(WARNING "find_package(Clang) error: ${error_var}")
set(ENABLE_NCC_STYLE OFF)
Expand All @@ -39,19 +57,11 @@ if(ENABLE_NCC_STYLE)
get_target_property(libclang_location libclang LOCATION)
message(STATUS "Found libclang: ${libclang_location}")
else()
message(WARNING "libclang is not found (required for ncc naming style check)")
message(WARNING "libclang-${clang_version} is not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()
endif()

# find python3

find_package(PythonInterp 3 QUIET)
if(NOT PYTHONINTERP_FOUND)
message(WARNING "Python3 interpreter was not found (required for ncc naming style check)")
set(ENABLE_NCC_STYLE OFF)
endif()

# check python requirements_dev.txt

set(ncc_script_py "${ncc_style_dir}/ncc/ncc.py")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
clang==11.0
clang==10.0.1; python_version == '3.6'
clang==12.0.1; python_version == '3.8'
clang==12.0.1; python_version == '3.9'
clang==14.0; python_version == '3.10'
pyyaml

0 comments on commit 016083c

Please sign in to comment.