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

FIX: Trying to fix compilation with simplified FindBoost.cmake

parent 52a1047a
No related branches found
No related tags found
No related merge requests found
...@@ -61,13 +61,18 @@ message("Looking for external libraries...") ...@@ -61,13 +61,18 @@ message("Looking for external libraries...")
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# TODO Instead use better FIND BOOST !!! # TODO Instead use better FIND BOOST !!!
set(Boost_USE_MULTITHREADED ON) set(Boost_USE_MULTITHREADED OFF)
#set(Boost_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost) #set(Boost_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost)
#set(Boost_LIBRARY_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost/stage/lib) #set(Boost_LIBRARY_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/external_dependencies/boost/stage/lib)
find_package(Boost find_package(
COMPONENTS system serialization random Boost
COMPONENTS
system
serialization
random
) )
message("Boost INCLUDE DIR: ${Boost_INCLUDE_DIR}") message("Boost INCLUDE DIR: ${Boost_INCLUDE_DIR}")
...@@ -103,9 +108,9 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib) ...@@ -103,9 +108,9 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
# #----------------------------------------#
# Dependencies for the lib4neuro library # Dependencies for the lib4neuro library #
# #----------------------------------------#
if(WIN32) if(WIN32)
set(LINK_DEP_LIB4NEURO libboost_serialization libboost_system libboost_random libboost_unit_test libexprtk) set(LINK_DEP_LIB4NEURO libboost_serialization libboost_system libboost_random libboost_unit_test libexprtk)
else() else()
......
...@@ -26,40 +26,38 @@ message(${CMAKE_CURRENT_LIST_DIR}) ...@@ -26,40 +26,38 @@ message(${CMAKE_CURRENT_LIST_DIR})
message(${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost) message(${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost)
message(${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost/stage/lib) message(${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost/stage/lib)
file(GLOB tmp
"*.h"
)
message("${tmp}")
# Look for a standard boost header file. # Look for a standard boost header file.
find_path( find_path(
Boost_INCLUDE_DIRS Boost_INCLUDE_DIRS
NAMES NAMES
config.hpp config.hpp
HINTS HINTS
${BOOST_INCLUDEDIR} ${BOOST_INCLUDEDIR}
$ENV{BOOST_INCLUDEDIR} $ENV{BOOST_INCLUDEDIR}
PATHS PATHS
${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost
/usr/include/boost /usr/include/boost
/home/boost /home/boost
${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost
PATH_SUFFIXES PATH_SUFFIXES
include include
boost
) )
if(NOT Boost_INCLUDE_DIRS) if(NOT Boost_INCLUDE_DIRS)
message(FATAL_ERROR "Boost include directory was not found! Please, set variable BOOST_INCLUDEDIR to the correct path.") message(FATAL_ERROR "Boost include directory was not found! Please, set variable BOOST_INCLUDEDIR to the correct path.")
else() else()
message("Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
include_directories("${Boost_INCLUDE_DIRS}") include_directories("${Boost_INCLUDE_DIRS}")
endif() endif()
# Create a list of requested Boost libraries with "system" names # Create a list of requested Boost libraries with "system" names
set(REQUESTED_BOOST_LIBS "") set(REQUESTED_BOOST_LIBS "")
foreach(COMPONENT in ${Boost_FIND_COMPONENTS}) foreach(COMPONENT ${Boost_FIND_COMPONENTS})
list(APPEND REQUESTED_BOOST_LIBS libboost_${COMPONENT}.so) list(APPEND REQUESTED_BOOST_LIBS "libboost_${COMPONENT}.so")
endforeach() endforeach()
# Look for libraries specified by COMPONENTS flag # Look for libraries specified by COMPONENTS flag
...@@ -67,25 +65,38 @@ find_path( ...@@ -67,25 +65,38 @@ find_path(
Boost_LIBRARY_DIRS Boost_LIBRARY_DIRS
NAMES NAMES
REQUESTED_BOOST_LIBS ${REQUESTED_BOOST_LIBS}
HINTS HINTS
${BOOST_LIBRARYDIR} ${BOOST_LIBRARYDIR}
$ENV{BOOST_LIBRARYDIR} $ENV{BOOST_LIBRARYDIR}
PATHS
${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost
/usr/lib/boost /usr/lib/boost
/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
${CMAKE_CURRENT_LIST_DIR}/external_dependencies/boost/stage/lib
PATH_SUFFIXES PATH_SUFFIXES
stage/lib
lib lib
) )
if(NOT Boost_LIBRARY_DIRS) if(NOT Boost_LIBRARY_DIRS)
message(FATAL_ERROR "Boost library directory was not found! Please, set variable BOOST_LIBRARYDIR to the correct path.") message(FATAL_ERROR "Boost library directory was not found! Please, set variable BOOST_LIBRARYDIR to the correct path.")
else()
message("Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}")
endif() endif()
# Set Boost_FOUND # Set Boost_FOUND
if(Boost_INCLUDE_DIRS AND Boost_LIBRARY_DIRS) INCLUDE(FindPackageHandleStandardArgs)
set(Boost_FOUND TRUE) FIND_PACKAGE_HANDLE_STANDARD_ARGS(
else() Boost
message(FATAL_ERROR "Boost library was NOT found!")
endif() FAIL_MESSAGE
"Boost was NOT found!"
REQUIRED_VARS
Boost_INCLUDE_DIRS
Boost_LIBRARY_DIRS
)
...@@ -22,8 +22,15 @@ if ("${BUILD_LIB}" STREQUAL "yes") ...@@ -22,8 +22,15 @@ if ("${BUILD_LIB}" STREQUAL "yes")
DataSet/DataSet.cpp DataSet/DataSet.cpp
ErrorFunction/ErrorFunctions.cpp ErrorFunction/ErrorFunctions.cpp
Solvers/DESolver.cpp Solvers/DESolver.cpp
LearningMethods/ILearningMethods.h
) )
set_target_properties(
lib4neuro
PROPERTIES
IMPORTED_LOCATION
"${Boost_LIBRARY_DIRS}"
)
if(WIN32) if(WIN32)
add_library(libboost_unit_test STATIC boost_test_lib_dummy.cpp) add_library(libboost_unit_test STATIC boost_test_lib_dummy.cpp)
......
...@@ -22,3 +22,18 @@ target_link_libraries(net_test_pde_1 lib4neuro) ...@@ -22,3 +22,18 @@ target_link_libraries(net_test_pde_1 lib4neuro)
add_executable(network_serialization network_serialization.cpp) add_executable(network_serialization network_serialization.cpp)
target_link_libraries(network_serialization lib4neuro) target_link_libraries(network_serialization lib4neuro)
set_target_properties(
test_cases
net_test_1
net_test_2
net_test_3
net_test_ode_1
net_test_pde_1
network_serialization
PROPERTIES
IMPORTED_LOCATION
"${Boost_LIBRARY_DIRS}"
)
...@@ -39,5 +39,27 @@ add_executable(NeuralNetworkSum_test NeuralNetworkSum_test.cpp) ...@@ -39,5 +39,27 @@ add_executable(NeuralNetworkSum_test NeuralNetworkSum_test.cpp)
target_link_libraries(NeuralNetworkSum_test lib4neuro ${LINK_DEP_LIB4NEURO}) target_link_libraries(NeuralNetworkSum_test lib4neuro ${LINK_DEP_LIB4NEURO})
add_executable(DESolver_test DESolver_test.cpp) add_executable(DESolver_test DESolver_test.cpp)
target_link_libraries(DESolver_test lib4neuro ${LINK_DEP_LIB4NEURO}) target_link_libraries(DESolver_test ${LINK_DEP_LIB4NEURO} lib4neuro)
# Set a path to the library dir
set_target_properties(
linear_neuron_test
constant_neuron_test
binary_neuron_test
logistic_neuron_test
connectionFunctionGeneral_test
connection_Function_identity_test
neural_network_test
dataset_test
particle_swarm_test
particle_test
neural_network_test
errorfunction_test
DESolver_test
PROPERTIES
IMPORTED_LOCATION
"${Boost_LIBRARY_DIRS}"
)
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