|
From: <ai...@us...> - 2013-11-26 20:59:07
|
Revision: 12757
http://sourceforge.net/p/plplot/code/12757
Author: airwin
Date: 2013-11-26 20:59:05 +0000 (Tue, 26 Nov 2013)
Log Message:
-----------
Make changes to the shapelib build so that the confusing "Unable to
open" shapelib error messages are quieted for the normal PLplot
procedure (see src/plmap.c) of trying several different directories to
find shapefiles.
Tested by Alan W. Irwin <ai...@us...> on Linux using
both a standalone build of shapelib and also a build_projects build
and install of that software.
Modified Paths:
--------------
trunk/cmake/build_projects/shapelib/CMakeLists.txt
trunk/cmake/build_projects/shapelib/README
trunk/cmake/build_projects/shapelib/bp.cmake
Added Paths:
-----------
trunk/cmake/build_projects/shapelib/shapelib.patch
Modified: trunk/cmake/build_projects/shapelib/CMakeLists.txt
===================================================================
--- trunk/cmake/build_projects/shapelib/CMakeLists.txt 2013-11-26 17:40:50 UTC (rev 12756)
+++ trunk/cmake/build_projects/shapelib/CMakeLists.txt 2013-11-26 20:59:05 UTC (rev 12757)
@@ -1,7 +1,7 @@
# Top-level CMakeLists.txt for the CMake-based build and test system
# of the shapelib software.
-# Copyright (C) 2012 Alan W. Irwin
+# Copyright (C) 2012-2013 Alan W. Irwin
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU Library General Public License as published
@@ -38,9 +38,9 @@
# In windows all created dlls are gathered in the dll directory
# if you add this directory to your PATH all shared libraries are available
-if(BUILD_SHARED_LIBS AND WIN32)
+if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
-endif(BUILD_SHARED_LIBS AND WIN32)
+endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
set(PACKAGE shp)
@@ -83,14 +83,23 @@
shptree.c
)
+option(SHP_DROP_UNABLE_TO_OPEN_MSG "Drop \"unable to open\" error messages" ON)
+if(SHP_DROP_UNABLE_TO_OPEN_MSG)
+ #define the SHP_DROP_UNABLE_TO_OPEN_MSG C macro for this source file.
+ set_source_files_properties(shpopen.c
+ PROPERTIES
+ COMPILE_DEFINITIONS SHP_DROP_UNABLE_TO_OPEN_MSG
+ )
+endif(SHP_DROP_UNABLE_TO_OPEN_MSG)
+
add_library(shp ${lib_SRC})
-if(WIN32)
+if(WIN32 AND NOT CYGWIN)
set_target_properties(shp
PROPERTIES
COMPILE_DEFINITIONS SHAPELIB_DLLEXPORT
)
-endif(WIN32)
+endif(WIN32 AND NOT CYGWIN)
set(shp_SOVERSION 1)
set(shp_VERSION ${shp_SOVERSION}.0.1)
Modified: trunk/cmake/build_projects/shapelib/README
===================================================================
--- trunk/cmake/build_projects/shapelib/README 2013-11-26 17:40:50 UTC (rev 12756)
+++ trunk/cmake/build_projects/shapelib/README 2013-11-26 20:59:05 UTC (rev 12757)
@@ -17,15 +17,23 @@
(3) Copy the CMakeLists.txt file into the top-level of the unpacked
shapelib-1.3.0 source tree.
-(4) Create a separate empty build tree and use it to configure, build,
+(4) Apply shapelib.patch (which optionally quiets error messages when
+shapelib is unable to open shapefiles). First change directory
+to the top-level of the shapelib-1.3.0 source tree, then
+
+patch -p1 < <full path to shapelib.patch>
+
+(5) Create a separate empty build tree and use it to configure, build,
install and test shapelib. For example (you will need to tailor the
-install prefix, eg_data location, and source tree location to your own
+compiler, compile options, install prefix, eg_data location, and source tree location to your own
needs):
mkdir build_dir
cd build_dir
-# Configure
+# Configure with the compiler and compiler options of your choice.
+# N.B. the gcc -fvisibility=hidden option not (yet) supported by shapelib.
+env CC=gcc CFLAGS="-O3 -Wuninitialized" \
cmake \
-G "Unix Makefiles" \
-DCMAKE_INSTALL_PREFIX=/home/software/shapelib/install \
@@ -33,7 +41,7 @@
../shapelib-1.3.0 >& cmake.out
# Build and install
-make install >& install.out
+make VERBOSE=1 -j4 install >& install.out
# Test
ctest
@@ -51,4 +59,5 @@
install shapelib on both the Linux and MinGW/MSYS/Wine platforms.
Furthermore, on both platforms I have built and tested PLplot using
the installed versions created by the above procedure. No issues were
-discovered with example 19 for these two separate platform tests.
+discovered with PLplot example 19 (which demos PLplot map capabilities with
+map shapefiles) for these two separate platform tests.
Modified: trunk/cmake/build_projects/shapelib/bp.cmake
===================================================================
--- trunk/cmake/build_projects/shapelib/bp.cmake 2013-11-26 17:40:50 UTC (rev 12756)
+++ trunk/cmake/build_projects/shapelib/bp.cmake 2013-11-26 20:59:05 UTC (rev 12757)
@@ -55,6 +55,7 @@
build_${BP_PACKAGE}
URL ${${BP_PACKAGE}_URL}
URL_MD5 ${${BP_PACKAGE}_URL_MD5}
+ PATCH_COMMAND ${PATCH_EXECUTABLE} -p1 < ${CMAKE_SOURCE_DIR}/${BP_PACKAGE}/${BP_PACKAGE}.patch
CONFIGURE_COMMAND ${ENV_EXECUTABLE} PATH=${BP_PATH} CFLAGS=${${BP_PACKAGE}_CFLAGS} ${BP_CMAKE_COMMAND} -DEG_DATA:PATH=${EP_BASE}/Source/build_${BP_PACKAGE}/eg_data ${EP_BASE}/Source/build_${BP_PACKAGE}
BUILD_COMMAND ${ENV_EXECUTABLE} PATH=${BP_PATH} ${BP_PARALLEL_BUILD_COMMAND}
TEST_BEFORE_INSTALL ON
Added: trunk/cmake/build_projects/shapelib/shapelib.patch
===================================================================
--- trunk/cmake/build_projects/shapelib/shapelib.patch (rev 0)
+++ trunk/cmake/build_projects/shapelib/shapelib.patch 2013-11-26 20:59:05 UTC (rev 12757)
@@ -0,0 +1,23 @@
+diff -Naur '--exclude=CMakeLists.txt' '--exclude=*~' shapelib-1.3.0_pristine/shpopen.c shapelib-1.3.0/shpopen.c
+--- shapelib-1.3.0_pristine/shpopen.c 2012-01-24 14:33:01.000000000 -0800
++++ shapelib-1.3.0/shpopen.c 2013-11-26 11:46:43.215221421 -0800
+@@ -559,7 +559,9 @@
+ char *pszMessage = (char *) malloc(strlen(pszBasename)*2+256);
+ sprintf( pszMessage, "Unable to open %s.shp or %s.SHP.",
+ pszBasename, pszBasename );
++#ifndef SHP_DROP_UNABLE_TO_OPEN_MSG
+ psHooks->Error( pszMessage );
++#endif
+ free( pszMessage );
+
+ free( psSHP );
+@@ -582,7 +584,9 @@
+ char *pszMessage = (char *) malloc(strlen(pszBasename)*2+256);
+ sprintf( pszMessage, "Unable to open %s.shx or %s.SHX.",
+ pszBasename, pszBasename );
++#ifndef SHP_DROP_UNABLE_TO_OPEN_MSG
+ psHooks->Error( pszMessage );
++#endif
+ free( pszMessage );
+
+ psSHP->sHooks.FClose( psSHP->fpSHP );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|