From 49c1f51839089409c1a952e2b0f39a9de0c99217 Mon Sep 17 00:00:00 2001 From: Philippose Rajan Date: Sun, 5 Apr 2009 22:12:45 +0000 Subject: [PATCH] * Now uses NETGENDIR environment variable for install automation * Note: NETGENDIR points to "\bin" folder * Use new install folder structure during post build phase --- windows/postBuild_netgen.bat | 31 ++++++++++++-------- windows/postBuild_nglib.bat | 55 ++++++++++++++++++++++++++++-------- 2 files changed, 64 insertions(+), 22 deletions(-) diff --git a/windows/postBuild_netgen.bat b/windows/postBuild_netgen.bat index ee3c2cc3..2e60c34e 100644 --- a/windows/postBuild_netgen.bat +++ b/windows/postBuild_netgen.bat @@ -7,7 +7,7 @@ REM *** Used to perform an "Install" of the generated executable REM *** along with the required *.tcl files REM *** REM *** Call from Visual C++ using: -REM *** postBuild_netgen.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) +REM *** postBuild_netgen.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) REM ********************************************************************************* if [%1]==[] goto InputParamsFailed set PROJ_NAME=%~1 @@ -17,7 +17,16 @@ set PROJ_DIR=%~4 set LIB_NAME=%~5 REM *** Change these Folders if required *** -set INSTALL_FOLDER=%PROJ_DIR%%BUILD_TYPE%-bin +REM Check if the environment variable NETGENDIR exists, +REM and use it as the installation folder +if defined NETGENDIR ( + echo Environment variable NETGENDIR found: %NETGENDIR% + set INSTALL_FOLDER=%NETGENDIR%\.. +) else ( + echo Environment variable NETGENDIR not found.... using default location!!! + set INSTALL_FOLDER=%PROJ_DIR%..\..\%PROJ_NAME%-inst +) + set NETGEN_TCLSRC=%PROJ_DIR%..\ng set NETGEN_LIBINC=%PROJ_DIR%..\libsrc\include @@ -31,8 +40,8 @@ if errorlevel 1 goto ManifestFailed echo Embedding Manifest into the executable: Completed OK!! REM *** Copy the core TCL files into the Install Folder *** -echo Installing core TCL files into %INSTALL_FOLDER% .... -xcopy "%NETGEN_TCLSRC%\*.tcl" "%INSTALL_FOLDER%" /i /d /y +echo Installing core TCL files into %INSTALL_FOLDER%\bin .... +xcopy "%NETGEN_TCLSRC%\*.tcl" "%INSTALL_FOLDER%\bin\" /i /d /y if errorlevel 1 goto CoreTCLFailed echo Installing core TCL Files: Completed OK!! @@ -41,19 +50,19 @@ REM if errorlevel 1 goto AuxTCLFailed REM echo Installing auxiliary TCL Files: Completed OK!! REM *** Copy the primary Netgen executable file into the Install Folder *** -echo Installing %PROJ_EXEC% into %INSTALL_FOLDER% .... -xcopy "%PROJ_DIR%%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%" /i /d /y +echo Installing %PROJ_EXEC% into %INSTALL_FOLDER%\bin .... +xcopy "%PROJ_DIR%%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%\bin\" /i /d /y if errorlevel 1 goto ExecInstallFailed echo Installing %PROJ_EXEC%: Completed OK!! REM *** Copy the primary Netgen library and include files into the Install Folder *** -echo Installing %LIB_NAME%.lib into %INSTALL_FOLDER% .... -xcopy "%PROJ_DIR%%BUILD_TYPE%\%LIB_NAME%.lib" "%INSTALL_FOLDER%" /i /d /y +echo Installing %LIB_NAME%.lib into %INSTALL_FOLDER%\lib .... +xcopy "%PROJ_DIR%%BUILD_TYPE%\%LIB_NAME%.lib" "%INSTALL_FOLDER%\lib\" /i /d /y if errorlevel 1 goto LibInstallFailed echo Installing %LIB_NAME%.lib: Completed OK!! -echo Installing %LIB_NAME%.h into %INSTALL_FOLDER% .... -xcopy "%NETGEN_LIBINC%\%LIB_NAME%.h" "%INSTALL_FOLDER%" /i /d /y +echo Installing %LIB_NAME%.h into %INSTALL_FOLDER%\include .... +xcopy "%NETGEN_LIBINC%\%LIB_NAME%.h" "%INSTALL_FOLDER%\include\" /i /d /y if errorlevel 1 goto LibInstallFailed echo Installing %LIB_NAME%.h: Completed OK!! @@ -77,7 +86,7 @@ exit 1 echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying core TCL Files into install folder!!! exit 1 :ExecInstallFailed -echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying the netgen executable into install folder!!! +echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying the %PROJ_NAME% executable into install folder!!! exit 1 :LibInstallFailed echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying %LIB_NAME%.lib or %LIB_NAME%.h into install folder!!! diff --git a/windows/postBuild_nglib.bat b/windows/postBuild_nglib.bat index 6aa52017..b58583a8 100644 --- a/windows/postBuild_nglib.bat +++ b/windows/postBuild_nglib.bat @@ -9,29 +9,50 @@ REM *** REM *** Call from Visual C++ using: REM *** postBuild_nglib.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) REM ********************************************************************************* -if [%1]==[] goto BuildEventFailed +if [%1]==[] goto InputParamsFailed set PROJ_NAME=%~1 set PROJ_EXEC=%~2 set BUILD_TYPE=%~3 set PROJ_DIR=%~4 REM *** Change these Folders if required *** -set NETGEN_TCLSRC=%PROJ_DIR%..\ng -set INSTALL_FOLDER=%PROJ_DIR%%BUILD_TYPE%-lib\ +REM Check if the environment variable NETGENDIR exists, +REM and use it as the installation folder +if defined NETGENDIR ( + echo Environment variable NETGENDIR found: %NETGENDIR% + set INSTALL_FOLDER=%NETGENDIR%\.. +) else ( + echo Environment variable NETGENDIR not found.... using default location!!! + set INSTALL_FOLDER=%PROJ_DIR%..\..\%PROJ_NAME%-inst +) + +set NGLIB_LIBINC=%PROJ_DIR%..\nglib + echo POSTBUILD Script for %PROJ_NAME% ........ REM *** Embed the Windows Manifest into the Executable File *** -echo Embedding Manifest into the executable: %PROJ_EXEC% .... +echo Embedding Manifest into the DLL: %PROJ_EXEC% .... mt.exe -manifest "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%.intermediate.manifest" "-outputresource:%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%;2" -if errorlevel 1 goto BuildEventFailed +if errorlevel 1 goto ManifestFailed +echo Embedding Manifest into the DLL: Completed OK!! REM *** Copy the DLL and LIB Files into the install folder *** echo Installing required files into %INSTALL_FOLDER% .... -xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%" /i /d /y -if errorlevel 1 goto BuildEventFailed -xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_NAME%.lib" "%INSTALL_FOLDER%" /i /d /y -if errorlevel 1 goto BuildEventFailed +xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%\bin\" /i /d /y +if errorlevel 1 goto DLLInstallFailed +echo Installing %PROJ_EXEC%: Completed OK!! + +xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_NAME%.lib" "%INSTALL_FOLDER%\lib\" /i /d /y +if errorlevel 1 goto LibInstallFailed +echo Installing %PROJ_NAME%.lib: Completed OK!! + +REM *** Copy the include file nglib.h into the install folder *** +echo Installing %PROJ_NAME%.h into %INSTALL_FOLDER%\include .... +xcopy "%NGLIB_LIBINC%\%PROJ_NAME%.h" "%INSTALL_FOLDER%\include\" /i /d /y +if errorlevel 1 goto LibInstallFailed +echo Installing %PROJ_NAME%.h: Completed OK!! + REM *** Clean up the build directory by deleting the OBJ files *** REM echo Deleting the %PROJ_NAME% build folder %PROJ_DIR%%PROJ_NAME% .... @@ -39,8 +60,20 @@ REM rmdir %PROJ_DIR%%PROJ_NAME% /s /q REM *** If there have been no errors so far, we are done *** goto BuildEventOK -:BuildEventFailed -echo POSTBUILD Script for %PROJ_NAME% FAILED..... Install Manually !!! + +REM *** Error Messages for each stage of the post build process *** +:InputParamsFailed +echo POSTBUILD Script for %PROJ_NAME% FAILED..... Invalid number of input parameters!!! exit 1 +:ManifestFailed +echo POSTBUILD Script for %PROJ_NAME% FAILED..... Manifest not successfully embedded!!! +exit 1 +:DLLInstallFailed +echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying the %PROJ_NAME% DLL into install folder!!! +exit 1 +:LibInstallFailed +echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying %PROJ_NAME%.lib or %PROJ_NAME%.h into install folder!!! +exit 1 + :BuildEventOK echo POSTBUILD Script for %PROJ_NAME% completed OK.....!!