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
|
|
|
|
2022-08-26 10:48:53 +08:00
|
|
|
@echo off
|
|
|
|
echo Start build at: %date% %time%
|
|
|
|
|
2020-12-10 23:14:52 +08:00
|
|
|
SET BASE_PATH=%CD%
|
|
|
|
SET BUILD_PATH=%BASE_PATH%/build
|
|
|
|
|
2021-08-22 22:16:37 +08:00
|
|
|
SET threads=8
|
2020-12-18 13:48:52 +08:00
|
|
|
SET ENABLE_GITEE=OFF
|
2020-12-10 23:14:52 +08:00
|
|
|
|
2022-04-09 10:09:26 +08:00
|
|
|
set VERSION_STR=''
|
|
|
|
for /f "tokens=1" %%a in (version.txt) do (set VERSION_STR=%%a)
|
2020-09-30 16:35:51 +08:00
|
|
|
|
2020-12-09 11:18:35 +08:00
|
|
|
ECHO %2%|FINDSTR "^[0-9][0-9]*$"
|
|
|
|
IF %errorlevel% == 0 (
|
2020-09-30 16:35:51 +08:00
|
|
|
SET threads=%2%
|
|
|
|
)
|
2020-09-19 17:27:01 +08:00
|
|
|
|
2020-12-18 13:48:52 +08:00
|
|
|
IF "%FROM_GITEE%" == "1" (
|
|
|
|
echo "DownLoad from gitee"
|
|
|
|
SET ENABLE_GITEE=ON
|
|
|
|
)
|
|
|
|
|
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" (
|
2022-04-09 10:09:26 +08:00
|
|
|
echo "======Start building MindSpore Lite %VERSION_STR%======"
|
2021-03-23 10:21:01 +08:00
|
|
|
rd /s /q "%BASE_PATH%\output"
|
2021-01-14 19:21:29 +08:00
|
|
|
(git log -1 | findstr "^commit") > %BUILD_PATH%\.commit_id
|
2021-07-31 10:46:37 +08:00
|
|
|
IF defined VisualStudioVersion (
|
2022-04-09 10:09:26 +08:00
|
|
|
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DVERSION_STR=%VERSION_STR% ^
|
2021-07-31 10:46:37 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release -G "Ninja" "%BASE_PATH%/mindspore/lite"
|
|
|
|
) ELSE (
|
2022-04-09 10:09:26 +08:00
|
|
|
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DVERSION_STR=%VERSION_STR% ^
|
2021-07-31 10:46:37 +08:00
|
|
|
-DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
|
|
|
|
)
|
2020-08-19 16:18:07 +08:00
|
|
|
) ELSE (
|
2022-08-26 10:48:53 +08:00
|
|
|
IF "%1%" == "ms_vs_gpu" (
|
|
|
|
echo "======Start gen VS2019 Project for MS gpu ======"
|
2022-10-10 21:31:10 +08:00
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_GPU=ON -DGPU_BACKEND_CUDA=ON -DMS_REQUIRE_CUDA_VERSION=11.1 -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
2022-08-26 10:48:53 +08:00
|
|
|
-G "Visual Studio 16 2019" -A x64 ../..
|
2022-10-13 15:14:18 +08:00
|
|
|
) ELSE IF "%1%" == "ms_vs_cpu" (
|
|
|
|
echo "======Start gen VS2019 Project for MS cpu ======"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
|
|
|
-G "Visual Studio 16 2019" -A x64 ../..
|
|
|
|
) ELSE IF "%1%" == "ms_vs_cpu_debug" (
|
|
|
|
echo "======Start gen VS2019 Project for MS cpu debug======"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=Debug -DDEBUG_MODE=ON -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
|
|
|
-G "Visual Studio 16 2019" -A x64 ../..
|
2022-08-26 10:48:53 +08:00
|
|
|
) ELSE (
|
2022-10-13 15:14:18 +08:00
|
|
|
echo "======Start gen MinGW64 Project for MS cpu ======"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
2022-08-26 10:48:53 +08:00
|
|
|
-G "CodeBlocks - MinGW Makefiles" ../..
|
|
|
|
)
|
2020-09-30 16:35:51 +08:00
|
|
|
)
|
|
|
|
IF NOT %errorlevel% == 0 (
|
|
|
|
echo "cmake fail."
|
2020-12-10 23:14:52 +08:00
|
|
|
call :clean
|
2020-12-16 17:03:04 +08:00
|
|
|
EXIT /b 1
|
2020-09-30 16:35:51 +08:00
|
|
|
)
|
2020-08-19 16:18:07 +08:00
|
|
|
|
2022-08-26 10:48:53 +08:00
|
|
|
IF "%1%" == "ms_vs_gpu" (
|
|
|
|
cmake --build . --config Release --target package
|
2022-10-13 15:14:18 +08:00
|
|
|
) ELSE IF "%1%" == "ms_vs_cpu" (
|
|
|
|
cmake --build . --config Release --target package
|
|
|
|
) ELSE IF "%1%" == "ms_vs_cpu_debug" (
|
|
|
|
cmake --build . --config Debug --target package
|
2022-08-26 10:48:53 +08:00
|
|
|
) ELSE (
|
2022-10-13 15:14:18 +08:00
|
|
|
cmake --build . --target package -- -j%threads%
|
2022-08-26 10:48:53 +08:00
|
|
|
)
|
|
|
|
|
2020-09-30 16:35:51 +08:00
|
|
|
IF NOT %errorlevel% == 0 (
|
|
|
|
echo "build fail."
|
2020-12-10 23:14:52 +08:00
|
|
|
call :clean
|
2020-12-16 17:03:04 +08:00
|
|
|
EXIT /b 1
|
2020-08-19 16:18:07 +08:00
|
|
|
)
|
2020-04-15 17:36:48 +08:00
|
|
|
|
2020-12-16 17:03:04 +08:00
|
|
|
call :clean
|
|
|
|
EXIT /b 0
|
2020-04-15 17:36:48 +08:00
|
|
|
|
2020-12-10 23:14:52 +08:00
|
|
|
:clean
|
2020-12-16 17:03:04 +08:00
|
|
|
IF EXIST "%BASE_PATH%/output" (
|
|
|
|
cd %BASE_PATH%/output
|
2021-11-15 16:53:23 +08:00
|
|
|
if EXIST "%BASE_PATH%/output/_CPack_Packages" (
|
|
|
|
rd /s /q _CPack_Packages
|
|
|
|
)
|
2020-12-16 17:03:04 +08:00
|
|
|
)
|
2022-08-26 10:48:53 +08:00
|
|
|
cd %BASE_PATH%
|
|
|
|
|
|
|
|
@echo off
|
|
|
|
echo End build at: %date% %time%
|