forked from mindspore-Ecosystem/mindspore
!49344 optimize windows building speed using sccache and ninja
Merge pull request !49344 from qinzheng/win_build
This commit is contained in:
commit
94ad76bc14
26
build.bat
26
build.bat
|
@ -15,6 +15,8 @@
|
|||
@echo off
|
||||
@title mindspore_build
|
||||
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
@echo off
|
||||
echo Start build at: %date% %time%
|
||||
|
||||
|
@ -23,7 +25,6 @@ SET BUILD_PATH=%BASE_PATH%/build
|
|||
|
||||
SET threads=8
|
||||
SET ENABLE_GITEE=OFF
|
||||
SET ENABLE_INCREDIBUILD=OFF
|
||||
SET ENABLE_MSVC=OFF
|
||||
set BUILD_TYPE=Release
|
||||
set VERSION_STR=''
|
||||
|
@ -47,14 +48,6 @@ IF %errorlevel% == 0 (
|
|||
echo "use mingw compiler"
|
||||
)
|
||||
|
||||
where buildconsole
|
||||
IF %errorlevel% == 0 (
|
||||
echo "use buildconsole to speed up compile"
|
||||
SET ENABLE_INCREDIBUILD=ON
|
||||
) else (
|
||||
echo "fail to find buildconsole"
|
||||
)
|
||||
|
||||
IF NOT EXIST "%BUILD_PATH%" (
|
||||
md "build"
|
||||
)
|
||||
|
@ -82,8 +75,17 @@ IF "%1%" == "lite" (
|
|||
-G "Visual Studio 16 2019" -A x64 ../..
|
||||
) ELSE IF "%1%" == "ms_vs_cpu" (
|
||||
echo "======Start gen VS2019 Project for MS cpu ======"
|
||||
for /f "delims=" %%i in ('powershell.exe -ExecutionPolicy Bypass -Command "Get-ChildItem HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | foreach { Get-ItemProperty $_.PsPath } | where { $_.DisplayName -like '*Visual Studio*' -and $_.InstallLocation.Length -gt 0 } | sort InstallDate -Descending | foreach { Join-Path $_.InstallLocation 'VC\Auxiliary\Build'}"') do (call "%%i\vcvars64.bat")
|
||||
where sccache
|
||||
IF !errorlevel! == 0 (
|
||||
echo "use sccache to speed up compile"
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DENABLE_CPU=ON -DENABLE_MINDDATA=ON -DUSE_GLOG=ON -DENABLE_GITEE=%ENABLE_GITEE% ^
|
||||
-G Ninja ../..
|
||||
) ELSE (
|
||||
echo "fail to find sccache"
|
||||
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 ../..
|
||||
-G Ninja ../..
|
||||
)
|
||||
) 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% ^
|
||||
|
@ -102,11 +104,7 @@ IF NOT %errorlevel% == 0 (
|
|||
)
|
||||
|
||||
IF ON == %ENABLE_MSVC% (
|
||||
IF ON == %ENABLE_INCREDIBUILD% (
|
||||
buildconsole /command="cmake --build . --config %BUILD_TYPE% --target package"
|
||||
) ELSE (
|
||||
cmake --build . --config %BUILD_TYPE% --target package
|
||||
)
|
||||
) ELSE (
|
||||
cmake --build . --target package -- -j%threads%
|
||||
)
|
||||
|
|
|
@ -281,6 +281,8 @@ if(PLATFORM_ARM)
|
|||
set(nnacl_static_obj ${nnacl_static_obj} $<TARGET_OBJECTS:nnacl_fp16_mid>)
|
||||
endif()
|
||||
endif()
|
||||
add_library(nnacl_static STATIC ${nnacl_static_obj})
|
||||
set_target_properties(nnacl_static PROPERTIES OUTPUT_NAME "nnacl")
|
||||
set_target_properties(nnacl_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
if(NOT ${CMAKE_GENERATOR} MATCHES "Ninja")
|
||||
add_library(nnacl_static STATIC ${nnacl_static_obj})
|
||||
set_target_properties(nnacl_static PROPERTIES OUTPUT_NAME "nnacl")
|
||||
set_target_properties(nnacl_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue