diff --git a/external/cmake-files/Boost.cmake b/external/cmake-files/Boost.cmake new file mode 100644 index 000000000..48dad5e6f --- /dev/null +++ b/external/cmake-files/Boost.cmake @@ -0,0 +1,36 @@ +set(BOOST_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}) +function(GetBoost) + find_path(BOOST_DIR NAMES boost PATHS ${BOOST_CMAKE_DIR}/../_deps/boost-src) + + if (NOT BOOST_DIR) + + set(BOOST_URL "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" CACHE STRING "Boost download URL") + set(BOOST_URL_SHA256 "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" CACHE STRING "Boost download URL SHA256 checksum") + + include(FetchContent) + set(FETCHCONTENT_BASE_DIR "${BOOST_CMAKE_DIR}/../_deps") + FetchContent_Declare( + Boost + URL ${BOOST_URL} + URL_HASH SHA256=${BOOST_URL_SHA256} + ) + FetchContent_GetProperties(Boost) + + if(NOT Boost_POPULATED) + message(STATUS "Fetching Boost") + FetchContent_Populate(Boost) + message(STATUS "Fetching Boost - done") + set(BOOST_DIR ${boost_SOURCE_DIR}) + endif() + + message(STATUS "Using downloaded Boost library at ${BOOST_DIR}") + + else () + message(STATUS "Boost Library found: ${BOOST_DIR}") + + endif() + + include_directories(${BOOST_DIR}) + include_directories(${BOOST_DIR}/boost) + +endfunction() diff --git a/external/cmake-files/Eigen.cmake b/external/cmake-files/Eigen.cmake new file mode 100644 index 000000000..974a6f184 --- /dev/null +++ b/external/cmake-files/Eigen.cmake @@ -0,0 +1,32 @@ +set(EIGEN_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}) +function(GetEigen) + find_path(EIGEN_DIR NAMES Eigen PATHS ${EIGEN_CMAKE_DIR}/../_deps/eigen-src) + + if (NOT EIGEN_DIR) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR "${EIGEN_CMAKE_DIR}/../_deps") + FetchContent_Declare( + eigen + GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git + GIT_TAG 3.4.0 + ) + + FetchContent_GetProperties(eigen) + + if(NOT eigen_POPULATED) + message(STATUS "Eigen library not found locally, downloading it.") + FetchContent_Populate(eigen) + endif() + + set(EIGEN_DIR ${eigen_SOURCE_DIR}) + message(STATUS "Using downloaded Eigen library at: ${EIGEN_DIR}") + + else () + + message(STATUS "Eigen Library found: ${EIGEN_DIR}") + + endif() + + include_directories(${EIGEN_DIR}) + +endfunction() diff --git a/external/cmake-files/LPSolve.cmake b/external/cmake-files/LPSolve.cmake new file mode 100644 index 000000000..b3f3cf98b --- /dev/null +++ b/external/cmake-files/LPSolve.cmake @@ -0,0 +1,32 @@ +set(LP_SOLVE_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}) +function(GetLPSolve) + find_path(LP_SOLVE_DIR NAMES lpsolve.h PATHS ${LP_SOLVE_CMAKE_DIR}/../_deps/lpsolve-src) + + if (NOT LP_SOLVE_DIR) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR "${LP_SOLVE_CMAKE_DIR}/../_deps") + FetchContent_Declare( + lpsolve + URL https://webwerks.dl.sourceforge.net/project/lpsolve/lpsolve/5.5.2.11/lp_solve_5.5.2.11_source.tar.gz + URL_HASH MD5=a829a8d9c60ff81dc72ff52363703886 + ) + + FetchContent_GetProperties(lpsolve) + + if(NOT lpsolve_POPULATED) + message(STATUS "lp_solve library not found locally, downloading it.") + FetchContent_Populate(lpsolve) + endif() + + set(LP_SOLVE_DIR "${lpsolve_SOURCE_DIR}") + message(STATUS "Using downloaded lp_solve at: ${LP_SOLVE_DIR}") + + else() + + message(STATUS "lp_solve library found: ${LP_SOLVE_DIR}") + + endif() + + include_directories(${LP_SOLVE_DIR}) + +endfunction() diff --git a/external/cmake-files/QD.cmake b/external/cmake-files/QD.cmake new file mode 100644 index 000000000..b65e4f51c --- /dev/null +++ b/external/cmake-files/QD.cmake @@ -0,0 +1,54 @@ +set(QD_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR}) +function(GetQD) + find_path(QD_DIR NAMES config.h PATHS ${QD_CMAKE_DIR}/../_deps/qd-src/) + + if (NOT QD_DIR) + include(FetchContent) + set(FETCHCONTENT_BASE_DIR "${QD_CMAKE_DIR}/../_deps") + FetchContent_Declare( + qd + URL https://www.davidhbailey.com/dhbsoftware/qd-2.3.23.tar.gz + ) + + FetchContent_GetProperties(qd) + + if(NOT qd_POPULATED) + message(STATUS "QD library not found locally, downloading it.") + FetchContent_Populate(qd) + endif() + + set(QD_DIR "${qd_SOURCE_DIR}") + message(STATUS "Using downloaded QD at: ${QD_DIR}") + + else() + + message(STATUS "QD library found: ${QD_DIR}") + + endif() + + include_directories(BEFORE "${QD_DIR}/include/") + message(STATUS "configuring the QD library") + execute_process( + COMMAND ./configure + WORKING_DIRECTORY ${QD_DIR} + OUTPUT_FILE CMD_OUTPUT + RESULT_VARIABLE EXECUTE + ) + if(NOT ${EXECUTE} EQUAL "0") + message(FATAL_ERROR "./configure QD library failed") + endif() + + execute_process( + COMMAND make + WORKING_DIRECTORY ${QD_DIR} + OUTPUT_FILE qd_compilation.txt + RESULT_VARIABLE EXECUTE_MAKE + ) + + if(NOT ${EXECUTE_MAKE} EQUAL "0") + message(FATAL_ERROR "building the QD library failed") + endif() + + find_library(QD_LIB NAMES libqd.a PATHS "${QD_DIR}/src/.libs") + +endfunction()