Skip to content
Permalink
Browse files

CMake files for 0.8 for easier debugging. Only tested on Linux so far.

Does NOT create the same libraries as Makefiles.
Normal Makefiles not affected.


git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6470 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann
homann committed Jan 28, 2007
1 parent 43a2e41 commit 81fde95c36d672695b12fbd7880434e6f9a1d319
Showing with 2,510 additions and 0 deletions.
  1. +219 −0 CMakeLists.txt
  2. +49 −0 cmake/Bison.cmake
  3. +36 −0 cmake/FindExpat.cmake
  4. +94 −0 cmake/FindGDAL.cmake
  5. +31 −0 cmake/FindGEOS.cmake
  6. +90 −0 cmake/FindGRASS.cmake
  7. +112 −0 cmake/FindGSL.cmake
  8. +70 −0 cmake/FindPostgres.cmake
  9. +31 −0 cmake/FindProj.cmake
  10. +31 −0 cmake/FindSqlite3.cmake
  11. +36 −0 cmake/Flex.cmake
  12. +99 −0 cmake/Python.cmake
  13. +16 −0 doc/CMakeLists.txt
  14. +36 −0 i18n/CMakeLists.txt
  15. +2 −0 images/CMakeLists.txt
  16. +4 −0 images/developers/CMakeLists.txt
  17. +4 −0 images/icons/CMakeLists.txt
  18. +5 −0 images/north_arrows/CMakeLists.txt
  19. +5 −0 images/splash/CMakeLists.txt
  20. +11 −0 images/svg/CMakeLists.txt
  21. +2 −0 images/themes/CMakeLists.txt
  22. +5 −0 images/themes/default/CMakeLists.txt
  23. +5 −0 images/themes/nkids/CMakeLists.txt
  24. +16 −0 qgsconfig.h.in_cmake
  25. +5 −0 resources/CMakeLists.txt
  26. +6 −0 resources/context_help/CMakeLists.txt
  27. +6 −0 src/CMakeLists.txt
  28. +114 −0 src/core/CMakeLists.txt
  29. +243 −0 src/gui/CMakeLists.txt
  30. +46 −0 src/helpviewer/CMakeLists.txt
  31. +18 −0 src/plugins/CMakeLists.txt
  32. +46 −0 src/plugins/copyright_label/CMakeLists.txt
  33. +50 −0 src/plugins/delimited_text/CMakeLists.txt
  34. +47 −0 src/plugins/geoprocessing/CMakeLists.txt
  35. +69 −0 src/plugins/georeferencer/CMakeLists.txt
  36. +62 −0 src/plugins/gps_importer/CMakeLists.txt
  37. +101 −0 src/plugins/grass/CMakeLists.txt
  38. +79 −0 src/plugins/grid_maker/CMakeLists.txt
  39. +50 −0 src/plugins/north_arrow/CMakeLists.txt
  40. +50 −0 src/plugins/scale_bar/CMakeLists.txt
  41. +95 −0 src/plugins/spit/CMakeLists.txt
  42. +56 −0 src/plugins/wfs/CMakeLists.txt
  43. +14 −0 src/providers/CMakeLists.txt
  44. +34 −0 src/providers/delimitedtext/CMakeLists.txt
  45. +34 −0 src/providers/gpx/CMakeLists.txt
  46. +49 −0 src/providers/grass/CMakeLists.txt
  47. +24 −0 src/providers/ogr/CMakeLists.txt
  48. +42 −0 src/providers/postgres/CMakeLists.txt
  49. +39 −0 src/providers/wfs/CMakeLists.txt
  50. +18 −0 src/providers/wms/CMakeLists.txt
  51. +55 −0 src/ui/CMakeLists.txt
  52. +4 −0 tools/CMakeLists.txt
  53. +45 −0 tools/mapserver_export/CMakeLists.txt
@@ -0,0 +1,219 @@

PROJECT(qgis)

# TODO:
# - install includes for libs
# - nice output when configured
# - rename *.ui files to have the same filename as their implementation
# e.g. instead of blahblahbase.ui use blahblah.ui
# because it's more common in Qt4

#############################################################
# CMake settings

CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3)

SET(CMAKE_COLOR_MAKEFILE ON)

# set path to additional CMake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})

# it's possible to set PLUGINS_ALSO_BINARIES to TRUE
# then some plugins that can run as standalone apps will be built
# also as standalone apps
SET (PLUGINS_ALSO_BINARIES FALSE)


# try to configure and build GRASS plugin by default
SET (WITH_GRASS TRE CACHE BOOL "Determines whether GRASS plugin should be built")
SET (GRASS_PREFIX "" CACHE PATH "Path to GRASS base directory")

# try to configure and build python bindings by default
SET (WITH_BINDINGS TRUE CACHE BOOL "Determines whether python bindings should be built")


#############################################################
# check if lexer and parser are not missing
# http://www.mail-archive.com/cmake@cmake.org/msg02861.html

INCLUDE(Flex)

FIND_FLEX()

IF (NOT FLEX_EXECUTABLE)
MESSAGE(FATAL_ERROR "Couldn't find Flex")
ENDIF (NOT FLEX_EXECUTABLE)

INCLUDE(Bison)

FIND_BISON()

IF (NOT BISON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Couldn't find Bison")
ENDIF (NOT BISON_EXECUTABLE)

#############################################################
# search for dependencies

# required
FIND_PACKAGE(Proj)
FIND_PACKAGE(Sqlite3)
FIND_PACKAGE(GEOS)
FIND_PACKAGE(GDAL)

# optional
FIND_PACKAGE(Postgres) # PostgreSQL provider, SPIT plugin
FIND_PACKAGE(Expat) # GPS importer plugin
FIND_PACKAGE(GSL) # Georeferencer
FIND_PACKAGE(GRASS) # GRASS plugin

# python support:
# - mapserver export tool
# - bindings
INCLUDE (Python) # file cmake/Python.cmake


IF (NOT PROJ_FOUND OR NOT SQLITE3_FOUND OR NOT GEOS_FOUND OR NOT GDAL_FOUND)
MESSAGE (SEND_ERROR "Some dependencies were not found!")
ENDIF (NOT PROJ_FOUND OR NOT SQLITE3_FOUND OR NOT GEOS_FOUND OR NOT GDAL_FOUND)

IF (POSTGRES_FOUND)
# following variable is used in qgsconfig.h
SET (HAVE_POSTGRESQL TRUE)
ENDIF (POSTGRES_FOUND)


#############################################################
# search for Qt4

SET( QT_USE_QT3SUPPORT TRUE )
SET( QT_USE_QTXML TRUE )
SET( QT_USE_QTNETWORK TRUE )
SET( QT_USE_QTSVG TRUE )
# TODO: should not be needed, report it to CMake devs
IF (APPLE AND QT_USE_QT3SUPPORT)
SET( QT_USE_QTSQL TRUE )
ENDIF (APPLE AND QT_USE_QT3SUPPORT)

FIND_PACKAGE(Qt4 REQUIRED)

INCLUDE( ${QT_USE_FILE} )

FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
NAMES lrelease
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)

#############################################################
# enable warnings

ADD_DEFINITIONS( -Wall )

IF (CMAKE_BUILD_TYPE MATCHES Debug)
ADD_DEFINITIONS(-DQGISDEBUG=1)
ENDIF (CMAKE_BUILD_TYPE MATCHES Debug)

#############################################################
# platform specific stuff

IF (WIN32)

SET (QGIS_BIN_DIR ${CMAKE_INSTALL_PREFIX})
SET (QGIS_DATA_DIR ${CMAKE_INSTALL_PREFIX})
SET (QGIS_PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/plugins)

ELSE (WIN32)

IF (APPLE)
# for Mac OS X, everything is put inside an application bundle
SET (CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}.app/Contents/MacOS)
# path for library references
SET (CMAKE_INSTALL_NAME_DIR @executable_path/lib)
ENDIF (APPLE)

# common for MAC and UNIX
SET (QGIS_BIN_DIR ${CMAKE_INSTALL_PREFIX}/bin)
SET (QGIS_DATA_DIR ${CMAKE_INSTALL_PREFIX}/share/qgis)
SET (QGIS_PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/lib/qgis)

IF (UNIX AND NOT APPLE)
ADD_DEFINITIONS(-DPREFIX=\\"${CMAKE_INSTALL_PREFIX}\\")
ADD_DEFINITIONS(-DPLUGINPATH=\\"${QGIS_PLUGIN_DIR}\\")
ADD_DEFINITIONS(-DPKGDATAPATH=\\"${QGIS_DATA_DIR}\\")
ENDIF (UNIX AND NOT APPLE)

ENDIF (WIN32)


IF (WIN32)
# expect that classes are being imported
# Note: MSVC doesn't like when the macros are quotes
# and MSYS doesn't like them unqouted (bacause of braces)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllimport)")
ELSE (MSVC)
ADD_DEFINITIONS("\"-DCORE_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("\"-DGUI_EXPORT=__declspec(dllimport)\"")
ENDIF (MSVC)
ELSE (WIN32)
# other compilers don't use that MSVC construct
ADD_DEFINITIONS(-DCORE_EXPORT=)
ADD_DEFINITIONS(-DGUI_EXPORT=)
ENDIF (WIN32)


#############################################################
# create qgsconfig.h

CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/qgsconfig.h.in_cmake ${CMAKE_SOURCE_DIR}/qgsconfig.h)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})

#############################################################
# create qgssvnversion.h

# this is useful variable for developers
SET (QGIS_NO_SVNVERSION FALSE CACHE BOOL "Set to true if you don't want qgssvnversion.h to be regenerated every make")

IF (QGIS_NO_SVNVERSION)

ADD_CUSTOM_TARGET(svnversion
echo '\#define QGSSVNVERSION \"\"' > qgssvnversion.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})

ELSE (QGIS_NO_SVNVERSION)

IF (WIN32)
# TODO: create qgssvnversion.h properly
ADD_CUSTOM_TARGET(svnversion echo "#define QGSSVNVERSION \"svn\"" > qgssvnversion.h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
ELSE (WIN32)
ADD_CUSTOM_TARGET(svnversion ALL
QGSSVNDEF='\#define QGSSVNVERSION \"'`svnversion .`'\"' &&
if [ \"`grep QGSSVNVERSION qgssvnversion.h 2>/dev/null`\" != \"$$QGSSVNDEF\" ]; then
echo $$QGSSVNDEF > qgssvnversion.h \; fi
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

ENDIF (WIN32)

ENDIF (QGIS_NO_SVNVERSION)

#############################################################
# process subdirs

SUBDIRS(src doc images resources i18n tools)



#############################################################
# install stuff

INSTALL (FILES AUTHORS SPONSORS
DESTINATION ${QGIS_DATA_DIR}/doc)

# manual page... install also on windows?
INSTALL (FILES qgis.man
DESTINATION ${CMAKE_INSTALL_PREFIX}/man/man1)
@@ -0,0 +1,49 @@
# use bison for .yy files

# search for bison
MACRO(FIND_BISON)
IF(NOT BISON_EXECUTABLE)
FIND_PROGRAM(BISON_EXECUTABLE bison)
IF (NOT BISON_EXECUTABLE)
MESSAGE(FATAL_ERROR "Bison not found - aborting")
ENDIF (NOT BISON_EXECUTABLE)
ENDIF(NOT BISON_EXECUTABLE)
ENDMACRO(FIND_BISON)

MACRO(ADD_BISON_FILES _sources )
FIND_BISON()

FOREACH (_current_FILE ${ARGN})
GET_FILENAME_COMPONENT(_in ${_current_FILE} ABSOLUTE)
GET_FILENAME_COMPONENT(_basename ${_current_FILE} NAME_WE)

SET(_out ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
SET(_out_h ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
SET(_out_hpp ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.hpp)


# bison options:
# -t add debugging facilities
# -d produce additional header file (used in parser.l)
# -v produce additional *.output file with parser states
ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${BISON_EXECUTABLE}
ARGS
-o${_out} -d -v -t
${_in}
DEPENDS ${_in}
)
ADD_CUSTOM_COMMAND(
OUTPUT ${_out_h}
COMMAND mv
ARGS
${_out_hpp} ${_out_h}
DEPENDS ${_out}
)


SET(${_sources} ${${_sources}} ${_out} ${_out_h} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_BISON_FILES)
@@ -0,0 +1,36 @@

# CMake module to search for Expat library
# (library for parsing XML files)
#
# If it's found it sets EXPAT_FOUND to TRUE
# and following variables are set:
# EXPAT_INCLUDE_DIR
# EXPAT_LIBRARY


FIND_PATH(EXPAT_INCLUDE_DIR expat.h /usr/local/include /usr/include c:/msys/local/include)

FIND_LIBRARY(EXPAT_LIBRARY NAMES expat PATH /usr/local/lib /usr/lib c:/msys/local/lib)

IF (EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY)
SET(EXPAT_FOUND TRUE)
ENDIF (EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY)


IF (EXPAT_FOUND)

IF (NOT EXPAT_FIND_QUIETLY)
MESSAGE(STATUS "Found Expat: ${EXPAT_LIBRARY}")
ENDIF (NOT EXPAT_FIND_QUIETLY)

ELSE (EXPAT_FOUND)

IF (EXPAT_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find Expat")
ELSE (EXPAT_FIND_REQUIRED)
IF (NOT EXPAT_FIND_QUIETLY)
MESSAGE(STATUS "Could not find Expat")
ENDIF (NOT EXPAT_FIND_QUIETLY)
ENDIF (EXPAT_FIND_REQUIRED)

ENDIF (EXPAT_FOUND)

0 comments on commit 81fde95

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