Skip to content
New issue

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

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

Already on GitHub? # to your account

Merge commits from smwesten-usgs #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 79 additions & 12 deletions CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,79 @@ option(BUILD_PROJ "Build Proj library" ON)
option(BUILD_GDAL "Build Gdal library" ON)
option(BUILD_READOSM "Build ReadOSM library" OFF)

set(CMAKE_SHARED_LIBRARY_SUFFIX ".a")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".a")

# see if the libraries are present on the system regardless of
# present build options
find_library(SHAPELIB_LIBRARY
NAMES shp shapelib
)

find_library(PROJ_LIBRARY
NAMES proj projlib
)

find_library(READOSM_LIBRARY
NAMES readosm readosmlib
)

find_library(GDAL_LIBRARY
NAMES gdal gdal19 gdallib
)

find_library(STDC++_LIBRARY
NAMES libstdc++ stdc++
PATHS /usr/lib/gcc/x86_64-linux-gnu/6/
)

find_library(STDC_LIBRARY
NAMES libc c
PATHS /usr/lib/x86_64-linux-gnu
)

find_library(FORTRAN_LIBRARY
NAMES libgfortran gfortran
PATHS /usr/lib/gcc/x86_64-linux-gnu/6/
)

find_library(SQLITE3_LIBRARY
NAMES sqlite3 libsqlite3
)

find_library(DL_LIBRARY
NAMES dl libdl
PATHS /usr/lib/x86_64-linux-gnu
)

find_library(RT_LIBRARY
NAMES rt librt
PATHS /usr/lib/x86_64-linux-gnu
)

find_library(UBSAN_LIBRARY
NAMES ubsan libubsan
PATHS /usr/lib/gcc/x86_64-linux-gnu/6
)

find_library(PTHREAD_LIBRARY
NAMES pthread libpthread
PATHS /usr/lib/x86_64-linux-gnu
)

set(EXTERNAL_LIBS
${SQLITE3_LIBRARY}
${DL_LIBRARY}
${UBSAN_LIBRARY}
${RT_LIBRARY}
${PTHREAD_LIBRARY}
${STDC++_LIBRARY}
${FORTRAN_LIBRARY}
${STDC_LIBRARY}
)

if(BUILD_SHAPELIB)
find_library(SHAPELIB_LIBRARY
NAMES shp shapelib
)
if(SHAPELIB_LIBRARY)
set(GOBUILD 1)
# set(HAVE_SHAPELIB ON CACHE BOOL "No Shape library" FORCE)
Expand All @@ -40,9 +109,6 @@ if(BUILD_SHAPELIB)
endif(BUILD_SHAPELIB)

if(BUILD_GDAL)
find_library(GDAL_LIBRARY
NAMES gdal gdal19 gdallib
)
if(GDAL_LIBRARY)
set(GOBUILD 1)
message(STATUS "GDAL library: found")
Expand All @@ -52,9 +118,6 @@ if(BUILD_GDAL)
endif(BUILD_GDAL)

if(BUILD_PROJ)
find_library(PROJ_LIBRARY
NAMES proj projlib
)
if(PROJ_LIBRARY)
set(GOBUILD 1)
message(STATUS "Proj library: found")
Expand All @@ -64,9 +127,6 @@ if(BUILD_PROJ)
endif(BUILD_PROJ)

if(BUILD_READOSM)
find_library(READOSM_LIBRARY
NAMES readosm readosmlib
)
if(READOSM_LIBRARY)
set(GOBUILD 1)
message(STATUS "ReadOSM library: found")
Expand All @@ -82,13 +142,20 @@ if(NOT GOBUILD)
message(FATAL_ERROR "At least one component of Shapelib, GDAL, Proj or ReadOSM must be present - none were found")
endif(NOT GOBUILD)



#
# Run over the subdirectories ...
#
enable_testing()

include_directories( ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/libfortranc )

add_subdirectory(libfortranc)
add_subdirectory(libfortrangis)

include( cmake/print_summary.cmake )

#
# Configure the config.h file
# renamed to cmake_config.h.in to avoid conflict with automake since
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
This is a fork of Davide Cesari's FortranGIS. If I have time I hope to add some additional functions from gdal_utils and gdal_alg APIs.

------------------------------------------------------------

## [FortranGIS project](http://fortrangis.sourceforge.net/index.php)

FortranGIS project includes a collection of Fortran interfaces to some
Expand Down
36 changes: 36 additions & 0 deletions build/linux/gfortran/run_cmake_gfortran.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
#remove existing Cmake cache and directories
# remove existing Cmake cache and directories
rm -fr CMake*
rm -f *.txt


export Fortran_COMPILER_NAME=gfortran
export R_HOME=/usr/bin/R

export PATH=/usr/bin:/usr/local/bin:/usr/local/lib:/usr/bin/cmake:/usr/local/opt:$PATH

# define where 'make copy' will place executables
export INSTALL_PREFIX=/usr/local/bin

# define other variables for use in the CMakeList.txt file
# options are "Release" or "Debug"
export BUILD_TYPE="Debug"
# options are "x86" (32-bit) or "x64" (64-bit)
export OS="MacOS"

# define platform and compiler specific compilation flags
export CMAKE_Fortran_FLAGS_DEBUG="-O0 -g -ggdb -Wuninitialized -fbacktrace -fcheck=all -fexceptions -fsanitize=null -fsanitize=leak -fmax-errors=6 -fbackslash -ffree-line-length-none -Wno-maybe-uninitialized -static-libgfortran -static-libgcc -static"
# "-fpe-trap=overflow,zero"
export CMAKE_Fortran_FLAGS_RELEASE="-O1 -g -march=native -ffree-line-length-512 -fbackslash -ffpe-summary='none' -Wno-maybe-uninitialized -static-libgfortran -static-libgcc -static"

# set important environment variables
export FC=$GFORTRAN
export CC=$GCC
export CXX=$GPP

cmake "../../.." -G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE " \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX " \
-DCMAKE_Fortran_FLAGS_DEBUG="$CMAKE_Fortran_FLAGS_DEBUG " \
-DCMAKE_Fortran_FLAGS_RELEASE="$CMAKE_Fortran_FLAGS_RELEASE"
57 changes: 57 additions & 0 deletions build/mac_osx/gfortran/run_cmake_gfortran.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash
#remove existing Cmake cache and directories
# remove existing Cmake cache and directories
rm -fr CMake*
rm -f *.txt


export GCC_VERSION=8.1.0
export GCC_MAJ_VERSION=8
# set CMAKE-related and build-related variables
export GCCLIST=$( glocate gcc-$GCC_MAJ_VERSION | grep Cellar | grep bin | grep $GCC_VERSION )
export GCCARR=($GCCLIST)
export GCC=${GCCARR[1]}
export GFORTRANLIST=$( glocate gfortran-$GCC_MAJ_VERSION | grep Cellar | grep bin | grep $GCC_VERSION )
export GFORTRANARR=($GFORTRANLIST)
export GFORTRAN=${GFORTRANARR[1]}

export LIB_GCC=$( glocate libgcc.a | grep Cellar | grep $GCC_VERSION | grep -v i386 )
export LIB_GFORTRAN=$( glocate libgfortran.a | grep Cellar | grep $GCC_VERSION | grep -v i386 )
export LIB_SHP=$( glocate libshp.a | grep /usr/local/lib )

export CMAKEROOT=/usr/bin/cmake
export R_HOME=/usr/bin/R

export Fortran_COMPILER_NAME=gfortran
export R_HOME=/usr/bin/R

export FORTRANGIS_EXTERNAL_LIBS="$LIB_SHP;$LIB_GCC;$LIB_GFORTRAN"

export PATH=/usr/bin:/usr/local/bin:/usr/local/lib:/usr/bin/cmake:/usr/local/opt:$PATH

# define where 'make copy' will place executables
export INSTALL_PREFIX=/usr/local/bin

# define other variables for use in the CMakeList.txt file
# options are "Release" or "Debug"
export BUILD_TYPE="Debug"
# options are "x86" (32-bit) or "x64" (64-bit)
export OS="MacOS"

# define platform and compiler specific compilation flags
export CMAKE_Fortran_FLAGS_DEBUG="-O0 -g -gfull -ggdb -Wuninitialized -fbacktrace -fcheck=all -fexceptions -fsanitize=null -fsanitize=leak -fmax-errors=6 -fbackslash -ffree-line-length-none -Wno-maybe-uninitialized -static-libgfortran -static-libgcc -static"
# "-fpe-trap=overflow,zero"
export CMAKE_Fortran_FLAGS_RELEASE="-O1 -g -march=native -ffree-line-length-512 -fbackslash -ffpe-summary='none' -Wno-maybe-uninitialized -static-libgfortran -static-libgcc -static"

# set important environment variables
export FC=$GFORTRAN
export CC=$GCC
export CXX=$GPP

cmake "../../.." -G "Unix Makefiles" \
-DSYSTEM_TYPE="$SYSTEM_TYPE " \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE " \
-DFORTRANGIS_EXTERNAL_LIBS="$FORTRANGIS_EXTERNAL_LIBS " \
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_PREFIX " \
-DCMAKE_Fortran_FLAGS_DEBUG="$CMAKE_Fortran_FLAGS_DEBUG " \
-DCMAKE_Fortran_FLAGS_RELEASE="$CMAKE_Fortran_FLAGS_RELEASE"
2 changes: 1 addition & 1 deletion libfortranc/fortranc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
! You should have received a copy of the GNU Lesser General Public
! License along with FortranGIS. If not, see
! <http://www.gnu.org/licenses/>.
#include "config.h"
!#include "config.h"

!> Utility module for supporting Fortran 2003 C language interface module.
!! This module contains various utilties for simplifying the exchange
Expand Down
12 changes: 7 additions & 5 deletions libfortrangis/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,34 @@ if(SHAPELIB_LIBRARY)
set(fortrangisc_LIB_SRCS
shapelibint.c
)
list(APPEND fortrangis_LIBS ${SHAPELIB_LIBRARY})
set( fortrangis_LIBS ${fortrangis_LIBS} ${SHAPELIB_LIBRARY})

endif(SHAPELIB_LIBRARY)

if(PROJ_LIBRARY)
list(APPEND fortrangis_LIB_SRCS
proj.F90
)
list(APPEND fortrangis_LIBS ${PROJ_LIBRARY})
set( fortrangis_LIBS ${fortrangis_LIBS} ${PROJ_LIBRARY})
endif(PROJ_LIBRARY)

if(GDAL_LIBRARY)
list(APPEND fortrangis_LIB_SRCS
gdal.F90
)
list(APPEND fortrangis_LIBS ${GDAL_LIBRARY})
set( fortrangis_LIBS ${fortrangis_LIBS} ${GDAL_LIBRARY})
endif(GDAL_LIBRARY)

if(READOSM_LIBRARY)
list(APPEND fortrangis_LIB_SRCS
readosm.F90
)
list(APPEND fortrangis_LIBS ${READOSM_LIBRARY})
set( fortrangis_LIBS ${fortrangis_LIBS} ${READOSM_LIBRARY})
endif(READOSM_LIBRARY)

set( fortrangis_LIBS ${fortrangis_LIBS} ${EXTERNAL_LIBS})
set( fortrangis_LIBS ${fortrangis_LIBS} PARENT_SCOPE)

message(STATUS "${fortrangis_LIB_SRCS}")

include_directories(${CMAKE_BINARY_DIR}/libfortranc ${CMAKE_BINARY_DIR}/include)
Expand Down Expand Up @@ -71,4 +74,3 @@ if(READOSM_LIBRARY)
target_link_libraries(readosm_test ${fortrangis_LIBS})
add_test("ReadOSM" readosm_test)
endif(READOSM_LIBRARY)