Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2010-05-30 14:27:59 +0400
committerXhmikosR <xhmikosr@users.sourceforge.net>2010-05-30 14:27:59 +0400
commit7dff3c0b2b0565bdee624c7a14b0c98cd854840f (patch)
treefc3e86446b2bb69d2bda059b4c27304d29789a01 /build.bat
parent8fd560784007737fff8329753f145947ce902a42 (diff)
replaced build.bat with build_specific.bat (it accepts multiple command line arguments)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1992 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'build.bat')
-rw-r--r--build.bat156
1 files changed, 98 insertions, 58 deletions
diff --git a/build.bat b/build.bat
index 0055bb15e..d9fe43c69 100644
--- a/build.bat
+++ b/build.bat
@@ -1,12 +1,27 @@
@ECHO OFF
+REM For debugging batch script:
+REM @ECHO ON
SETLOCAL
-REM The batch file accepts one argument so you can do a Build|Rebuild|Clean
-REM e.g.: build.bat Rebuild
-REM Check if the needed environment variables are present
-IF "%VS90COMNTOOLS%"=="" GOTO :BadPaths
-IF "%MINGW32%"=="" GOTO :BadPaths
-IF "%MINGW64%"=="" GOTO :BadPaths
+REM Notes
+REM Visual Studio 2008 Devenv Command Line Switches - http://msdn.microsoft.com/en-us/library/xee0c8y7.aspx
+
+REM Usage:
+REM build.bat [clean|build|rebuild] [null|x86|x64] [null|Main|Resource] [Debug]
+REM Executing "build.bat" will cause it to use defaults "build.bat build null null
+REM Examples:
+REM 'null' can be replaced with anything example 'all': "build.bat build x86 all Debug"
+REM "build.bat build x86 Resource" - Will build the x86 resources only
+REM "build.bat build null Resource" - Will build both x86 and x64 resources only
+REM "build.bat build x86" - Will build x86 Main exe and the resources (*.dll)
+REM "build.bat build x86 null Debug" - Will build x86 Main Debug exe and resources (*.dll)
+REM NOTE: Debug only applies to Main (mpc-hc.sln) project
+
+REM pre-build checks
+
+IF "%VS90COMNTOOLS%" == "" GOTO :MissingVar
+IF "%MINGW32%" == "" GOTO :MissingVar
+IF "%MINGW64%" == "" GOTO :MissingVar
REM Detect if we are running on 64bit WIN and use Wow6432Node, set the path
REM of Inno Setup accordingly
@@ -21,90 +36,115 @@ FOR /f "delims=" %%a IN (
'REG QUERY "%U_%\%A_%_is1" /v "%I_%: App Path"2^>Nul^|FIND "REG_"') DO (
SET "InnoSetupPath=%%a"&CALL :SubIS %%InnoSetupPath:*Z=%%)
-GOTO :GoodPaths
+GOTO :NoVarMissing
-:BadPaths
+:MissingVar
+COLOR 0C
ECHO: "Not all build dependencies found. To build MPC-HC you need:"
-ECHO: "* Visual Studio 2008 installed"
+ECHO: "* Visual Studio 2008 (SP1) installed"
ECHO: "* MinGW 32 bit build environment with MSYS pointed to in MINGW32 env var"
ECHO: "* MinGW 64 bit build environment with MSYS pointed to in MINGW64 env var"
PAUSE
-GOTO :EndBad
+GOTO :END
-:GoodPaths
-SET BUILDTYPE=/%1
-IF "%1"=="" SET BUILDTYPE=/Build
+:NoVarMissing
+REM setup variables
+
+IF "%1" == "" (SET BUILDTYPE=/Build) ELSE (SET BUILDTYPE=/%1)
SET ORIGPATH="%CD%"
+REM FIXME: Does this work for x64 builds??
+REM we do have a good alternative vcvarsall.bat x86 | x64
+REM Default location: "C:\Program Files\Microsoft Visual Studio 9\VC\Vcvarsall.bat"
CALL "%VS90COMNTOOLS%vsvars32.bat"
CD %ORIGPATH%
-devenv mpc-hc.sln %BUILDTYPE% "Release|Win32"
-IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+SET BUILD_APP=devenv /nologo
-devenv mpciconlib.sln %BUILDTYPE% "Release|Win32"
-IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+REM Debug build only applies to Main(mpc-hc.sln), Resource only have the Release config
+IF /I "%4" == "Debug" (SET BUILDCONFIG=Debug) ELSE (SET BUILDCONFIG=Release)
-FOR %%A IN ("Belarusian" "Catalan" "Chinese simplified" "Chinese traditional"
-"Czech" "Dutch" "French" "German" "Hungarian" "Italian" "Korean" "Polish"
-"Portuguese" "Russian" "Slovak" "Spanish" "Swedish" "Turkish" "Ukrainian"
-) DO (
-CALL :SubMPCRES %%A Win32
-)
+REM Do we want to build x86, x64 or both?
+IF /I "%2" == "x64" GOTO :skip32
-IF "%1"=="clean" GOTO x64
-XCOPY src\apps\mplayerc\AUTHORS "bin\mpc-hc_x86\" /Y
-XCOPY src\apps\mplayerc\ChangeLog "bin\mpc-hc_x86\" /Y
-XCOPY COPYING "bin\mpc-hc_x86\" /Y
-DEL/f/a "bin\mpc-hc_x86\mpciconlib.exp" "bin\mpc-hc_x86\mpciconlib.lib" >NUL 2>&1
+SET COPY_TO_DIR=bin\mpc-hc_x86
+SET Platform=Win32
+CALL :Sub_build_internal %*
+IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
-IF DEFINED InnoSetupPath ("%InnoSetupPath%\iscc.exe" /Q^
- "distrib\mpc-hc_setup.iss") ELSE (GOTO :x64)
+:skip32
+IF /I "%2" == "x86" GOTO :END
+SET COPY_TO_DIR=bin\mpc-hc_x64
+SET Platform=x64
+CALL :Sub_build_internal %*
+IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
+
+:EndWithError
+ECHO. && ECHO.
+ECHO: **ERROR: Build failed and aborted!**
+PAUSE
+ENDLOCAL
+EXIT
+
+:END
+ENDLOCAL
+GOTO :EOF
-:x64
-REM Uncomment the following line if you want to skip the x64 build
-REM GOTO :Nox64
-devenv mpc-hc.sln %BUILDTYPE% "Release|x64"
-IF %ERRORLEVEL% NEQ 0 GOTO EndBad
-devenv mpciconlib.sln %BUILDTYPE% "Release|x64"
-IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+:Sub_build_internal
+IF /I "%3"=="Resource" GOTO :skipMain
+%BUILD_APP% mpc-hc.sln %BUILDTYPE% "%BUILDCONFIG%|%Platform%"
+IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
+
+:skipMain
+IF /I "%3"=="Main" GOTO :skipResource
+%BUILD_APP% mpciconlib.sln %BUILDTYPE% "Release|%Platform%"
+IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
+
+DEL/f/a "%COPY_TO_DIR%\mpciconlib.exp" "%COPY_TO_DIR%\mpciconlib.lib" >NUL 2>&1
FOR %%A IN ("Belarusian" "Catalan" "Chinese simplified" "Chinese traditional"
"Czech" "Dutch" "French" "German" "Hungarian" "Italian" "Korean" "Polish"
"Portuguese" "Russian" "Slovak" "Spanish" "Swedish" "Turkish" "Ukrainian"
) DO (
-CALL :SubMPCRES %%A x64
+CALL :SubMPCRES %%A
)
-IF "%1"=="clean" GOTO :Nox64
-XCOPY src\apps\mplayerc\AUTHORS "bin\mpc-hc_x64\" /Y
-XCOPY src\apps\mplayerc\ChangeLog "bin\mpc-hc_x64\" /Y
-XCOPY COPYING "bin\mpc-hc_x64\" /Y
-DEL/f/a "bin\mpc-hc_x64\mpciconlib.exp" "bin\mpc-hc_x64\mpciconlib.lib" >NUL 2>&1
+:skipResource
+IF /I "%1" == "clean" GOTO :END
-IF DEFINED InnoSetupPath ("%InnoSetupPath%\iscc.exe" /Q^
- "distrib\mpc-hc_setup.iss" /DBuildx64=True) ELSE (GOTO :Nox64)
+IF NOT EXIST %COPY_TO_DIR% MKDIR %COPY_TO_DIR%
-:Nox64
-GOTO :EndGood
+IF /I "%3" == "Resource" GOTO :skipMainCopy
-:EndBad
-ECHO.
-ECHO: ERROR: Build failed and aborted
-PAUSE
-ENDLOCAL
-EXIT
+:skipMainCopy
+IF /I "%3" == "Main" GOTO :skipResourceCopy
+
+:skipResourceCopy
+IF /I "%3" == "Resource" GOTO :END
+IF /I "%4" == "Debug" GOTO :END
+XCOPY "src\apps\mplayerc\AUTHORS" ".\%COPY_TO_DIR%\" /Y /V
+XCOPY "src\apps\mplayerc\ChangeLog" ".\%COPY_TO_DIR%\" /Y /V
+XCOPY "COPYING" ".\%COPY_TO_DIR%\" /Y /V
+
+IF /I "%2" == "x86" (
+IF DEFINED InnoSetupPath ("%InnoSetupPath%\iscc.exe" /Q^
+ "distrib\mpc-hc_setup.iss") ELSE (GOTO :END)
+)
+
+IF /I "%2" == "x64" (
+IF DEFINED InnoSetupPath ("%InnoSetupPath%\iscc.exe" /Q^
+ "distrib\mpc-hc_setup.iss" /DBuildx64=True) ELSE (GOTO :END)
+)
-:EndGood
-ENDLOCAL
GOTO :EOF
+
:SubMPCRES
-devenv mpcresources.sln %BUILDTYPE% "Release %~1|%2"
-IF %ERRORLEVEL% NEQ 0 GOTO EndBad
+%BUILD_APP% mpcresources.sln %BUILDTYPE% "Release %~1|%Platform%"
+IF %ERRORLEVEL% NEQ 0 GOTO :EndWithError
GOTO :EOF
:SubIS
SET InnoSetupPath=%*
-GOTO :EOF \ No newline at end of file
+GOTO :EOF