[mlpack-svn] r13719 - mlpack/trunk/CMake

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Oct 16 00:32:33 EDT 2012


Author: rcurtin
Date: 2012-10-16 00:32:33 -0400 (Tue, 16 Oct 2012)
New Revision: 13719

Added:
   mlpack/trunk/CMake/ModifyMatlabPathdef.cmake
Log:
Script to modify the file which controls the MATLAB default path to add the
"MLPACK toolbox", as I am calling it.  Also in reference to an earlier commit
message, to clarify, my cat is quite seriously weapons-grade stupid.


Added: mlpack/trunk/CMake/ModifyMatlabPathdef.cmake
===================================================================
--- mlpack/trunk/CMake/ModifyMatlabPathdef.cmake	                        (rev 0)
+++ mlpack/trunk/CMake/ModifyMatlabPathdef.cmake	2012-10-16 04:32:33 UTC (rev 13719)
@@ -0,0 +1,25 @@
+# Our goal is to make sure that the toolbox/mlpack directory is in the MATLAB
+# default path.  It is possible that that directory is already in the path, so
+# we must consider that possibility too.
+#
+# This script assumes that ${MATLAB_ROOT} is set and writes the (potentially)
+# modified file to ${PATHDEF_OUTPUT_FILE}.
+
+# This could potentially be incorrect for older versions of MATLAB.
+file(READ "${MATLAB_ROOT}/toolbox/local/pathdef.m" PATHDEF)
+
+string(REGEX MATCH "matlabroot,'/toolbox/mlpack:',[ ]*..." MLPACK_PATHDEF
+    "${PATHDEF}")
+
+if("${MLPACK_PATHDEF}" STREQUAL "")
+  # The MLPACK toolbox does not exist in the path.  Therefore we have to modify
+  # the file.
+  string(REPLACE "%%% END ENTRIES %%%"
+      "matlabroot,'/toolbox/mlpack:', ...\n%%% END ENTRIES %%%" MOD_PATHDEF
+      "${PATHDEF}")
+
+  file(WRITE "${PATHDEF_OUTPUT_FILE}" "${MOD_PATHDEF}")
+else("${MLPACK_PATHDEF}" STREQUAL "")
+  # Write unmodified file.
+  file(WRITE "${PATHDEF_OUTPUT_FILE}" "${PATHDEF}")
+endif("${MLPACK_PATHDEF}" STREQUAL "")




More information about the mlpack-svn mailing list