2020-04-18 09:41:25 +08:00
|
|
|
@rem Copyright 2020 Huawei Technologies Co., Ltd
|
|
|
|
@rem
|
|
|
|
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
@rem you may not use this file except in compliance with the License.
|
|
|
|
@rem You may obtain a copy of the License at
|
|
|
|
@rem
|
|
|
|
@rem http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
@rem
|
|
|
|
@rem Unless required by applicable law or agreed to in writing, software
|
|
|
|
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
@rem See the License for the specific language governing permissions and
|
|
|
|
@rem limitations under the License.
|
|
|
|
@rem ============================================================================
|
2020-04-15 17:36:48 +08:00
|
|
|
@echo off
|
|
|
|
@title mindspore_build
|
2020-04-27 11:24:13 +08:00
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
find "const int ms_version_major =" mindspore\lite\include\version.h > version.txt
|
|
|
|
for /f "delims=\= tokens=2" %%a in ('findstr "const int ms_version_major = " version.txt') do (set x=%%a)
|
|
|
|
set VERSION_MAJOR=%x:~1,1%
|
|
|
|
find "const int ms_version_minor =" mindspore\lite\include\version.h > version.txt
|
|
|
|
for /f "delims=\= tokens=2" %%b in ('findstr "const int ms_versio/retestn_minor = " version.txt') do (set y=%%b)
|
|
|
|
set VERSION_MINOR=%y:~1,1%
|
|
|
|
find "const int ms_version_revision =" mindspore\lite\include\version.h > version.txt
|
|
|
|
for /f "delims=\= tokens=2" %%c in ('findstr "const int ms_version_revision = " version.txt') do (set z=%%c)
|
|
|
|
set VERSION_REVISION=%z:~1,1%
|
|
|
|
del version.txt
|
|
|
|
|
|
|
|
echo "======Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%======"
|
|
|
|
|
|
|
|
SET threads=6
|
2020-12-09 11:18:35 +08:00
|
|
|
SET X86_64_SIMD=off
|
|
|
|
|
|
|
|
ECHO %2%|FINDSTR "^[0-9][0-9]*$"
|
|
|
|
IF %errorlevel% == 0 (
|
2020-09-30 16:35:51 +08:00
|
|
|
SET threads=%2%
|
2020-12-09 11:18:35 +08:00
|
|
|
) ELSE (
|
|
|
|
IF NOT "%2%" == "" (
|
|
|
|
IF "%2%" == "avx" (
|
|
|
|
SET X86_64_SIMD=avx
|
|
|
|
) ELSE IF "%2%" == "sse" (
|
|
|
|
SET X86_64_SIMD=sse
|
|
|
|
) ELSE IF "%2%" == "off" (
|
|
|
|
SET X86_64_SIMD=off
|
|
|
|
) ELSE IF "%2%" == "avx512" (
|
|
|
|
SET X86_64_SIMD=avx512
|
|
|
|
) ELSE (
|
|
|
|
echo "MindSpore_lite the second parameter must in [avx, avx512, sse, off], but now is [%2%]"
|
|
|
|
call :run_fail
|
|
|
|
)
|
|
|
|
IF NOT "%3%" == "" (
|
|
|
|
SET threads=%3%
|
|
|
|
)
|
|
|
|
)
|
2020-09-30 16:35:51 +08:00
|
|
|
)
|
2020-09-19 17:27:01 +08:00
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
SET BASE_PATH=%CD%
|
|
|
|
SET BUILD_PATH=%BASE_PATH%/build
|
2020-09-19 17:27:01 +08:00
|
|
|
IF NOT EXIST "%BUILD_PATH%" (
|
2020-08-19 16:18:07 +08:00
|
|
|
md "build"
|
|
|
|
)
|
2020-09-19 17:27:01 +08:00
|
|
|
cd %BUILD_PATH%
|
2020-08-27 18:54:37 +08:00
|
|
|
IF NOT EXIST "%BUILD_PATH%/mindspore" (
|
2020-08-19 16:18:07 +08:00
|
|
|
md "mindspore"
|
|
|
|
)
|
2020-04-27 11:24:13 +08:00
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
cd %BUILD_PATH%/mindspore
|
2020-08-24 15:47:32 +08:00
|
|
|
IF "%1%" == "lite" (
|
2020-10-22 21:16:18 +08:00
|
|
|
cmake -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
|
|
|
|
-DENABLE_TOOLS=on -DENABLE_CONVERTER=on -DBUILD_TESTCASES=off ^
|
2020-09-30 16:35:51 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^
|
|
|
|
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
|
2020-12-09 11:18:35 +08:00
|
|
|
-DX86_64_SIMD=%X86_64_SIMD% ^
|
2020-09-30 16:35:51 +08:00
|
|
|
-G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
|
2020-08-19 16:18:07 +08:00
|
|
|
) ELSE (
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON ^
|
|
|
|
-G "CodeBlocks - MinGW Makefiles" ../..
|
2020-09-30 16:35:51 +08:00
|
|
|
)
|
|
|
|
IF NOT %errorlevel% == 0 (
|
|
|
|
echo "cmake fail."
|
|
|
|
call :run_fail
|
|
|
|
)
|
2020-08-19 16:18:07 +08:00
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
cmake --build . --target package -- -j%threads%
|
|
|
|
IF NOT %errorlevel% == 0 (
|
|
|
|
echo "build fail."
|
|
|
|
call :run_fail
|
2020-08-19 16:18:07 +08:00
|
|
|
)
|
2020-04-15 17:36:48 +08:00
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
IF EXIST "%BASE_PATH%/output" (
|
|
|
|
cd %BASE_PATH%/output
|
|
|
|
rd /s /q _CPack_Packages
|
|
|
|
)
|
2020-04-15 17:36:48 +08:00
|
|
|
|
|
|
|
goto run_eof
|
|
|
|
|
|
|
|
:run_fail
|
2020-09-30 16:35:51 +08:00
|
|
|
cd %BASE_PATH%
|
2020-04-22 10:24:48 +08:00
|
|
|
set errorlevel=1
|
2020-09-30 16:35:51 +08:00
|
|
|
EXIT /b %errorlevel%
|
2020-04-15 17:36:48 +08:00
|
|
|
|
|
|
|
:run_eof
|
2020-09-30 16:35:51 +08:00
|
|
|
cd %BASE_PATH%
|