Skip to content
Permalink
Browse files

cmake improvements

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11424 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Aug 18, 2009
1 parent 59fe46a commit ec1c1074168cef3c99beac84cd73554386423e56
Showing with 63 additions and 38 deletions.
  1. +4 −1 cmake/Bison.cmake
  2. +4 −3 cmake/Flex.cmake
  3. +27 −5 cmake/Python.cmake
  4. +28 −21 ms-windows/osgeo4w/package.cmd
  5. +0 −8 python/CMakeLists.txt
@@ -4,7 +4,10 @@
MACRO(FIND_BISON)
IF(NOT BISON_EXECUTABLE)
IF (MSVC)
FIND_PROGRAM(BISON_EXECUTABLE "$ENV{LIB_DIR}/bin/bison.exe")
FIND_PROGRAM(BISON_EXECUTABLE PATHS
NAMES bison.exe
PATHS $ENV{LIB_DIR} $ENV{PROGRAMFILES}/GnuWin32/bin
)
ELSE (MSVC)
FIND_PROGRAM(BISON_EXECUTABLE bison)
ENDIF (MSVC)
@@ -4,9 +4,10 @@
MACRO(FIND_FLEX)
IF(NOT FLEX_EXECUTABLE)
IF (MSVC)
FIND_PROGRAM(FLEX_EXECUTABLE
"$ENV{LIB_DIR}/bin/flex.exe"
)
FIND_PROGRAM(FLEX_EXECUTABLE
NAMES flex.exe
PATHS $ENV{LIB_DIR}/bin $ENV{PROGRAMFILES}/GnuWin32/bin
)
ELSE(MSVC)
FIND_PROGRAM(FLEX_EXECUTABLE flex)
ENDIF (MSVC)
@@ -7,11 +7,20 @@
FIND_PACKAGE(PythonLibs) # MapServer export tool
FIND_PACKAGE(PythonInterp) # test for sip and PyQt4

FIND_PROGRAM(PYUIC4_PROGRAM pyuic4)
IF(NOT PYUIC4_PROGRAM)
IF (MSVC)
FIND_PROGRAM(PYUIC4_PROGRAM
NAMES pyuic4.bat
PATHS $ENV{LIB_DIR}/bin
)
ELSE(MSVC)
FIND_PROGRAM(PYUIC4_PROGRAM pyuic4)
ENDIF (MSVC)

IF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
MESSAGE(ERROR "pyuic4 is required")
ENDIF(${PYUIC4_PROGRAM} STREQUAL "PYUIC4_PROGRAM-NOTFOUND")
IF (NOT PYUIC4_PROGRAM)
MESSAGE(FATAL_ERROR "pyuic4 not found - aborting")
ENDIF (NOT PYUIC4_PROGRAM)
ENDIF(NOT PYUIC4_PROGRAM)

# Adapted from QT4_WRAP_UI
MACRO(PYQT4_WRAP_UI outfiles )
@@ -27,7 +36,20 @@ MACRO(PYQT4_WRAP_UI outfiles )
ENDFOREACH(it)
ENDMACRO(PYQT4_WRAP_UI)

FIND_PROGRAM(PYRCC4_PROGRAM pyrcc4)
IF(NOT PYRCC4_PROGRAM)
IF (MSVC)
FIND_PROGRAM(PYRCC4_PROGRAM
NAMES pyrcc4.exe
PATHS $ENV{LIB_DIR}/bin
)
ELSE(MSVC)
FIND_PROGRAM(PYRCC4_PROGRAM pyrcc4)
ENDIF (MSVC)

IF (NOT PYRCC4_PROGRAM)
MESSAGE(FATAL_ERROR "pyrcc4 not found - aborting")
ENDIF (NOT PYRCC4_PROGRAM)
ENDIF(NOT PYRCC4_PROGRAM)

# Adapted from QT4_ADD_RESOURCES
MACRO (PYQT4_ADD_RESOURCES outfiles )
@@ -1,34 +1,46 @@
@echo off
set GRASS_VERSION=6.4.0svn

set VERSION=%1
set PACKAGE=%2
if "%VERSION%"=="" goto error
if "%PACKAGE%"=="" goto error

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
if "%OSGEO4W_ROOT%"=="" set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" goto error

call "%OSGEO4W_ROOT%\bin\o4w_env.bat"

set BUILDDIR=%CD%\build
REM set BUILDDIR=%TEMP%\qgis_unstable

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

set FLEX=%PROGRAMFILES%\GnuWin32\bin\flex.exe
set BISON=%PROGRAMFILES%\GnuWin32\bin\bison.exe
set PYUIC4=%O4W_ROOT%/bin/pyuic4.bat

set VERSION=%1
set PACKAGE=%2
if %VERSION%=="" goto error
if %PACKAGE%=="" goto error
set DEVENV=
if exist "%DevEnvDir%\vcexpress.exe" set DEVENV=vcexpress
if exist "%DevEnvDir%\devenv.exe" set DEVENV=devenv
if "%DEVENV%"=="" goto error

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 "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" goto error

cd ..\..
set SRCDIR=%CD%

if "%BUILDDIR:~1,1%"==":" %BUILDDIR:~0,2%
cd %BUILDDIR%

if not exist build.log goto build

@@ -55,9 +67,7 @@ if exist build.tmp del build.tmp
goto error

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

cd build
set LOG=%BUILDDIR%\build.log

echo Logging to %LOG%
echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1
@@ -76,9 +86,6 @@ cmake -G "Visual Studio 9 2008" ^
-D WITH_INTERNAL_SPATIALITE=TRUE ^
-D CMAKE_CONFIGURATION_TYPE=%BUILDCONF% ^
-D CMAKE_BUILDCONFIGURATION_TYPES=%BUILDCONF% ^
-D FLEX_EXECUTABLE=%FLEX% ^
-D BISON_EXECUTABLE=%BISON% ^
-D PYUIC4_PROGRAM=%PYUIC4% ^
-D GDAL_INCLUDE_DIR=%O4W_ROOT%/apps/gdal-16/include ^
-D GDAL_LIBRARY=%O4W_ROOT%/apps/gdal-16/lib/gdal_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^
@@ -92,7 +99,7 @@ cmake -G "Visual Studio 9 2008" ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/qgis-dev ^
../../..>>%LOG% 2>&1
%SRCDIR%>>%LOG% 2>&1
if errorlevel 1 goto error

REM bail out if python or grass was not found
@@ -102,15 +109,15 @@ if not errorlevel 1 goto error
:skipcmake

echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
devenv qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%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% /Out %LOG%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error

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

echo PACKAGE: %DATE% %TIME%>>%LOG% 2>&1
@@ -26,7 +26,6 @@ SET (BINDINGS_LIBS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB})
SET (BINDINGS_CORE_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/core/Makefile)
SET (BINDINGS_GUI_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/gui/Makefile)


# 'python' target will force to build bindings libs for core and gui
ADD_CUSTOM_TARGET (python ALL DEPENDS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB})

@@ -36,13 +35,6 @@ ADD_DEPENDENCIES (python qgis_core qgis_gui)
FILE(GLOB CORE_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/core/*.sip")
FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip")

# Extract GDAL library path and name for configure.py.in
STRING(REGEX REPLACE "^(.*)/.*$" "\\1" GDAL_LIB_PATH ${GDAL_LIBRARY})
STRING(REGEX REPLACE "^.*/(lib)?(.*)\\.[^.]+$" "\\2" GDAL_LIB_NAME ${GDAL_LIBRARY})
# Extract GEOS library path and name for configure.py.in
STRING(REGEX REPLACE "^(.*)/.*$" "\\1" GEOS_LIB_PATH ${GEOS_LIBRARY})
STRING(REGEX REPLACE "^.*/(lib)?(.*)\\.[^.]+$" "\\2" GEOS_LIB_NAME ${GEOS_LIBRARY})

# Step 1: during configuration
# create file configure.py from configure.py.in
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in

0 comments on commit ec1c107

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