Skip to content

Commit

Permalink
Minor inclusion for crhmc
Browse files Browse the repository at this point in the history
  • Loading branch information
guillexm committed Sep 8, 2023
1 parent 1297059 commit a512dac
Show file tree
Hide file tree
Showing 4 changed files with 154 additions and 0 deletions.
36 changes: 36 additions & 0 deletions external/cmake-files/Boost.cmake
Original file line number Diff line number Diff line change
@@ -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()
32 changes: 32 additions & 0 deletions external/cmake-files/Eigen.cmake
Original file line number Diff line number Diff line change
@@ -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()
32 changes: 32 additions & 0 deletions external/cmake-files/LPSolve.cmake
Original file line number Diff line number Diff line change
@@ -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()
54 changes: 54 additions & 0 deletions external/cmake-files/QD.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit a512dac

Please sign in to comment.