From: Sergey Lyubimtsev Date: Fri, 30 Oct 2020 11:37:06 +0000 (+0300) Subject: [MO] Add CMake install for Model Optimizer (28291) (#2831) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93342f08601b85e97a585a3248ef4177977215f3;p=platform%2Fupstream%2Fdldt.git [MO] Add CMake install for Model Optimizer (28291) (#2831) * [MO] Add CMake install for Model Optimizer * [MO] Update test for version.py * [MO] Add CMake install for Model Optimizer * [MO] Update test for version.py * [MO] Add CMake install for Model Optimizer * [MO] Update test for version.py * [MO] fix file permissions for install location --- diff --git a/.github/workflows/mo.yml b/.github/workflows/mo.yml index b3a1a61..e996bdf 100644 --- a/.github/workflows/mo.yml +++ b/.github/workflows/mo.yml @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 with: @@ -37,12 +40,20 @@ jobs: # MO requirements pip install -r requirements.txt pip install -r requirements_dev.txt + # requrements for CMake + sudo apt --assume-yes install libusb-1.0-0-dev working-directory: model-optimizer - name: Pylint run: pylint -d C,R,W mo/ mo.py extensions/ working-directory: model-optimizer + - name: CMake + run: | + mkdir build + cd build + cmake .. + - name: UT run: | export PYTHONPATH=$PYTHONPATH:`pwd` diff --git a/CMakeLists.txt b/CMakeLists.txt index f1be3f4..6ae1fbf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -126,6 +126,7 @@ build_ngraph() add_subdirectory(inference-engine) +add_subdirectory(model-optimizer) add_subdirectory(docs) # diff --git a/model-optimizer/CMakeLists.txt b/model-optimizer/CMakeLists.txt new file mode 100644 index 0000000..413472e --- /dev/null +++ b/model-optimizer/CMakeLists.txt @@ -0,0 +1,43 @@ +# Copyright (C) 2018-2020 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. + + +# install +ie_cpack_add_component(model_optimizer REQUIRED) + +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/automation/version.txt.in" + "${CMAKE_CURRENT_SOURCE_DIR}/version.txt" + @ONLY) + +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ + DESTINATION deployment_tools/model_optimizer + USE_SOURCE_PERMISSIONS + COMPONENT model_optimizer + PATTERN ".*" EXCLUDE + PATTERN "automation" EXCLUDE + PATTERN "requirements_dev.txt" EXCLUDE + PATTERN "README.md" EXCLUDE + PATTERN "CMakeLists.txt" EXCLUDE + + PATTERN "extensions/front/caffe/CustomLayersMapping.xml" EXCLUDE + PATTERN "mo/utils/convert.py" EXCLUDE + PATTERN "mo/utils/unittest" EXCLUDE + + REGEX ".*__pycache__.*" EXCLUDE + REGEX ".*\\.pyc$" EXCLUDE + REGEX ".*\\.swp" EXCLUDE + REGEX ".*\\.DS_Store$" EXCLUDE + REGEX ".*_test\.py$" EXCLUDE + ) diff --git a/model-optimizer/automation/version.txt.in b/model-optimizer/automation/version.txt.in new file mode 100644 index 0000000..9e9d021 --- /dev/null +++ b/model-optimizer/automation/version.txt.in @@ -0,0 +1 @@ +@CI_BUILD_NUMBER@ \ No newline at end of file diff --git a/model-optimizer/mo/utils/version_test.py b/model-optimizer/mo/utils/version_test.py index cc73a3a..0975f7f 100644 --- a/model-optimizer/mo/utils/version_test.py +++ b/model-optimizer/mo/utils/version_test.py @@ -24,7 +24,7 @@ from mo.utils.version import get_version class TestingVersion(unittest.TestCase): def test_unknown_version(self): - self.assertEqual(get_version(), "unknown version") + self.assertNotEqual(get_version(), "unknown version") @patch('os.path.isfile') @mock.patch('builtins.open', new_callable=mock_open, create=True, read_data='2021.1.0-1028-55e4d5673a8')