Skip to content

Commit

Permalink
parent adb62d5
Browse files Browse the repository at this point in the history
author Manav Shah <manavshah2002@live.com> 1617172313 -0700
committer Manav Shah <manavshah2002@live.com> 1618279004 -0700

Made cmake for lp_solve
  • Loading branch information
ManavShah05 committed Apr 13, 2021
1 parent adb62d5 commit dbab7de
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ test/Testing/Temporary/CTestCostData.txt
*.log
.Rproj.user
*.png
test/build
.vscode
build
.Rhistory
19 changes: 13 additions & 6 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,36 @@ 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)

message(FATAL_ERROR "This program requires the lp_solve library, and will not be compiled.")

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)
Expand Down
23 changes: 23 additions & 0 deletions test/_deps/lpsolve-subbuild/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
35 changes: 35 additions & 0 deletions test/lp_solver.cmake
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit dbab7de

Please sign in to comment.