* Now uses NETGENDIR environment variable for install automation

* Note: NETGENDIR points to "<netgen_root>\bin" folder
* Use new install folder structure during post build phase
This commit is contained in:
Philippose Rajan 2009-04-05 22:12:45 +00:00
parent d75718fc56
commit 49c1f51839
2 changed files with 64 additions and 22 deletions

View File

@ -7,7 +7,7 @@ REM *** Used to perform an "Install" of the generated executable
REM *** along with the required *.tcl files REM *** along with the required *.tcl files
REM *** REM ***
REM *** Call from Visual C++ using: REM *** Call from Visual C++ using:
REM *** postBuild_netgen.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) REM *** postBuild_netgen.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) <lib filename>
REM ********************************************************************************* REM *********************************************************************************
if [%1]==[] goto InputParamsFailed if [%1]==[] goto InputParamsFailed
set PROJ_NAME=%~1 set PROJ_NAME=%~1
@ -17,7 +17,16 @@ set PROJ_DIR=%~4
set LIB_NAME=%~5 set LIB_NAME=%~5
REM *** Change these Folders if required *** 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_TCLSRC=%PROJ_DIR%..\ng
set NETGEN_LIBINC=%PROJ_DIR%..\libsrc\include set NETGEN_LIBINC=%PROJ_DIR%..\libsrc\include
@ -31,8 +40,8 @@ if errorlevel 1 goto ManifestFailed
echo Embedding Manifest into the executable: Completed OK!! echo Embedding Manifest into the executable: Completed OK!!
REM *** Copy the core TCL files into the Install Folder *** REM *** Copy the core TCL files into the Install Folder ***
echo Installing core TCL files into %INSTALL_FOLDER% .... echo Installing core TCL files into %INSTALL_FOLDER%\bin ....
xcopy "%NETGEN_TCLSRC%\*.tcl" "%INSTALL_FOLDER%" /i /d /y xcopy "%NETGEN_TCLSRC%\*.tcl" "%INSTALL_FOLDER%\bin\" /i /d /y
if errorlevel 1 goto CoreTCLFailed if errorlevel 1 goto CoreTCLFailed
echo Installing core TCL Files: Completed OK!! 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 echo Installing auxiliary TCL Files: Completed OK!!
REM *** Copy the primary Netgen executable file into the Install Folder *** REM *** Copy the primary Netgen executable file into the Install Folder ***
echo Installing %PROJ_EXEC% into %INSTALL_FOLDER% .... echo Installing %PROJ_EXEC% into %INSTALL_FOLDER%\bin ....
xcopy "%PROJ_DIR%%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%" /i /d /y xcopy "%PROJ_DIR%%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%\bin\" /i /d /y
if errorlevel 1 goto ExecInstallFailed if errorlevel 1 goto ExecInstallFailed
echo Installing %PROJ_EXEC%: Completed OK!! echo Installing %PROJ_EXEC%: Completed OK!!
REM *** Copy the primary Netgen library and include files into the Install Folder *** REM *** Copy the primary Netgen library and include files into the Install Folder ***
echo Installing %LIB_NAME%.lib into %INSTALL_FOLDER% .... echo Installing %LIB_NAME%.lib into %INSTALL_FOLDER%\lib ....
xcopy "%PROJ_DIR%%BUILD_TYPE%\%LIB_NAME%.lib" "%INSTALL_FOLDER%" /i /d /y xcopy "%PROJ_DIR%%BUILD_TYPE%\%LIB_NAME%.lib" "%INSTALL_FOLDER%\lib\" /i /d /y
if errorlevel 1 goto LibInstallFailed if errorlevel 1 goto LibInstallFailed
echo Installing %LIB_NAME%.lib: Completed OK!! echo Installing %LIB_NAME%.lib: Completed OK!!
echo Installing %LIB_NAME%.h into %INSTALL_FOLDER% .... echo Installing %LIB_NAME%.h into %INSTALL_FOLDER%\include ....
xcopy "%NETGEN_LIBINC%\%LIB_NAME%.h" "%INSTALL_FOLDER%" /i /d /y xcopy "%NETGEN_LIBINC%\%LIB_NAME%.h" "%INSTALL_FOLDER%\include\" /i /d /y
if errorlevel 1 goto LibInstallFailed if errorlevel 1 goto LibInstallFailed
echo Installing %LIB_NAME%.h: Completed OK!! 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!!! echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying core TCL Files into install folder!!!
exit 1 exit 1
:ExecInstallFailed :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 exit 1
:LibInstallFailed :LibInstallFailed
echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying %LIB_NAME%.lib or %LIB_NAME%.h into install folder!!! echo POSTBUILD Script for %PROJ_NAME% FAILED..... Error copying %LIB_NAME%.lib or %LIB_NAME%.h into install folder!!!

View File

@ -9,29 +9,50 @@ REM ***
REM *** Call from Visual C++ using: REM *** Call from Visual C++ using:
REM *** postBuild_nglib.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir) REM *** postBuild_nglib.bat $(ProjectName) $(TargetFileName) $(ConfigurationName) $(ProjectDir)
REM ********************************************************************************* REM *********************************************************************************
if [%1]==[] goto BuildEventFailed if [%1]==[] goto InputParamsFailed
set PROJ_NAME=%~1 set PROJ_NAME=%~1
set PROJ_EXEC=%~2 set PROJ_EXEC=%~2
set BUILD_TYPE=%~3 set BUILD_TYPE=%~3
set PROJ_DIR=%~4 set PROJ_DIR=%~4
REM *** Change these Folders if required *** REM *** Change these Folders if required ***
set NETGEN_TCLSRC=%PROJ_DIR%..\ng REM Check if the environment variable NETGENDIR exists,
set INSTALL_FOLDER=%PROJ_DIR%%BUILD_TYPE%-lib\ 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% ........ echo POSTBUILD Script for %PROJ_NAME% ........
REM *** Embed the Windows Manifest into the Executable File *** 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" 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 *** REM *** Copy the DLL and LIB Files into the install folder ***
echo Installing required files into %INSTALL_FOLDER% .... echo Installing required files into %INSTALL_FOLDER% ....
xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%" /i /d /y xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_EXEC%" "%INSTALL_FOLDER%\bin\" /i /d /y
if errorlevel 1 goto BuildEventFailed if errorlevel 1 goto DLLInstallFailed
xcopy "%PROJ_DIR%%PROJ_NAME%\%BUILD_TYPE%\%PROJ_NAME%.lib" "%INSTALL_FOLDER%" /i /d /y echo Installing %PROJ_EXEC%: Completed OK!!
if errorlevel 1 goto BuildEventFailed
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 *** Clean up the build directory by deleting the OBJ files ***
REM echo Deleting the %PROJ_NAME% build folder %PROJ_DIR%%PROJ_NAME% .... 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 *** REM *** If there have been no errors so far, we are done ***
goto BuildEventOK 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 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 :BuildEventOK
echo POSTBUILD Script for %PROJ_NAME% completed OK.....!! echo POSTBUILD Script for %PROJ_NAME% completed OK.....!!