Mercurial > hg > orthanc-databases
changeset 103:9263b3de37ed
fix build on Debian Buster
author | jodogne |
---|---|
date | Tue, 22 Jan 2019 13:14:52 +0000 |
parents | 905bd21eb327 |
children | 0a713ffdf842 |
files | Framework/PostgreSQL/PostgreSQLDatabase.cpp Framework/PostgreSQL/PostgreSQLIncludes.h Framework/PostgreSQL/PostgreSQLLargeObject.cpp Framework/PostgreSQL/PostgreSQLResult.cpp Framework/PostgreSQL/PostgreSQLStatement.cpp PostgreSQL/NEWS Resources/CMake/FindPostgreSQL.cmake Resources/CMake/PostgreSQLConfiguration.cmake |
diffstat | 8 files changed, 43 insertions(+), 213 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/PostgreSQL/PostgreSQLDatabase.cpp Mon Jan 21 17:34:50 2019 +0100 +++ b/Framework/PostgreSQL/PostgreSQLDatabase.cpp Tue Jan 22 13:14:52 2019 +0000 @@ -19,6 +19,7 @@ **/ +#include "PostgreSQLIncludes.h" #include "PostgreSQLDatabase.h" #include "PostgreSQLResult.h" @@ -26,23 +27,11 @@ #include "PostgreSQLTransaction.h" #include "../Common/ImplicitTransaction.h" -#include <pg_config.h> - -#if PG_VERSION_NUM >= 110000 -# include <postgres.h> -# undef LOG // This one comes from <postgres.h>, and conflicts with <Core/Logging.h> -#endif - #include <Core/Logging.h> #include <Core/OrthancException.h> #include <boost/lexical_cast.hpp> -// PostgreSQL includes -#include <libpq-fe.h> -#include <c.h> -#include <catalog/pg_type.h> - namespace OrthancDatabases {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Framework/PostgreSQL/PostgreSQLIncludes.h Tue Jan 22 13:14:52 2019 +0000 @@ -0,0 +1,34 @@ +/** + * Orthanc - A Lightweight, RESTful DICOM Store + * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics + * Department, University Hospital of Liege, Belgium + * Copyright (C) 2017-2019 Osimis S.A., Belgium + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * 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 + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + **/ + + +#pragma once + +// PostgreSQL includes +#include <pg_config.h> + +#if PG_VERSION_NUM >= 110000 +# include <postgres.h> +# undef LOG // This one comes from <postgres.h>, and conflicts with <Core/Logging.h> +#endif + +#include <libpq-fe.h> +#include <c.h> +#include <catalog/pg_type.h>
--- a/Framework/PostgreSQL/PostgreSQLLargeObject.cpp Mon Jan 21 17:34:50 2019 +0100 +++ b/Framework/PostgreSQL/PostgreSQLLargeObject.cpp Tue Jan 22 13:14:52 2019 +0000 @@ -21,6 +21,7 @@ // http://www.postgresql.org/docs/9.1/static/lo-interfaces.html#AEN33102 +#include "PostgreSQLIncludes.h" #include "PostgreSQLLargeObject.h" #include <Core/Logging.h>
--- a/Framework/PostgreSQL/PostgreSQLResult.cpp Mon Jan 21 17:34:50 2019 +0100 +++ b/Framework/PostgreSQL/PostgreSQLResult.cpp Tue Jan 22 13:14:52 2019 +0000 @@ -19,6 +19,7 @@ **/ +#include "PostgreSQLIncludes.h" #include "PostgreSQLResult.h" #include "../Common/BinaryStringValue.h" @@ -27,26 +28,13 @@ #include "../Common/NullValue.h" #include "../Common/Utf8StringValue.h" -#include <pg_config.h> - -#if PG_VERSION_NUM >= 110000 -# include <postgres.h> -# undef LOG // This one comes from <postgres.h>, and conflicts with <Core/Logging.h> -#endif - #include <Core/OrthancException.h> #include <Core/Logging.h> +#include <Core/Endianness.h> #include <cassert> #include <boost/lexical_cast.hpp> -// PostgreSQL includes -#include <libpq-fe.h> -#include <c.h> -#include <catalog/pg_type.h> - -#include <Core/Endianness.h> - namespace OrthancDatabases {
--- a/Framework/PostgreSQL/PostgreSQLStatement.cpp Mon Jan 21 17:34:50 2019 +0100 +++ b/Framework/PostgreSQL/PostgreSQLStatement.cpp Tue Jan 22 13:14:52 2019 +0000 @@ -19,6 +19,7 @@ **/ +#include "PostgreSQLIncludes.h" #include "PostgreSQLStatement.h" #include "../Common/BinaryStringValue.h" @@ -29,26 +30,13 @@ #include "../Common/Utf8StringValue.h" #include "PostgreSQLResult.h" -#include <pg_config.h> - -#if PG_VERSION_NUM >= 110000 -# include <postgres.h> -# undef LOG // This one comes from <postgres.h>, and conflicts with <Core/Logging.h> -#endif - #include <Core/Logging.h> #include <Core/OrthancException.h> #include <Core/Toolbox.h> +#include <Core/Endianness.h> #include <cassert> -// PostgreSQL includes -#include <libpq-fe.h> -#include <c.h> -#include <catalog/pg_type.h> - -#include <Core/Endianness.h> - namespace OrthancDatabases {
--- a/PostgreSQL/NEWS Mon Jan 21 17:34:50 2019 +0100 +++ b/PostgreSQL/NEWS Tue Jan 22 13:14:52 2019 +0000 @@ -1,6 +1,8 @@ Pending changes in the mainline =============================== +* Fix build on Debian Buster + Release 3.0 (2019-01-21) ========================
--- a/Resources/CMake/FindPostgreSQL.cmake Mon Jan 21 17:34:50 2019 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -# - Find the PostgreSQL installation. -# In Windows, we make the assumption that, if the PostgreSQL files are installed, the default directory -# will be C:\Program Files\PostgreSQL. -# -# This module defines -# PostgreSQL_LIBRARIES - the PostgreSQL libraries needed for linking -# PostgreSQL_INCLUDE_DIRS - the directories of the PostgreSQL headers -# PostgreSQL_VERSION_STRING - the version of PostgreSQL found (since CMake 2.8.8) - -#============================================================================= -# Copyright 2004-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# ---------------------------------------------------------------------------- -# History: -# This module is derived from the module originally found in the VTK source tree. -# -# ---------------------------------------------------------------------------- -# Note: -# PostgreSQL_ADDITIONAL_VERSIONS is a variable that can be used to set the -# version mumber of the implementation of PostgreSQL. -# In Windows the default installation of PostgreSQL uses that as part of the path. -# E.g C:\Program Files\PostgreSQL\8.4. -# Currently, the following version numbers are known to this module: -# "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0" -# -# To use this variable just do something like this: -# set(PostgreSQL_ADDITIONAL_VERSIONS "9.2" "8.4.4") -# before calling find_package(PostgreSQL) in your CMakeLists.txt file. -# This will mean that the versions you set here will be found first in the order -# specified before the default ones are searched. -# -# ---------------------------------------------------------------------------- -# You may need to manually set: -# PostgreSQL_INCLUDE_DIR - the path to where the PostgreSQL include files are. -# PostgreSQL_LIBRARY_DIR - The path to where the PostgreSQL library files are. -# If FindPostgreSQL.cmake cannot find the include files or the library files. -# -# ---------------------------------------------------------------------------- -# The following variables are set if PostgreSQL is found: -# PostgreSQL_FOUND - Set to true when PostgreSQL is found. -# PostgreSQL_INCLUDE_DIRS - Include directories for PostgreSQL -# PostgreSQL_LIBRARY_DIRS - Link directories for PostgreSQL libraries -# PostgreSQL_LIBRARIES - The PostgreSQL libraries. -# -# ---------------------------------------------------------------------------- -# If you have installed PostgreSQL in a non-standard location. -# (Please note that in the following comments, it is assumed that <Your Path> -# points to the root directory of the include directory of PostgreSQL.) -# Then you have three options. -# 1) After CMake runs, set PostgreSQL_INCLUDE_DIR to <Your Path>/include and -# PostgreSQL_LIBRARY_DIR to wherever the library pq (or libpq in windows) is -# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/PostgreSQL<-version>. This will allow find_path() -# to locate PostgreSQL_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g. In your CMakeLists.txt file -# set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include") -# 3) Set an environment variable called ${PostgreSQL_ROOT} that points to the root of where you have -# installed PostgreSQL, e.g. <Your Path>. -# -# ---------------------------------------------------------------------------- - -set(PostgreSQL_INCLUDE_PATH_DESCRIPTION "top-level directory containing the PostgreSQL include directories. E.g /usr/local/include/PostgreSQL/8.4 or C:/Program Files/PostgreSQL/8.4/include") -set(PostgreSQL_INCLUDE_DIR_MESSAGE "Set the PostgreSQL_INCLUDE_DIR cmake cache entry to the ${PostgreSQL_INCLUDE_PATH_DESCRIPTION}") -set(PostgreSQL_LIBRARY_PATH_DESCRIPTION "top-level directory containing the PostgreSQL libraries.") -set(PostgreSQL_LIBRARY_DIR_MESSAGE "Set the PostgreSQL_LIBRARY_DIR cmake cache entry to the ${PostgreSQL_LIBRARY_PATH_DESCRIPTION}") -set(PostgreSQL_ROOT_DIR_MESSAGE "Set the PostgreSQL_ROOT system variable to where PostgreSQL is found on the machine E.g C:/Program Files/PostgreSQL/8.4") - - -set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS} - "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0") - -# Define additional search paths for root directories. -if ( WIN32 ) - foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} ) - set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "C:/Program Files/PostgreSQL/${suffix}" ) - endforeach() -else() - foreach (suffix ${PostgreSQL_KNOWN_VERSIONS} ) - set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} "/usr/include/postgresql/${suffix}" "/usr/local/include/postgresql/${suffix}") - endforeach() -endif() -set( PostgreSQL_ROOT_DIRECTORIES - ENV PostgreSQL_ROOT - ${PostgreSQL_ROOT} - ${PostgreSQL_ADDITIONAL_SEARCH_PATHS} -) - -# -# Look for an installation. -# -find_path(PostgreSQL_INCLUDE_DIR - NAMES libpq-fe.h - PATHS - # Look in other places. - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - pgsql - postgresql - include - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" -) - -find_path(PostgreSQL_TYPE_INCLUDE_DIR - NAMES catalog/pg_type.h - PATHS - # Look in other places. - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - postgresql - pgsql/server - postgresql/server - include/server - server - # Help the user find it if we cannot. - DOC "The ${PostgreSQL_INCLUDE_DIR_MESSAGE}" - ) - -# The PostgreSQL library. -set (PostgreSQL_LIBRARY_TO_FIND pq) -# Setting some more prefixes for the library -set (PostgreSQL_LIB_PREFIX "") -if ( WIN32 ) - set (PostgreSQL_LIB_PREFIX ${PostgreSQL_LIB_PREFIX} "lib") - set ( PostgreSQL_LIBRARY_TO_FIND ${PostgreSQL_LIB_PREFIX}${PostgreSQL_LIBRARY_TO_FIND}) -endif() - -find_library( PostgreSQL_LIBRARY - NAMES ${PostgreSQL_LIBRARY_TO_FIND} - PATHS - ${PostgreSQL_ROOT_DIRECTORIES} - PATH_SUFFIXES - lib -) -get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH) - -if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") - file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str - REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"") - - string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1" - PostgreSQL_VERSION_STRING "${pgsql_version_str}") - unset(pgsql_version_str) -endif() - -# Did we find anything? -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(PostgreSQL - REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR - VERSION_VAR PostgreSQL_VERSION_STRING) -set( PostgreSQL_FOUND ${POSTGRESQL_FOUND}) - -# Now try to get the include and library path. -if(PostgreSQL_FOUND) - - set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR} ) - set(PostgreSQL_LIBRARY_DIRS ${PostgreSQL_LIBRARY_DIR} ) - set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY_TO_FIND}) - #message("Final PostgreSQL include dir: ${PostgreSQL_INCLUDE_DIRS}") - #message("Final PostgreSQL library dir: ${PostgreSQL_LIBRARY_DIRS}") - #message("Final PostgreSQL libraries: ${PostgreSQL_LIBRARIES}") -endif() - -mark_as_advanced(PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR PostgreSQL_LIBRARY )
--- a/Resources/CMake/PostgreSQLConfiguration.cmake Mon Jan 21 17:34:50 2019 +0100 +++ b/Resources/CMake/PostgreSQLConfiguration.cmake Tue Jan 22 13:14:52 2019 +0000 @@ -376,7 +376,7 @@ source_group(ThirdParty\\PostgreSQL REGULAR_EXPRESSION ${LIBPQ_SOURCES_DIR}/.*) else() - include(${CMAKE_CURRENT_LIST_DIR}/FindPostgreSQL.cmake) + include(FindPostgreSQL) include_directories( ${PostgreSQL_INCLUDE_DIR} ${PostgreSQL_TYPE_INCLUDE_DIR}