On 04/05/2011 09:02 PM, Alan W. Irwin wrote:
On 2011-04-05 16:14-0600 Orion Poplawski wrote:
This is a patch that uses octave-config to help find the octave headers and
libraries. I've tested this in a couple situations and it should be
backwards compatible.
Motivation - With octave-3.4.0 in Fedora we have moved the libraries to
/usr/lib/octave/3.4.0 instead of /usr/lib/octave-3.4.0. Not sure if this
will be permanent, but it any case this patch supports any possible future
moves as well.
Note - in octave 3.2 octave-config -p OCTINCLUDEDIR returns
/usr/include/octave-VERSION. In 3.4 it returns
/usr/include/octave-VERSION/octave. This patch handles both cases by
continuing to use find_path.
Hi Orion:
I like your ideas. However, your patch does not apply cleanly to the
svn trunk version of PLplot. Please rebase on that version.
Here you go.
--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA/CoRA Division FAX: 303-415-9702
3380 Mitchell Lane or...@cora.nwra.com
Boulder, CO 80301 http://www.cora.nwra.com
Index: cmake/modules/octave.cmake
===================================================================
--- cmake/modules/octave.cmake (revision 11686)
+++ cmake/modules/octave.cmake (working copy)
@@ -73,28 +73,33 @@
endif(ENABLE_octave)
if(ENABLE_octave)
+ find_program(OCTAVE_CONFIG octave-config)
+ if(OCTAVE_CONFIG)
+ message(STATUS "OCTAVE_CONFIG = ${OCTAVE_CONFIG}")
+ else(OCTAVE_CONFIG)
+ message(STATUS "WARNING: "
+ "octave-config not found. Disabling octave bindings")
+ set(ENABLE_octave OFF CACHE BOOL "Enable Octave bindings" FORCE)
+ endif(OCTAVE_CONFIG)
+endif(ENABLE_octave)
+
+if(ENABLE_octave)
#OCTAVE_VERSION is the (dotted triplet) octave version.
execute_process(
- COMMAND ${OCTAVE} --version
- OUTPUT_VARIABLE _OCTAVE_VERSION
+ COMMAND ${OCTAVE_CONFIG} -p VERSION
+ OUTPUT_VARIABLE OCTAVE_VERSION
ERROR_VARIABLE OCTAVE_ERROR
RESULT_VARIABLE return_code
)
if(return_code)
message(STATUS "OCTAVE_ERROR = ${OCTAVE_ERROR}")
message(STATUS "WARNING: "
- "${OCTAVE} --version generates an error (non-zero return code). Disabling octave bindings")
+ "${OCTAVE_CONFIG} -p VERSION generates an error (non-zero return code). Disabling octave bindings")
set(ENABLE_octave OFF CACHE BOOL "Enable Octave bindings" FORCE)
endif(return_code)
endif(ENABLE_octave)
if(ENABLE_octave)
- string(REGEX REPLACE
- "^.*version ([0-9]\\.[0-9]\\.[0-9]*).*$"
- "\\1"
- OCTAVE_VERSION
- ${_OCTAVE_VERSION}
- )
message(STATUS "OCTAVE_VERSION = ${OCTAVE_VERSION}")
# Logic that depends on octave version
transform_version(NUMERICAL_OCTAVE_TESTING_MINIMUM_VERSION "2.9.0")
@@ -123,22 +128,35 @@
# if OCTAVE_INCLUDE_PATH is defined from the previous cmake run should be
# fine.
if(NOT DEFINED OCTAVE_INCLUDE_PATH)
+ execute_process(
+ COMMAND ${OCTAVE_CONFIG} -p OCTINCLUDEDIR
+ OUTPUT_VARIABLE OCTAVE_INCLUDE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
find_path(
OCTAVE_INCLUDE_PATH
oct.h
- PATH_SUFFIXES octave-${OCTAVE_VERSION}/octave
+ PATHS ${OCTAVE_INCLUDE_DIR}
+ PATH_SUFFIXES octave
)
+ execute_process(
+ COMMAND ${OCTAVE_CONFIG} -p OCTLIBDIR
+ OUTPUT_VARIABLE OCTAVE_LIB_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
find_library(
OCTAVE_LIBRARIES
octave
- PATH_SUFFIXES octave-${OCTAVE_VERSION}
+ PATHS ${OCTAVE_LIB_DIR}
)
find_library(
OCTINTERP_LIBRARIES
octinterp
- PATH_SUFFIXES octave-${OCTAVE_VERSION}
+ PATHS ${OCTAVE_LIB_DIR}
)
if(OCTAVE_INCLUDE_PATH AND OCTAVE_LIBRARIES AND OCTINTERP_LIBRARIES)
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel