From f4264b5adb478ff723d4b9ef05586a5b4ff0e9c8 Mon Sep 17 00:00:00 2001 From: ski Date: Tue, 27 Oct 2015 12:51:21 +0300 Subject: [PATCH] 0016472: Improve environment scripts for samples Output directory for binaries of CSharp samples was corrected. Common run.bat was created for CSharp samples. Behaviour of run.bat file from mfc samples was extended. Recovered separate run_*.bat files for each sample in CSharp sample. --- samples/CSharp/OCCTProxy/OCCTProxy.vcproj | 8 ++-- samples/CSharp/OCCTProxy/OCCTProxy.vcxproj | 8 ++-- .../CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj | 8 ++-- .../OCCTProxy_D3D/OCCTProxy_D3D.vcxproj | 8 ++-- samples/CSharp/WPF_D3D/IE_WPF_D3D.csproj | 8 ++-- .../WPF_WinForms/IE_WPF_WinForms.csproj | 8 ++-- samples/CSharp/WinForms/IE_WinForms.csproj | 8 ++-- samples/CSharp/env.bat | 11 ++++++ samples/CSharp/run.bat | 38 +++++++++++++++++++ samples/CSharp/run_winforms.bat | 26 +------------ samples/CSharp/run_wpf.bat | 26 +------------ samples/CSharp/run_wpf_D3D.bat | 26 +------------ samples/mfc/standard/run.bat | 31 ++++++++++----- samples/qt/IESample/genproj.bat | 14 +++---- samples/qt/Tutorial/genproj.bat | 14 +++---- 15 files changed, 116 insertions(+), 126 deletions(-) create mode 100644 samples/CSharp/env.bat create mode 100644 samples/CSharp/run.bat diff --git a/samples/CSharp/OCCTProxy/OCCTProxy.vcproj b/samples/CSharp/OCCTProxy/OCCTProxy.vcproj index f7ff0bed81..2f74a96642 100644 --- a/samples/CSharp/OCCTProxy/OCCTProxy.vcproj +++ b/samples/CSharp/OCCTProxy/OCCTProxy.vcproj @@ -21,7 +21,7 @@ <_ProjectFileVersion>10.0.40219.1 - ..\win32\bind\ + ..\win32\$(VCVER)\bind\ obj\$(Platform)\$(Configuration)\ true - ..\win64\bind\ + ..\win64\$(VCVER)\bind\ obj\$(Platform)\$(Configuration)\ true - ..\win32\bin\ + ..\win32\$(VCVER)\bin\ obj\$(Platform)\$(Configuration)\ false - ..\win64\bin\ + ..\win64\$(VCVER)\bin\ obj\$(Platform)\$(Configuration)\ false diff --git a/samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj b/samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj index 9c11a90f7b..02d9783a94 100644 --- a/samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj +++ b/samples/CSharp/OCCTProxy_D3D/OCCTProxy_D3D.vcproj @@ -21,7 +21,7 @@ <_ProjectFileVersion>10.0.40219.1 - ..\win32\bind\ + ..\win32\$(VCVER)\bind\ obj\$(Platform)\$(Configuration)\ false - ..\win64\bind\ + ..\win64\$(VCVER)\bind\ obj\$(Platform)\$(Configuration)\ false - ..\win32\bin\ + ..\win32\$(VCVER)\bin\ obj\$(Platform)\$(Configuration)\ false - ..\win64\bin\ + ..\win64\$(VCVER)\bin\ obj\$(Platform)\$(Configuration)\ false diff --git a/samples/CSharp/WPF_D3D/IE_WPF_D3D.csproj b/samples/CSharp/WPF_D3D/IE_WPF_D3D.csproj index d080875527..91cc3260ed 100644 --- a/samples/CSharp/WPF_D3D/IE_WPF_D3D.csproj +++ b/samples/CSharp/WPF_D3D/IE_WPF_D3D.csproj @@ -55,14 +55,14 @@ true - ..\win32\bind\ + ..\win32\$(VCVER)\bind\ DEBUG;TRACE full x86 prompt - ..\win32\bin\ + ..\win32\$(VCVER)\bin\ TRACE true pdbonly @@ -71,14 +71,14 @@ true - ..\win64\bind\ + ..\win64\$(VCVER)\bind\ DEBUG;TRACE full x64 prompt - ..\win64\bin\ + ..\win64\$(VCVER)\bin\ TRACE true pdbonly diff --git a/samples/CSharp/WPF_WinForms/IE_WPF_WinForms.csproj b/samples/CSharp/WPF_WinForms/IE_WPF_WinForms.csproj index 3a71baa9f7..4996b0755b 100644 --- a/samples/CSharp/WPF_WinForms/IE_WPF_WinForms.csproj +++ b/samples/CSharp/WPF_WinForms/IE_WPF_WinForms.csproj @@ -55,14 +55,14 @@ true - ..\win32\bind\ + ..\win32\$(VCVER)\bind\ DEBUG;TRACE full x86 prompt - ..\win32\bin\ + ..\win32\$(VCVER)\bin\ TRACE true pdbonly @@ -71,14 +71,14 @@ true - ..\win64\bind\ + ..\win64\$(VCVER)\bind\ DEBUG;TRACE full x64 prompt - ..\win64\bin\ + ..\win64\$(VCVER)\bin\ TRACE true pdbonly diff --git a/samples/CSharp/WinForms/IE_WinForms.csproj b/samples/CSharp/WinForms/IE_WinForms.csproj index 41a68fa0b0..54b7b2aa39 100644 --- a/samples/CSharp/WinForms/IE_WinForms.csproj +++ b/samples/CSharp/WinForms/IE_WinForms.csproj @@ -95,7 +95,7 @@ true - ..\win32\bind\ + ..\win32\$(VCVER)\bind\ DEBUG;TRACE 285212672 full @@ -104,7 +104,7 @@ Off - ..\win32\bin\ + ..\win32\$(VCVER)\bin\ TRACE 285212672 true @@ -116,7 +116,7 @@ true - ..\win64\bind\ + ..\win64\$(VCVER)\bind\ DEBUG;TRACE 285212672 4096 @@ -125,7 +125,7 @@ prompt - ..\win64\bin\ + ..\win64\$(VCVER)\bin\ TRACE 285212672 true diff --git a/samples/CSharp/env.bat b/samples/CSharp/env.bat new file mode 100644 index 0000000000..dafb10bd86 --- /dev/null +++ b/samples/CSharp/env.bat @@ -0,0 +1,11 @@ +call "%~dp0..\..\env.bat" %1 %2 %3 + +set "BIN_DIR=win%ARCH%\%VCVER%\bind" +set "LIB_DIR=win%ARCH%\%VCVER%\libd" + +if ["%CASDEB%"] == [""] ( + set "BIN_DIR=win%ARCH%\%VCVER%\bin" + set "LIB_DIR=win%ARCH%\%VCVER%\lib" +) + +set "PATH=%~dp0%LIB_DIR%;%~dp0%BIN_DIR%;%PATH%" \ No newline at end of file diff --git a/samples/CSharp/run.bat b/samples/CSharp/run.bat new file mode 100644 index 0000000000..1643fd64ab --- /dev/null +++ b/samples/CSharp/run.bat @@ -0,0 +1,38 @@ +@echo off + +if "%1" == "-h" ( + goto err_bat +) + +if not ["%4"] == [""] ( + set "SampleName=%4" + call "%~dp0env.bat" %1 %2 %3 +) else if not ["%1"] == [""] ( + set "SampleName=%1" + call "%~dp0env.bat" +) else ( + goto err_bat +) + +if not exist "%~dp0%BIN_DIR%\IE_%SampleName%.exe" goto err_exe + +"%~dp0%BIN_DIR%\IE_%SampleName%.exe" + +goto eof + +:err_bat +echo Possible names of samples: WinForms, WPF_D3D, WPF_WinForms +echo Launch selected sample as follows: +echo %~n0.bat [^vc8^|^vc9^|^vc10^|^vc11^|vc12] [^win32^|^win64^] [^Release^|^Debug^] [^SampleName^] +echo or +echo %~n0.bat [^SampleName^] +echo Run %~n0.bat -h to get this help +exit /B + +:err_exe +echo Executable %~dp0%BIN_DIR%\IE_%SampleName%.exe not found. +echo Check that OCCT and sample are built with the selected configuration: +echo compiler=%VCVER% platform=win%ARCH% %3 +exit /B + +:eof diff --git a/samples/CSharp/run_winforms.bat b/samples/CSharp/run_winforms.bat index 1c93f65d0c..9ea30924b7 100644 --- a/samples/CSharp/run_winforms.bat +++ b/samples/CSharp/run_winforms.bat @@ -1,27 +1,3 @@ @echo off -if "%1" == "-h" ( - echo Launch WinForms sample as follows: - echo %~n0 ^[vc9^] ^[win32^|win64^] ^[Debug^|Release^] - echo By default configuration set in ..\..\custom.bat is used - echo Run %~n0 -h to get this help - exit /B -) - -call "%~dp0..\..\env.bat" %1 %2 %3 - -set "EXEC=%~dp0\win%ARCH%\bin%CASDEB%\IE_WinForms.exe" - -if not exist "%EXEC%" goto err_exe - -"%EXEC%" - -goto eof - -:err_exe -echo Executable %EXEC% not found. -echo Check that OCCT and sample are built with the selected configuration: -echo compiler=%VCVER% platform=win%ARCH% %3 -exit /B - -:eof \ No newline at end of file +call "%~dp0run.bat" WinForms diff --git a/samples/CSharp/run_wpf.bat b/samples/CSharp/run_wpf.bat index 07ddc2a5db..7a09f13843 100644 --- a/samples/CSharp/run_wpf.bat +++ b/samples/CSharp/run_wpf.bat @@ -1,27 +1,3 @@ @echo off -if "%1" == "-h" ( - echo Launch WPF sample as follows: - echo %~n0 ^[vc9^] ^[win32^|win64^] ^[Debug^|Release^] - echo By default configuration set in ..\..\custom.bat is used - echo Run %~n0 -h to get this help - exit /B -) - -call "%~dp0..\..\env.bat" %1 %2 %3 - -set "EXEC=%~dp0\win%ARCH%\bin%CASDEB%\IE_WPF_WinForms.exe" - -if not exist "%EXEC%" goto err_exe - -"%EXEC%" - -goto eof - -:err_exe -echo Executable %EXEC% not found. -echo Check that OCCT and sample are built with the selected configuration: -echo compiler=%VCVER% platform=win%ARCH% %3 -exit /B - -:eof \ No newline at end of file +call "%~dp0run.bat" WPF_WinForms diff --git a/samples/CSharp/run_wpf_D3D.bat b/samples/CSharp/run_wpf_D3D.bat index 37c8904598..9a4d882e0f 100644 --- a/samples/CSharp/run_wpf_D3D.bat +++ b/samples/CSharp/run_wpf_D3D.bat @@ -1,27 +1,3 @@ @echo off -if "%1" == "-h" ( - echo Launch WPF sample as follows: - echo %~n0 ^[vc9^] ^[win32^|win64^] ^[Debug^|Release^] - echo By default configuration set in ..\..\custom.bat is used - echo Run %~n0 -h to get this help - exit /B -) - -call "%~dp0..\..\env.bat" %1 %2 %3 - -set "EXEC=%~dp0\win%ARCH%\bin%CASDEB%\IE_WPF_D3D.exe" - -if not exist "%EXEC%" goto err_exe - -"%EXEC%" - -goto eof - -:err_exe -echo Executable %EXEC% not found. -echo Check that OCCT and sample are built with the selected configuration: -echo compiler=%VCVER% platform=win%ARCH% %3 -exit /B - -:eof \ No newline at end of file +call "%~dp0run.bat" WPF_D3D diff --git a/samples/mfc/standard/run.bat b/samples/mfc/standard/run.bat index c2a62b4c76..a2feea1b43 100644 --- a/samples/mfc/standard/run.bat +++ b/samples/mfc/standard/run.bat @@ -1,22 +1,35 @@ @echo off -if ["%4"] == [""] ( - echo Launch selected sample as follows: - echo Run.bat [^vc8^|^vc9^|^vc10^|^vc11^|vc12] [^win32^|^win64^] [^Release^|^Debug^] [^SampleName^] - echo Use option -d to run Debug mode - exit /B +if "%1" == "-h" ( + goto err_bat ) -call "%~dp0env.bat" %1 %2 %3 +if not ["%4"] == [""] ( + set "SampleName=%4" + call "%~dp0env.bat" %1 %2 %3 +) else if not ["%1"] == [""] ( + set "SampleName=%1" + call "%~dp0env.bat" +) else ( + goto err_bat +) -if not exist "%~dp0%BIN_DIR%\%4.exe" goto err_exe +if not exist "%~dp0%BIN_DIR%\%SampleName%.exe" goto err_exe -"%~dp0%BIN_DIR%\%4.exe" +"%~dp0%BIN_DIR%\%SampleName%.exe" goto eof +:err_bat +echo Launch selected sample as follows: +echo %~n0.bat [^vc8^|^vc9^|^vc10^|^vc11^|vc12] [^win32^|^win64^] [^Release^|^Debug^] [^SampleName^] +echo or +echo %~n0.bat [^SampleName^] +echo Run %~n0.bat -h to get this help +exit /B + :err_exe -echo Executable %~dp0%BIN_DIR%\%4.exe not found. +echo Executable %~dp0%BIN_DIR%\%SampleName%.exe not found. echo Probably you didn't compile the application. exit /B diff --git a/samples/qt/IESample/genproj.bat b/samples/qt/IESample/genproj.bat index b65650fe27..b3bf9b3974 100644 --- a/samples/qt/IESample/genproj.bat +++ b/samples/qt/IESample/genproj.bat @@ -10,27 +10,27 @@ call "%~dp0env.bat" %1 %2 %3 set EXT=vcproj -if not "%1" == "" ( - if /I "%1" == "vc8" ( +if not "%VCVER%" == "" ( + if /I "%VCVER%" == "vc8" ( set VCVER=vc8 set "VCVARS=%VS80COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc9" ( + ) else if /I "%VCVER%" == "vc9" ( set VCVER=vc9 set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc10" ( + ) else if /I "%VCVER%" == "vc10" ( set VCVER=vc10 set EXT=vcxproj set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc11" ( + ) else if /I "%VCVER%" == "vc11" ( set VCVER=vc11 set EXT=vcxproj set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc12" ( + ) else if /I "%VCVER%" == "vc12" ( set VCVER=vc12 set EXT=vcxproj set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" ) else ( - echo Error: first argument ^(%1^) should specify supported version of Visual C++, + echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++, echo one of: vc8 ^(VS 2005 SP1^), vc9 ^(VS 2008 SP1^), vc10 ^(VS 2010^) or vc11 ^(VS 2012^) exit ) diff --git a/samples/qt/Tutorial/genproj.bat b/samples/qt/Tutorial/genproj.bat index 2cac91964b..eb1903d186 100644 --- a/samples/qt/Tutorial/genproj.bat +++ b/samples/qt/Tutorial/genproj.bat @@ -10,27 +10,27 @@ call "%~dp0env.bat" %1 %2 %3 set EXT=vcproj -if not "%1" == "" ( - if /I "%1" == "vc8" ( +if not "%VCVER%" == "" ( + if /I "%VCVER%" == "vc8" ( set VCVER=vc8 set "VCVARS=%VS80COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc9" ( + ) else if /I "%VCVER%" == "vc9" ( set VCVER=vc9 set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc10" ( + ) else if /I "%VCVER%" == "vc10" ( set VCVER=vc10 set EXT=vcxproj set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc11" ( + ) else if /I "%VCVER%" == "vc11" ( set VCVER=vc11 set EXT=vcxproj set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat" - ) else if /I "%1" == "vc12" ( + ) else if /I "%VCVER%" == "vc12" ( set VCVER=vc12 set EXT=vcxproj set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat" ) else ( - echo Error: first argument ^(%1^) should specify supported version of Visual C++, + echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++, echo one of: vc8 ^(VS 2005 SP1^), vc9 ^(VS 2008 SP1^), vc10 ^(VS 2010^) or vc11 ^(VS 2012^) exit )