[Scummvm-cvs-logs] SF.net SVN: scummvm:[54381] scummvm/trunk/tools/create_project

littleboy at users.sourceforge.net littleboy at users.sourceforge.net
Fri Nov 19 15:12:34 CET 2010


Revision: 54381
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54381&view=rev
Author:   littleboy
Date:     2010-11-19 14:12:33 +0000 (Fri, 19 Nov 2010)

Log Message:
-----------
TOOLS: Move Visual Studio pre/post build events scripts to external files

Modified Paths:
--------------
    scummvm/trunk/tools/create_project/msvc.cpp
    scummvm/trunk/tools/create_project/msvc.h
    scummvm/trunk/tools/create_project/scripts/postbuild.cmd
    scummvm/trunk/tools/create_project/scripts/prebuild.cmd

Modified: scummvm/trunk/tools/create_project/msvc.cpp
===================================================================
--- scummvm/trunk/tools/create_project/msvc.cpp	2010-11-19 13:59:02 UTC (rev 54380)
+++ scummvm/trunk/tools/create_project/msvc.cpp	2010-11-19 14:12:33 UTC (rev 54381)
@@ -142,41 +142,31 @@
 	outputGlobalPropFile(properties, 64, x64Defines, convertPathToWin(setup.filePrefix));
 }
 
-std::string MSVCProvider::getRevisionToolCommandLine() const {
+std::string MSVCProvider::getPreBuildEvent() const {
 	std::string cmdLine = "";
 
 	cmdLine = "@echo off\n"
-	          "ECHO Generating revision number\n"
-	          "IF NOT EXIST "$(SolutionDir)../../.svn/" GOTO working_copy\n"
-	          "SubWCRev.exe "$(SolutionDir)../.." "$(SolutionDir)../../base/internal_version.h.tpl" "$(SolutionDir)../../base/internal_version.h"\n"
-	          "IF NOT %errorlevel%==0 GOTO error\n"
-	          ":working_copy\n"
-	          "ECHO Not a working copy, skipping...\n"
-	          "EXIT /B0\n"
-	          ":error\n"
-	          "ECHO SubWCRev not found, skipping...\n"
+	          "echo Executing Pre-Build script...\n"
+			  "echo.\n"
+			  "@call "$(SolutionDir)../../tools/create_project/scripts/prebuild.cmd" "$(SolutionDir)/../.."\n"
 	          "EXIT /B0";
 
 	return cmdLine;
 }
 
-std::string MSVCProvider::getCopyDataCommandLine(bool isWin32) const {
+std::string MSVCProvider::getPostBuildEvent(bool isWin32) const {
 	std::string cmdLine = "";
 
-	// Copy data files and themes
 	cmdLine = "@echo off\n"
-	          "ECHO Copying data files\n"
-	          "xcopy /F /Y "$(SolutionDir)../engine-data/*.dat" $(OutDir)\n"
-	          "xcopy /F /Y "$(SolutionDir)../engine-data/*.tbl" $(OutDir)\n"
-	          "xcopy /F /Y "$(SolutionDir)../engine-data/*.cpt" $(OutDir)\n"
-	          "xcopy /F /Y "$(SolutionDir)../engine-data/README" $(OutDir)\n"
-	          "xcopy /F /Y "$(SolutionDir)../../gui/themes/*.zip" $(OutDir)\n"
-	          "xcopy /F /Y "$(SolutionDir)../../gui/themes/translations.dat" $(OutDir)\n";
+	          "echo Executing Post-Build script...\n"
+	          "echo.\n"
+	          "@call "$(SolutionDir)../../tools/create_project/scripts/postbuild.cmd" "$(SolutionDir)/../.." "$(OutDir)" ";
 
-	cmdLine += "xcopy /F /Y "$(SCUMMVM_LIBS)/lib/";
-	cmdLine += (isWin32 ? "x86" : "x64");
-	cmdLine += "/SDL.dll" $(OutDir)";
+	cmdLine += (isWin32) ? "x86" : "x64";
 
+	cmdLine += "\n"
+	           "EXIT /B0";
+
 	return cmdLine;
 }
 
@@ -222,10 +212,10 @@
 	           "\t\t\t\tAdditionalDependencies=\"" << libraries << "\"\n" \
 	           "\t\t\t/>\n" \
 	           "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n" \
-	           "\t\t\t\tCommandLine=\"" << getRevisionToolCommandLine() << "\"\n" \
+	           "\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n" \
 	           "\t\t\t/>\n" \
 	           "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n" \
-	           "\t\t\t\tCommandLine=\"" << getCopyDataCommandLine(isWin32) << "\"\n" \
+	           "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32) << "\"\n" \
 	           "\t\t\t/>\n" \
 	           "\t\t</Configuration>\n"; \
 }
@@ -760,14 +750,14 @@
 		if (!isRelease) {
 			project << "\t\t<PreBuildEvent>\n"
 			           "\t\t\t<Message>Generate internal_version.h</Message>\n"
-			           "\t\t\t<Command>" << getRevisionToolCommandLine() << "</Command>\n"
+			           "\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
 			           "\t\t</PreBuildEvent>\n";
 		}
 
 		// Copy data files to the build folder
 		project << "\t\t<PostBuildEvent>\n"
 		           "\t\t\t<Message>Copy data files to the build folder</Message>\n"
-	               "\t\t\t<Command>" << getCopyDataCommandLine(isWin32) << "</Command>\n"
+	               "\t\t\t<Command>" << getPostBuildEvent(isWin32) << "</Command>\n"
 		           "\t\t</PostBuildEvent>\n";
 	}
 

Modified: scummvm/trunk/tools/create_project/msvc.h
===================================================================
--- scummvm/trunk/tools/create_project/msvc.h	2010-11-19 13:59:02 UTC (rev 54380)
+++ scummvm/trunk/tools/create_project/msvc.h	2010-11-19 14:12:33 UTC (rev 54381)
@@ -85,14 +85,14 @@
 	/**
 	 * Get the command line for the revision tool (shared between all Visual Studio based providers)
 	 */
-	std::string getRevisionToolCommandLine() const;
+	std::string getPreBuildEvent() const;
 
 	/**
 	 * Get the command line for copying data files to the build directory
 	 *
 	 * @param isWin32 Bitness of property file
 	 */
-	std::string getCopyDataCommandLine(bool isWin32) const;
+	std::string getPostBuildEvent(bool isWin32) const;
 };
 
 class VisualStudioProvider : public MSVCProvider {

Modified: scummvm/trunk/tools/create_project/scripts/postbuild.cmd
===================================================================
--- scummvm/trunk/tools/create_project/scripts/postbuild.cmd	2010-11-19 13:59:02 UTC (rev 54380)
+++ scummvm/trunk/tools/create_project/scripts/postbuild.cmd	2010-11-19 14:12:33 UTC (rev 54381)
@@ -0,0 +1,45 @@
+REM @echo off
+
+REM ---------------------------------------------------------------
+REM -- Post-Build Script
+REM ---------------------------------------------------------------
+REM
+REM Copy engine data, themes, translation and required dlls to the
+REM output folder.
+REM
+REM Expected parameters
+REM    Root folder
+REM    Output folder
+REM    Architecture
+
+if "%~1"=="" goto error_input
+if "%~2"=="" goto error_output
+if "%~3"=="" goto error_arch
+
+echo Copying data files
+echo.
+
+REM Copy files
+xcopy /F /Y "%~1/dists/engine-data/*.dat" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/dists/engine-data/*.tbl" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/dists/engine-data/*.cpt" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/dists/engine-data/README" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/gui/themes/*.zip" %~2 > NUL 2>&1
+xcopy /F /Y "%~1/gui/themes/translations.dat" %~2 > NUL 2>&1
+xcopy /F /Y "%SCUMMVM_LIBS%/lib/%~3/SDL.dll" %~2 > NUL 2>&1
+goto done
+
+:error_output
+ at echo Invalid root folder (%~1)!
+goto done
+
+:error_output
+ at echo Invalid output folder (%~2)!
+goto done
+
+:error_arch
+ at echo Invalid arch parameter (was: %~3, allowed: x86, x64)!
+goto done
+
+:done
+exit /B0

Modified: scummvm/trunk/tools/create_project/scripts/prebuild.cmd
===================================================================
--- scummvm/trunk/tools/create_project/scripts/prebuild.cmd	2010-11-19 13:59:02 UTC (rev 54380)
+++ scummvm/trunk/tools/create_project/scripts/prebuild.cmd	2010-11-19 14:12:33 UTC (rev 54381)
@@ -0,0 +1,36 @@
+ at echo off
+
+REM ---------------------------------------------------------------
+REM -- Pre-Build Script
+REM ---------------------------------------------------------------
+REM
+REM Generate file with proper revision number
+REM
+REM Expected parameters
+REM    Root folder
+
+if "%~1"=="" goto error_input
+
+if not exist "%~1/.svn/" GOTO error_working_copy
+
+echo Generating revision number
+
+SubWCRev.exe "%~1" "%~1/base/internal_version.h.tpl" "%~1/base/internal_version.h"
+
+if not %errorlevel% == 0 goto error_subwcrev
+goto done
+
+:error_output
+ at echo Invalid root folder (%~1)!
+goto done
+
+:error_working_copy
+echo Not a working copy, skipping...
+exit /B0
+
+:error_subwcrev
+echo SubWCRev not found or invalid command line, skipping...
+exit /B0
+
+:done
+exit /B0


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list