Add win generate.bat
This commit is contained in:
parent
7475dc3dbe
commit
6fa55e9ad7
|
@ -70,7 +70,9 @@ macro(set_outdir ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPU
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
set(__exe2bat_relative_path false)
|
if(NOT __exe2bat_relative_path)
|
||||||
|
set(__exe2bat_relative_path false)
|
||||||
|
endif()
|
||||||
|
|
||||||
macro(exe2bat exe_name exe_dir dll_search_paths)
|
macro(exe2bat exe_name exe_dir dll_search_paths)
|
||||||
message(STATUS "Generating ${exe_name}.bat")
|
message(STATUS "Generating ${exe_name}.bat")
|
||||||
|
|
20
scripts/win/generate.bat
Normal file
20
scripts/win/generate.bat
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
set _MY_DIR=%~dp0
|
||||||
|
|
||||||
|
set _VS_GEN="Visual Studio 15 2017 Win64"
|
||||||
|
REM set _VS_GEN="Visual Studio 14 2015 Win64"
|
||||||
|
|
||||||
|
cd %_MY_DIR%
|
||||||
|
|
||||||
|
mkdir _build
|
||||||
|
cd _build/
|
||||||
|
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release ^
|
||||||
|
-DCMAKE_PREFIX_PATH="%_MY_DIR%/../lib/cmake" ^
|
||||||
|
-DOpenCV_DIR="%_MY_DIR%/../3rdparty/opencv/build" ^
|
||||||
|
-G %_VS_GEN% ^
|
||||||
|
..
|
||||||
|
|
||||||
|
cd %_MY_DIR%
|
||||||
|
pause
|
|
@ -37,17 +37,36 @@ fi
|
||||||
export OpenCV_DIR="$ROOT_DIR/3rdparty/opencv/build"
|
export OpenCV_DIR="$ROOT_DIR/3rdparty/opencv/build"
|
||||||
|
|
||||||
_rm() {
|
_rm() {
|
||||||
[ -e "$1" ] && (rm -r "$1" && _echo_in "RM: $1")
|
[ -e "$1" ] && (rm -r "$1" && _echo_i "RM: $1")
|
||||||
}
|
}
|
||||||
|
|
||||||
_md() {
|
_md() {
|
||||||
[ ! -d "$1" ] && (mkdir -p "$1" && _echo_in "MD: $1")
|
[ ! -d "$1" ] && (mkdir -p "$1" && _echo_i "MD: $1")
|
||||||
|
}
|
||||||
|
|
||||||
|
# _mv_subs <srcdir> <dstdir> [sub1 sub2 ...]
|
||||||
|
_mv_subs() {
|
||||||
|
_src_dir="$1"; shift; _dst_dir="$1"; shift; _subs="$@";
|
||||||
|
if [ -z "$_subs" ]; then
|
||||||
|
_subs=`ls $_src_dir`
|
||||||
|
fi
|
||||||
|
for _sub in $_subs; do
|
||||||
|
_src="$_src_dir/$_sub"
|
||||||
|
[ ! -e "$_src" ] && (_echo_i "Not exist: $_src") && continue
|
||||||
|
_dst=
|
||||||
|
[ -f "$_src" ] && _dst="$_dst_dir"
|
||||||
|
[ -d "$_src" ] && _dst="$_dst_dir/$_sub"
|
||||||
|
[ -z "$_dst" ] && continue
|
||||||
|
# _echo "_src: $_src"
|
||||||
|
# _echo "_dst: $_dst"
|
||||||
|
mv "$_src" "$_dst"
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# build release
|
# build release
|
||||||
|
|
||||||
make install
|
make samples tools
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# build debug
|
# build debug
|
||||||
|
@ -59,12 +78,6 @@ make build BUILD_TYPE=Debug
|
||||||
mv "$ROOT_DIR/_output/bin/mynteyed.dll" "$ROOT_DIR/_install/bin/mynteyed.dll"
|
mv "$ROOT_DIR/_output/bin/mynteyed.dll" "$ROOT_DIR/_install/bin/mynteyed.dll"
|
||||||
mv "$ROOT_DIR/_output/lib/mynteyed.lib" "$ROOT_DIR/_install/lib/mynteyed.lib"
|
mv "$ROOT_DIR/_output/lib/mynteyed.lib" "$ROOT_DIR/_install/lib/mynteyed.lib"
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# copy to _install
|
|
||||||
|
|
||||||
cp -f "$ROOT_DIR/scripts/win/cmake/mynteye-targets.cmake" "$ROOT_DIR/_install/lib/cmake/mynteye/"
|
|
||||||
cp -f "$ROOT_DIR/scripts/win/cmake/mynteye-targets-release.cmake" "$ROOT_DIR/_install/lib/cmake/mynteye/"
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# move to _install
|
# move to _install
|
||||||
|
|
||||||
|
@ -72,23 +85,67 @@ cp -f "$ROOT_DIR/scripts/win/cmake/mynteye-targets-release.cmake" "$ROOT_DIR/_in
|
||||||
_md "$ROOT_DIR/_install/3rdparty"
|
_md "$ROOT_DIR/_install/3rdparty"
|
||||||
mv "$ROOT_DIR/3rdparty/opencv" "$ROOT_DIR/_install/3rdparty/opencv"
|
mv "$ROOT_DIR/3rdparty/opencv" "$ROOT_DIR/_install/3rdparty/opencv"
|
||||||
|
|
||||||
|
# cmake
|
||||||
|
mv "$ROOT_DIR/cmake" "$ROOT_DIR/_install/cmake"
|
||||||
|
|
||||||
|
# samples
|
||||||
|
mv "$ROOT_DIR/samples/_output/bin" "$ROOT_DIR/_install/bin/samples"
|
||||||
|
mv "$ROOT_DIR/samples/_output/lib" "$ROOT_DIR/_install/lib/samples"
|
||||||
|
_rm "$ROOT_DIR/samples/_build"
|
||||||
|
_rm "$ROOT_DIR/samples/_output"
|
||||||
|
mv "$ROOT_DIR/samples" "$ROOT_DIR/_install/samples"
|
||||||
|
|
||||||
|
# tools
|
||||||
|
mv "$ROOT_DIR/tools/_output/bin" "$ROOT_DIR/_install/bin/tools"
|
||||||
|
mv "$ROOT_DIR/tools/_output/lib" "$ROOT_DIR/_install/lib/tools"
|
||||||
|
_rm "$ROOT_DIR/tools/_build"
|
||||||
|
_rm "$ROOT_DIR/tools/_output"
|
||||||
|
mv "$ROOT_DIR/tools/linter" "$ROOT_DIR/3rdparty/linter"
|
||||||
|
mv "$ROOT_DIR/tools" "$ROOT_DIR/_install/tools"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# copy to _install
|
||||||
|
|
||||||
|
cp -f "$ROOT_DIR/scripts/win/cmake/mynteye-targets.cmake" "$ROOT_DIR/_install/lib/cmake/mynteye/"
|
||||||
|
cp -f "$ROOT_DIR/scripts/win/cmake/mynteye-targets-release.cmake" "$ROOT_DIR/_install/lib/cmake/mynteye/"
|
||||||
|
|
||||||
|
cp -f "$ROOT_DIR/scripts/win/generate.bat" "$ROOT_DIR/_install/samples/"
|
||||||
|
cp -f "$ROOT_DIR/scripts/win/generate.bat" "$ROOT_DIR/_install/tools/"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# archive exe
|
# archive exe
|
||||||
|
|
||||||
source "$ROOT_DIR/pkginfo.sh"
|
source "$ROOT_DIR/pkginfo.sh"
|
||||||
_pkgname=$1-opencv-$OpenCV_VERSION
|
_pkgname="$1-opencv-$OpenCV_VERSION"
|
||||||
|
_rm "$ROOT_DIR/$_pkgname.exe"
|
||||||
mv "$ROOT_DIR/_install" "$ROOT_DIR/$_pkgname"
|
mv "$ROOT_DIR/_install" "$ROOT_DIR/$_pkgname"
|
||||||
|
|
||||||
makensis "$ROOT_DIR/winpack.nsi"
|
makensis "$ROOT_DIR/winpack.nsi"
|
||||||
|
|
||||||
mv "$ROOT_DIR/$_pkgname" "$ROOT_DIR/_install"
|
mv "$ROOT_DIR/$_pkgname" "$ROOT_DIR/_install"
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# remove from _install
|
||||||
|
|
||||||
|
_rm "$ROOT_DIR/_install/samples/generate.bat"
|
||||||
|
_rm "$ROOT_DIR/_install/tools/generate.bat"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# move back from _install
|
# move back from _install
|
||||||
|
|
||||||
# 3rdparty/opencv
|
# 3rdparty/opencv
|
||||||
mv "$ROOT_DIR/_install/3rdparty/opencv" "$ROOT_DIR/3rdparty/opencv"
|
mv "$ROOT_DIR/_install/3rdparty/opencv" "$ROOT_DIR/3rdparty/opencv"
|
||||||
|
|
||||||
|
# cmake
|
||||||
|
mv "$ROOT_DIR/_install/cmake" "$ROOT_DIR/cmake"
|
||||||
|
|
||||||
|
# samples
|
||||||
|
mv "$ROOT_DIR/_install/samples" "$ROOT_DIR/samples"
|
||||||
|
|
||||||
|
# tools
|
||||||
|
mv "$ROOT_DIR/_install/tools" "$ROOT_DIR/tools"
|
||||||
|
mv "$ROOT_DIR/3rdparty/linter" "$ROOT_DIR/tools/linter"
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# clean build
|
# clean build
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user