Skip to content
Snippets Groups Projects
Commit b41ec5b9 authored by Martin Beseda's avatar Martin Beseda
Browse files

FIX: Trying to fix Armadillo Find module

parent bb473a84
No related branches found
No related tags found
No related merge requests found
......@@ -86,6 +86,20 @@ if(N_CORES GREATER 1)
endif()
message("Build will be performed on ${N_CORES} cores.")
#----------------------------------------#
# Set prefixes and suffixes of libraries #
#----------------------------------------#
set(LIB_PREFIX "lib")
set(LIB_SUFFIX "a") # suffix for Linux static libraries
if("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared" AND WIN32)
set(LIB_PREFIX "")
set(LIB_SUFFIX "dll")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static" AND WIN32)
set(LIB_SUFFIX "lib")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared")
set(LIB_SUFFIX "so")
endif()
#-------------------------#
# Find external libraries #
#-------------------------#
......
......@@ -2,9 +2,9 @@ set(ARMADILLO_LOCAL_PATH ${CMAKE_CURRENT_LIST_DIR}/external_dependencies/armadil
include(FetchContent)
###################
# Download exprtk #
###################
######################
# Download Armadillo #
######################
FetchContent_Declare(
armadillo
SOURCE_DIR ${ARMADILLO_LOCAL_PATH}
......
message("FindArmadillo starting...")
# Find headers and libraries
# Find headers
FIND_PATH(
ARMADILLO_INCLUDE_DIR
......@@ -23,29 +23,49 @@ FIND_PATH(
armadillo
include/armadillo
)
# Set TURTLE_FOUND honoring the QUIET and REQUIRED arguments
# Find library
set(LIBNAME ${LIB_PREFIX}armadillo.so)
message(${LIBNAME})
FIND_LIBRARY(
ARMADILLO_LIBRARY_DIR
NAMES
${LIBNAME}
HINTS
external_dependencies/armadillo
PATHS
/usr/lib
/usr/local/lib
)
# Set ARMADILLO_FOUND honoring the QUIET and REQUIRED arguments
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
armadillo
"Armadillo was NOT found!"
ARMADILLO_INCLUDE_DIR)
ARMADILLO_INCLUDE_DIR
ARMADILLO_LIBRARY_DIR)
# Output variables
IF(ARMADILLO_FOUND)
# Include dirs
SET(ARMADILLO_INCLUDE_DIRS ${ARMADILLO_INCLUDE_DIR})
set(TMP "")
string(REGEX REPLACE "/include" "" TMP ${ARMADILLO_INCLUDE_DIR})
add_subdirectory(${TMP} ${TMP})
# If Armadillo is downloaded as a source code, add it to the project, so the library will be compiled
# automatically
IF(${ARMADILLO_INCLUDE_DIR} MATCHES "^.*external_dependencies.*$")
set(TMP "")
string(REGEX REPLACE "/include" "" TMP ${ARMADILLO_INCLUDE_DIR})
add_subdirectory(${TMP} ${TMP})
ENDIF()
message("Armadillo was successfully found.")
ENDIF()
# Add path only to the 'include' folder
#set(TMP "")
#string(REGEX REPLACE "/turtle$" "" TMP ${TURTLE_INCLUDE_DIR})
#list(APPEND TURTLE_INCLUDE_DIR ${TMP})
# Advanced options for not cluttering the cmake UIs:
MARK_AS_ADVANCED(ARMADILLO_INCLUDE_DIR)
MARK_AS_ADVANCED(ARMADILLO_LIBRARY_DIR)
......@@ -74,17 +74,6 @@ if(NOT DEPENDENCIES_LINK_TYPE)
message(FATAL_ERROR "Variable DEPENDENCIES_LINK_TYPE is not set! Set it to 'static' or 'shared'.")
endif()
set(LIB_PREFIX "lib")
set(LIB_SUFFIX "a") # suffix for Linux static libraries
if("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared" AND WIN32)
set(LIB_PREFIX "")
set(LIB_SUFFIX "dll")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "static" AND WIN32)
set(LIB_SUFFIX "lib")
elseif("${DEPENDENCIES_LINK_TYPE}" STREQUAL "shared")
set(LIB_SUFFIX "so")
endif()
set(REQUESTED_BOOST_LIBS "")
foreach(COMPONENT ${Boost_FIND_COMPONENTS})
list(APPEND REQUESTED_BOOST_LIBS "${LIB_PREFIX}boost_${COMPONENT}.${LIB_SUFFIX}")
......
......@@ -171,7 +171,7 @@ namespace lib4neuro {
*/
DataSet* ds_test = nullptr;
};
class MSE : public ErrorFunction{
public:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment