Skip to content

Commit

Permalink
Try msys2 build
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanzimanyi committed Sep 4, 2021
1 parent b07c530 commit 275ba7d
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
sudo service postgresql start
pgver=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d \()')
echo "PGVER=${pgver}" >> $GITHUB_ENV
echo "PGIS=2.5" >> $GITHUB_ENV
echo "PGIS=3" >> $GITHUB_ENV
echo "PGPORT=5432" >> $GITHUB_ENV
- name: Add PostgreSQL APT repository
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ name: Build for macOS

on:
workflow_dispatch:
push:
branch_ignore: gh-pages
pull_request:
branch_ignore: gh-pages
# push:
# branch_ignore: gh-pages
# pull_request:
# branch_ignore: gh-pages

jobs:
build:
Expand Down Expand Up @@ -38,17 +38,8 @@ jobs:
- name: test install
run: |
pg_ctl -D /usr/local/var/postgres start
# sudo groupadd postgres
# sudo useradd postgres -g postgres
sudo dscl . -create /Users/postgres
# id postgres
# id -g postgres
sudo -u postgres createdb ___mobdb___test___
sudo -u postgres psql -d ___mobdb___test___ -c "CREATE EXTENSION mobilitydb CASCADE; SELECT mobilitydb_version()"
# sudo createdb ___mobdb___test___
# sudo psql -d ___mobdb___test___ -c "CREATE EXTENSION mobilitydb CASCADE; SELECT mobilitydb_version()"
# createdb ___mobdb___test___
# psql -d ___mobdb___test___ -c "CREATE EXTENSION mobilitydb CASCADE; SELECT mobilitydb_version()"
createdb ___mobdb___test___
psql -d ___mobdb___test___ -c "CREATE EXTENSION mobilitydb CASCADE; SELECT mobilitydb_version()"
- name: Test
run: |
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/msys2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build for windows using msys2
on: [push, pull_request]

jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2

- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-postgresql
mingw-w64-x86_64-postgis
mingw-w64-x86_64-gsl
mingw-w64-i686-xz
- name: CMake build
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -G"MinGW Makefiles" ..
make
- name: CMake self-tests
run: make test
working-directory: build

# - name: CI-Build
# shell: msys2 {0}
# run: |
# cd /C/_
# mkdir build
# cd build
# cmake -DCMAKE_TOOLCHAIN_FILE=cmake/Toolchains/mingw64-x86_64.cmake -DCMAKE_BUILD_TYPE=Release -G 'MSYS Makefiles' ..
# make -j4
# make test
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Minimum version supporting fixtures
cmake_minimum_required(VERSION 3.7)
cmake_policy(VERSION 3.7...3.21)

# Disallow in-source builds
if( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
Expand Down Expand Up @@ -119,14 +120,14 @@ include_directories(SYSTEM ${GEOS_INCLUDE_DIR})
math(EXPR POSTGIS_GEOS_VERSION "${GEOS_VERSION_MAJOR} * 10 + ${GEOS_VERSION_MINOR}")
message(STATUS "POSTGIS_GEOS_VERSION: ${POSTGIS_GEOS_VERSION}")

find_package(JSON-C REQUIRED)
include_directories(SYSTEM ${JSON-C_INCLUDE_DIRS})

find_package(PROJ REQUIRED)
include_directories(SYSTEM ${PROJ_INCLUDE_DIRS})
math(EXPR POSTGIS_PROJ_VERSION "${PROJ_VERSION_MAJOR} * 10 + ${PROJ_VERSION_MINOR}")
message(STATUS "POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}")

find_package(JSON-C REQUIRED)
include_directories(SYSTEM ${JSON-C_INCLUDE_DIRS})

find_package(GSL REQUIRED)
include_directories(SYSTEM ${GSL_INCLUDE_DIRS})

Expand Down Expand Up @@ -165,11 +166,15 @@ endif()
# Specify libraries to link
#--------------------------------

target_link_libraries(${MOBILITYDB_LIB_NAME} ${JSON-C_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${PROJ_LIBRARIES})
if("${CMAKE_SHARED_LIBRARY_SUFFIX}" STREQUAL ".dll")
target_link_libraries(${MOBILITYDB_LIB_NAME} ${POSTGIS_LIBRARY})
endif()
if(POSTGIS_VERSION_NUMBER LESS 30000)
target_link_libraries(${MOBILITYDB_LIB_NAME} ${LWGEOM_LIBRARIES})
endif()
target_link_libraries(${MOBILITYDB_LIB_NAME} ${GEOS_LIBRARY})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${PROJ_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${JSON-C_LIBRARIES})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${GSL_LIBRARY})
target_link_libraries(${MOBILITYDB_LIB_NAME} ${GSL_CBLAS_LIBRARY})

Expand Down
2 changes: 2 additions & 0 deletions cmake/FindGEOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ IF(GEOS_INCLUDE_DIR AND NOT GEOS_VERSION)
FILE(READ ${GEOS_INCLUDE_DIR}/geos_c.h VERSIONFILE)
STRING(REGEX MATCH "#define GEOS_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+" GEOS_VERSION ${VERSIONFILE})
STRING(REGEX MATCH "[0-9]+\\.[0-9]\\.[0-9]+" GEOS_VERSION ${GEOS_VERSION})
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)(dev)?" "\\1" GEOS_VERSION_MAJOR "${GEOS_VERSION}")
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)(dev)?" "\\2" GEOS_VERSION_MINOR "${GEOS_VERSION}")
ENDIF(GEOS_INCLUDE_DIR AND NOT GEOS_VERSION)

IF (GEOS_INCLUDE_DIR AND GEOS_LIBRARY)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindPOSTGIS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ endif()
# If specific version of PostGIS requested, choose that one, otherwise get all versions
if(POSTGIS_REQUIRED_VERSION)
message(STATUS "Selecting requested PostGIS version: Selecting postgis-${POSTGIS_REQUIRED_VERSION}")
file(GLOB POSTGIS_LIBRARY "${POSTGRESQL_DYNLIB_DIR}/postgis-${POSTGIS_REQUIRED_VERSION}.*")
file(GLOB POSTGIS_LIBRARY "${POSTGRESQL_DYNLIB_DIR}/postgis-${POSTGIS_REQUIRED_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}")
else()
file(GLOB POSTGIS_LIBRARY "${POSTGRESQL_DYNLIB_DIR}/postgis-*.*")
file(GLOB POSTGIS_LIBRARY "${POSTGRESQL_DYNLIB_DIR}/postgis-*${CMAKE_SHARED_LIBRARY_SUFFIX}")
endif()

if(POSTGIS_LIBRARY STREQUAL "")
Expand Down
8 changes: 4 additions & 4 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ option(ALL_LANG

# Defining the available language options
foreach(lang ${PROJECT_SUPPORTED_LANGUAGES})
list(FIND PROJECT_SUPPORTED_LANGUAGES lang idx)
list(GET PROJECT_SUPPORTED_LANGUAGES_STRING idx lang_str)
list(FIND PROJECT_SUPPORTED_LANGUAGES ${lang} idx)
list(GET PROJECT_SUPPORTED_LANGUAGES_STRING ${idx} lang_str)
string(TOUPPER ${lang} val)
option(${val}
"Set ON|OFF (default=OFF) build the ${lang_str} user's documentation" OFF)
Expand All @@ -77,8 +77,8 @@ list(APPEND PROJECT_BUILD_LANGUAGES_STRING ${PROJECT_ENGLISH_STRING})
foreach(lang ${PROJECT_SUPPORTED_LANGUAGES})
string(TOUPPER ${lang} opt)
if(${opt} OR ALL_LANG)
list(FIND PROJECT_SUPPORTED_LANGUAGES lang idx)
list(GET PROJECT_SUPPORTED_LANGUAGES_STRING idx lang_str)
list(FIND PROJECT_SUPPORTED_LANGUAGES ${lang} idx)
list(GET PROJECT_SUPPORTED_LANGUAGES_STRING ${idx} lang_str)
list(APPEND PROJECT_BUILD_LANGUAGES ${lang})
list(APPEND PROJECT_BUILD_LANGUAGES_STRING ${lang_str})
endif()
Expand Down
4 changes: 2 additions & 2 deletions sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ endforeach()
configure_file(${CMAKE_CURRENT_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE}.in ${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE} COPYONLY)

file(READ "${CMAKE_BINARY_DIR}/${MOBILITYDB_EXTENSION_FILE}" sql_commands)
string(REGEX REPLACE "MODULE_PATHNAME" "${CMAKE_BINARY_DIR}/lib${MOBILITYDB_LIB_NAME}.so" sql_commands "${sql_commands}")
message(STATUS "Substitution: ${CMAKE_BINARY_DIR}/lib${MOBILITYDB_LIB_NAME}.so")
string(REGEX REPLACE "MODULE_PATHNAME" "${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${MOBILITYDB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}" sql_commands "${sql_commands}")
message(STATUS "Substitution: ${CMAKE_BINARY_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${MOBILITYDB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
string(REGEX REPLACE "@extschema@" "public" sql_commands "${sql_commands}")
file(WRITE ${MOBILITYDB_TEST_EXTENSION_FILE}.in "${sql_commands}")
configure_file(${MOBILITYDB_TEST_EXTENSION_FILE}.in ${MOBILITYDB_TEST_EXTENSION_FILE} COPYONLY)
4 changes: 2 additions & 2 deletions src/general/tempcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ populate_temptype_cache()

PG_TRY();
{
bzero(_temptype_cache, sizeof(_temptype_cache));
memset(_temptype_cache, 0, sizeof(_temptype_cache));
/*
* This fetches the pre-computed temporal type cache from the catalog
* where it is stored in a table.
Expand Down Expand Up @@ -308,7 +308,7 @@ populate_operators()
PG_TRY();
{
populate_types();
bzero(_op_oids, sizeof(_op_oids));
memset(_op_oids, 0, sizeof(_op_oids));
/*
* This fetches the pre-computed operator cache from the catalog where
* it is stored in a table. See the fill_opcache function below.
Expand Down
4 changes: 2 additions & 2 deletions src/npoint/tnpoint_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ npoint_parse(char **str)

int64 rid;
double pos;
if (sscanf(*str, "( %ld , %lf )", &rid, &pos) != 2)
if (sscanf(*str, "( %lld , %lf )", &rid, &pos) != 2)
ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("Could not parse network point")));
if (pos < 0 || pos > 1)
Expand Down Expand Up @@ -97,7 +97,7 @@ nsegment_parse(char **str)
int64 rid;
double pos1;
double pos2;
if (sscanf(*str, "( %ld , %lf , %lf )", &rid, &pos1, &pos2) != 3)
if (sscanf(*str, "( %lld , %lf , %lf )", &rid, &pos1, &pos2) != 3)
ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("Could not parse network segment")));
if (pos1 < 0 || pos1 > 1 || pos2 < 0 || pos2 > 1)
Expand Down
20 changes: 10 additions & 10 deletions src/npoint/tnpoint_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ PGDLLEXPORT Datum
nsegment_out(PG_FUNCTION_ARGS)
{
nsegment *ns = PG_GETARG_NSEGMENT(0);
char *result = psprintf("NSegment(%ld,%g,%g)", ns->rid, ns->pos1, ns->pos2);
char *result = psprintf("NSegment(%lld,%g,%g)", ns->rid, ns->pos1, ns->pos2);
PG_RETURN_CSTRING(result);
}

Expand Down Expand Up @@ -385,7 +385,7 @@ npoint_set(npoint *np, int64 rid, double pos)
{
if (!route_exists(rid))
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("there is no route with gid value %lu in table ways", rid)));
errmsg("there is no route with gid value %lld in table ways", rid)));
if (pos < 0 || pos > 1)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("the relative position must be a real number between 0 and 1")));
Expand All @@ -403,7 +403,7 @@ npoint_make(int64 rid, double pos)
{
if (!route_exists(rid))
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("there is no route with gid value %lu in table ways", rid)));
errmsg("there is no route with gid value %lld in table ways", rid)));
if (pos < 0 || pos > 1)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("the relative position must be a real number between 0 and 1")));
Expand Down Expand Up @@ -432,7 +432,7 @@ nsegment_set(nsegment *ns, int64 rid, double pos1, double pos2)
{
if (!route_exists(rid))
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("there is no route with gid value %lu in table ways", rid)));
errmsg("there is no route with gid value %lld in table ways", rid)));
if (pos1 < 0 || pos1 > 1 || pos2 < 0 || pos2 > 1)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("The relative position of a network segment must be a real number between 0 and 1")));
Expand All @@ -451,7 +451,7 @@ nsegment_make(int64 rid, double pos1, double pos2)
{
if (!route_exists(rid))
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("there is no route with gid value %lu in table ways", rid)));
errmsg("there is no route with gid value %lld in table ways", rid)));
if (pos1 < 0 || pos1 > 1 || pos2 < 0 || pos2 > 1)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("The relative position of a network segment must be a real number between 0 and 1")));
Expand Down Expand Up @@ -823,7 +823,7 @@ bool
route_exists(int64 rid)
{
char sql[64];
sprintf(sql, "SELECT true FROM public.ways WHERE gid = %ld", rid);
sprintf(sql, "SELECT true FROM public.ways WHERE gid = %lld", rid);
bool isNull = true;
bool result = false;
SPI_connect();
Expand All @@ -843,7 +843,7 @@ double
route_length(int64 rid)
{
char sql[64];
sprintf(sql, "SELECT length FROM public.ways WHERE gid = %ld", rid);
sprintf(sql, "SELECT length FROM public.ways WHERE gid = %lld", rid);
bool isNull = true;
double result = 0;
SPI_connect();
Expand All @@ -859,7 +859,7 @@ route_length(int64 rid)

if (isNull)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("cannot get the length for route %ld", rid)));
errmsg("cannot get the length for route %lld", rid)));

return result;
}
Expand All @@ -870,7 +870,7 @@ Datum
route_geom(int64 rid)
{
char sql[64];
sprintf(sql, "SELECT the_geom FROM public.ways WHERE gid = %ld", rid);
sprintf(sql, "SELECT the_geom FROM public.ways WHERE gid = %lld", rid);
bool isNull = true;
GSERIALIZED *result = NULL;
SPI_connect();
Expand All @@ -892,7 +892,7 @@ route_geom(int64 rid)

if (isNull)
ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
errmsg("cannot get the geometry for route %ld", rid)));
errmsg("cannot get the geometry for route %lld", rid)));

ensure_non_empty(result);

Expand Down
2 changes: 1 addition & 1 deletion src/point/tpoint_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ tpoint_to_wkb(const Temporal *temp, uint8_t variant, size_t *size_out)

if (buf == NULL)
{
elog(ERROR, "Unable to allocate %lu bytes for WKB output buffer.", buf_size);
elog(ERROR, "Unable to allocate %llu bytes for WKB output buffer.", buf_size);
return NULL;
}

Expand Down
4 changes: 2 additions & 2 deletions test/scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ run_compare)
cat "${WORKDIR}"/out/"${TESTNAME}".out > "$(dirname "${TESTFILE}")/../expected/$(basename "${TESTFILE}" .sql).out"
exit 0
else
tmpactual=$(mktemp --suffix=actual)
tmpexpected=$(mktemp --suffix=expected)
tmpactual=$(mktemp)
tmpexpected=$(mktemp)
sed -e's/^ERROR:.*/ERROR/' "${WORKDIR}"/out/"${TESTNAME}".out >> "$tmpactual"
sed -e's/^ERROR:.*/ERROR/' "$(dirname "${TESTFILE}")/../expected/$(basename "${TESTFILE}" .sql).out" >> "$tmpexpected"
echo
Expand Down

0 comments on commit 275ba7d

Please sign in to comment.