aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontellese <montellese@xbmc.org>2015-03-08 14:52:25 +0100
committermontellese <montellese@xbmc.org>2015-03-11 08:16:13 +0100
commit948a84b13be7a316247ac1dc28c6f35949b2f4d3 (patch)
treebc6648f7fa472e92e0b8ae2d0c0d4692b4ecbda0
parent38d39c160399ef0db245dd9b4af5a545dcb6eb93 (diff)
[win32] add prepare-binary-addons-dev.bat for easier binary addon development
-rw-r--r--tools/windows/prepare-binary-addons-dev.bat108
1 files changed, 108 insertions, 0 deletions
diff --git a/tools/windows/prepare-binary-addons-dev.bat b/tools/windows/prepare-binary-addons-dev.bat
new file mode 100644
index 0000000000..ff7d916941
--- /dev/null
+++ b/tools/windows/prepare-binary-addons-dev.bat
@@ -0,0 +1,108 @@
+@ECHO OFF
+
+SETLOCAL
+
+SET EXITCODE=0
+
+SET clean=false
+SET addon=
+
+SETLOCAL EnableDelayedExpansion
+FOR %%b IN (%*) DO (
+ IF %%b == clean (
+ SET clean=true
+ ) ELSE (
+ SET addon=!addon! %%b
+ )
+)
+SETLOCAL DisableDelayedExpansion
+
+rem set Visual C++ build environment
+call "%VS120COMNTOOLS%..\..\VC\bin\vcvars32.bat"
+
+SET WORKDIR=%WORKSPACE%
+
+IF "%WORKDIR%" == "" (
+ SET WORKDIR=%CD%\..\..
+)
+
+rem setup some paths that we need later
+SET CUR_PATH=%CD%
+SET BASE_PATH=%WORKDIR%\project\cmake
+SET SCRIPTS_PATH=%BASE_PATH%\scripts\windows
+SET ADDONS_PATH=%BASE_PATH%\addons
+SET ADDON_DEPENDS_PATH=%ADDONS_PATH%\output
+SET ADDONS_BUILD_PATH=%ADDONS_PATH%\build
+SET ADDONS_DEFINITION_PATH=%ADDONS_PATH%\addons
+
+SET ERRORFILE=%ADDONS_PATH%\make-addons.error
+
+IF %clean% == true (
+ rem remove the build directory if it exists
+ IF EXIST "%ADDONS_BUILD_PATH%" (
+ RMDIR "%ADDONS_BUILD_PATH%" /S /Q > NUL
+ )
+
+ rem remove the build directory if it exists
+ IF EXIST "%ADDON_DEPENDS_PATH%" (
+ RMDIR "%ADDON_DEPENDS_PATH%" /S /Q > NUL
+ )
+
+ GOTO END
+)
+
+rem create the depends directory
+IF NOT EXIST "%ADDON_DEPENDS_PATH%" MKDIR "%ADDON_DEPENDS_PATH%"
+
+rem create the build directory
+IF NOT EXIST "%ADDONS_BUILD_PATH%" MKDIR "%ADDONS_BUILD_PATH%"
+
+rem go into the build directory
+CD "%ADDONS_BUILD_PATH%"
+
+ECHO --------------------------------------------------
+ECHO Preparing addons development environment
+ECHO --------------------------------------------------
+
+SET ADDONS_TO_BUILD=
+IF "%addon%" NEQ "" (
+ SET ADDONS_TO_BUILD=%addon%
+) ELSE (
+ SETLOCAL EnableDelayedExpansion
+ FOR /D %%a IN (%ADDONS_DEFINITION_PATH%\*) DO (
+ SET ADDONS_TO_BUILD=!ADDONS_TO_BUILD! %%~nxa
+ )
+ SETLOCAL DisableDelayedExpansion
+)
+
+rem execute cmake to generate Visual Studio 12 project files
+cmake "%ADDONS_PATH%" -G "Visual Studio 12" ^
+ -DCMAKE_BUILD_TYPE=Debug ^
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE="%SCRIPTS_PATH%/c-flag-overrides.cmake" ^
+ -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%SCRIPTS_PATH%/cxx-flag-overrides.cmake" ^
+ -DCMAKE_INSTALL_PREFIX=%WORKDIR%\addons ^
+ -DAPP_ROOT=%WORKDIR% ^
+ -DBUILD_DIR=%ADDONS_BUILD_PATH% ^
+ -DDEPENDS_PATH=%ADDON_DEPENDS_PATH% ^
+ -DPACKAGE_ZIP=1 ^
+ -DADDONS_TO_BUILD="%ADDONS_TO_BUILD%"
+IF ERRORLEVEL 1 (
+ ECHO cmake error level: %ERRORLEVEL% > %ERRORFILE%
+ GOTO ERROR
+)
+
+rem everything was fine
+GOTO END
+
+:ERROR
+rem something went wrong
+ECHO Failed to prepare addons development environment
+ECHO See %ERRORFILE% for more details
+SET EXITCODE=1
+
+:END
+rem go back to the original directory
+cd %CUR_PATH%
+
+rem exit the script with the defined exitcode
+EXIT /B %EXITCODE%