Skip to content
Permalink
Browse files

osgeo4w: run builds using cmake --build

  • Loading branch information
jef-n committed Apr 18, 2014
1 parent 018086e commit e19139f68d06cb55519abef24ff1245618726875
Showing with 74 additions and 105 deletions.
  1. +33 −48 ms-windows/osgeo4w/package-nightly.cmd
  2. +41 −57 ms-windows/osgeo4w/package.cmd
@@ -25,7 +25,6 @@ if "%PACKAGENAME%"=="" goto usage
if "%ARCH%"=="" goto usage

set BUILDDIR=%CD%\build-nightly-%ARCH%
set LOG=%BUILDDIR%\build.log

if "%OSGEO4W_ROOT%"=="" (
if "%ARCH%"=="x86" (
@@ -36,17 +35,17 @@ if "%OSGEO4W_ROOT%"=="" (
)

if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" (echo "could not create build directory %BUILDDIR%" & goto error)
if not exist "%BUILDDIR%" (echo could not create build directory %BUILDDIR% & goto error)

if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" (echo "o4w_env.bat not found" & goto error)
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" (echo o4w_env.bat not found & goto error)
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"

set O4W_ROOT=%OSGEO4W_ROOT:\=/%
set LIB_DIR=%O4W_ROOT%

if not "%PROGRAMFILES(X86)%"=="" set PF86=%PROGRAMFILES(X86)%
if "%PF86%"=="" set PF86=%PROGRAMFILES%
if "%PF86%"=="" (echo "PROGRAMFILES not set" & goto error)
if "%PF86%"=="" (echo PROGRAMFILES not set & goto error)

if "%ARCH%"=="x86" goto devenv_x86
goto devenv_x86_64
@@ -55,35 +54,33 @@ goto devenv_x86_64
set VS90COMNTOOLS=%PF86%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PF86%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

set DEVENV=
if exist "%DevEnvDir%\vcexpress.exe" set DEVENV=vcexpress
if exist "%DevEnvDir%\devenv.exe" set DEVENV=devenv

set CMAKE_OPT=^
-G "Visual Studio 9 2008" ^
-D BUILDNAME="OSGeo4W-Nightly-VC9" ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /MP /Od /D NDEBUG /D QGISDEBUG"
goto devenv

:devenv_x86_64
call "%PF86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
if exist "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x64 /Release

set SETUPAPI_LIBRARY=%PF86%\Microsoft SDKs\Windows\v7.0A\Lib\x64\SetupAPI.Lib
if not exist "%SETUPAPI_LIBRARY%" set SETUPAPI_LIBRARY=%PROGRAMFILES%\Microsoft SDKs\Windows\v7.1\Lib\x64\SetupAPI.lib
if not exist "%SETUPAPI_LIBRARY%" (echo SETUPAPI_LIBRARY not found & goto error)

set DEVENV=devenv
set CMAKE_OPT=^
-G "Visual Studio 10 Win64" ^
-D BUILDNAME="OSGeo4W-Nightly-VC10-64" ^
-D SPATIALINDEX_LIBRARY=%O4W_ROOT%/lib/spatialindex-64.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/bin/sip.exe ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /Zi /MP /Od /D NDEBUG /D QGISDEBUG" ^
-D SETUPAPI_LIBRARY="%PF86%/Microsoft SDKs/Windows/v7.0A/Lib/x64/SetupAPI.Lib"
-D SETUPAPI_LIBRARY="%SETUPAPI_LIBRARY%" ^
-D CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS=TRUE

:devenv
set PYTHONPATH=
path %PF86%\CMake 2.8\bin;%PATH%;c:\cygwin\bin
if "%DEVENV%"=="" (echo "DEVENV not found" & goto error)

PROMPT qgis%VERSION%$g

@@ -104,7 +101,7 @@ REM try renaming the logfile to see if it's locked
REM

if exist build.tmp del build.tmp
if exist build.tmp (echo "could not remove build.tmp" & goto error)
if exist build.tmp (echo could not remove build.tmp & goto error)

ren build.log build.tmp
if exist build.log goto locked
@@ -122,18 +119,15 @@ if exist build.tmp del build.tmp
goto error

:build

echo Logging to %LOG%
echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1
if errorlevel 1 (echo "could not write to log %LOG%" & goto error)
echo BEGIN: %DATE% %TIME%

set >buildenv.log

if exist qgsversion.h del qgsversion.h

if exist CMakeCache.txt goto skipcmake

echo CMAKE: %DATE% %TIME%>>%LOG% 2>&1
echo CMAKE: %DATE% %TIME%
if errorlevel 1 goto error

set LIB=%LIB%;%OSGEO4W_ROOT%\lib
@@ -167,48 +161,40 @@ cmake %CMAKE_OPT% ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^
-D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^
-D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^
%SRCDIR%>>%LOG% 2>&1
if errorlevel 1 (echo "cmake failed" & goto error)

REM bail out if python or grass was not found
grep -Eq "^(Python not being built|Could not find GRASS)" %LOG%
if not errorlevel 1 (echo "python or grass not found" & goto error)
%SRCDIR%
if errorlevel 1 (echo cmake failed & goto error)

:skipcmake
if exist noclean goto skipclean
echo CLEAN: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Clean %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 (echo "CLEAN failed" & goto error)
if exist noclean (echo skip clean & goto skipclean)
echo CLEAN: %DATE% %TIME%
cmake --build %BUILDDIR% --target clean --config %BUILDCONF%
if errorlevel 1 (echo clean failed & goto error)

:skipclean
echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 (echo "ZERO_CHECK failed" & goto error)

echo ALL_BUILD: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 %DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 (echo "ALL_BUILD failed" & goto error)
echo ALL_BUILD: %DATE% %TIME%
cmake --build %BUILDDIR% --config %BUILDCONF%
if errorlevel 1 cmake --build %BUILDDIR% --config %BUILDCONF%
if errorlevel 1 (echo build failed twice & goto error)

if not exist ..\skiptests (
echo RUN_TESTS: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project Nightly /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 echo "TESTS WERE NOT SUCCESSFUL."
echo RUN_TESTS: %DATE% %TIME%
cmake --build %BUILDDIR% --target Nightly --config %BUILDCONF%
if errorlevel 1 echo TESTS WERE NOT SUCCESSFUL.
)

set PKGDIR=%OSGEO4W_ROOT%\apps\%PACKAGENAME%

if exist %PKGDIR% (
echo REMOVE: %DATE% %TIME%>>%LOG% 2>&1
echo REMOVE: %DATE% %TIME%
rmdir /s /q %PKGDIR%
)

echo INSTALL: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project INSTALL /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
echo INSTALL: %DATE% %TIME%
cmake --build %BUILDDIR% --target INSTALL --config %BUILDCONF%
if errorlevel 1 (echo INSTALL failed & goto error)

:package
echo PACKAGE: %DATE% %TIME%>>%LOG% 2>&1
echo PACKAGE: %DATE% %TIME%

cd ..
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%GRASS_VERSION%/g' postinstall-dev.bat >%OSGEO4W_ROOT%\etc\postinstall\%PACKAGENAME%.bat
@@ -238,8 +224,7 @@ tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERS
apps/qt4/plugins/sqldrivers/qsqlocispatial.dll ^
apps/qt4/plugins/sqldrivers/qsqlspatialite.dll ^
etc/postinstall/%PACKAGENAME%.bat ^
etc/preremove/%PACKAGENAME%.bat ^
>>%LOG% 2>&1
etc/preremove/%PACKAGENAME%.bat
if errorlevel 1 (echo tar failed & goto error)

goto end
@@ -251,8 +236,8 @@ exit

:error
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%>>%LOG% 2>&1
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
if exist %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2

:end
echo FINISHED: %DATE% %TIME% >>%LOG% 2>&1
echo FINISHED: %DATE% %TIME%

0 comments on commit e19139f

Please sign in to comment.
You can’t perform that action at this time.