From: <ai...@us...> - 2009-07-18 02:03:30
|
Revision: 10156 http://plplot.svn.sourceforge.net/plplot/?rev=10156&view=rev Author: airwin Date: 2009-07-18 02:03:28 +0000 (Sat, 18 Jul 2009) Log Message: ----------- Give users who happen to have one or more of the Ada, C++, D, Fortran, or Java compilers missing or broken a soft landing (warning message, disable that component or PLplot, and continue without a CMake error). This effort works around CMake bug 9220 by running a small test CMake session inside the normal CMake session to test for a working compiler without causing the normal CMake session to error out. These changes should all be dropped once CMake bug 9220 (fix the OPTIONAL signature of enable_language so it does not error out) has been fixed. Modified Paths: -------------- 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 Added Paths: ----------- trunk/cmake/modules/language_support.cmake Modified: trunk/cmake/modules/ada.cmake =================================================================== --- trunk/cmake/modules/ada.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/ada.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -25,6 +25,14 @@ option(ENABLE_ada "Enable Ada bindings" ON) endif(DEFAULT_NO_BINDINGS) +if(ENABLE_ada AND NOT PLPLOT_Ada_COMPILER_WORKS) + workaround_9220(Ada PLPLOT_Ada_COMPILER_WORKS) + if(NOT PLPLOT_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 PLPLOT_Ada_COMPILER_WORKS) +endif(ENABLE_ada AND NOT PLPLOT_Ada_COMPILER_WORKS) + if(ENABLE_ada) # Find and check Ada compiler enable_language(Ada OPTIONAL) Modified: trunk/cmake/modules/c++.cmake =================================================================== --- trunk/cmake/modules/c++.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/c++.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -28,6 +28,14 @@ OPTION(ENABLE_cxx "Enable C++ bindings" ON) endif(DEFAULT_NO_BINDINGS) +if(ENABLE_cxx AND NOT PLPLOT_CXX_COMPILER_WORKS) + workaround_9220(CXX PLPLOT_CXX_COMPILER_WORKS) + if(NOT PLPLOT_CXX_COMPILER_WORKS) + message(STATUS "WARNING: no working C++ compiler so disabling C++ bindings and examples.") + set(ENABLE_cxx OFF CACHE BOOL "Enable C++ bindings" FORCE) + endif(NOT PLPLOT_CXX_COMPILER_WORKS) +endif(ENABLE_cxx AND NOT PLPLOT_CXX_COMPILER_WORKS) + if(ENABLE_cxx) # Find and check C++ compiler. enable_language(CXX OPTIONAL) Modified: trunk/cmake/modules/d.cmake =================================================================== --- trunk/cmake/modules/d.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/d.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -28,6 +28,14 @@ option(ENABLE_d "Enable D bindings" OFF) endif(DEFAULT_NO_BINDINGS) +if(ENABLE_d AND NOT PLPLOT_D_COMPILER_WORKS) + workaround_9220(D PLPLOT_D_COMPILER_WORKS) + if(NOT PLPLOT_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 PLPLOT_D_COMPILER_WORKS) +endif(ENABLE_d AND NOT PLPLOT_D_COMPILER_WORKS) + if(ENABLE_d) # Find and check D compiler enable_language(D OPTIONAL) Modified: trunk/cmake/modules/fortran.cmake =================================================================== --- trunk/cmake/modules/fortran.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/fortran.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -31,6 +31,19 @@ endif(DEFAULT_NO_BINDINGS) if(ENABLE_f77 OR ENABLE_f95) + set(ENABLE_fortran ON) +endif(ENABLE_f77 OR ENABLE_f95) + +if(ENABLE_fortran AND NOT PLPLOT_Fortran_COMPILER_WORKS) + workaround_9220(Fortran PLPLOT_Fortran_COMPILER_WORKS) + if(NOT PLPLOT_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 PLPLOT_Fortran_COMPILER_WORKS) +endif(ENABLE_fortran AND NOT PLPLOT_Fortran_COMPILER_WORKS) + +if(ENABLE_f77 OR ENABLE_f95) # Find and check Fortran compiler. enable_language(Fortran OPTIONAL) if(NOT CMAKE_Fortran_COMPILER_WORKS) Modified: trunk/cmake/modules/java.cmake =================================================================== --- trunk/cmake/modules/java.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/java.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -40,6 +40,14 @@ set(ENABLE_java OFF CACHE BOOL "Enable Java bindings" FORCE) endif(ENABLE_java AND NOT SWIG_FOUND) +if(ENABLE_java AND NOT PLPLOT_Java_COMPILER_WORKS) + workaround_9220(Java PLPLOT_Java_COMPILER_WORKS) + if(NOT PLPLOT_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 PLPLOT_Java_COMPILER_WORKS) +endif(ENABLE_java AND NOT PLPLOT_Java_COMPILER_WORKS) + if(ENABLE_java) # Find and check Java compiler. enable_language(Java OPTIONAL) Added: trunk/cmake/modules/language_support.cmake =================================================================== --- trunk/cmake/modules/language_support.cmake (rev 0) +++ trunk/cmake/modules/language_support.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -0,0 +1,98 @@ +# cmake/modules/language_support.cmake +# +# Temporary additional general language support is contained within this +# file. + +# This additional function definition is needed to provide a workaround for +# CMake bug 9220. + +function(workaround_9220 language language_works) + #message("DEBUG: language = ${language}") + set(text + "project(test NONE) +# Location where PLplot cmake build system first looks for cmake modules. +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) +cmake_minimum_required(VERSION 2.6.0) +enable_language(${language} OPTIONAL) +" + ) + file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/language_tests/${language}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}) + file(WRITE ${CMAKE_BINARY_DIR}/language_tests/${language}/CMakeLists.txt + ${text}) + # Special language support files for various languages: + # N.B. This list of files has to be maintained to be consistent + # with anything special we do in terms of language support. + + if(language STREQUAL "Ada") + set(language_special ON) + set(language_files + CMakeAdaCompiler.cmake.in + CMakeAdaInformation.cmake + CMakeDetermineAdaCompiler.cmake + CMakeTestAdaCompiler.cmake + ) + elseif(language STREQUAL "D") + set(language_special ON) + set(language_files + CMakeDCompiler.cmake.in + CMakeDInformation.cmake + CMakeDetermineDCompiler.cmake + CMakeTestDCompiler.cmake + Platform/Linux-dmd.cmake + Platform/Linux-gdc.cmake + Platform/Windows-dmd.cmake + Platform/Windows-gdc.cmake + ) + elseif(language STREQUAL "Fortran") + set(language_special ON) + set(language_files + CMakeFortranInformation.cmake + Platform/Cygwin-GNU-Fortran.cmake + Platform/Windows-GNU-Fortran.cmake + Platform/Windows-df.cmake + Platform/Windows-f90.cmake + ) + else(language STREQUAL "Ada") + set(language_special OFF) + endif(language STREQUAL "Ada") + + if(language_special) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}/cmake/modules/Platform) + foreach(file ${language_files}) + configure_file( + ${CMAKE_SOURCE_DIR}/cmake/modules/${file} + ${CMAKE_BINARY_DIR}/language_tests/${language}/cmake/modules/${file} + COPYONLY + ) + endforeach(file ${language_files}) + endif(language_special) + + execute_process( + COMMAND ${CMAKE_COMMAND} . + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language} + RESULT_VARIABLE return_code + OUTPUT_QUIET + ERROR_QUIET) + if(return_code EQUAL 0) + set(${language_works} ON CACHE INTERNAL "") + else(return_code EQUAL 0) + set(${language_works} OFF CACHE INTERNAL "") + endif(return_code EQUAL 0) +endfunction(workaround_9220) + +# Temporary tests of the above function. +#workaround_9220(CXX CXX_language_works) +#message("CXX_language_works = ${CXX_language_works}") +#workaround_9220(CXXp CXXp_language_works) +#message("CXXp_language_works = ${CXXp_language_works}") +#workaround_9220(Ada Ada_language_works) +#message("Ada_language_works = ${Ada_language_works}") +#workaround_9220(D D_language_works) +#message("D_language_works = ${D_language_works}") +#workaround_9220(Fortran Fortran_language_works) +#message("Fortran_language_works = ${Fortran_language_works}") +#workaround_9220(Java Java_language_works) +#message("Java_language_works = ${Java_language_works}") + + Property changes on: trunk/cmake/modules/language_support.cmake ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-07-18 00:35:08 UTC (rev 10155) +++ trunk/cmake/modules/plplot.cmake 2009-07-18 02:03:28 UTC (rev 10156) @@ -379,6 +379,10 @@ "All language bindings are disabled by default" OFF ) +# Temporary workaround for language support that is required. +include(language_support) + +# Individual language support. include(c++) include(fortran) include(java) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |