-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake refactor and fix examples. (#190)
* cmake refactoring * lpsolve include changes * fix in examples * Trigger Build * fix external cmake-files * fix vpolytopevolume example * fix examples cmake * Update R-CMD-check-macOS.yml
- Loading branch information
Showing
26 changed files
with
569 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
test/build | ||
external/_deps | ||
examples/build | ||
.vscode | ||
test/Testing/Temporary/CTestCostData.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ _deps | |
CMakeFiles | ||
cmake_install.cmake | ||
Makefile | ||
compile_commands.json | ||
compile_commands.json | ||
CMakeCache.txt |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
112 changes: 110 additions & 2 deletions
112
examples/count-linear-extensions-using-hpolytope/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,112 @@ | ||
# VolEsti (volume computation and sampling library) | ||
# Copyright (c) 2012-2021 Vissarion Fisikopoulos | ||
# Copyright (c) 2018-2021 Apostolos Chalkis | ||
# Contributed and/or modified by Vaibhav Thakkar | ||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
add_executable (volesti_lecount volesti_lecount.cpp) | ||
TARGET_LINK_LIBRARIES(volesti_lecount ${LP_SOLVE}) | ||
project( VolEsti ) | ||
|
||
|
||
CMAKE_MINIMUM_REQUIRED(VERSION 3.11) | ||
|
||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) | ||
|
||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
|
||
|
||
option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON) | ||
option(BUILTIN_EIGEN "Use eigen from ../../external" OFF) | ||
|
||
|
||
if(DISABLE_NLP_ORACLES) | ||
add_definitions(-DDISABLE_NLP_ORACLES) | ||
else() | ||
find_library(IFOPT NAMES libifopt_core.so PATHS /usr/local/lib) | ||
find_library(IFOPT_IPOPT NAMES libifopt_ipopt.so PATHS /usr/local/lib) | ||
find_library(GMP NAMES libgmp.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(MPSOLVE NAMES libmps.so PATHS /usr/local/lib) | ||
find_library(PTHREAD NAMES libpthread.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(FFTW3 NAMES libfftw3.so.3 PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
|
||
if (NOT IFOPT) | ||
|
||
message(FATAL_ERROR "This program requires the ifopt library, and will not be compiled.") | ||
|
||
elseif (NOT GMP) | ||
|
||
message(FATAL_ERROR "This program requires the gmp library, and will not be compiled.") | ||
|
||
elseif (NOT MPSOLVE) | ||
|
||
message(FATAL_ERROR "This program requires the mpsolve library, and will not be compiled.") | ||
|
||
elseif (NOT FFTW3) | ||
|
||
message(FATAL_ERROR "This program requires the fftw3 library, and will not be compiled.") | ||
|
||
else() | ||
message(STATUS "Library ifopt found: ${IFOPT}") | ||
message(STATUS "Library gmp found: ${GMP}") | ||
message(STATUS "Library mpsolve found: ${MPSOLVE}") | ||
message(STATUS "Library fftw3 found:" ${FFTW3}) | ||
|
||
endif(NOT IFOPT) | ||
|
||
endif(DISABLE_NLP_ORACLES) | ||
|
||
include("../../external/cmake-files/Eigen.cmake") | ||
GetEigen() | ||
|
||
include("../../external/cmake-files/Boost.cmake") | ||
GetBoost() | ||
|
||
include("../../external/cmake-files/LPSolve.cmake") | ||
GetLPSolve() | ||
|
||
# Find lpsolve library | ||
find_library(LP_SOLVE NAMES liblpsolve55.so PATHS /usr/lib/lp_solve) | ||
|
||
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/generators) | ||
include_directories (BEFORE ../../include/volume) | ||
include_directories (BEFORE ../../include) | ||
include_directories (BEFORE ../../include/convex_bodies) | ||
include_directories (BEFORE ../../include/random_walks) | ||
include_directories (BEFORE ../../include/annealing) | ||
include_directories (BEFORE ../../include/ode_solvers) | ||
include_directories (BEFORE ../../include/root_finders) | ||
include_directories (BEFORE ../../include/samplers) | ||
include_directories (BEFORE ../../include/lp_oracles) | ||
include_directories (BEFORE ../../include/nlp_oracles) | ||
include_directories (BEFORE ../../include/misc) | ||
include_directories (BEFORE ../../include/optimization) | ||
|
||
# for Eigen | ||
if (${CMAKE_VERSION} VERSION_LESS "3.12.0") | ||
add_compile_options(-D "EIGEN_NO_DEBUG") | ||
else () | ||
add_compile_definitions("EIGEN_NO_DEBUG") | ||
endif () | ||
|
||
|
||
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++11") # enable C++11 standard | ||
add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler | ||
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-ldl") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-DBOOST_NO_AUTO_PTR") | ||
|
||
add_executable (volesti_lecount volesti_lecount.cpp) | ||
TARGET_LINK_LIBRARIES(volesti_lecount ${LP_SOLVE}) | ||
|
||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,112 @@ | ||
# VolEsti (volume computation and sampling library) | ||
# Copyright (c) 2012-2021 Vissarion Fisikopoulos | ||
# Copyright (c) 2018-2021 Apostolos Chalkis | ||
# Contributed and/or modified by Vaibhav Thakkar | ||
# Licensed under GNU LGPL.3, see LICENCE file | ||
|
||
# Copyright (c) 2012-2018 Vissarion Fisikopoulos | ||
# Copyright (c) 2018 Apostolos Chalkis | ||
# Copyright (c) 2021- Vaibhav Thakkar | ||
project( VolEsti ) | ||
|
||
# Contributed and/or modified by Vaibhav Thakkar | ||
|
||
# Licensed under GNU LGPL.3, see LICENCE file | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.11) | ||
|
||
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) | ||
|
||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
|
||
|
||
option(DISABLE_NLP_ORACLES "Disable non-linear oracles (used in collocation)" ON) | ||
option(BUILTIN_EIGEN "Use eigen from ../../external" OFF) | ||
|
||
|
||
if(DISABLE_NLP_ORACLES) | ||
add_definitions(-DDISABLE_NLP_ORACLES) | ||
else() | ||
find_library(IFOPT NAMES libifopt_core.so PATHS /usr/local/lib) | ||
find_library(IFOPT_IPOPT NAMES libifopt_ipopt.so PATHS /usr/local/lib) | ||
find_library(GMP NAMES libgmp.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(MPSOLVE NAMES libmps.so PATHS /usr/local/lib) | ||
find_library(PTHREAD NAMES libpthread.so PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
find_library(FFTW3 NAMES libfftw3.so.3 PATHS /usr/lib/x86_64-linux-gnu /usr/lib/i386-linux-gnu) | ||
|
||
if (NOT IFOPT) | ||
|
||
message(FATAL_ERROR "This program requires the ifopt library, and will not be compiled.") | ||
|
||
elseif (NOT GMP) | ||
|
||
message(FATAL_ERROR "This program requires the gmp library, and will not be compiled.") | ||
|
||
elseif (NOT MPSOLVE) | ||
|
||
message(FATAL_ERROR "This program requires the mpsolve library, and will not be compiled.") | ||
|
||
elseif (NOT FFTW3) | ||
|
||
message(FATAL_ERROR "This program requires the fftw3 library, and will not be compiled.") | ||
|
||
else() | ||
message(STATUS "Library ifopt found: ${IFOPT}") | ||
message(STATUS "Library gmp found: ${GMP}") | ||
message(STATUS "Library mpsolve found: ${MPSOLVE}") | ||
message(STATUS "Library fftw3 found:" ${FFTW3}) | ||
|
||
endif(NOT IFOPT) | ||
|
||
endif(DISABLE_NLP_ORACLES) | ||
|
||
include("../../external/cmake-files/Eigen.cmake") | ||
GetEigen() | ||
|
||
include("../../external/cmake-files/Boost.cmake") | ||
GetBoost() | ||
|
||
include("../../external/cmake-files/LPSolve.cmake") | ||
GetLPSolve() | ||
|
||
# Find lpsolve library | ||
find_library(LP_SOLVE NAMES liblpsolve55.so PATHS /usr/lib/lp_solve) | ||
|
||
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/generators) | ||
include_directories (BEFORE ../../include/volume) | ||
include_directories (BEFORE ../../include) | ||
include_directories (BEFORE ../../include/convex_bodies) | ||
include_directories (BEFORE ../../include/random_walks) | ||
include_directories (BEFORE ../../include/annealing) | ||
include_directories (BEFORE ../../include/ode_solvers) | ||
include_directories (BEFORE ../../include/root_finders) | ||
include_directories (BEFORE ../../include/samplers) | ||
include_directories (BEFORE ../../include/lp_oracles) | ||
include_directories (BEFORE ../../include/nlp_oracles) | ||
include_directories (BEFORE ../../include/misc) | ||
include_directories (BEFORE ../../include/optimization) | ||
|
||
# for Eigen | ||
if (${CMAKE_VERSION} VERSION_LESS "3.12.0") | ||
add_compile_options(-D "EIGEN_NO_DEBUG") | ||
else () | ||
add_compile_definitions("EIGEN_NO_DEBUG") | ||
endif () | ||
|
||
|
||
add_definitions(${CMAKE_CXX_FLAGS} "-std=c++11") # enable C++11 standard | ||
add_definitions(${CMAKE_CXX_FLAGS} "-O3") # optimization of the compiler | ||
#add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lgsl") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-lm") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-ldl") | ||
add_definitions(${CXX_COVERAGE_COMPILE_FLAGS} "-DBOOST_NO_AUTO_PTR") | ||
|
||
add_executable (ellipsoid2d-sampling ellipsoid2d-sampling.cpp) | ||
TARGET_LINK_LIBRARIES(ellipsoid2d-sampling ${LP_SOLVE}) | ||
|
||
add_executable (ellipsoid2d-sampling ellipsoid2d-sampling.cpp) | ||
TARGET_LINK_LIBRARIES(ellipsoid2d-sampling ${LP_SOLVE}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.