From: <hez...@us...> - 2009-09-29 05:42:48
|
Revision: 10488 http://plplot.svn.sourceforge.net/plplot/?rev=10488&view=rev Author: hezekiahcarty Date: 2009-09-29 05:42:40 +0000 (Tue, 29 Sep 2009) Log Message: ----------- Initial steps toward adding Plcairo to the PLplot OCaml build system This patch makes a number of changes to the OCaml portion of the CMake build system. A check is added for ocamlfind (an OCaml compilation aid), checks are made for Cairo and Gtk+ (lablgtk2) OCaml bindings. If the extcairo device is built and the Cairo OCaml bindings are found then the Plcairo OCaml module will be built, which includes support for using the extcairo driver from OCaml. The check for OCaml Gtk+ bindings is not currently used but it will be once Plcairo examples are added. Modified Paths: -------------- trunk/bindings/ocaml/CMakeLists.txt trunk/cmake/modules/ocaml.cmake trunk/cmake/modules/plplot.cmake Modified: trunk/bindings/ocaml/CMakeLists.txt =================================================================== --- trunk/bindings/ocaml/CMakeLists.txt 2009-09-29 05:32:56 UTC (rev 10487) +++ trunk/bindings/ocaml/CMakeLists.txt 2009-09-29 05:42:40 UTC (rev 10488) @@ -24,6 +24,9 @@ if(ENABLE_ocaml) + # Try to build the Plcairo module + add_subdirectory(plcairo) + # optional command to generate generated_plplot_h.inc. This generated # version of the file should be identical to plplot_h.inc. if(GENERATE_PLPLOT_H_INC) Modified: trunk/cmake/modules/ocaml.cmake =================================================================== --- trunk/cmake/modules/ocaml.cmake 2009-09-29 05:32:56 UTC (rev 10487) +++ trunk/cmake/modules/ocaml.cmake 2009-09-29 05:42:40 UTC (rev 10488) @@ -77,6 +77,16 @@ endif(ENABLE_ocaml) if(ENABLE_ocaml) + find_program(OCAMLFIND ocamlfind) + if (OCAMLFIND) + message(STATUS "OCAMLFIND = ${OCAMLFIND}") + else (OCAMLFIND) + message(STATUS "WARNING:" + "ocamlfind not found.") + endif (OCAMLFIND) +endif(ENABLE_ocaml) + +if(ENABLE_ocaml) execute_process(COMMAND ${OCAMLC} -version OUTPUT_VARIABLE OCAML_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE @@ -144,4 +154,46 @@ endif(output OR error) endif(GENERATE_PLPLOT_H_INC) + + # Test for the availability of Cairo and Gtk+ bindings + if(OCAMLFIND) + if(PLD_extcairo) + set(text_cairo "module C = Cairo") + file(WRITE ${CMAKE_BINARY_DIR}/test_cairo.ml ${text_cairo}) + execute_process( + COMMAND ${OCAMLFIND} c -package cairo -linkpkg test_cairo.ml -o test_cairo + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE OCAML_HAS_CAIRO + ) + # Invert the test result. What CMake takes as true is meant to be false. + set(OCAML_HAS_CAIRO NOT OCAML_HAS_CAIRO) + if(OCAML_HAS_CAIRO) + message(STATUS "Cairo OCaml library found") + else(OCAML_HAS_CAIRO) + message(STATUS "WARNING:" + "Cairo OCaml library not found. Disabling Plcairo module") + endif(OCAML_HAS_CAIRO) + + set(text_gtk + "module G = Gtk + module C = Cairo_lablgtk" + ) + file (WRITE ${CMAKE_BINARY_DIR}/test_gtk.ml ${text_gtk}) + execute_process( + COMMAND ${OCAMLFIND} c -package cairo.lablgtk2 -linkpkg test_gtk.ml -o test_gtk + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + RESULT_VARIABLE OCAML_HAS_GTK + ) + # Invert the test result. What CMake takes as true is meant to be false. + set(OCAML_HAS_GTK NOT OCAML_HAS_GTK) + if(OCAML_HAS_GTK) + message(STATUS "lablgtk2 OCaml library found") + else(OCAML_HAS_GTK) + message(STATUS "WARNING: lablgtk2 OCaml library not found.") + endif(OCAML_HAS_GTK) + endif (PLD_extcairo) + else(OCAMLFIND) + message(STATUS "WARNING:" + "ocamlfind not available. Disabling Plcairo module and lablgtk support") + endif(OCAMLFIND) endif(ENABLE_ocaml) Modified: trunk/cmake/modules/plplot.cmake =================================================================== --- trunk/cmake/modules/plplot.cmake 2009-09-29 05:32:56 UTC (rev 10487) +++ trunk/cmake/modules/plplot.cmake 2009-09-29 05:42:40 UTC (rev 10488) @@ -427,7 +427,9 @@ include(tcl-related) include(pdl) include(ada) -include(ocaml) +# OCaml support is included after the check for output drivers in order to +# check for extcairo support. +#include(ocaml) include(lua) include(d) @@ -458,6 +460,11 @@ include(drivers) # ======================================================================= +# OCaml support (after drivers to check for extcairo) +# ======================================================================= +include(ocaml) + +# ======================================================================= # Miscellaneous other features - including docbook documentation # ======================================================================= include(docbook) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |