📄 build.bat
字号:
@echo off
rem Review how this should best be integrated
rem into the build script
rem set dxsdk9=\\infosurf\swtools\DX9SDK
rem test for desire for help
if not "%1" == "?" (
if not "%1" == "/?" (
goto begin
)
)
:usage
echo.
echo Syntax
echo build ?
echo build /?
echo build [ Debug ^| Release ]
echo.
echo Arguments
echo ?
echo displays help at the command prompt
echo Debug
echo performs non-Official, i.e. local, build (default, when neither Debug nor Release is specified)
echo Release
echo performs Official, i.e. network, build
echo.
goto cleanup
:begin
rem separator
echo.
echo.
echo *************************************************
echo *************************************************
echo *** ***
echo *** New Build ***
echo *** ***
echo *************************************************
echo *************************************************
echo.
echo.
:test_for_indic_prep_env_var
rem ** test for presence (existence) of the environment variable holding the location of
rem ** the MSDEV .Net preparatory building file
if not %VSCOMNTOOLS%=="" goto test_for_containing_folder
rem ** environment variable that indicates location of the MSDEV .Net preparatory building
rem ** file is not present (does not exist); advise user and fail
echo Unable to find VSCOMNTOOLS, the environment variable that holds the location of vsvars32.bat, the file that prepares the environment for building under MSDEV .Net!
echo If MSDEV .Net is indeed installed, ensure said environment variable holds location of said file.
goto failure
:test_for_containing_folder
rem ** test for presence (existence) of folder indicated by aforementioned environment
rem ** variable
if exist %VSCOMNTOOLS% goto test_for_preparatory_file
rem ** folder indicated by aforementioned environment variable is not present (does not
rem ** exist); advise user and fail
echo Unable to find %VSCOMNTOOLS%, the folder containing vsvars32.bat, the file that prepares the environment for building under MSDEV .Net!
echo If MSDEV .Net is indeed installed, ensure environment variable VSCOMNTOOLS holds location of said file.
goto failure
:test_for_preparatory_file
rem ** test for presence (existence) of MSDEV .Net preparatory building file, in folder
rem ** indicated by aforementioned environment variable
if exist %VSCOMNTOOLS%\vsvars32.bat goto ensure_environment_settings
rem ** MSDEV .Net preparatory building file is not present (does not exist) in folder
rem ** indicated by aforementioned environment variable; advise user and fail
echo In %VSCOMNTOOLS%, the folder indicated by environment variable VSCOMNTOOLS, unable to find VSVARS32.BAT, the file that prepares the environment for building under MSDEV .Net!
echo If MSDEV .Net is indeed installed, ensure said environment variable holds location of said file.
goto failure
:ensure_environment_settings
rem ensure proper environment settings
rem test environment for presence (existence) of MSDEV .Net indicative setting
rem if this test evaluates to true, i.e. if VSINSTALLDIR is defined, the following is assumed:
rem a. VSINSTALLDIR is defined properly,
rem b. its siblings are defined, and
rem c. its siblings are defined properly, i.e. congruently with the definition of VSINSTALLDIR.
rem any deviance from these conditions will most likely cause problems;
rem moreover, these problems will, most likely, be difficult to find.
if not "%VSINSTALLDIR%"=="" (
SET FLAG_VSVARS32_VARS_ALREADY_SET=true
goto branch_on_build_type
) else (
SET FLAG_VSVARS32_VARS_ALREADY_SET=
)
rem store current environment, for restoration later
rem assume environment variables beginning with EXTERNAL_PRIOR_ did not exist before instantiation
if not "%VSINSTALLDIR%"=="" (
SET EXTERNAL_PRIOR_VSINSTALLDIR=%VSINSTALLDIR%
) else (
SET EXTERNAL_PRIOR_VSINSTALLDIR=
)
if not "%VCINSTALLDIR%"=="" (
SET EXTERNAL_PRIOR_VCINSTALLDIR=%VCINSTALLDIR%
) else (
SET EXTERNAL_PRIOR_VCINSTALLDIR=
)
if not "%FrameworkDir%"=="" (
SET EXTERNAL_PRIOR_FrameworkDIR=%FrameworkDir%
) else (
SET EXTERNAL_PRIOR_FrameworkDIR=
)
if not "%FrameworkVersion%"=="" (
SET EXTERNAL_PRIOR_FrameworkVersion=%FrameworkVersion%
) else (
SET EXTERNAL_PRIOR_FrameworkVersion=
)
if not "%FrameworkSDKDir%"=="" (
SET EXTERNAL_PRIOR_FrameworkSDKDir=%FrameworkSDKDir%
) else (
SET EXTERNAL_PRIOR_FrameworkSDKDir=
)
if not "%DevEnvDir%"=="" (
SET EXTERNAL_PRIOR_DevEnvDir=%DevEnvDir%
) else (
SET EXTERNAL_PRIOR_DevEnvDir=
)
if not "%MSVCDir%"=="" (
SET EXTERNAL_PRIOR_MSVCDir=%MSVCDir%
) else (
SET EXTERNAL_PRIOR_MSVCDir=
)
if not "%PATH%"=="" (
SET EXTERNAL_PRIOR_PATH=%PATH%
) else (
SET EXTERNAL_PRIOR_PATH=
)
if not "%INCLUDE%"=="" (
SET EXTERNAL_PRIOR_INCLUDE=%INCLUDE%
) else (
SET EXTERNAL_PRIOR_INCLUDE=
)
if not "%LIB%"=="" (
SET EXTERNAL_PRIOR_LIB=%LIB%
) else (
SET EXTERNAL_PRIOR_LIB=
)
rem environment is not prepared to build under MSDEV .Net; prepare it
call %VSCOMNTOOLS%\vsvars32.bat
:branch_on_build_type
echo.
rem Release should be Official
if "%1" == "Release" goto perform_official_build
rem Debug should be Non-official
if "%1" == "Debug" goto perform_non_official_build
if "%1" == "" goto perform_non_official_build
echo **!! Usage Error !!**
goto usage
rem ------------------------------------------------------------------------
rem ------------------------------------------------------------------------
rem For Official build
:perform_official_build
echo Commencing Build...
if not "%INCLUDE%"=="" (
SET INTERNAL_PRIOR_INCLUDE=%INCLUDE%
) else (
SET INTERNAL_PRIOR_INCLUDE=
)
if not "%LIB%"=="" (
SET INTERNAL_PRIOR_LIB=%LIB%
) else (
SET INTERNAL_PRIOR_LIB=
)
rem set environment variables for building of solution
rem ** Note: This is the union of environment variables necessary
rem ** to build all desired pieces of solution, namely [Unicorn] application
set INCLUDE=%SWTOOLS%\ddkdir\ddkxpsp1\inc\wxp;%SWTOOLS%\DX9SDK\Include;%SWTOOLS%\DX9SDK\Samples\C++\DirectShow\BaseClasses;..\pciminidriver;..\timedelay;..\common\include;%SWTOOLS%\MSVS7\VC7\include;%SWTOOLS%\MSVS7\VC7\ATLMFC\include;%SWTOOLS%\MSVS7\VC7\PlatformSDK\include
set LIB=%SWTOOLS%\DX9SDK\Lib;%SWTOOLS%\DX9SDK\Samples\C++\DirectShow\BaseClasses\Release;%SWTOOLS%\MSVS7\VC7\lib;%SWTOOLS%\MSVS7\VC7\ATLMFC\lib;%SWTOOLS%\MSVS7\VC7\PlatformSDK\lib
rem build 'Release' configurations of solution
devenv /rebuild "Release" cpnotify.sln /useenv
if errorlevel 1 goto failure
echo Terminating Build...
echo Build Successful!
goto cleanup
rem ------------------------------------------------------------------------
rem ------------------------------------------------------------------------
rem For non-Official build
:perform_non_official_build
echo Commencing Build...
if not "%INCLUDE%"=="" (
SET INTERNAL_PRIOR_INCLUDE=%INCLUDE%
) else (
SET INTERNAL_PRIOR_INCLUDE=
)
if not "%LIB%"=="" (
SET INTERNAL_PRIOR_LIB=%LIB%
) else (
SET INTERNAL_PRIOR_LIB=
)
rem set environment variables for building of solution
rem ** Note: This is the union of environment variables necessary
rem ** to build all desired pieces of solution, namely [Unicorn] application
set INCLUDE=%SWTOOLS%\ddkdir\ddkxpsp1\inc\wxp;%SWTOOLS%\DX9SDK\Include;%SWTOOLS%\DX9SDK\Samples\C++\DirectShow\BaseClasses;..\pciminidriver;..\timedelay;..\common\include;%SWTOOLS%\MSVS7\VC7\include;%SWTOOLS%\MSVS7\VC7\ATLMFC\include;%SWTOOLS%\MSVS7\VC7\PlatformSDK\include
set LIB=%SWTOOLS%\DX9SDK\Lib;%SWTOOLS%\DX9SDK\Samples\C++\DirectShow\BaseClasses\Release;%SWTOOLS%\MSVS7\VC7\lib;%SWTOOLS%\MSVS7\VC7\ATLMFC\lib;%SWTOOLS%\MSVS7\VC7\PlatformSDK\lib
rem build 'Debug' configurations of solution
devenv /rebuild "Debug" cpnotify.sln /useenv
if errorlevel 1 goto failure
echo Terminating Build...
echo Build Successful!
goto cleanup
:failure
echo Build Failure!
echo Build Failure! >> ..\..\error.txt
:cleanup
rem restore previous environment
rem assume environment variables beginning with EXTERNAL_PRIOR_ did not exist before instantiation
if not "%FLAG_VSVARS32_VARS_ALREADY_SET%"=="" (
if not "%INTERNAL_PRIOR_INCLUDE%"=="" (
SET INCLUDE=%INTERNAL_PRIOR_INCLUDE%
SET INTERNAL_PRIOR_INCLUDE=
) else (
SET INCLUDE=
)
if not "%INTERNAL_PRIOR_LIB%"=="" (
SET LIB=%INTERNAL_PRIOR_LIB%
SET INTERNAL_PRIOR_LIB=
) else (
SET LIB=
)
SET FLAG_VSVARS32_VARS_ALREADY_SET=
goto end
) else (
if not "%EXTERNAL_PRIOR_VSINSTALLDIR%"=="" (
SET VSINSTALLDIR=%EXTERNAL_PRIOR_VSINSTALLDIR%
SET EXTERNAL_PRIOR_VSINSTALLDIR=
) else (
SET VSINSTALLDIR=
)
if not "%EXTERNAL_PRIOR_VCINSTALLDIR%"=="" (
SET VCINSTALLDIR=%EXTERNAL_PRIOR_VCINSTALLDIR%
SET EXTERNAL_PRIOR_VCINSTALLDIR=
) else (
SET VCINSTALLDIR=
)
if not "%EXTERNAL_PRIOR_FrameworkDir%"=="" (
SET FrameworkDIR=%EXTERNAL_PRIOR_FrameworkDir%
SET EXTERNAL_PRIOR_FrameworkDIR=
) else (
SET FrameworkDIR=
)
if not "%EXTERNAL_PRIOR_FrameworkVersion%"=="" (
SET FrameworkVersion=%EXTERNAL_PRIOR_FrameworkVersion%
SET EXTERNAL_PRIOR_FrameworkVersion=
) else (
SET FrameworkVersion=
)
if not "%EXTERNAL_PRIOR_FrameworkSDKDir%"=="" (
SET FrameworkSDKDir=%EXTERNAL_PRIOR_FrameworkSDKDir%
SET EXTERNAL_PRIOR_FrameworkSDKDir=
) else (
SET FrameworkSDKDir=
)
if not "%EXTERNAL_PRIOR_DevEnvDir%"=="" (
SET DevEnvDir=%EXTERNAL_PRIOR_DevEnvDir%
SET EXTERNAL_PRIOR_DevEnvDir=
) else (
SET DevEnvDir=
)
if not "%EXTERNAL_PRIOR_MSVCDir%"=="" (
SET MSVCDir=%EXTERNAL_PRIOR_MSVCDir%
SET EXTERNAL_PRIOR_MSVCDir=
) else (
SET MSVCDir=
)
if not "%EXTERNAL_PRIOR_PATH%"=="" (
SET PATH=%EXTERNAL_PRIOR_PATH%
SET EXTERNAL_PRIOR_PATH=
) else (
SET PATH=
)
if not "%EXTERNAL_PRIOR_INCLUDE%"=="" (
SET INCLUDE=%EXTERNAL_PRIOR_INCLUDE%
SET EXTERNAL_PRIOR_INCLUDE=
) else (
SET INCLUDE=
)
if not "%EXTERNAL_PRIOR_LIB%"=="" (
SET LIB=%EXTERNAL_PRIOR_LIB%
SET EXTERNAL_PRIOR_LIB=
) else (
SET LIB=
)
if not "%INTERNAL_PRIOR_INCLUDE%"=="" (
SET INTERNAL_PRIOR_INCLUDE=
)
if not "%INTERNAL_PRIOR_LIB%"=="" (
SET INTERNAL_PRIOR_LIB=
)
)
:end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -