Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 30 additions & 13 deletions ports/coin-or-ipopt/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,39 +1,56 @@
set(VCPKG_BUILD_TYPE release)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO coin-or/Ipopt
REF ec43e37a06054246764fb116e50e3e30c9ada089
SHA512 f5b30e81b4a1a178e9a0e2b51b4832f07441b2c3e9a2aa61a6f07807f94185998e985fcf3c34d96fbfde78f07b69f2e0a0675e1e478a4e668da6da60521e0fd6
HEAD_REF master
)
# --with-precision floating-point precision to use: single or double
# (default)
# --with-intsize integer type to use: specify 32 for int or 64 for
# int64_t
file(COPY "${CURRENT_INSTALLED_DIR}/share/coin-or-buildtools/" DESTINATION "${SOURCE_PATH}")

set(ENV{ACLOCAL} "aclocal -I \"${SOURCE_PATH}/BuildTools\"")

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
#--with-pardiso
set(CONFIGURE_ARGS
--without-spral
#--without-wsmp
--without-hsl
--without-asl
--with-lapack
--without-mumps
--enable-relocatable
--disable-f77
--disable-java
#--with-pardiso
#--without-wsmp
#--with-precision floating-point precision to use: single or double(default)
#--with-intsize integer type to use: specify 32 for int or 64(default) for int64_t
)

if("mumps" IN_LIST FEATURES)
list(APPEND CONFIGURE_ARGS "--with-mumps")
endif()

# link against openblas, assumed static lib
set(OPENBLAS_LIB "${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}")

if(VCPKG_HOST_IS_WINDOWS)
list(APPEND CONFIGURE_ARGS "--with-lapack-lflags=${CURRENT_INSTALLED_DIR}/lib/${OPENBLAS_LIB}")
elseif(VCPKG_HOST_IS_LINUX)
list(APPEND CONFIGURE_ARGS "--with-lapack-lflags=-L${CURRENT_INSTALLED_DIR}/lib -lopenblas -lm")
endif()

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
${CONFIGURE_ARGS}
)
vcpkg_install_make()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
# Install usage file and custom FindModules
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

# Handle copyright
#file(REMOVE "${CURRENT_PACKAGES_DIR}/share/${PORT}/LICENSE")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
12 changes: 12 additions & 0 deletions ports/coin-or-ipopt/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
The package coin-or-ipopt provides pkg-config config:

pkg_check_modules(IPOPT REQUIRED ipopt)
target_include_directories(main PRIVATE ${IPOPT_INCLUDE_DIRS})
target_link_directories(main PRIVATE ${IPOPT_LIBRARY_DIRS})
target_link_libraries(main PRIVATE ${IPOPT_LIBRARIES})

Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a software package for large-scale nonlinear optimization

The ipopt target provides access to the COIN-OR build of IPOPT
with with basic set of required dependencies, BLAS, LAPACK (both provided by OpenBLAS), and MUMPS (provided by COINMUMPS)
automatically linked.
23 changes: 21 additions & 2 deletions ports/coin-or-ipopt/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
{
"name": "coin-or-ipopt",
"version-date": "2023-02-01",
"port-version":2,
"description": "Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a software package for large-scale nonlinear optimization",
"homepage": "https://github.com/coin-or/Ipopt",
"license": "EPL-2.0",
"dependencies": [
"coinutils",
"intel-mkl"
]
"pkgconf",
{
"name":"openblas",
"features":["blas","lapack"]
}
],
"default-features": [
"mumps"
],
"features": {
"mumps": {
"description": "Enable MUMPS linear solver",
"dependencies": [
"mumps"
]
},
"hsl": {
"description": "Enable HSL linear solvers (requires HSL sources)"
}
}
}
100 changes: 100 additions & 0 deletions ports/mumps/FindMUMPS_MPI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Custom MPI finder for MUMPS that includes all required MPI libraries
# This module creates a MUMPS_MPI::MUMPS_MPI target with all the MPI libraries
# that MUMPS needs, including the Fortran interface libraries.

include(FindPackageHandleStandardArgs)

# First find the standard MPI
find_package(MPI REQUIRED COMPONENTS C)

# Get the MPI library directory from the standard MPI target
get_target_property(MPI_C_LIBRARIES MPI::MPI_C INTERFACE_LINK_LIBRARIES)

# Extract the library directory from one of the MPI libraries
if(MPI_C_LIBRARIES)
foreach(lib IN LISTS MPI_C_LIBRARIES)
if(EXISTS "${lib}" AND NOT IS_DIRECTORY "${lib}")
get_filename_component(MPI_LIB_DIR "${lib}" DIRECTORY)
break()
endif()
endforeach()
endif()

# Define the list of MPI libraries that MUMPS needs based on platform
if(WIN32)
# Windows with MS-MPI
set(MUMPS_MPI_LIBRARY_NAMES
msmpi
)
else()
# Linux/Unix with OpenMPI or similar
set(MUMPS_MPI_LIBRARY_NAMES
#mpi_usempif08
#mpi_usempi_ignore_tkr
#mpi_mpifh
mpi
)
endif()

# Find each required MPI library
set(MUMPS_MPI_LIBRARIES "")
set(MUMPS_MPI_LIBRARIES_FOUND TRUE)

foreach(lib_name IN LISTS MUMPS_MPI_LIBRARY_NAMES)
find_library(MUMPS_MPI_${lib_name}_LIBRARY
NAMES ${lib_name}
HINTS ${MPI_LIB_DIR}
DOC "Location of lib${lib_name} for MUMPS MPI support"
)

if(MUMPS_MPI_${lib_name}_LIBRARY)
list(APPEND MUMPS_MPI_LIBRARIES ${MUMPS_MPI_${lib_name}_LIBRARY})
message(STATUS "Found ${MUMPS_MPI_${lib_name}_LIBRARY}")
mark_as_advanced(MUMPS_MPI_${lib_name}_LIBRARY)
else()
set(MUMPS_MPI_LIBRARIES_FOUND FALSE)
message(STATUS "Could not find MPI library: ${lib_name}")
endif()
endforeach()

# Create the MUMPS_MPI target
if(MUMPS_MPI_LIBRARIES_FOUND AND NOT TARGET MUMPS_MPI::MUMPS_MPI)
add_library(MUMPS_MPI::MUMPS_MPI INTERFACE IMPORTED)

# Link all the MUMPS-specific MPI libraries
set_target_properties(MUMPS_MPI::MUMPS_MPI PROPERTIES
INTERFACE_LINK_LIBRARIES "${MUMPS_MPI_LIBRARIES}"
)

# Also inherit properties from the standard MPI targets
get_target_property(MPI_C_INCLUDE_DIRS MPI::MPI_C INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(MPI_C_COMPILE_OPTIONS MPI::MPI_C INTERFACE_COMPILE_OPTIONS)
get_target_property(MPI_C_COMPILE_DEFINITIONS MPI::MPI_C INTERFACE_COMPILE_DEFINITIONS)

if(MPI_C_INCLUDE_DIRS)
set_target_properties(MUMPS_MPI::MUMPS_MPI PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MPI_C_INCLUDE_DIRS}"
)
endif()

if(MPI_C_COMPILE_OPTIONS)
set_target_properties(MUMPS_MPI::MUMPS_MPI PROPERTIES
INTERFACE_COMPILE_OPTIONS "${MPI_C_COMPILE_OPTIONS}"
)
endif()

if(MPI_C_COMPILE_DEFINITIONS)
set_target_properties(MUMPS_MPI::MUMPS_MPI PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "${MPI_C_COMPILE_DEFINITIONS}"
)
endif()
endif()

# Handle the find_package result
find_package_handle_standard_args(MUMPS_MPI
REQUIRED_VARS MUMPS_MPI_LIBRARIES_FOUND
FAIL_MESSAGE "Could not find all required MPI libraries for MUMPS"
)

# Set the found variable
set(MUMPS_MPI_FOUND ${MUMPS_MPI_LIBRARIES_FOUND})
11 changes: 11 additions & 0 deletions ports/mumps/elapse_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/libseq/elapse.h
+++ b/libseq/elapse.h
@@ -25,7 +25,7 @@
#endif
#endif

-#if (defined(_WIN32) && ! defined(__MINGW32__)) || defined(UPPER)
+#if defined(UPPER)
#define mumps_elapse MUMPS_ELAPSE
#elif defined(Add__)
#define mumps_elapse mumps_elapse__
38 changes: 38 additions & 0 deletions ports/mumps/mumps_c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
--- a/src/mumps_c.c
+++ b/src/mumps_c.c
@@ -43,7 +43,7 @@
* CMUMPS_XXX in the code to get rid of any symbol convention annoyance.
*/
#if MUMPS_ARITH == MUMPS_ARITH_s
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) SMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) smumps_##lower_case##_
@@ -53,7 +53,7 @@
# define F_SYM_ARITH(lower_case,upper_case) smumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_d
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) DMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) dmumps_##lower_case##_
@@ -63,7 +63,7 @@
# define F_SYM_ARITH(lower_case,upper_case) dmumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_c
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) CMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) cmumps_##lower_case##_
@@ -73,7 +73,7 @@
# define F_SYM_ARITH(lower_case,upper_case) cmumps_##lower_case
# endif
#elif MUMPS_ARITH == MUMPS_ARITH_z
-# if defined(UPPER) || defined(MUMPS_WIN32)
+# if defined(UPPER)
# define F_SYM_ARITH(lower_case,upper_case) ZMUMPS_##upper_case
# elif defined(Add_)
# define F_SYM_ARITH(lower_case,upper_case) zmumps_##lower_case##_
11 changes: 11 additions & 0 deletions ports/mumps/mumps_common_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/mumps_common.h
+++ b/src/mumps_common.h
@@ -28,7 +28,7 @@
* knowledge, there is no way to perform the conversion with CPP
* directives only.
*/
-#if defined(UPPER) || defined(MUMPS_WIN32)
+#if defined(UPPER)
# define F_SYMBOL(lower_case,upper_case) MUMPS_##upper_case
#elif defined(Add_)
# define F_SYMBOL(lower_case,upper_case) mumps_##lower_case##_
58 changes: 58 additions & 0 deletions ports/mumps/mumps_mpi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
diff -ur MUMPS_5.4.0/libseq/mpic.c MUMPS/libseq/mpic.c
--- MUMPS_5.4.0/libseq/mpic.c 2021-04-13 17:26:34.000000000 +0200
+++ MUMPS/libseq/mpic.c 2021-05-12 16:25:49.708906988 +0200
@@ -13,7 +13,7 @@
* https://cecill.info/licences/Licence_CeCILL-C_V1-en.html)
*
*/
-#include "mpi.h"
+#include "mumps_mpi.h"
#include "elapse.h"
MPI_Comm LIBSEQ_CALL MPI_Comm_f2c(LIBSEQ_INT comm)
{
return 0;
diff -ur MUMPS_5.4.0/src/mumps_metis64.h MUMPS/src/mumps_metis64.h
--- MUMPS_5.4.0/src/mumps_metis64.h 2021-04-13 17:26:35.000000000 +0200
+++ MUMPS/src/mumps_metis64.h 2021-05-12 16:25:49.708906988 +0200
@@ -18,7 +18,11 @@
/* Interfacing with 64-bit (par)metis, for METIS 4 or METIS 5 */
#include "mumps_common.h" /* includes mumps_compat.h and mumps_c_types.h */
#if defined(parmetis) || defined(parmetis3)
+#ifdef MPI
#include "mpi.h"
+#else
+#include "mumps_mpi.h"
+#endif
#define MUMPS_PARMETIS_64 \
F_SYMBOL(parmetis_64,PARMETIS_64)
void MUMPS_CALL
diff -ur MUMPS_5.4.0/src/mumps_metis.h MUMPS/src/mumps_metis.h
--- MUMPS_5.4.0/src/mumps_metis.h 2021-04-13 17:26:35.000000000 +0200
+++ MUMPS/src/mumps_metis.h 2021-05-12 16:25:49.708906988 +0200
@@ -18,7 +18,11 @@
/* Interfacing with 32-bit (par)metis, for METIS 4 or METIS 5 */
#include "mumps_common.h" /* includes mumps_compat.h and mumps_c_types.h */
#if defined(parmetis) || defined(parmetis3)
+#ifdef MPI
#include "mpi.h"
+#else
+#include "mumps_mpi.h"
+#endif
#define MUMPS_PARMETIS \
F_SYMBOL(parmetis,PARMETIS)
void MUMPS_CALL
diff -ur MUMPS_5.4.0/src/mumps_scotch.h MUMPS/src/mumps_scotch.h
--- MUMPS_5.4.0/src/mumps_scotch.h 2021-04-13 17:26:35.000000000 +0200
+++ MUMPS/src/mumps_scotch.h 2021-05-12 16:25:49.708906988 +0200
@@ -82,7 +82,11 @@
MUMPS_SCOTCH_SET_PTHREAD_NUMBER (MUMPS_INT *PTHREAD_NUMBER);
#endif /*scotch or ptscotch*/
#if defined(ptscotch)
+#ifdef MPI
#include "mpi.h"
+#else
+#include "mumps_mpi.h"
+#endif
#include "ptscotch.h"
#define MUMPS_DGRAPHINIT \
F_SYMBOL(dgraphinit,DGRAPHINIT)
Loading
Loading