Skip to content

Commit

Permalink
Merge pull request #105 from cvvergara/org-code-option2
Browse files Browse the repository at this point in the history
Org code option2
  • Loading branch information
cvvergara committed Jul 27, 2021
2 parents 057329d + fa97b72 commit a61c886
Show file tree
Hide file tree
Showing 162 changed files with 1,395 additions and 1,387 deletions.
143 changes: 60 additions & 83 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,49 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
You may need to remove 'CMakeCache.txt' and 'CMakeFiles/'.")
endif()

project(MobilityDB VERSION 1.0)
set(MOBILITYDB_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
project(MobilityDB VERSION 1.0.0)
set(MOBILITYDB_VERSION "${MobilityDB_VERSION}")
set(MOBILITYDB_LIB_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
set(MOBILITYDB_LIB_NAME "${CMAKE_PROJECT_NAME}-${MOBILITYDB_LIB_VERSION}")
set(PROJECT_VERSION_DEV "Beta 3")
set(MOBILITYDB_VERSION_STR "${PROJECT_NAME} ${MOBILITYDB_VERSION} ${PROJECT_VERSION_DEV}")
string(TOLOWER ${CMAKE_PROJECT_NAME} MOBILITYDB_LOWERCASE_NAME)
set(MOBILITYDB_EXTENSION_FILE "${MOBILITYDB_LOWERCASE_NAME}--${MOBILITYDB_VERSION}.sql")

add_definitions(-DMOBILITYDB_VERSION_STR="${MOBILITYDB_VERSION_STR}")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(CheckSymbolExists)

set(SRCS
src/geo_constructors.c
src/doublen.c
src/lifting.c
src/period.c
src/periodset.c
src/rangetypes_ext.c
src/skiplist.c
src/tbool_boolops.c
src/tbox.c
src/tempcache.c
src/temporal.c
src/tinstant.c
src/tinstantset.c
src/tsequence.c
src/tsequenceset.c
src/temporal_aggfuncs.c
src/temporal_analyze.c
src/temporal_boxops.c
src/temporal_compops.c
src/temporal_gist.c
src/tnumber_mathfuncs.c
src/temporal_parser.c
src/temporal_posops.c
src/temporal_selfuncs.c
src/temporal_spgist.c
src/temporal_tile.c
src/temporal_util.c
src/temporal_waggfuncs.c
src/timeops.c
src/timestampset.c
src/time_aggfuncs.c
src/time_analyze.c
src/time_gist.c
src/time_selfuncs.c
src/time_spgist.c
src/tnumber_distance.c
src/tnumber_gist.c
src/tnumber_selfuncs.c
src/tnumber_spgist.c
src/ttext_textfuncs.c
)
include(CTest)
enable_testing()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

#-------------------------------------
# special cases of compiler flags
#-------------------------------------

include(CheckCCompilerFlag)
if(NOT WIN32)
CHECK_C_COMPILER_FLAG("-fPIC" C_COMPILER_SUPPORTS_FPIC)
if(C_COMPILER_SUPPORTS_FPIC)
add_definitions(-fPIC)
endif()
endif()

check_symbol_exists(ffsl "string.h" HAS_FFSL)
if(NOT HAS_FFSL)
add_definitions(-DNO_FFSL)
endif()

#-------------------------------------
# Verify PostgreSQL Version
#-------------------------------------
set(PG_MIN_MAJOR_VERSION "10")
set(PG_MAX_MAJOR_VERSION "14")

#--------------------------------
find_package(POSTGRESQL ${PG_MIN_MAJOR_VERSION} REQUIRED)
if (NOT POSTGRES_VERSION VERSION_LESS PG_MAX_MAJOR_VERSION)
message(FATAL_ERROR "Not supporting PostgreSQL ${POSTGRESQL_VERSION}")
Expand All @@ -85,12 +68,15 @@ if(WIN32)
link_directories(${POSTGRESQL_LIBRARIES})
link_libraries(postgres)
endif()
#--------------------------------

# Currently does not work with other versions of PostGIS
find_package(POSTGIS 2.5 EXACT REQUIRED)
add_definitions(-DPOSTGIS_VERSION_STR="${POSTGIS_VERSION_STR}")
add_definitions(-DPOSTGIS_VERSION_NUMBER=${POSTGIS_VERSION_NUMBER})

include_directories("include")
#--------------------------------


add_definitions(-Wall -Wextra -std=gnu1x -Wno-unused-parameter)
if (CMAKE_COMPILER_IS_GNUCC)
if (WITH_COVERAGE)
Expand All @@ -102,60 +88,51 @@ endif ()
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")


set(CONTROLIN "control.in")
set(CONTROLOUT "${MOBILITYDB_LOWERCASE_NAME}.control")
set(SQLPP "${MOBILITYDB_LOWERCASE_NAME}--${MOBILITYDB_VERSION}.sql.c")
set(MOBILITYDB_EXTENSION_FILE "${MOBILITYDB_LOWERCASE_NAME}--${MOBILITYDB_VERSION}.sql")


add_custom_target(sqlscript ALL DEPENDS ${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE})
add_custom_target(control ALL DEPENDS ${CMAKE_BINARY_DIR}/${CONTROLOUT})

add_library(${CMAKE_PROJECT_NAME} MODULE ${SRCS})

if (APPLE)
SET_TARGET_PROPERTIES(${CMAKE_PROJECT_NAME} PROPERTIES LINK_FLAGS "-Wl,-undefined,dynamic_lookup -bundle_loader /usr/local/bin/postgres")
endif ()

# Currently does not work with other versions of PostGIS
find_package(POSTGIS 2.5 EXACT REQUIRED)
add_definitions(-DPOSTGIS_VERSION_STR="${POSTGIS_VERSION_STR}")
add_definitions(-DPOSTGIS_VERSION_NUMBER=${POSTGIS_VERSION_NUMBER})
#--------------------------------
# Belongs to MobilityDB
# Must go before target_link_libraries

include_directories("include")
add_subdirectory("src")
set(PROJECT_OBJECTS "$<TARGET_OBJECTS:general>")
set(PROJECT_OBJECTS ${PROJECT_OBJECTS} "$<TARGET_OBJECTS:point>")
set(PROJECT_OBJECTS ${PROJECT_OBJECTS} "$<TARGET_OBJECTS:npoint>")
add_library(${MOBILITYDB_LIB_NAME} MODULE ${PROJECT_OBJECTS})

#--------------------------------
# other requirements
#--------------------------------

find_package(JSON-C REQUIRED)
include_directories(${JSON-C_INCLUDE_DIRS})
target_link_libraries(${CMAKE_PROJECT_NAME} ${JSON-C_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${JSON-C_LIBRARIES})

find_package(PROJ REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} ${PROJ_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${PROJ_LIBRARIES})
include_directories(${PROJ_INCLUDE_DIRS})

find_package(LWGEOM REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} ${LWGEOM_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${LWGEOM_LIBRARIES})
include_directories(${LWGEOM_INCLUDE_DIRS})

find_package(GSL REQUIRED)
target_link_libraries(${CMAKE_PROJECT_NAME} ${GSL_LIBRARY})
target_link_libraries(${CMAKE_PROJECT_NAME} ${GSL_CLBAS_LIBRARY})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${GSL_LIBRARY})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${GSL_CLBAS_LIBRARY})

#--------------------------------
# Belongs to MobilityDB

add_subdirectory(test)
include("point/point.cmake")
include("npoint/npoint.cmake")

add_subdirectory(sql)

check_symbol_exists(ffsl "string.h" HAS_FFSL)
if(NOT HAS_FFSL)
add_definitions(-D NO_FFSL)
endif()
add_custom_target(sqlscript ALL DEPENDS ${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE})
add_custom_target(control ALL DEPENDS ${CMAKE_BINARY_DIR}/mobilitydb.control)

add_subdirectory(sql)
add_custom_command(
OUTPUT ${CONTROLOUT}
COMMAND cat ${CONTROLIN} | sed -e's/LIBNAME/${CMAKE_PROJECT_NAME}/' -e's/VERSION/${MOBILITYDB_VERSION}/' > ${CMAKE_BINARY_DIR}/${CONTROLOUT}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
DEPENDS ${CONTROLIN})

install(TARGETS ${CMAKE_PROJECT_NAME} DESTINATION "${POSTGRESQL_DYNLIB_DIR}")
install(FILES "${CMAKE_BINARY_DIR}/${CONTROLOUT}" DESTINATION "${POSTGRESQL_SHARE_DIR}/extension")
install(FILES "${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE}" DESTINATION "${POSTGRESQL_SHARE_DIR}/extension")
install(TARGETS ${MOBILITYDB_LIB_NAME} DESTINATION "${POSTGRESQL_DYNLIB_DIR}")
install(
FILES "${CMAKE_BINARY_DIR}/mobilitydb.control" "${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE}"
DESTINATION "${POSTGRESQL_SHARE_DIR}/extension")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions include/temporal.h → include/general/temporal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "timetypes.h"
#include "tbox.h"
#include "stbox.h"
#include "point/stbox.h"

#if POSTGRESQL_VERSION_NUMBER < 130000
#ifndef USE_FLOAT4_BYVAL
Expand Down Expand Up @@ -143,7 +143,6 @@ typedef enum
* Compatibility with older versions of PostgreSQL
*****************************************************************************/

#define MOBDB_VERSION_STR "MobilityDB 1.0 beta 3"


/*****************************************************************************
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <utils/rangetypes.h>

#include "temporal.h"
#include "postgis.h"
#include "point/postgis.h"

/*****************************************************************************/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion include/tinstant.h → include/general/tinstant.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <utils/rangetypes.h>

#include "temporal.h"
#include "postgis.h"
#include "point/postgis.h"

/*****************************************************************************/

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion npoint/include/tnpoint.h → include/npoint/tnpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <postgres.h>
#include <catalog/pg_type.h>
#include "temporal.h"
#include "general/temporal.h"

/*****************************************************************************
* Struct definitions
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <postgres.h>
#include <catalog/pg_type.h>

#include "temporal.h"
#include "general/temporal.h"
#include "tnpoint.h"

/*****************************************************************************/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <postgres.h>
#include <catalog/pg_type.h>
#include "temporal.h"
#include "general/temporal.h"

/*****************************************************************************/

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#ifndef __TNPOINT_PARSER_H__
#define __TNPOINT_PARSER_H__

#include "temporal.h"
#include "general/temporal.h"
#include "tnpoint.h"

/*****************************************************************************/
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <postgres.h>
#include <catalog/pg_type.h>

#include "temporal.h"
#include "general/temporal.h"
#include "tnpoint_static.h"

/*****************************************************************************/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion point/include/postgis.h → include/point/postgis.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ extern Datum geography_lt(PG_FUNCTION_ARGS);
#define PG_GETARG_GSERIALIZED_P(varno) ((GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(varno)))
#define PG_GETARG_GSERIALIZED_P_COPY(varno) ((GSERIALIZED *)PG_DETOAST_DATUM_COPY(PG_GETARG_DATUM(varno)))

#include "temporal.h"
#include "general/temporal.h"
#include <liblwgeom.h>

#endif /* __TEMPORAL_POSTGIS_H__ */
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion point/include/stbox.h → include/point/stbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#endif
#include <liblwgeom.h>

#include "timetypes.h"
#include "general/timetypes.h"

/*****************************************************************************
* Struct definition
Expand Down
2 changes: 1 addition & 1 deletion point/include/tpoint.h → include/point/tpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <postgres.h>
#include <catalog/pg_type.h>

#include "temporal.h"
#include "general/temporal.h"

#include <liblwgeom.h>
#include "stbox.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include <fmgr.h>
#include <catalog/pg_type.h>

#include "temporal.h"
#include "skiplist.h"
#include "general/temporal.h"
#include "general/skiplist.h"

/*****************************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <postgres.h>
#include <fmgr.h>

#include "temporaltypes.h"
#include "general/temporaltypes.h"

/*****************************************************************************/

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include <catalog/pg_type.h>
#include <liblwgeom.h>

#include "temporal.h"
#include "temporal_util.h"
#include "general/temporal.h"
#include "general/temporal_util.h"
#include "stbox.h"

/*****************************************************************************/
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <catalog/pg_type.h>
#include <float.h>

#include "temporal.h"
#include "general/temporal.h"
#include <liblwgeom.h>
#include "tpoint.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <postgres.h>
#include <catalog/pg_type.h>
#include <utils/builtins.h>
#include "temporal.h"
#include "general/temporal.h"

/*****************************************************************************/

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#include <postgres.h>
#include <catalog/pg_type.h>
#include "temporal.h"
#include "general/temporal.h"

/*****************************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <postgres.h>
#include <catalog/pg_type.h>
#include "temporal.h"
#include "general/temporal.h"

/*****************************************************************************/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <catalog/pg_statistic.h>
#include <utils/selfuncs.h>

#include "tempcache.h"
#include "general/tempcache.h"
#include "tpoint.h"
#include "tpoint_analyze.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <postgres.h>
#include <liblwgeom.h>

#include "temporal.h"
#include "general/temporal.h"
#include "tpoint.h"

/*****************************************************************************/
Expand Down
Loading

0 comments on commit a61c886

Please sign in to comment.