[ecos] Add new port (#9019)

This commit is contained in:
Daniel Siladji 2019-11-22 01:58:35 +01:00 committed by Robert Schumacher
parent a306312f4b
commit b12c4501d8
3 changed files with 75 additions and 0 deletions

49
ports/ecos/CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
cmake_minimum_required(VERSION 3.14)
project(ecos C)
#include(GNUInstallDirs)
set(EXTERNAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/external)
set(SUITESPARSE ${EXTERNAL_SRC}/SuiteSparse_config)
add_library(ecos-suitesparse INTERFACE)
target_sources(ecos-suitesparse INTERFACE $<BUILD_INTERFACE:${SUITESPARSE}/SuiteSparse_config.h> $<INSTALL_INTERFACE:include/ecos>)
target_include_directories(ecos-suitesparse INTERFACE $<BUILD_INTERFACE:${SUITESPARSE}> $<INSTALL_INTERFACE:include/ecos>)
target_compile_definitions(ecos-suitesparse INTERFACE DLONG LDL_LONG)
set(AMD_SRC ${EXTERNAL_SRC}/amd/src)
set(AMD_INCLUDE ${EXTERNAL_SRC}/amd/include)
add_library(ecos-amd STATIC
${AMD_SRC}/amd_1.c ${AMD_SRC}/amd_2.c ${AMD_SRC}/amd_aat.c ${AMD_SRC}/amd_control.c ${AMD_SRC}/amd_defaults.c ${AMD_SRC}/amd_dump.c ${AMD_SRC}/amd_global.c ${AMD_SRC}/amd_info.c ${AMD_SRC}/amd_order.c ${AMD_SRC}/amd_post_tree.c ${AMD_SRC}/amd_postorder.c ${AMD_SRC}/amd_preprocess.c ${AMD_SRC}/amd_valid.c
)
file(GLOB AMD_HEADERS ${EXTERNAL_SRC}/amd/include/*.h)
target_include_directories(ecos-amd PUBLIC $<BUILD_INTERFACE:${AMD_INCLUDE}> $<INSTALL_INTERFACE:include/ecos>)
target_link_libraries(ecos-amd ecos-suitesparse)
add_library(ecos-ldl STATIC
${EXTERNAL_SRC}/ldl/src/ldl.c
)
file(GLOB LDL_HEADERS ${EXTERNAL_SRC}/ldl/include/*.h)
target_include_directories(ecos-ldl PUBLIC $<BUILD_INTERFACE:${EXTERNAL_SRC}/ldl/include/> $<INSTALL_INTERFACE:include/ecos>)
target_link_libraries(ecos-ldl ecos-suitesparse)
add_library(ecos STATIC
src/cone.c src/ecos.c src/expcone.c src/preproc.c src/splamm.c src/wright_omega.c src/ctrlc.c src/equil.c src/kkt.c src/spla.c src/timer.c
)
file(GLOB ECOS_HEADERS include/*.h)
target_include_directories(ecos PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include/ecos>)
target_link_libraries(ecos ecos-amd ecos-ldl)
install(FILES ${SUITESPARSE}/SuiteSparse_config.h DESTINATION "include/ecos/")
install(FILES ${ECOS_HEADERS} DESTINATION "include/ecos/")
install(FILES ${LDL_HEADERS} DESTINATION "include/ecos/")
install(FILES ${AMD_HEADERS} DESTINATION "include/ecos/")
install(TARGETS ecos ecos-amd ecos-ldl ecos-suitesparse EXPORT ecos-targets)
install(
EXPORT ecos-targets
FILE ecos-config.cmake
DESTINATION share/ecos/
)

3
ports/ecos/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: ecos
Version: 2.0.7
Description: A lightweight conic solver for second-order cone programming.

23
ports/ecos/portfile.cmake Normal file
View File

@ -0,0 +1,23 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO embotech/ecos
REF 2.0.7
SHA512 2781435164b68e5b113a12547cd3a5a787b806009d07d45209117758178cb6e85e26dfb5689172d60b5e40671eb6d303ece131eb5f1b8bab4cbb250af74597b2
HEAD_REF develop
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/ecos RENAME copyright)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_fixup_cmake_targets(CONFIG_PATH "share/ecos")