Skip to content

Commit

Permalink
[version] adding code for issue #716
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Jul 24, 2019
1 parent 86b3529 commit f8964bb
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 4 deletions.
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(pgr/BuildType)
add_definitions(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}")


#---------------------------------------------
Expand All @@ -38,8 +39,14 @@ project(PGROUTING VERSION 3.0.0
set(PGROUTING_VERSION_DEV "-dev")

include(pgr/GitInfo)
add_definitions(-DPGROUTING_HASH="${PGROUTING_GIT_HASH}")

include(pgr/Version)
add_definitions(-DPGROUTING_VERSION="${PGROUTING_VERSION}${PGROUTING_VERSION_DEV}")
add_definitions(-DPGROUTING_LIB_NAME="pgrouting-${PGROUTING_LIB_VERSION}")

string(TIMESTAMP COMPILATION_DATE "%Y/%m/%d")
add_definitions(-DCOMPILATION_DATE="${COMPILATION_DATE}")



Expand Down Expand Up @@ -114,6 +121,7 @@ elseif(COMPILER_SUPPORTS_CXX0X)
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++0x or C++11 flags support.")
endif()
add_definitions(-DCOMPILER_VERSION="${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")



Expand Down Expand Up @@ -205,9 +213,8 @@ if(WIN32)
endif(MSVC)
endif(WIN32)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPGSQL_VERSION=${PGSQL_VERSION}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPGSQL_VERSION=${PGSQL_VERSION}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DPGSQL_VERSION=${PGSQL_VERSION}")
add_definitions(-DPGSQL_VERSION=${PGSQL_VERSION})
add_definitions(-DPOSTGRES_VERSION="${POSTGRESQL_VERSION_STRING}")
message(STATUS "PGSQL_VERSION=${PGSQL_VERSION}")


Expand All @@ -223,6 +230,7 @@ if(Boost_FOUND)
else()
message(FATAL_ERROR " Please check your Boost installation ")
endif()
add_definitions(-DBOOST_VERSION="${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")


# Boost for Chinese postman needs 1.55 at least
Expand Down
1 change: 1 addition & 0 deletions configuration.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dagShortestPath | Y | Y | Y
chinese | Y | Y | Y
spanningTree | Y | Y | Y
mincut | Y | Y | Y
version | Y | Y | N
#----------------------
# SQL only directories
#----------------------
Expand Down
1 change: 0 additions & 1 deletion sql/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

SET(LOCAL_FILES
pgRouting-header.sql
pgrouting_version.sql
_point_toId.sql
_startPoint.sql
_endPoint.sql
Expand Down
8 changes: 8 additions & 0 deletions sql/sigs/pgrouting--3.0.0.sig
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ pgr_bellmanford(text,text,bigint,anyarray,boolean)
pgr_bellmanford(text,text,bigint,bigint,boolean)
_pgr_biconnectedcomponents(text)
pgr_biconnectedcomponents(text)
_pgr_boost_version()
pgr_boykovkolmogorov(text,anyarray,anyarray)
pgr_boykovkolmogorov(text,anyarray,bigint)
pgr_boykovkolmogorov(text,bigint,anyarray)
pgr_boykovkolmogorov(text,bigint,bigint)
_pgr_bridges(text)
pgr_bridges(text)
_pgr_build_type()
_pgr_checkverttab(text,text[],integer,text)
pgr_chinesepostmancost(text)
pgr_chinesepostman(text)
_pgr_chinesepostman(text,boolean)
_pgr_compilation_date()
_pgr_compiler_version()
_pgr_connectedcomponents(text)
pgr_connectedcomponents(text)
_pgr_contraction(text,bigint[],integer,bigint[],boolean)
Expand Down Expand Up @@ -104,12 +108,14 @@ _pgr_endpoint(geometry)
pgr_extractvertices(text,boolean)
_pgr_floydwarshall(text,boolean)
pgr_floydwarshall(text,boolean)
pgr_full_version()
_pgr_getcolumnname(text,text,integer,text)
_pgr_getcolumnname(text,text,text,integer,text)
_pgr_getcolumntype(text,text,integer,text)
_pgr_getcolumntype(text,text,text,integer,text)
_pgr_get_statement(text)
_pgr_gettablename(text,integer,text)
_pgr_git_hash()
_pgr_iscolumnindexed(text,text,integer,text)
_pgr_iscolumnindexed(text,text,text,integer,text)
_pgr_iscolumnintable(text,text)
Expand All @@ -127,6 +133,7 @@ pgr_kruskal(text)
_pgr_kruskal(text,anyarray,text,bigint,double precision)
_pgr_ksp(text,bigint,bigint,integer,boolean,boolean)
pgr_ksp(text,bigint,bigint,integer,boolean,boolean)
_pgr_lib_version()
_pgr_linegraphfull(text)
pgr_linegraphfull(text)
_pgr_linegraph(text,boolean)
Expand All @@ -151,6 +158,7 @@ _pgr_msg(integer,text,text)
pgr_nodenetwork(text,double precision,text,text,text,text,boolean)
_pgr_onerror(boolean,integer,text,text,text,text)
_pgr_parameter_check(text,text,boolean)
_pgr_pgsql_version()
_pgr_pickdelivereuclidean(text,text,double precision,integer,integer)
pgr_pickdelivereuclidean(text,text,double precision,integer,integer)
_pgr_pickdeliver(text,text,text,double precision,integer,integer)
Expand Down
13 changes: 13 additions & 0 deletions sql/version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

SET(LOCAL_FILES
_version.sql
version.sql
full_version.sql
)

foreach (f ${LOCAL_FILES})
configure_file(${f} ${f})
list(APPEND PACKAGE_SQL_FILES ${CMAKE_CURRENT_BINARY_DIR}/${f})
endforeach()

set(PGROUTING_SQL_FILES ${PGROUTING_SQL_FILES} ${PACKAGE_SQL_FILES} PARENT_SCOPE)
94 changes: 94 additions & 0 deletions sql/version/_version.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/*PGR-GNU*****************************************************************
Copyright (c) 2019 pgRouting developers
Mail: project@pgrouting.org
Developer:
Copyright (c) 2019 Celia Virginia Vergara Castillo
------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
********************************************************************PGR-GNU*/

CREATE OR REPLACE FUNCTION _pgr_boost_version()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_boost_version() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_build_type()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_build_type() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_compilation_date()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_compilation_date() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_compiler_version()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_compiler_version() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_git_hash()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_compilation_date() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_lib_version()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_lib_version() IS
'pgRouting internal function';

---

CREATE OR REPLACE FUNCTION _pgr_pgsql_version()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION _pgr_pgsql_version() IS
'pgRouting internal function';

54 changes: 54 additions & 0 deletions sql/version/full_version.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*PGR-GNU*****************************************************************
Copyright (c) 2019 pgRouting developers
Mail: project@pgrouting.org
Developer:
Copyright (c) 2019 Celia Virginia Vergara Castillo
------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
********************************************************************PGR-GNU*/



CREATE OR REPLACE FUNCTION pgr_full_version(
OUT version TEXT,
OUT build_type TEXT,
OUT library TEXT,
OUT PostgreSQL TEXT,
OUT compiler TEXT,
OUT boost TEXT,
OUT hash TEXT
)
RETURNS Record AS
$BODY$
SELECT pgr_version(),
_pgr_build_type(),
_pgr_lib_version(),
_pgr_pgsql_version(),
_pgr_compiler_version(),
_pgr_boost_version(),
_pgr_git_hash()
$BODY$
LANGUAGE sql IMMUTABLE;

COMMENT ON FUNCTION pgr_full_version() IS
'pgr_full_version
- Documentation
- ${PGROUTING_DOC_LINK}/pgr_full_version.html
';
36 changes: 36 additions & 0 deletions sql/version/version.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*PGR-GNU*****************************************************************
Copyright (c) 2019 pgRouting developers
Mail: project@pgrouting.org
Developer:
Copyright (c) 2019 Celia Virginia Vergara Castillo
------
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 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 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 Street, Fifth Floor, Boston, MA 02110-1301 USA.
********************************************************************PGR-GNU*/

CREATE OR REPLACE FUNCTION pgr_version()
RETURNS TEXT AS
'MODULE_PATHNAME'
LANGUAGE C VOLATILE STRICT;

COMMENT ON FUNCTION pgr_version() IS
'pgr_version
- Documentation
- ${PGROUTING_DOC_LINK}/pgr_version.html
';
4 changes: 4 additions & 0 deletions src/version/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ADD_LIBRARY(version OBJECT
version.c
_version.c
)
Loading

0 comments on commit f8964bb

Please sign in to comment.