2020-11-06 11:05:52 +08:00
|
|
|
# MNN
|
|
|
|
# |-- Debug
|
|
|
|
# | |--- MD
|
|
|
|
# | |--- MT
|
|
|
|
# | |--- Static
|
|
|
|
# |
|
|
|
|
# |-- Release
|
|
|
|
# |--- MD
|
|
|
|
# |--- MT
|
|
|
|
# |--- Static
|
|
|
|
|
|
|
|
Param(
|
|
|
|
[Parameter(Mandatory=$true)][String]$path,
|
|
|
|
[Switch]$opencl
|
|
|
|
)
|
|
|
|
$erroractionpreference = "stop"
|
|
|
|
Remove-Item $path -Recurse -ErrorAction Ignore
|
|
|
|
mkdir -p $path
|
|
|
|
$PACKAGE_PATH = $(Resolve-Path $path).Path
|
|
|
|
|
|
|
|
#clear and create package directory
|
|
|
|
powershell ./schema/generate.ps1
|
|
|
|
pushd $PACKAGE_PATH
|
|
|
|
mkdir -p Debug\MD
|
|
|
|
mkdir -p Debug\MT
|
|
|
|
mkdir -p Debug\Static
|
|
|
|
mkdir -p Release\MD
|
|
|
|
mkdir -p Release\MT
|
|
|
|
mkdir -p Release\Static
|
|
|
|
popd
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
$CMAKE_ARGS = "-DMNN_SEP_BUILD=OFF -DMNN_BUILD_TRAIN=ON"
|
2020-11-06 11:05:52 +08:00
|
|
|
if ($opencl) {
|
|
|
|
$CMAKE_ARGS = "$CMAKE_ARGS -DMNN_OPENCL=ON"
|
|
|
|
}
|
|
|
|
|
|
|
|
Remove-Item build -Recurse -ErrorAction Ignore
|
|
|
|
mkdir build
|
|
|
|
pushd build
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Debug/MT ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug -DMNN_WIN_RUNTIME_MT=ON .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Debug\MT
|
|
|
|
cp MNN.dll $PACKAGE_PATH\Debug\MT
|
|
|
|
cp MNN.pdb $PACKAGE_PATH\Debug\MT
|
|
|
|
rm MNN.*
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Debug/MD ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug -DMNN_WIN_RUNTIME_MT=OFF .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Debug\MD
|
|
|
|
cp MNN.dll $PACKAGE_PATH\Debug\MD
|
|
|
|
cp MNN.pdb $PACKAGE_PATH\Debug\MD
|
|
|
|
rm MNN.*
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Debug/Static ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Debug -DMNN_WIN_RUNTIME_MT=OFF -DMNN_BUILD_SHARED_LIBS=OFF .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Debug\Static
|
|
|
|
rm MNN.*
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Release/MT ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DMNN_WIN_RUNTIME_MT=ON .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Release\MT
|
|
|
|
cp MNN.dll $PACKAGE_PATH\Release\MT
|
|
|
|
cp MNN.pdb $PACKAGE_PATH\Release\MT
|
|
|
|
rm MNN.*
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Release/MD ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DMNN_WIN_RUNTIME_MT=OFF .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Release\MD
|
|
|
|
cp MNN.dll $PACKAGE_PATH\Release\MD
|
|
|
|
cp MNN.pdb $PACKAGE_PATH\Release\MD
|
|
|
|
rm MNN.*
|
|
|
|
|
2021-01-06 16:29:37 +08:00
|
|
|
##### Release/Static ####
|
2020-11-06 11:05:52 +08:00
|
|
|
Remove-Item CMakeCache.txt -ErrorAction Ignore
|
|
|
|
Invoke-Expression "cmake -G Ninja $CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DMNN_WIN_RUNTIME_MT=OFF -DMNN_BUILD_SHARED_LIBS=OFF .."
|
|
|
|
ninja
|
|
|
|
cp MNN.lib $PACKAGE_PATH\Release\Static
|
|
|
|
|
|
|
|
popd
|