[geos-commits] r2899 - trunk

svn_geos at osgeo.org svn_geos at osgeo.org
Sat Jan 30 22:05:16 EST 2010


Author: mloskot
Date: 2010-01-30 22:05:15 -0500 (Sat, 30 Jan 2010)
New Revision: 2899

Modified:
   trunk/CMakeLists.txt
Log:
Added GEOS_ENABLE_FLOATSTORE option to CMake to control GCC flag -ffloat-store (#317)

Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2010-01-31 01:26:53 UTC (rev 2898)
+++ trunk/CMakeLists.txt	2010-01-31 03:05:15 UTC (rev 2899)
@@ -58,6 +58,11 @@
     "Set to ON|OFF (default) to build GEOS with assert() macro enabled" OFF) 
 endif()
 
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+  option(GEOS_ENABLE_FLOATSTORE
+    "Set to OFF|ON (default) to control IEEE754 conformance and remove extra precision" ON)
+endif()
+
 #################################################################################
 # Setup C/C++ compiler options
 #################################################################################
@@ -76,16 +81,24 @@
 
   # General options
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -ansi")
-  
-  #add_definitions(_ISOC99_SOURCE)
-  set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_ISOC99_SOURCE=1")
 
+  # Numerical stability
+  if(GEOS_ENABLE_FLOATSTORE)
+    # Remove extra precision by forcing conformance to IEEE 754 rather than IEEE 854
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffloat-store")
+  endif()
+  message(STATUS
+    "Forcing IEEE 754 using flag -ffloat-store - ${GEOS_ENABLE_FLOATSTORE}")
+
   # Warnings specification
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long")
 
   # Turn on Position Independent Code generation for GEOS C shared library
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
 
+  # Enable glibc ISO C99 features (macros isfinite, isnan)
+  set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -D_ISOC99_SOURCE=1")
+
 elseif(MSVC)
     
   # Set pedantic mode by default



More information about the geos-commits mailing list