Skip to content

Commit

Permalink
Update built to find PgSQL
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Ramsey committed Jun 12, 2013
1 parent 4150c98 commit edbeae7
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 9 deletions.
25 changes: 18 additions & 7 deletions CMakeLists.txt
Expand Up @@ -325,15 +325,26 @@ endif()

set(WITH_SOCI FALSE CACHE BOOL "Choose if SOCI database support should be built")
if (WITH_SOCI)
find_package(Soci 3.1.0)
if (SOCI_FOUND)
mark_as_advanced(CLEAR SOCI_INCLUDE_DIRS)
mark_as_advanced(CLEAR SOCI_LIBRARY)
include_directories(${SOCI_INCLUDE_DIRS})
set(PDAL_HAVE_SOCI 1)
endif()
find_package(Soci 3.1.0)
if (SOCI_FOUND)
mark_as_advanced(CLEAR SOCI_INCLUDE_DIRS)
mark_as_advanced(CLEAR SOCI_LIBRARY)
include_directories(${SOCI_INCLUDE_DIRS})
set(PDAL_HAVE_SOCI 1)
endif()
endif()

set(WITH_PGPOINTCLOUD FALSE CACHE BOOL "Choose if PostgreSQL PointCloud support should be built")
if (WITH_PGPOINTCLOUD)
find_package(PostgreSQL)
if (POSTGRESQL_FOUND)
set(PDAL_HAVE_PGPOINTCLOUD 1)
mark_as_advanced(CLEAR POSTGRESQL_INCLUDE_DIRS)
mark_as_advanced(CLEAR POSTGRESQL_LIBRARIES)
include_directories(${POSTGRESQL_INCLUDE_DIRS})
message(STATUS "Building with PgPointCloud")
endif()
endif()

set(WITH_NITRO FALSE CACHE BOOL "Choose if Nitro support (only install supported is from http://github.com/hobu/nitro)")

Expand Down
55 changes: 55 additions & 0 deletions cmake/modules/FindPostgreSQL.cmake
@@ -0,0 +1,55 @@
# - Find PostgreSQL
# Find the PostgreSQL includes and client library
# This module defines
# POSTGRESQL_INCLUDE_DIR, where to find POSTGRESQL.h
# POSTGRESQL_LIBRARIES, the libraries needed to use POSTGRESQL.
# POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
#
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

# Add the postgresql and mysql include paths here

if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)

set(POSTGRESQL_FOUND TRUE)
message(STATUS "Enabled PostgreSQL: ${POSTGRESQL_INCLUDE_DIR}, ${POSTGRESQL_LIBRARIES}")

else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)

FIND_PATH(POSTGRESQL_INCLUDE_DIR libpq-fe.h
/usr/include/postgresql*/
/usr/pgsql*/include
/usr/local/pgsql/include
/usr/local/include
/opt/local/include
/usr/include/pgsql
$ENV{ProgramFiles}/PostgreSQL/*/include
$ENV{SystemDrive}/PostgreSQL/*/include
)

FIND_LIBRARY(POSTGRESQL_LIBRARIES NAMES pq libpq
PATHS
/usr/lib
/usr/lib/postgresql
/usr/local/lib
/usr/pgsql*/lib
/usr/lib64
/usr/lib64/postgresql
/usr/local/lib64
/usr/pgsql*/lib64
$ENV{ProgramFiles}/PostgreSQL/*/lib/ms
$ENV{SystemDrive}/PostgreSQL/*/lib/ms
)

if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
set(POSTGRESQL_FOUND TRUE)
message(STATUS "Found PostgreSQL: ${POSTGRESQL_INCLUDE_DIR}, ${POSTGRESQL_LIBRARIES}")
else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
set(POSTGRESQL_FOUND FALSE)
message(STATUS "PostgreSQL not found.")
endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)

endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
2 changes: 1 addition & 1 deletion pramsey-config.sh
Expand Up @@ -21,7 +21,7 @@ if ! [ -z "$1" ]; then
fi

cmake -G "$CONFIG" \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=${HOME}/pdal \
-DPDAL_EMBED_BOOST=${EMBED} \
-DWITH_GDAL=ON \
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Expand Up @@ -428,7 +428,7 @@ set (PDAL_DRIVERS_PGPOINTCLOUD_CPP
)

# no provision is made for building as a plugin
if (SOCI_FOUND)
if (POSTGRESQL_FOUND)
# if (NOT USE_PDAL_PLUGIN_SOCI)
list (APPEND PDAL_CPP ${PDAL_DRIVERS_PGPOINTCLOUD_CPP} )
list (APPEND PDAL_HPP ${PDAL_DRIVERS_PGPOINTCLOUD_HPP} )
Expand Down

0 comments on commit edbeae7

Please sign in to comment.