[mlpack-git] master: If we are using Armadillo 5+, ARMA_64BIT_WORD is implicit. (ea0d81f)

gitdub at big.cc.gt.atl.ga.us gitdub at big.cc.gt.atl.ga.us
Tue Apr 14 17:40:28 EDT 2015


Repository : https://github.com/mlpack/mlpack

On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/9a55cac0229c9d469db3f6ff01cd0fb2985aa599...ea0d81f60e7d6eeb0902dba4e8de9a857c5ef56d

>---------------------------------------------------------------

commit ea0d81f60e7d6eeb0902dba4e8de9a857c5ef56d
Author: Ryan Curtin <ryan at ratml.org>
Date:   Tue Apr 14 17:33:06 2015 -0400

    If we are using Armadillo 5+, ARMA_64BIT_WORD is implicit.


>---------------------------------------------------------------

ea0d81f60e7d6eeb0902dba4e8de9a857c5ef56d
 CMakeLists.txt | 55 +++++++++++++++++++++++++++++++------------------------
 1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d4002d..f04b033 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -116,30 +116,37 @@ find_package(Armadillo 3.6.0 REQUIRED)
 
 # If Armadillo was compiled without ARMA_64BIT_WORD and we are on a 64-bit
 # system (where size_t will be 64 bits), suggest to the user that they should
-# compile Armadillo with 64-bit words.
+# compile Armadillo with 64-bit words.  Note that with Armadillo 5.000.0 and
+# newer, ARMA_64BIT_WORD is enabled by default.
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  # Can we open the configuration file?  If not, issue a warning.
-  if(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
-    message(WARNING "Armadillo configuration file "
-        "(${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp) does not exist!")
-  else(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
-    # We are on a 64-bit system.  Does Armadillo have ARMA_64BIT_WORD enabled?
-    file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp" ARMA_CONFIG)
-    string(REGEX MATCH
-        "[\r\n][ ]*#define ARMA_64BIT_WORD"
-        ARMA_HAS_64BIT_WORD_PRE
-        "${ARMA_CONFIG}")
-
-    string(LENGTH "${ARMA_HAS_64BIT_WORD_PRE}" ARMA_HAS_64BIT_WORD)
-
-    if(ARMA_HAS_64BIT_WORD EQUAL 0)
-      message(WARNING "This is a 64-bit system, but Armadillo was compiled "
-          "without 64-bit index support.  Consider recompiling Armadillo with "
-          "ARMA_64BIT_WORD to enable 64-bit indices (large matrix support). "
-          "MLPACK will still work without ARMA_64BIT_WORD defined, but will not "
-          "scale to matrices with more than 4 billion elements.")
-    endif(ARMA_HAS_64BIT_WORD EQUAL 0)
-  endif(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+  # Check the version, to see if ARMA_64BIT_WORD is enabled by default.
+  set(ARMA_HAS_64BIT_WORD 0)
+  if(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5))
+    set(ARMA_HAS_64BIT_WORD 1)
+  else(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5))
+    # Can we open the configuration file?  If not, issue a warning.
+    if(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+      message(WARNING "Armadillo configuration file "
+          "(${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp) does not exist!")
+    else(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+      # We are on a 64-bit system.  Does Armadillo have ARMA_64BIT_WORD enabled?
+      file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp" ARMA_CONFIG)
+      string(REGEX MATCH
+          "[\r\n][ ]*#define ARMA_64BIT_WORD"
+          ARMA_HAS_64BIT_WORD_PRE
+          "${ARMA_CONFIG}")
+
+      string(LENGTH "${ARMA_HAS_64BIT_WORD_PRE}" ARMA_HAS_64BIT_WORD)
+    endif(NOT EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+  endif(NOT (${ARMADILLO_VERSION_MAJOR} LESS 5))
+
+  if(ARMA_HAS_64BIT_WORD EQUAL 0)
+    message(WARNING "This is a 64-bit system, but Armadillo was compiled "
+        "without 64-bit index support.  Consider recompiling Armadillo with "
+        "ARMA_64BIT_WORD to enable 64-bit indices (large matrix support). "
+        "MLPACK will still work without ARMA_64BIT_WORD defined, but will not "
+        "scale to matrices with more than 4 billion elements.")
+  endif(ARMA_HAS_64BIT_WORD EQUAL 0)
 endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
 
 # On Windows, Armadillo should be using LAPACK and BLAS but we still need to
@@ -168,7 +175,7 @@ if (WIN32)
 
   # Piggyback LAPACK and BLAS linking into Armadillo link.
   set(ARMADILLO_LIBRARIES
-      "${ARMADILLO_LIBRARIES};${BLAS_LIBRARY};${LAPACK_LIBRARY}")
+       ${ARMADILLO_LIBRARIES} ${BLAS_LIBRARY} ${LAPACK_LIBRARY})
 endif (WIN32)
 
 find_package(LibXml2 2.6.0 REQUIRED)



More information about the mlpack-git mailing list