diff --git a/.gitignore b/.gitignore index dbf367d9c..a1d05d120 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ test/Testing/Temporary/CTestCostData.txt *.log .Rproj.user *.png +test/build +.vscode +build +.Rhistory diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 231b65fb4..45ec0cf87 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -57,13 +57,22 @@ endif(COMMAND cmake_policy) include("Eigen.cmake") GetEigen() +#if(NOT DEFINED BOOST) +# message(FATAL_ERROR "This program requires the boost library, and will not be compiled.") +#else() +# message(STATUS "BOOST is DEFINED") +#endif() + +include("lp_solver.cmake") +Get_LP_Solver() + include("Boost.cmake") GetBoost() include("lp_solver.cmake") Get_LP_Solver() -#find_library(LP_SOLVE NAMES liblpsolve55.so liblpsolve55.dylib PATHS /usr/lib/lp_solve /opt/local/lib) +find_library(LP_SOLVE NAMES liblpsolve55.so liblpsolve55.dylib PATHS /usr/lib/lp_solve /opt/local/lib) if (NOT LP_SOLVE) @@ -71,15 +80,13 @@ if (NOT LP_SOLVE) else () + message(STATUS "Library lp_solve found: ${LP_SOLVE}") set(CMAKE_EXPORT_COMPILE_COMMANDS "ON") include_directories (BEFORE ../external) include_directories (BEFORE ../external/minimum_ellipsoid) - #include_directories (BEFORE ../include/cartesian_geom) - #include_directories (BEFORE ../include/convex_bodies) - include_directories (BEFORE _deps/lpsolve-src) - include_directories (BEFORE ../external/boost) - #include_directories (BEFORE BOOST) + include_directories (BEFORE ../external/LPsolve_src/run_headers) + include_directories (BEFORE build/_deps/lpsolve-src) include_directories (BEFORE ../include/generators) include_directories (BEFORE ../include/volume) include_directories (BEFORE ../include) diff --git a/test/_deps/lpsolve-subbuild/CMakeLists.txt b/test/_deps/lpsolve-subbuild/CMakeLists.txt new file mode 100644 index 000000000..4c54759f3 --- /dev/null +++ b/test/_deps/lpsolve-subbuild/CMakeLists.txt @@ -0,0 +1,23 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +cmake_minimum_required(VERSION 3.16.3) + +# We name the project and the target for the ExternalProject_Add() call +# to something that will highlight to the user what we are working on if +# something goes wrong and an error message is produced. + +project(lpsolve-populate NONE) + +include(ExternalProject) +ExternalProject_Add(lpsolve-populate + "UPDATE_DISCONNECTED" "False" "URL" "https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.11/lp_solve_5.5.2.11_source.tar.gz/download" "URL_HASH" "MD5=a829a8d9c60ff81dc72ff52363703886" + SOURCE_DIR "/home/manav/volesti_fork/test/_deps/lpsolve-src" + BINARY_DIR "/home/manav/volesti_fork/test/_deps/lpsolve-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" + USES_TERMINAL_DOWNLOAD YES + USES_TERMINAL_UPDATE YES +) diff --git a/test/lp_solver.cmake b/test/lp_solver.cmake new file mode 100644 index 000000000..6f8ec1b97 --- /dev/null +++ b/test/lp_solver.cmake @@ -0,0 +1,35 @@ +function(Get_LP_Solver) + find_path(LPSOLVE_DIR NAMES LPsolve_src PATHS ../../external) + + if(NOT LPSOLVE_DIR) + + include(FetchContent) + FetchContent_Declare( + lpSolve + URL https://sourceforge.net/projects/lpsolve/files/lpsolve/5.5.2.11/lp_solve_5.5.2.11_source.tar.gz/download + URL_HASH MD5=a829a8d9c60ff81dc72ff52363703886 + ) + + FetchContent_GetProperties(lpSolve) + + if(NOT lpSolve_POPULATE) + message(STATUS "Downloading lp_solve.") + FetchContent_Populate(lpSolve) + message(STATUS "Download complete") + + set(LPSOLVE_DIR ${lpSolve_SOURCE_DIR}) + message(STATUS "Using downloaded lp_solve at: ${LPSOLVE_DIR}") + + else() + message(STATUS "lp_solve found: ${LPSOLVE_DIR}") + + endif() + + set(LPSOLVE_DIR "_deps/lpsolve-src") + message(STATUS "Using downloaded lp_solve at: ${LPSOLVE_DIR}") + + endif() + + include_directories(${LPSOLVE_DIR}) + +endfunction()