diff --git a/ports/ecos/CMakeLists.txt b/ports/ecos/CMakeLists.txt new file mode 100644 index 00000000000..231b31f2e72 --- /dev/null +++ b/ports/ecos/CMakeLists.txt @@ -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 $ $) +target_include_directories(ecos-suitesparse INTERFACE $ $) +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 $ $) +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 $ $) +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 $ $) +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/ +) \ No newline at end of file diff --git a/ports/ecos/CONTROL b/ports/ecos/CONTROL new file mode 100644 index 00000000000..fb89b4ed01e --- /dev/null +++ b/ports/ecos/CONTROL @@ -0,0 +1,3 @@ +Source: ecos +Version: 2.0.7 +Description: A lightweight conic solver for second-order cone programming. \ No newline at end of file diff --git a/ports/ecos/portfile.cmake b/ports/ecos/portfile.cmake new file mode 100644 index 00000000000..8c633db6fc1 --- /dev/null +++ b/ports/ecos/portfile.cmake @@ -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") \ No newline at end of file