[cgl] Add new port (#7810)

This commit is contained in:
NancyLi1013 2019-08-27 14:51:29 -07:00 committed by Curtis J Bezault
parent 24049959f2
commit dd8880cdd0
5 changed files with 211 additions and 0 deletions

143
ports/cgl/CMakeLists.txt Normal file
View File

@ -0,0 +1,143 @@
cmake_minimum_required(VERSION 3.11)
project(Cgl LANGUAGES C CXX)
set(PROJECT_VERSION 0.60.2)
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 60)
set(PROJECT_VERSION_PATCH 2)
set(CMAKE_CXX_STANDARD 14)
set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed")
set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed")
set(INSTALL_INCLUDE_DIR "include/Coin" CACHE PATH "Path where headers will be installed")
set(INSTALL_CMAKE_DIR "share/cgl" CACHE PATH "Path where cmake configs will be installed")
# Make relative paths absolute (needed later on)
set(RELATIVE_INSTALL_INCLUDE_DIR ${INSTALL_INCLUDE_DIR})
foreach(p LIB BIN INCLUDE CMAKE)
set(var INSTALL_${p}_DIR)
if(NOT IS_ABSOLUTE "${${var}}")
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()
if(MSVC)
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} /bigobj /MP /wd4996 /wd4819 /wd4251 /wd4267 /wd4244 /wd4275"
)
endif()
if(APPLE)
set(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override -Wno-unused-command-line-argument -Wno-unused-result -Wno-exceptions"
)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9"
CACHE STRING "Minimum OS X deployment version")
endif()
find_package(CoinUtils REQUIRED)
find_package(Osi REQUIRED)
file(GLOB CGL_SOURCES
Cgl/src/CglConfig.h
Cgl/src/*.hpp
Cgl/src/*.cpp
Cgl/src/CglAllDifferent/*.cpp
Cgl/src/CglAllDifferent/*.hpp
Cgl/src/CglBKClique/*.cpp
Cgl/src/CglBKClique/*.hpp
Cgl/src/CglClique/*.cpp
Cgl/src/CglClique/*.hpp
Cgl/src/CglCliqueMerging/*.cpp
Cgl/src/CglCliqueMerging/*.hpp
Cgl/src/CglDuplicateRow/*.cpp
Cgl/src/CglDuplicateRow/*.hpp
Cgl/src/CglFlowCover/*.cpp
Cgl/src/CglFlowCover/*.hpp
Cgl/src/CglGMI/*.cpp
Cgl/src/CglGMI/*.hpp
Cgl/src/CglGomory/*.cpp
Cgl/src/CglGomory/*.hpp
Cgl/src/CglKnapsackCover/*.cpp
Cgl/src/CglKnapsackCover/*.hpp
Cgl/src/CglLandP/*.cpp
Cgl/src/CglLandP/*.hpp
Cgl/src/CglLiftAndProject/*.cpp
Cgl/src/CglLiftAndProject/*.hpp
Cgl/src/CglMixedIntegerRounding/*.cpp
Cgl/src/CglMixedIntegerRounding/*.hpp
Cgl/src/CglMixedIntegerRounding2/*.cpp
Cgl/src/CglMixedIntegerRounding2/*.hpp
Cgl/src/CglOddHole/*.cpp
Cgl/src/CglOddHole/*.hpp
Cgl/src/CglOddHoleWC/*.cpp
Cgl/src/CglOddHoleWC/*.hpp
Cgl/src/CglPreProcess/*.cpp
Cgl/src/CglPreProcess/*.hpp
Cgl/src/CglProbing/*.cpp
Cgl/src/CglProbing/*.hpp
Cgl/src/CglRedSplit/*.cpp
Cgl/src/CglRedSplit/*.hpp
Cgl/src/CglRedSplit2/*.cpp
Cgl/src/CglRedSplit2/*.hpp
Cgl/src/CglResidualCapacity/*.cpp
Cgl/src/CglResidualCapacity/*.hpp
Cgl/src/CglSimpleRounding/*.cpp
Cgl/src/CglSimpleRounding/*.hpp
Cgl/src/CglTwomir/*.cpp
Cgl/src/CglTwomir/*.hpp
Cgl/src/CglZeroHalf/*.cpp
Cgl/src/CglZeroHalf/*.hpp)
add_library(${PROJECT_NAME} ${CGL_SOURCES})
target_include_directories(${PROJECT_NAME}
PUBLIC
$<INSTALL_INTERFACE:${RELATIVE_INSTALL_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/Cgl/src/>)
if(MSVC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_CMATH)
target_compile_definitions(${PROJECT_NAME} PUBLIC COIN_HAS_CLP)
target_link_libraries(${PROJECT_NAME} PRIVATE Coin::CoinUtils Coin::Osi)
install(DIRECTORY Cgl/src/
DESTINATION ${INSTALL_INCLUDE_DIR}
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "config_default.h" EXCLUDE)
install(TARGETS ${PROJECT_NAME}
EXPORT "${PROJECT_NAME}Targets"
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin)
include(CMakePackageConfigHelpers)
set(version_config "${CMAKE_CURRENT_BINARY_DIR}/temp/${PROJECT_NAME}ConfigVersion.cmake")
set(project_config "${CMAKE_CURRENT_BINARY_DIR}/temp/${PROJECT_NAME}Config.cmake")
set(namespace "Coin::")
write_basic_package_version_file("${version_config}"
COMPATIBILITY SameMajorVersion)
configure_package_config_file("Config.cmake.in"
"${project_config}"
INSTALL_DESTINATION
"${INSTALL_CMAKE_DIR}")
install(FILES "${project_config}" "${version_config}"
DESTINATION "${INSTALL_CMAKE_DIR}")
install(EXPORT "${PROJECT_NAME}Targets"
NAMESPACE "${namespace}"
DESTINATION "${INSTALL_CMAKE_DIR}")

5
ports/cgl/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: cgl
Version: 0.60.2-1
Homepage: https://github.com/coin-or/Cgl
Description: The COIN-OR Cut Generation Library (Cgl) is a collection of cut generators that can be used with other COIN-OR packages that make use of cuts, such as, among others, the linear solver Clp or the mixed integer linear programming solvers Cbc or BCP.
Build-Depends: coinutils, osi, clp

View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
check_required_components("@PROJECT_NAME@")

View File

@ -0,0 +1,30 @@
diff --git a/Cgl/src/CglLandP/CglLandP.cpp b/Cgl/src/CglLandP/CglLandP.cpp
index 2676790..af90a6e 100644
--- a/Cgl/src/CglLandP/CglLandP.cpp
+++ b/Cgl/src/CglLandP/CglLandP.cpp
@@ -22,7 +22,7 @@
#define CLONE_SI //Solver is cloned between two cuts
#include "CoinTime.hpp"
-#include "CglGomory.hpp"
+#include "CglGomory/CglGomory.hpp"
#include "CoinFactorization.hpp"
#include <fstream>
namespace LAP
diff --git a/Cgl/src/CglPreProcess/CglPreProcess.cpp b/Cgl/src/CglPreProcess/CglPreProcess.cpp
index 17cf372..8cb738f 100644
--- a/Cgl/src/CglPreProcess/CglPreProcess.cpp
+++ b/Cgl/src/CglPreProcess/CglPreProcess.cpp
@@ -24,9 +24,9 @@
#include "CoinHelperFunctions.hpp"
#include "CoinWarmStartBasis.hpp"
-#include "CglProbing.hpp"
-#include "CglDuplicateRow.hpp"
-#include "CglClique.hpp"
+#include "CglProbing/CglProbing.hpp"
+#include "CglDuplicateRow/CglDuplicateRow.hpp"
+#include "CglClique/CglClique.hpp"
//#define PRINT_DEBUG 1
//#define COIN_DEVELOP 1
#ifdef COIN_DEVELOP

28
ports/cgl/portfile.cmake Normal file
View File

@ -0,0 +1,28 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO coin-or/Cgl
REF releases/0.60.2
SHA512 86db94638d586d2fb64cb55f72197f847731c710351168189647686c5229555c79bc411044ab1cc789a520577de2be3c2e8611221d743f9dbaabb71544d0fa66
PATCHES fix-c1083-error.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/Config.cmake.in DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)