From: <ai...@us...> - 2009-06-29 02:22:14
|
Revision: 10094 http://plplot.svn.sourceforge.net/plplot/?rev=10094&view=rev Author: airwin Date: 2009-06-29 01:48:32 +0000 (Mon, 29 Jun 2009) Log Message: ----------- Move to model where the CMake build system should recover from most broken compilers by eliminating the appropriate bindings and examples. Of course, a build of the most fundamental components of PLplot demands a working C compiler. Furthermore, it turns out that check_prototype_exists, one of our preliminary checks, requires a working C++ compiler. However, at this time it appears all other compilers can be optional. N.B. these changes have only been tested for a system where all compilers (Ada, C, C++, D, Fortran, and Java) work. The result was a default PLplot build (except for the -DENABLE_d=ON option) worked without obvious errors. Warning: the "safety net" aspect of these changes (when an attempt is made to build PLplot for a platform with broken compilers) should work but has not been tested. Modified Paths: -------------- trunk/CMakeLists.txt trunk/cmake/modules/ada.cmake trunk/cmake/modules/c++.cmake trunk/cmake/modules/d.cmake trunk/cmake/modules/fortran.cmake trunk/cmake/modules/java.cmake trunk/cmake/modules/plplot.cmake trunk/cmake/modules/qt.cmake trunk/cmake/modules/wxwidgets.cmake Modified: trunk/CMakeLists.txt =================================================================== --- trunk/CMakeLists.txt 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/CMakeLists.txt 2009-06-29 01:48:32 UTC (rev 10094) @@ -30,7 +30,12 @@ ${CMAKE_SOURCE_DIR}/cmake/UserOverride.cmake ) -project(plplot) +# It is a fatal error if no working C compiler is available to build +# the PLplot core C library and core C examples. All other compilers +# required by our bindings are optional in that if no working compiler +# of the kind needed is available, the associated bindings and +# examples are disabled. +project(plplot C) # For use under MSYS version 2.6.3 or above of cmake is required! # The variable MSYS is first known at this point in the build process Modified: trunk/cmake/modules/ada.cmake =================================================================== --- trunk/cmake/modules/ada.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/ada.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -26,6 +26,22 @@ endif(DEFAULT_NO_BINDINGS) if(ENABLE_ada) + # Find and check Ada compiler + enable_language(Ada OPTIONAL) + if(NOT CMAKE_Ada_COMPILER_WORKS) + message(STATUS "WARNING: no working Ada compiler so disabling Ada bindings and examples.") + set(ENABLE_ada OFF CACHE BOOL "Enable Ada bindings" FORCE) + endif(NOT CMAKE_Ada_COMPILER_WORKS) +endif(ENABLE_ada) + +if(ENABLE_ada) + if(NOT CMAKE_Ada_COMPILER) + message(STATUS "WARNING: Ada compiler not found so disabling Ada bindings and examples.") + set(ENABLE_ada OFF CACHE BOOL "Enable Ada bindings" FORCE) + endif(NOT CMAKE_Ada_COMPILER) +endif(ENABLE_ada) + +if(ENABLE_ada) find_library(GNAT_LIB NAMES gnat gnat-4.1 gnat-4.2 gnat-4.3 gnat-4.4) if(NOT GNAT_LIB) message(STATUS "WARNING: " @@ -36,12 +52,8 @@ endif(NOT GNAT_LIB) endif(ENABLE_ada) -if(ENABLE_ada) - enable_language(Ada) -endif(ENABLE_ada) - # New stuff by Jerry for source modifications for Ada 2007 or not Ada 2007. option(HAVE_ADA_2007 "Ada 2007?" OFF) Modified: trunk/cmake/modules/c++.cmake =================================================================== --- trunk/cmake/modules/c++.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/c++.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -30,8 +30,25 @@ # Always carry out C++ checks, since some drivers also use these as # well as the C++ bindings -# IF (ENABLE_cxx) +# Find and check C++ compiler. +enable_language(CXX OPTIONAL) + +if(NOT CMAKE_CXX_COMPILER_WORKS) + # This is fatal error message rather than a warning because C++ absolutely + # required for check_prototype_exists test (and perhaps other preliminary + # tests as well). + message(FATAL_ERROR "No working C++ compiler found so PLplot cannot be built.") + set(ENABLE_cxx OFF CACHE BOOL "Enable C++ bindings" FORCE) +endif(NOT CMAKE_CXX_COMPILER_WORKS) + +if(ENABLE_cxx) + if(NOT CMAKE_CXX_COMPILER) + message(STATUS "WARNING: C++ compiler not found so disabling C++ bindings and examples.") + set(ENABLE_cxx OFF CACHE BOOL "Enable C++ bindings" FORCE) + endif(NOT CMAKE_CXX_COMPILER) +endif(ENABLE_cxx) + # Check if "using namespace std;" works INCLUDE(TestForNamespace) @@ -47,5 +64,3 @@ # Need to add check if stdint.h can be used from c++ (HAVE_CXX_STDINT_H) INCLUDE(TestForStdintCXX) - -# ENDIF(ENABLE_cxx) Modified: trunk/cmake/modules/d.cmake =================================================================== --- trunk/cmake/modules/d.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/d.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -29,17 +29,18 @@ endif(DEFAULT_NO_BINDINGS) if(ENABLE_d) - # Check for gdc or dmd compiler - include(CMakeDetermineDCompiler) + # Find and check D compiler + enable_language(D OPTIONAL) + if(NOT CMAKE_D_COMPILER_WORKS) + message(STATUS "WARNING: no working D compiler so disabling D bindings and examples.") + set(ENABLE_d OFF CACHE BOOL "Enable D bindings" FORCE) + endif(NOT CMAKE_D_COMPILER_WORKS) +endif(ENABLE_d) + +if(ENABLE_d) if(NOT CMAKE_D_COMPILER) - message(STATUS "WARNING: " - "D compiler not found. Disabling D bindings" - ) + message(STATUS "WARNING: D compiler not found so disabling D bindings and examples.") set(ENABLE_d OFF CACHE BOOL "Enable D bindings" FORCE) endif(NOT CMAKE_D_COMPILER) endif(ENABLE_d) -if(ENABLE_d) - # Enable D language - enable_language(D) -endif(ENABLE_d) Modified: trunk/cmake/modules/fortran.cmake =================================================================== --- trunk/cmake/modules/fortran.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/fortran.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -31,21 +31,24 @@ endif(DEFAULT_NO_BINDINGS) if(ENABLE_f77 OR ENABLE_f95) - # Check for fortran compiler - include(CMakeDetermineFortranCompiler) + # Find and check Fortran compiler. + enable_language(Fortran OPTIONAL) + if(NOT CMAKE_Fortran_COMPILER_WORKS) + message(STATUS "WARNING: no working Fortran compiler so disabling Fortran bindings and examples.") + set(ENABLE_f77 OFF CACHE BOOL "Enable f77 bindings" FORCE) + set(ENABLE_f95 OFF CACHE BOOL "Enable f95 bindings" FORCE) + endif(NOT CMAKE_Fortran_COMPILER_WORKS) +endif(ENABLE_f77 OR ENABLE_f95) + +if(ENABLE_f77 OR ENABLE_f95) if(NOT CMAKE_Fortran_COMPILER) - message(STATUS "WARNING: " - "fortran compiler not found. Disabling f77/f95 bindings" - ) + message(STATUS "WARNING: Fortran compiler not found so disabling Fortran bindings and examples.") set(ENABLE_f77 OFF CACHE BOOL "Enable f77 bindings" FORCE) set(ENABLE_f95 OFF CACHE BOOL "Enable f95 bindings" FORCE) endif(NOT CMAKE_Fortran_COMPILER) -endif (ENABLE_f77 OR ENABLE_f95) +endif(ENABLE_f77 OR ENABLE_f95) if(ENABLE_f77 OR ENABLE_f95) - # Enable fortran language - enable_language(Fortran) - # Don't compile Fortran 95 binding if compiler doesn't support it if(ENABLE_f95 AND NOT CMAKE_Fortran_COMPILER_SUPPORTS_F90) message(STATUS "WARNING: " Modified: trunk/cmake/modules/java.cmake =================================================================== --- trunk/cmake/modules/java.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/java.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -41,23 +41,30 @@ endif(ENABLE_java AND NOT SWIG_FOUND) if(ENABLE_java) - # Check for java compiler - include(CMakeDetermineJavaCompiler) + # Find and check Java compiler. + enable_language(Java OPTIONAL) + if(NOT CMAKE_Java_COMPILER_WORKS) + message(STATUS "WARNING: no working Java compiler so disabling Java bindings and examples.") + set(ENABLE_java OFF CACHE BOOL "Enable java bindings" FORCE) + endif(NOT CMAKE_Java_COMPILER_WORKS) +endif(ENABLE_java) + +if(ENABLE_java) if(NOT CMAKE_Java_COMPILER) - message(STATUS "WARNING: " - "java compiler not found. Disabling java bindings") + message(STATUS "WARNING: Java compiler not found so disabling Java bindings and examples.") set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE) endif(NOT CMAKE_Java_COMPILER) +endif(ENABLE_java) + +if(ENABLE_java) if(NOT CMAKE_Java_ARCHIVE) - message(STATUS "WARNING: " - "java archiver (jar) not found. Disabling java bindings") + message(STATUS "WARNING: java archiver (jar) not found. Disabling java bindings") set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE) endif(NOT CMAKE_Java_ARCHIVE) endif(ENABLE_java) if(ENABLE_java) # Check for java environment - enable_language(Java) find_package(JNI) # If CMake doesn't find jni.h you need set CMAKE_INCLUDE_PATH if(NOT JAVA_INCLUDE_PATH) Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/plplot.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -123,6 +123,9 @@ # the ctype.h' macros work on characters with the high bit set, as # ANSI C requires. +# check_prototype_exists requires C++ +include(c++) + message(STATUS "Checking whether system has ANSI C header files") check_include_files("stdlib.h;stdarg.h;string.h;float.h" StandardHeadersExist) if(StandardHeadersExist) @@ -380,7 +383,7 @@ OFF ) # Load language specific files -include(c++) +# C++ done much earlier because check_prototype_exists macro requires it. include(fortran) include(java) include(python) Modified: trunk/cmake/modules/qt.cmake =================================================================== --- trunk/cmake/modules/qt.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/qt.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -55,6 +55,25 @@ endif(PLD_bmpqt OR PLD_jpgqt OR PLD_pngqt OR PLD_ppmqt OR PLD_tiffqt OR PLD_epsqt OR PLD_pdfqt OR PLD_qtwidget OR PLD_svgqt OR PLD_extqt) if(ANY_QT_DEVICE) + if(NOT CMAKE_CXX_COMPILER_WORKS) + message(STATUS "WARNING: no working C++ compiler so " + "disabling all qt devices." + ) + set(PLD_bmpqt OFF CACHE BOOL "Enable Qt Windows bmp device" FORCE) + set(PLD_jpgqt OFF CACHE BOOL "Enable Qt jpg device" FORCE) + set(PLD_pngqt OFF CACHE BOOL "Enable Qt png device" FORCE) + set(PLD_ppmqt OFF CACHE BOOL "Enable Qt ppm device" FORCE) + set(PLD_tiffqt OFF CACHE BOOL "Enable Qt tiff device" FORCE) + set(PLD_epsqt OFF CACHE BOOL "Enable Qt EPS device" FORCE) + set(PLD_pdfqt OFF CACHE BOOL "Enable Qt PDF device" FORCE) + set(PLD_qtwidget OFF CACHE BOOL "Enable Qt interactive device" FORCE) + set(PLD_svgqt OFF CACHE BOOL "Enable Qt SVG device" FORCE) + set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE) + set(ANY_QT_DEVICE OFF) + endif(NOT CMAKE_CXX_COMPILER_WORKS) +endif(ANY_QT_DEVICE) + +if(ANY_QT_DEVICE) find_package(Qt4) if(QT4_FOUND) if(PLD_svgqt AND ${QT_VERSION_MINOR} GREATER 2) Modified: trunk/cmake/modules/wxwidgets.cmake =================================================================== --- trunk/cmake/modules/wxwidgets.cmake 2009-06-28 22:42:13 UTC (rev 10093) +++ trunk/cmake/modules/wxwidgets.cmake 2009-06-29 01:48:32 UTC (rev 10094) @@ -29,12 +29,23 @@ # when ENABLE_DYNDRIVERS OFF. # Find wxWidgets needed for driver and bindings + if(PLD_wxwidgets OR PLD_wxpng) + if(NOT CMAKE_CXX_COMPILER_WORKS) + message(STATUS "WARNING: no working C++ compiler so " + "setting all wxwidgets devices to OFF." + ) + set(PLD_wxwidgets OFF CACHE BOOL "Enable wxwidgets device" FORCE) + set(PLD_wxpng OFF CACHE BOOL "Enable wxwidgets png device" FORCE) + endif(NOT CMAKE_CXX_COMPILER_WORKS) +endif(PLD_wxwidgets OR PLD_wxpng) + +if(PLD_wxwidgets OR PLD_wxpng) find_package(wxWidgets COMPONENTS base core QUIET) if(NOT wxWidgets_FOUND) message(STATUS "WARNING: wxWidgets not found so " - "setting PLD_wxwidgets to OFF." + "setting all wxwidgets devices to OFF." ) set(PLD_wxwidgets OFF CACHE BOOL "Enable wxwidgets device" FORCE) set(PLD_wxpng OFF CACHE BOOL "Enable wxwidgets png device" FORCE) @@ -43,6 +54,7 @@ include(TestForStdintCXX) endif(NOT wxWidgets_FOUND) endif(PLD_wxwidgets OR PLD_wxpng) + if(PLD_wxwidgets OR PLD_wxpng) string(REGEX REPLACE ";" " -I" wxwidgets_COMPILE_FLAGS @@ -88,6 +100,7 @@ ${wxwidgets_LINK_FLAGS} ) endif(PLD_wxwidgets OR PLD_wxpng) + if(DEFAULT_NO_BINDINGS) option(ENABLE_wxwidgets "Enable wxwidgets bindings" OFF) else(DEFAULT_NO_BINDINGS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |