[Greater-commits] r175 - in trunk/GREAT-ER-DB/trunk/impl/postgresql: . cmake
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jun 9 12:57:30 CEST 2011
Author: aheinecke
Date: 2011-06-09 12:57:29 +0200 (Thu, 09 Jun 2011)
New Revision: 175
Added:
trunk/GREAT-ER-DB/trunk/impl/postgresql/CMakeLists.txt
trunk/GREAT-ER-DB/trunk/impl/postgresql/cmake/
trunk/GREAT-ER-DB/trunk/impl/postgresql/cmake/FindPostgresql.cmake
Log:
Add cmake buildsystem
Added: trunk/GREAT-ER-DB/trunk/impl/postgresql/CMakeLists.txt
===================================================================
--- trunk/GREAT-ER-DB/trunk/impl/postgresql/CMakeLists.txt 2011-06-09 09:26:30 UTC (rev 174)
+++ trunk/GREAT-ER-DB/trunk/impl/postgresql/CMakeLists.txt 2011-06-09 10:57:29 UTC (rev 175)
@@ -0,0 +1,89 @@
+# CMakeLists.txt
+#
+# Description: cmake file for dagreater_pg psql database bindings for GREAT-ER
+#
+# Authors:
+# Andre Heinecke <aheinecke at intevation.de>
+#
+# Copyright:
+# Copyright (C) 2011 by Intevation GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2,
+# or, at your option, any later version as published by the Free
+# Software Foundation
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+project(dagreater_pg)
+
+cmake_minimum_required(VERSION 2.6)
+
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
+
+set(CMAKE_DAGREATER_PG_VERSION_MAJOR 1)
+set(CMAKE_DAGREATER_PG_VERSION_MINOR 9)
+set(CMAKE_DAGREATER_PG_VERSION_PATCH 0)
+set(CMAKE_DAGREATER_PG_VERSION_STRING "${CMAKE_DAGREATER_PG_VERSION_MAJOR}.${CMAKE_DAGREATER_PG_VERSION_MINOR}.${CMAKE_DAGREATER_PG_VERSION_PATCH}")
+
+option(DAGERATER_ENABLE_TESTS "Enable tests")
+if (DAGREATER_ENABLE_TESTS)
+ message(STATUS "Testing is not yet implemented from cmake")
+ add_subdirectory(tests)
+endif (DAGREATER_ENABLE_TESTS)
+
+find_package(Postgresql REQUIRED)
+find_program(ECPG_EXECUTABLE ecpg REQUIRED)
+
+if (NOT ECPG_EXECUTABLE)
+ message(ERROR "Embedded psql precompiler not found!")
+endif()
+
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ${POSTGRESQL_INCLUDE_DIR})
+set(dagreater_pg_SRCS
+ dagreater_pg.c
+ gdagreater_pg.c
+ daexplib_pg.h
+ dagreater_pg.h
+ gdaexplib_pg.h
+)
+
+install(FILES
+ daexplib_pg.h
+ dagreater_pg.h
+ gdaexplib_pg.h
+ DESTINATION include/dagreater COMPONENT Devel
+)
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dagreater_pg.c
+ COMMAND ${ECPG_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/dagreater_pg.pgc -o
+ ${CMAKE_CURRENT_BINARY_DIR}/dagreater_pg.c
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dagreater_pg.pgc
+)
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gdagreater_pg.c
+ COMMAND ${ECPG_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gdagreater_pg.pgc -o
+ ${CMAKE_CURRENT_BINARY_DIR}/gdagreater_pg.c
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gdagreater_pg.pgc
+)
+
+add_library(dagreater_pg SHARED ${dagreater_pg_SRCS})
+
+set_target_properties(dagreater_pg PROPERTIES
+ VERSION ${CMAKE_DAGREATER_PG_VERSION_STRING}
+ SOVERSION ${CMAKE_DAGREATER_PG_VERSION_MAJOR}
+ LINK_INTERFACE_LIBRARIES ""
+ DEFINE_SYMBOL DAGREATER_PG_MAKEDLL
+)
+
+install(TARGETS dagreater_pg
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
+
Added: trunk/GREAT-ER-DB/trunk/impl/postgresql/cmake/FindPostgresql.cmake
===================================================================
--- trunk/GREAT-ER-DB/trunk/impl/postgresql/cmake/FindPostgresql.cmake 2011-06-09 09:26:30 UTC (rev 174)
+++ trunk/GREAT-ER-DB/trunk/impl/postgresql/cmake/FindPostgresql.cmake 2011-06-09 10:57:29 UTC (rev 175)
@@ -0,0 +1,58 @@
+# - 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 at 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)
+
+else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+
+ FIND_PATH(POSTGRESQL_INCLUDE_DIR libpq-fe.h
+ /usr/include/server
+ /usr/include/pgsql/server
+ /usr/local/include/pgsql/server
+ /usr/include/postgresql
+ /usr/include/postgresql/server
+ /usr/include/postgresql/*/server
+ /usr/local/include/postgresql/server
+ /usr/local/include/postgresql/*/server
+ /usr/local/pgsql/include
+ $ENV{ProgramFiles}/PostgreSQL/*/include/server
+ $ENV{SystemDrive}/PostgreSQL/*/include/server
+ )
+
+ find_library(POSTGRESQL_LIBRARIES NAMES pq libpq
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /usr/lib/postgresql
+ /usr/lib64
+ /usr/local/lib64
+ /usr/lib64/postgresql
+ /usr/local/pgsql/lib
+ $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}")
+ INCLUDE_DIRECTORIES(${POSTGRESQL_INCLUDE_DIR})
+ else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+ set(POSTGRESQL_FOUND FALSE)
+ message(STATUS "PostgreSQL not found.")
+ endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+
+ mark_as_advanced(POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARIES)
+
+endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
More information about the Greater-commits
mailing list