Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Org code option2 #105

Merged
merged 22 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
81450d7
[inlcude] organizing subdirectory general
cvvergara Jul 27, 2021
2d7a52d
[src] dos2unix applied to file and adjusted to include locations
cvvergara Jul 27, 2021
509cb6b
[src] adjusted to include location
cvvergara Jul 27, 2021
6db582f
[inlcude] organizing subdirectory point
cvvergara Jul 27, 2021
e96b91a
[src] adjusted to include/point location
cvvergara Jul 27, 2021
6a5b1ae
[inlcude] organizing subdirectory npoint
cvvergara Jul 27, 2021
bd8b354
[src] adjusted to include/npoint location
cvvergara Jul 27, 2021
4b2cd16
[build] removing useless include_directories and grouping mobilitydb
cvvergara Jul 27, 2021
635f3d6
[src] Organizing general subdirectory
cvvergara Jul 27, 2021
8ecf8f5
[build] using new location
cvvergara Jul 27, 2021
aa7c7a5
[src] Organizing point subdirectory
cvvergara Jul 27, 2021
6882b19
[build] adding CMakeLists files
cvvergara Jul 27, 2021
bf50533
[build] Using the changes
cvvergara Jul 27, 2021
e00d37d
[src] Organizing npoint subdirectory
cvvergara Jul 27, 2021
e075b98
[build] adding CMakeLists files
cvvergara Jul 27, 2021
c90fb1a
[build] Using the changes
cvvergara Jul 27, 2021
1e117f9
[build] removing unused code
cvvergara Jul 27, 2021
7a0ee0b
[build] removing unused definition
cvvergara Jul 27, 2021
42d7772
[build] fixing some issues about library version
cvvergara Jul 27, 2021
ea7cd74
[build] adding the control file
cvvergara Jul 27, 2021
a90a0db
[build] Doing some cleanup
cvvergara Jul 27, 2021
fa97b72
[build] organizing main build
cvvergara Jul 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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.
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