Skip to content

Commit

Permalink
Added clauses to find dependencies under MSVC. I will be making a zip…
Browse files Browse the repository at this point in the history
… file with file with all deps for streamlining the dev environment setup process

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7236 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux committed Oct 1, 2007
1 parent e94e9f6 commit 9ce8543
Show file tree
Hide file tree
Showing 8 changed files with 180 additions and 110 deletions.
112 changes: 58 additions & 54 deletions cmake/Bison.cmake
Original file line number Diff line number Diff line change
@@ -1,54 +1,58 @@
# 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")

ELSE (NOT BISON_EXECUTABLE)

EXEC_PROGRAM(${BISON_EXECUTABLE} ARGS --version OUTPUT_VARIABLE BISON_VERSION_STR)
# get first line in case it's multiline
STRING(REGEX REPLACE "([^\n]+).*" "\\1" FIRST_LINE "${BISON_VERSION_STR}")
# get version information
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\1" BISON_VERSION_MAJOR "${FIRST_LINE}")
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\2" BISON_VERSION_MINOR "${FIRST_LINE}")
IF (BISON_VERSION_MAJOR LESS 2)
MESSAGE (FATAL_ERROR "Bison version is too old (${BISON_VERSION_MAJOR}.${BISON_VERSION_MINOR}). Use 2.0 or higher.")
ENDIF (BISON_VERSION_MAJOR LESS 2)

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)


# 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}
)

SET(${_sources} ${${_sources}} ${_out} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_BISON_FILES)
# use bison for .yy files

# search for bison
MACRO(FIND_BISON)
IF(NOT BISON_EXECUTABLE)
IF (MSVC)
FIND_PROGRAM(BISON_EXECUTABLE "c:/dev/cpp/bison/bin/bison.exe")
ELSE (MSVC)
FIND_PROGRAM(BISON_EXECUTABLE bison)
ENDIF (MSVC)
IF (NOT BISON_EXECUTABLE)

MESSAGE(FATAL_ERROR "Bison not found - aborting")

ELSE (NOT BISON_EXECUTABLE)

EXEC_PROGRAM(${BISON_EXECUTABLE} ARGS --version OUTPUT_VARIABLE BISON_VERSION_STR)
# get first line in case it's multiline
STRING(REGEX REPLACE "([^\n]+).*" "\\1" FIRST_LINE "${BISON_VERSION_STR}")
# get version information
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\1" BISON_VERSION_MAJOR "${FIRST_LINE}")
STRING(REGEX REPLACE ".* ([0-9]+)\\.([0-9]+)" "\\2" BISON_VERSION_MINOR "${FIRST_LINE}")
IF (BISON_VERSION_MAJOR LESS 2)
MESSAGE (FATAL_ERROR "Bison version is too old (${BISON_VERSION_MAJOR}.${BISON_VERSION_MINOR}). Use 2.0 or higher.")
ENDIF (BISON_VERSION_MAJOR LESS 2)

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)


# 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}
)

SET(${_sources} ${${_sources}} ${_out} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_BISON_FILES)
16 changes: 13 additions & 3 deletions cmake/FindExpat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@
# EXPAT_LIBRARY


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

FIND_LIBRARY(EXPAT_LIBRARY NAMES expat PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
FIND_PATH(EXPAT_INCLUDE_DIR expat.h
/usr/local/include
/usr/include
c:/msys/local/include
"C:/dev/cpp/Expat 2.0.1/Source/Lib"
)
#libexpat needed for msvc version
FIND_LIBRARY(EXPAT_LIBRARY NAMES expat libexpat PATHS
/usr/local/lib
/usr/lib
c:/msys/local/lib
"C:/dev/cpp/Expat 2.0.1/Bin"
)

IF (EXPAT_INCLUDE_DIR AND EXPAT_LIBRARY)
SET(EXPAT_FOUND TRUE)
Expand Down
13 changes: 10 additions & 3 deletions cmake/FindGDAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@

IF(WIN32)

FIND_PATH(GDAL_INCLUDE_DIR gdal.h /usr/local/include /usr/include c:/msys/local/include)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS /usr/local/lib /usr/lib c:/msys/local/lib)

IF (MINGW)
FIND_PATH(GDAL_INCLUDE_DIR gdal.h /usr/local/include /usr/include c:/msys/local/include)
FIND_LIBRARY(GDAL_LIBRARY NAMES gdal PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
ENDIF (MINGW)

IF (MSVC)
SET (GDAL_INCLUDE_DIR C:/dev/cpp/gdal/gcore;C:/dev/cpp/gdal/port;C:/dev/cpp/gdal/ogr;C:/dev/cpp/gdal/alg;C:/dev/cpp/gdal/ogr/ogrsf_frmts CACHE STRING INTERNAL)
SET (GDAL_LIBRARY C:/dev/cpp/gdal/gdal.lib;odbc32;odbccp32 CACHE STRING INTERNAL)
ENDIF (MSVC)


ELSE(WIN32)
IF(UNIX)
Expand Down
18 changes: 15 additions & 3 deletions cmake/FindGEOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@
# GEOS_LIBRARY


FIND_PATH(GEOS_INCLUDE_DIR geos.h /usr/local/include /usr/include c:/msys/local/include)

FIND_LIBRARY(GEOS_LIBRARY NAMES geos PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
FIND_PATH(GEOS_INCLUDE_DIR geos.h
/usr/local/include
/usr/include
c:/msys/local/include
#MSVC
C:/dev/cpp/geos-2.2.1/source/headers
)

FIND_LIBRARY(GEOS_LIBRARY NAMES geos PATHS
/usr/local/lib
/usr/lib
c:/msys/local/lib
#MSVC
C:/dev/cpp/geos-2.2.1/source
)

IF (GEOS_INCLUDE_DIR AND GEOS_LIBRARY)
SET(GEOS_FOUND TRUE)
Expand Down
23 changes: 17 additions & 6 deletions cmake/FindGSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,23 @@

IF(WIN32)

SET(GSL_PREFIX "c:/msys/local" CACHE PATH "Path to GSL directory")

FIND_LIBRARY(GSL_LIB gsl PATHS ${GSL_PREFIX}/lib)
FIND_LIBRARY(GSLCBLAS_LIB gslcblas PATHS ${GSL_PREFIX}/lib)

FIND_PATH(GSL_INCLUDE_DIR gsl/gsl_version.h ${GSL_PREFIX}/include)
SET(GSL_MINGW_PREFIX "c:/msys/local" )
SET(GSL_MSVC_PREFIX "C:/dev/cpp/gsl" )

FIND_LIBRARY(GSL_LIB gsl PATHS
${GSL_MINGW_PREFIX}/lib
${GSL_MSVC_PREFIX}/lib
)
#MSVC version of the lib is just called 'cblas'
FIND_LIBRARY(GSLCBLAS_LIB gslcblas cblas PATHS
${GSL_PREFIX}/lib
${GSL_MSVC_PREFIX}/lib
)

FIND_PATH(GSL_INCLUDE_DIR gsl/gsl_version.h
${GSL_PREFIX}/include
${GSL_MSVC_PREFIX}/include
)

IF (GSL_LIB AND GSLCBLAS_LIB)
SET (GSL_LIBRARIES ${GSL_LIB} ${GSLCBLAS_LIB})
Expand Down
16 changes: 13 additions & 3 deletions cmake/FindProj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,19 @@
# PROJ_LIBRARY


FIND_PATH(PROJ_INCLUDE_DIR proj_api.h /usr/local/include /usr/include c:/msys/local/include)

FIND_LIBRARY(PROJ_LIBRARY NAMES proj PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
FIND_PATH(PROJ_INCLUDE_DIR proj_api.h
/usr/local/include
/usr/include
c:/msys/local/include
C:/dev/cpp/proj-4.5.0/src
)

FIND_LIBRARY(PROJ_LIBRARY NAMES proj PATHS
/usr/local/lib
/usr/lib
c:/msys/local/lib
C:/dev/cpp/proj-4.5.0/src
)

IF (PROJ_INCLUDE_DIR AND PROJ_LIBRARY)
SET(PROJ_FOUND TRUE)
Expand Down
18 changes: 15 additions & 3 deletions cmake/FindSqlite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,21 @@
# SQLITE3_LIBRARY


FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h /usr/local/include /usr/include c:/msys/local/include)

FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 PATHS /usr/local/lib /usr/lib c:/msys/local/lib)
FIND_PATH(SQLITE3_INCLUDE_DIR sqlite3.h
/usr/local/include
/usr/include
c:/msys/local/include
#msvc
c:/dev/cpp/sqlite3
)

FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 PATHS
/usr/local/lib
/usr/lib
c:/msys/local/lib
#msvc
c:/dev/cpp/sqlite3
)

IF (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY)
SET(SQLITE3_FOUND TRUE)
Expand Down
74 changes: 39 additions & 35 deletions cmake/Flex.cmake
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
# flex a .ll file

# search flex
MACRO(FIND_FLEX)
IF(NOT FLEX_EXECUTABLE)
FIND_PROGRAM(FLEX_EXECUTABLE flex)
IF (NOT FLEX_EXECUTABLE)
MESSAGE(FATAL_ERROR "flex not found - aborting")
ENDIF (NOT FLEX_EXECUTABLE)
ENDIF(NOT FLEX_EXECUTABLE)
ENDMACRO(FIND_FLEX)

MACRO(ADD_FLEX_FILES _sources )
FIND_FLEX()

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}/flex_${_basename}.cpp)


# flex a .ll file

# search flex
MACRO(FIND_FLEX)
IF(NOT FLEX_EXECUTABLE)
IF (MSVC)
FIND_PROGRAM(FLEX_EXECUTABLE "C:/dev/cpp/flex/bin/flex.exe")
ELSE(MSVC)
FIND_PROGRAM(FLEX_EXECUTABLE flex)
ENDIF (MSVC)
IF (NOT FLEX_EXECUTABLE)
MESSAGE(FATAL_ERROR "flex not found - aborting")
ENDIF (NOT FLEX_EXECUTABLE)
ENDIF(NOT FLEX_EXECUTABLE)
ENDMACRO(FIND_FLEX)

MACRO(ADD_FLEX_FILES _sources )
FIND_FLEX()

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}/flex_${_basename}.cpp)


# -d option for flex means that it will produce output to stderr while analyzing

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${FLEX_EXECUTABLE}
ARGS
-o${_out} -d
${_in}
DEPENDS ${_in}
)

SET(${_sources} ${${_sources}} ${_out} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_FLEX_FILES)

ADD_CUSTOM_COMMAND(
OUTPUT ${_out}
COMMAND ${FLEX_EXECUTABLE}
ARGS
-o${_out} -d
${_in}
DEPENDS ${_in}
)

SET(${_sources} ${${_sources}} ${_out} )
ENDFOREACH (_current_FILE)
ENDMACRO(ADD_FLEX_FILES)

0 comments on commit 9ce8543

Please sign in to comment.