Skip to content

Commit

Permalink
include OSGeo4W build scripts
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@11197 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jul 29, 2009
1 parent d979b6c commit f0b412a
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 10 deletions.
19 changes: 9 additions & 10 deletions CMakeLists.txt
Expand Up @@ -201,9 +201,10 @@ IF (PEDANTIC)
ENDIF (MSVC)
ENDIF (PEDANTIC)

IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_CONFIGURATION_TYPE MATCHES RelWithDebInfo)
MESSAGE ("-- Debug output enabled")
ADD_DEFINITIONS(-DQGISDEBUG=1)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_CONFIGURATION_TYPE MATCHES RelWithDebInfo)

#############################################################
# platform specific stuff
Expand All @@ -215,11 +216,6 @@ IF (WIN32)
SET (DEFAULT_INCLUDE_SUBDIR include)

IF (MSVC)
# Python parts need to be build with nmake not vcexpress
# if you dont add this clause, extra blank msvc projects
# will pop up mid way through the build process and block
# the build, plus the python bindings wont build correctly
SET (CMAKE_MAKE_PROGRAM nmake)
SET (DEFAULT_BIN_SUBDIR bin)
# put all the build products into a single directory
# under build (doesnt affect install target) to make for
Expand All @@ -234,11 +230,14 @@ IF (WIN32)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)

IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
IF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_CONFIGURATION_TYPE MATCHES RelWithDebInfo)
MESSAGE ("-- Generating browse files")
ADD_DEFINITIONS( /FR )
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_CONFIGURATION_TYPE MATCHES RelWithDebInfo)

INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/../vcdeps/. DESTINATION .)
IF (INSTALL_DEPS)
INSTALL(DIRECTORY ${INSTALL_DEPS} DESTINATION .)
ENDIF (INSTALL_DEPS)
ELSE(MSVC)
SET (DEFAULT_BIN_SUBDIR .)
ENDIF(MSVC)
Expand Down
127 changes: 127 additions & 0 deletions ms-windows/osgeo4w/package.cmd
@@ -0,0 +1,127 @@
@echo off
set GRASS_VERSION=6.4.0svn

path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem;%PROGRAMFILES%\CMake 2.6\bin
set PYTHONPATH=

set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"

set LIB_DIR=%OSGEO4W_ROOT%

set FLEX=%PROGRAMFILES%\GnuWin32\bin\flex.exe
set BISON=%PROGRAMFILES%\GnuWin32\bin\bison.exe

set VERSION=%1
set PACKAGE=%2

PROMPT qgis%VERSION%$g

set BUILDCONF=RelWithDebInfo
REM set BUILDCONF=Release

if not exist build mkdir build
if not exist build goto error

if not exist build.log goto build

REM
REM try renaming the logfile to see if it's locked
REM

if exist build.tmp del build.tmp
if exist build.tmp goto error

ren build.log build.tmp
if exist build.log goto locked
if not exist build.tmp goto locked

ren build.tmp build.log
if exist build.tmp goto locked
if not exist build.log goto locked

goto build

:locked
echo Logfile locked
if exist build.tmp del build.tmp
goto error

:build
set LOG=%CD%\build.log

cd build

echo Logging to %LOG%
echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1
if errorlevel 1 goto error

set >buildenv.log

if exist CMakeCache.txt goto skipcmake

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

cmake -G "Visual Studio 9 2008" ^
-D PEDANTIC=TRUE ^
-D WITH_SPATIALITE=TRUE ^
-D WITH_INTERNAL_SPATIALITE=TRUE ^
-D CMAKE_CONFIGURATION_TYPE=%BUILDCONF% ^
-D CMAKE_BUILDCONFIGURATION_TYPES=%BUILDCONF% ^
-D FLEX_EXECUTABLE=%FLEX% ^
-D BISON_EXECUTABLE=%BISON% ^
-D GDAL_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\gdal-16\include -D GDAL_LIBRARY=%OSGEO4W_ROOT%\apps\gdal-16\lib\gdal_i.lib ^
-D PYTHON_EXECUTABLE=%OSGEO4W_ROOT%\bin\python.exe ^
-D PYTHON_INCLUDE_DIR=%OSGEO4W_ROOT%\apps\Python25\include -D PYTHON_LIBRARY=%OSGEO4W_ROOT%\apps\Python25\libs\python25.lib ^
-D SIP_BINARY_PATH=%OSGEO4W_ROOT%\apps\Python25\sip.exe ^
-D GRASS_PREFIX=%OSGEO4W_ROOT%\apps\grass\grass-%GRASS_VERSION% ^
-D QT_BINARY_DIR=%OSGEO4W_ROOT%\bin -D QT_LIBRARY_DIR=%OSGEO4W_ROOT%\lib ^
-D QT_HEADERS_DIR=%OSGEO4W_ROOT%\include\qt4 ^
-D QT_ZLIB_LIBRARY=%OSGEO4W_ROOT%\lib\zlib.lib ^
-D QT_PNG_LIBRARY=%OSGEO4W_ROOT%\lib\libpng13.lib ^
-D CMAKE_INSTALL_PREFIX=%OSGEO4W_ROOT%\apps\qgis-dev ^
../../..>>%LOG% 2>&1
if errorlevel 1 goto error

:skipcmake

echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
devenv qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF%>>%LOG% 2>&1
if errorlevel 1 goto error

echo ALL_BUILD: %DATE% %TIME%>>%LOG% 2>&1
devenv qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF%>>%LOG% 2>&1
if errorlevel 1 goto error

echo INSTALL: %DATE% %TIME%>>%LOG% 2>&1
devenv qgis%VERSION%.sln /Project INSTALL /Build %BUILDCONF%>>%LOG% 2>&1
if errorlevel 1 goto error

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

cd ..
copy postinstall.bat %OSGEO4W_ROOT%\etc\postinstall\qgis-dev.bat
copy preremove.bat %OSGEO4W_ROOT%\etc\preremove\qgis-dev.bat
copy qgis-dev.bat.tmpl %OSGEO4W_ROOT%\bin\qgis-dev.bat.tmpl

tar -C %OSGEO4W_ROOT% -cjf qgis-dev-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude "apps/qgis-dev/plugins/EDBSQuery.dll" ^
apps/qgis-dev ^
bin/qgis-dev.bat.tmpl ^
etc/postinstall/qgis-dev.bat ^
etc/preremove/qgis-dev.bat>>%LOG% 2>&1
if errorlevel 1 goto error

goto end

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

:end
echo FINISHED: %DATE% %TIME% >>%LOG% 2>&1
5 changes: 5 additions & 0 deletions ms-windows/osgeo4w/postinstall.bat
@@ -0,0 +1,5 @@
textreplace -std -t bin\qgis-dev.bat

mkdir "%OSGEO4W_STARTMENU%"
xxmklink "%OSGEO4W_STARTMENU%\Quantum GIS (trunk).lnk" "%OSGEO4W_ROOT%\bin\qgis-dev.bat" " " \ "Quantum GIS - Desktop GIS (trunk)" 1 "%OSGEO4W_ROOT%\apps\qgis-dev\icons\QGIS.ico"
xxmklink "%ALLUSERSPROFILE%\Desktop\Quantum GIS (trunk).lnk" "%OSGEO4W_ROOT%\bin\qgis-dev.bat" " " \ "Quantum GIS - Desktop GIS (trunk)" 1 "%OSGEO4W_ROOT%\apps\qgis-dev\icons\QGIS.ico"
3 changes: 3 additions & 0 deletions ms-windows/osgeo4w/preremove.bat
@@ -0,0 +1,3 @@
del "%OSGEO4W_STARTMENU%\Quantum GIS (trunk).lnk"
del "%ALLUSERSPROFILE%\Desktop\Quantum GIS (trunk).lnk"
del "%OSGEO4W_ROOT%\bin\qgis-dev.bat
8 changes: 8 additions & 0 deletions ms-windows/osgeo4w/qgis-dev.bat.tmpl
@@ -0,0 +1,8 @@
@echo off

SET OSGEO4W_ROOT=@osgeo4w@
call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
call "%OSGEO4W_ROOT%"\bin\gdal16.bat
@echo off
path %PATH%;%GISBASE%\bin
start "Quantum GIS" /B "%OSGEO4W_ROOT%"\apps\qgis-dev\bin\qgis.exe %*
1 change: 1 addition & 0 deletions python/CMakeLists.txt
Expand Up @@ -50,6 +50,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in

IF (MSVC)
SET(EXPORT "__declspec(dllimport)")
SET(CMAKE_MAKE_PROGRAM $ENV{VCINSTALLDIR}/bin/nmake.exe)
ELSE (MSVC)
SET(EXPORT "")
ENDIF (MSVC)
Expand Down

0 comments on commit f0b412a

Please sign in to comment.