[mlpack-git] master: When compiling, see if ARMA_64BIT_WORD is enabled. Store it in a file. This will tell the user (or us, the bug receivers) later if libmlpack.so has 32-bit uword or 64-bit uword. (60010ca)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Wed Apr 1 18:58:15 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/90a9d939482856608467bf174f824bc441ec2c21...60010cad2a8c3e3f52f69c10d8077a025255d6db
>---------------------------------------------------------------
commit 60010cad2a8c3e3f52f69c10d8077a025255d6db
Author: ryan <ryan at ratml.org>
Date: Wed Apr 1 18:57:10 2015 -0400
When compiling, see if ARMA_64BIT_WORD is enabled.
Store it in a file. This will tell the user (or us, the bug receivers) later if libmlpack.so has 32-bit uword or 64-bit uword.
>---------------------------------------------------------------
60010cad2a8c3e3f52f69c10d8077a025255d6db
CMake/CreateArmaConfigInfo.cmake | 50 ++++++++++++++++++++++++++++++++++++++++
CMakeLists.txt | 15 +++++++++++-
2 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/CMake/CreateArmaConfigInfo.cmake b/CMake/CreateArmaConfigInfo.cmake
new file mode 100644
index 0000000..1f85ba9
--- /dev/null
+++ b/CMake/CreateArmaConfigInfo.cmake
@@ -0,0 +1,50 @@
+# Using the CMake tools to create the file arma_config.hpp, which contains
+# information on the Armadillo configuration when mlpack was compiled. We'll
+# need to open the config.hpp we are using.
+if(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+ file(READ "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp"
+ ARMA_CONFIG)
+
+ # Extract ARMA_64BIT_WORD.
+ 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)
+
+ file(REMOVE ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp)
+ file(WRITE ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp
+"/**
+ * @file arma_config.hpp
+ *
+ * This is an autogenerated file which contains the configuration of Armadillo
+ * at the time mlpack was built. If you modify anything in here by hand, your
+ * warranty is void, your house may catch fire, and we're not going to call the
+ * police when your program segfaults so hard that robbers come to your house
+ * and take everything you own. If you do decide, against better judgment, to
+ * modify anything at all in this file, and you are reporting a bug, be
+ * absolutely certain to mention that you've done something stupid in this file
+ * first.
+ *
+ * In short: don't touch this file.
+ */
+#ifndef __MLPACK_CORE_UTIL_ARMA_CONFIG_HPP
+#define __MLPACK_CORE_UTIL_ARMA_CONFIG_HPP
+
+")
+ if(ARMA_HAS_64BIT_WORD EQUAL 0)
+ file(APPEND ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp
+ "#define MLPACK_ARMA_NO_64BIT_WORD")
+ else(ARMA_HAS_64BIT_WORD EQUAL 0)
+ file(APPEND ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp
+ "#define MLPACK_ARMA_64BIT_WORD")
+ endif(ARMA_HAS_64BIT_WORD EQUAL 0)
+
+ file(APPEND ${CMAKE_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp
+ "\n\n#endif\n")
+
+else(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
+ message(WARNING "Armadillo configuration file
+ (${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp) does not exist!")
+endif(EXISTS "${ARMADILLO_INCLUDE_DIR}/armadillo_bits/config.hpp")
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3a86d54..1ef46a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -262,7 +262,6 @@ endif (WIN32)
# Determine whether or not this is a git repository, so that we can set the
# version number if necessary.
-
find_package(Git)
set (USING_GIT "NO")
if (GIT_FOUND)
@@ -298,6 +297,20 @@ if (USING_GIT STREQUAL "YES")
add_dependencies(mlpack mlpack_gitversion)
endif (USING_GIT STREQUAL "YES")
+# Create a target to generate arma_config.hpp, which is used to warn the user
+# when they are doing something stupid when linking something against mlpack.
+include(CMake/CreateArmaConfigInfo.cmake)
+
+add_custom_target(mlpack_arma_config ALL
+ COMMAND ${CMAKE_COMMAND}
+ -D ARMADILLO_INCLUDE_DIR="${ARMADILLO_INCLUDE_DIR}"
+ -P CMake/CreateArmaConfigInfo.cmake
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ COMMENT "Updating arma_config.hpp (if necessary)")
+set(MLPACK_SRCS ${MLPACK_SRCS}
+ "${CMAKE_CURRENT_SOURCE_DIR}/src/mlpack/core/util/arma_config.hpp")
+add_dependencies(mlpack mlpack_arma_config)
+
# Make a target to generate the documentation. If Doxygen isn't installed, then
# I guess this option will just be unavailable.
find_package(Doxygen)
More information about the mlpack-git
mailing list