Files
mlpack/CMake/CreateArmaConfigInfo.cmake
T
ryan 60010cad2a 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.
2015-04-01 18:57:10 -04:00

51 lines
2.1 KiB
CMake

# 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")