Skip to content

Commit

Permalink
including eigen submodule in cmakelists, restructure
Browse files Browse the repository at this point in the history
  • Loading branch information
shutsch committed Feb 23, 2024
1 parent d7e3ee1 commit aa050b6
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,36 +46,43 @@ endif()
## then AUTODIFF

if (USE_AUTODIFF)
message("-- Trying to find autodiff. Turn off via setting 'USE_AUTODIFF=OFF' in your environment before installation. ")
find_package(autodiff)
if (autodiff_FOUND)
message("-- global installation of the autodiff library found: attempting to find Eigen3.")
else()
message("-- no global installation of autodiff library found. Trying to include it as a submodule.")
set(INTERNAL_findautodiff_DIR ${PROJECT_SOURCE_DIR}/extern/autodiff)
if(NOT EXISTS ${INTERNAL_findautodiff_DIR})
message("The autodiff submodule was not found! Please run 'git submodule update --init'. Alternatively you can install autodiff globally on your system." )


find_package(Eigen3 REQUIRED NO_MODULE)
if(NOT Eigen3_FOUND)
message("-- Could not find Eigen3 library globally! Trying to include it as a submodule.")
set(EIGEN_PATH ${PROJECT_SOURCE_DIR}/extern/Eigen)
if(NOT EXISTS ${EIGEN_PATH})
message("The Eigen3 submodule was not found! Please run 'git submodule update --init'. Alternatively you can try to set the EIGEN_PATH to the eigen header files manually. Will proceed without autodiiferentiation." )
set(USE_AUTODIFF OFF)
else()
add_subdirectory(${INTERNAL_findautodiff_DIR})
message("-- autodiff library found as a submodule. Tests will be compiled.")
set(autodiff_FOUND ON)
message("-- Eigen3 library found as a submodule. Tests will be compiled.")
set(Eigen3_FOUND ON)
endif()
else()
message("-- Eigen3 library at ${EIGEN_PATH} found.")
endif()

if (autodiff_FOUND)

find_package(Eigen3 REQUIRED NO_MODULE)
if (Eigen3_FOUND)

set(autodiff_INCLUDE_DIRS ${EIGEN_PATH})

if(NOT Eigen3_FOUND)
message("-- Could not find the Eigen3 library! Autodifferention disabled.")
else()
message("-- Eigen3 library found: Autodifferention enabled.")
endif()
else()
message("-- Could not find the autodiff library! Autodifferention disabled.")
message("-- Trying to find autodiff. Turn off via setting 'USE_AUTODIFF=OFF' in your environment before installation. ")
find_package(autodiff)
if (autodiff_FOUND)
message("-- global installation of the autodiff library found: attempting to find Eigen3.")
else()
message("-- no global installation of autodiff library found. Trying to include it as a submodule.")
set(INTERNAL_findautodiff_DIR ${PROJECT_SOURCE_DIR}/extern/autodiff)
if(NOT EXISTS ${INTERNAL_findautodiff_DIR})
message("The autodiff submodule was not found! Please run 'git submodule update --init'. Alternatively you can install autodiff globally on your system." )
set(USE_AUTODIFF OFF)
else()
add_subdirectory(${INTERNAL_findautodiff_DIR})
message("-- autodiff library found as a submodule. Tests will be compiled.")
set(autodiff_FOUND ON)
endif()
endif()
endif()
else()
set(autodiff_FOUND OFF)
Expand Down

0 comments on commit aa050b6

Please sign in to comment.