diff options
author | Julien Templier | 2010-11-19 14:12:33 +0000 |
---|---|---|
committer | Julien Templier | 2010-11-19 14:12:33 +0000 |
commit | ec9ad50c145be10985666b08ee2dbf0f9129c551 (patch) | |
tree | 9f84b20270845e23d7a7ee9cfa2a044e523f1ab7 /tools | |
parent | 6aa770751fbb830436f305d64369b4332cbc8d86 (diff) | |
download | scummvm-rg350-ec9ad50c145be10985666b08ee2dbf0f9129c551.tar.gz scummvm-rg350-ec9ad50c145be10985666b08ee2dbf0f9129c551.tar.bz2 scummvm-rg350-ec9ad50c145be10985666b08ee2dbf0f9129c551.zip |
TOOLS: Move Visual Studio pre/post build events scripts to external files
svn-id: r54381
Diffstat (limited to 'tools')
-rw-r--r-- | tools/create_project/msvc.cpp | 44 | ||||
-rw-r--r-- | tools/create_project/msvc.h | 4 | ||||
-rw-r--r-- | tools/create_project/scripts/postbuild.cmd | 45 | ||||
-rw-r--r-- | tools/create_project/scripts/prebuild.cmd | 36 |
4 files changed, 100 insertions, 29 deletions
diff --git a/tools/create_project/msvc.cpp b/tools/create_project/msvc.cpp index 5d951f9d48..c6174f7bd4 100644 --- a/tools/create_project/msvc.cpp +++ b/tools/create_project/msvc.cpp @@ -142,40 +142,30 @@ void MSVCProvider::createGlobalProp(const BuildSetup &setup) { 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"; - - cmdLine += "xcopy /F /Y "$(SCUMMVM_LIBS)/lib/"; - cmdLine += (isWin32 ? "x86" : "x64"); - cmdLine += "/SDL.dll" $(OutDir)"; + "echo Executing Post-Build script...\n" + "echo.\n" + "@call "$(SolutionDir)../../tools/create_project/scripts/postbuild.cmd" "$(SolutionDir)/../.." "$(OutDir)" "; + + cmdLine += (isWin32) ? "x86" : "x64"; + + cmdLine += "\n" + "EXIT /B0"; return cmdLine; } @@ -222,10 +212,10 @@ int VisualStudioProvider::getVisualStudioVersion() { "\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 @@ void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::s 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"; } diff --git a/tools/create_project/msvc.h b/tools/create_project/msvc.h index 5459a434aa..d5c90972f4 100644 --- a/tools/create_project/msvc.h +++ b/tools/create_project/msvc.h @@ -85,14 +85,14 @@ protected: /** * 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 { diff --git a/tools/create_project/scripts/postbuild.cmd b/tools/create_project/scripts/postbuild.cmd index e69de29bb2..89062de2de 100644 --- a/tools/create_project/scripts/postbuild.cmd +++ b/tools/create_project/scripts/postbuild.cmd @@ -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
+@echo Invalid root folder (%~1)!
+goto done
+
+:error_output
+@echo Invalid output folder (%~2)!
+goto done
+
+:error_arch
+@echo Invalid arch parameter (was: %~3, allowed: x86, x64)!
+goto done
+
+:done
+exit /B0
diff --git a/tools/create_project/scripts/prebuild.cmd b/tools/create_project/scripts/prebuild.cmd index e69de29bb2..0e67b6f228 100644 --- a/tools/create_project/scripts/prebuild.cmd +++ b/tools/create_project/scripts/prebuild.cmd @@ -0,0 +1,36 @@ +@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
+@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
|