You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

build.bat 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. @rem Copyright 2020 Huawei Technologies Co., Ltd
  2. @rem
  3. @rem Licensed under the Apache License, Version 2.0 (the "License");
  4. @rem you may not use this file except in compliance with the License.
  5. @rem You may obtain a copy of the License at
  6. @rem
  7. @rem http://www.apache.org/licenses/LICENSE-2.0
  8. @rem
  9. @rem Unless required by applicable law or agreed to in writing, software
  10. @rem distributed under the License is distributed on an "AS IS" BASIS,
  11. @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. @rem See the License for the specific language governing permissions and
  13. @rem limitations under the License.
  14. @rem ============================================================================
  15. @echo off
  16. @title mindspore_build
  17. find "const int ms_version_major =" mindspore\lite\include\version.h > version.txt
  18. for /f "delims=\= tokens=2" %%a in ('findstr "const int ms_version_major = " version.txt') do (set x=%%a)
  19. set VERSION_MAJOR=%x:~1,1%
  20. find "const int ms_version_minor =" mindspore\lite\include\version.h > version.txt
  21. for /f "delims=\= tokens=2" %%b in ('findstr "const int ms_versio/retestn_minor = " version.txt') do (set y=%%b)
  22. set VERSION_MINOR=%y:~1,1%
  23. find "const int ms_version_revision =" mindspore\lite\include\version.h > version.txt
  24. for /f "delims=\= tokens=2" %%c in ('findstr "const int ms_version_revision = " version.txt') do (set z=%%c)
  25. set VERSION_REVISION=%z:~1,1%
  26. del version.txt
  27. echo "======Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%======"
  28. SET threads=6
  29. IF NOT "%2%" == "" (
  30. SET threads=%2%
  31. )
  32. SET BASE_PATH=%CD%
  33. SET BUILD_PATH=%BASE_PATH%/build
  34. IF NOT EXIST "%BUILD_PATH%" (
  35. md "build"
  36. )
  37. cd %BUILD_PATH%
  38. IF NOT EXIST "%BUILD_PATH%/mindspore" (
  39. md "mindspore"
  40. )
  41. cd %BUILD_PATH%/mindspore
  42. IF "%1%" == "lite" (
  43. cmake -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
  44. -DENABLE_TOOLS=on -DENABLE_CONVERTER=on -DBUILD_TESTCASES=off ^
  45. -DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^
  46. -DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
  47. -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
  48. ) ELSE (
  49. cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON ^
  50. -G "CodeBlocks - MinGW Makefiles" ../..
  51. )
  52. IF NOT %errorlevel% == 0 (
  53. echo "cmake fail."
  54. call :run_fail
  55. )
  56. cmake --build . --target package -- -j%threads%
  57. IF NOT %errorlevel% == 0 (
  58. echo "build fail."
  59. call :run_fail
  60. )
  61. IF EXIST "%BASE_PATH%/output" (
  62. cd %BASE_PATH%/output
  63. rd /s /q _CPack_Packages
  64. )
  65. goto run_eof
  66. :run_fail
  67. cd %BASE_PATH%
  68. set errorlevel=1
  69. EXIT /b %errorlevel%
  70. :run_eof
  71. cd %BASE_PATH%