Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions ports/ampl-asl/CONTROL
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Source: ampl-asl
Version: 2020-11-11
Homepage: https://github.com/ampl/asl
Description: AMPL Solver Library
Supports: !uwp
59 changes: 59 additions & 0 deletions ports/ampl-asl/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Licenses
========

Copyright (C) 1990 - 2001 Lucent Technologies

Permission to use, copy, modify, and distribute this software and
its documentation for any purpose and without fee is hereby
granted, provided that the above copyright notice appear in all
copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of Lucent or any of its entities
not be used in advertising or publicity pertaining to
distribution of the software without specific, written prior
permission.

LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

----------------------------------------------------------------------

Copyright (C) 2007 David M. Gay

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that the copyright notice and this permission notice and warranty
disclaimer appear in supporting documentation.

The author disclaims all warranties with regard to this software,
including all implied warranties of merchantability and fitness.
In no event shall the author be liable for any special, indirect or
consequential damages or any damages whatsoever resulting from loss of
use, data or profits, whether in an action of contract, negligence or
other tortious action, arising out of or in connection with the use or
performance of this software.

----------------------------------------------------------------------

Copyright (C) 2002 - 2014 AMPL Optimization LLC

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that the copyright notice and this permission notice and warranty
disclaimer appear in supporting documentation.

The author and AMPL Optimization LLC disclaim all warranties with
regard to this software, including all implied warranties of
merchantability and fitness. In no event shall the author be liable
for any special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether in an
action of contract, negligence or other tortious action, arising out
of or in connection with the use or performance of this software.
13 changes: 13 additions & 0 deletions ports/ampl-asl/fix-crt-linkage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 976af78..35d248d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -256,7 +256,7 @@ macro(createSingleASL name sourcedir sources)
endif()
if(MSVC)
target_compile_options(${name} PRIVATE
- /wd4013 /wd4018 /wd4101 /wd4244 /wd4273 /wd4267 /wd4996 /MT$<$<CONFIG:Debug>:d>)
+ /wd4013 /wd4018 /wd4101 /wd4244 /wd4273 /wd4267 /wd4996)
Copy link
Contributor Author

@JackBoosY JackBoosY Nov 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use CRT linkage in C_FLAGS/CXX_FLAGS set by vcpkg:

if(VCPKG_CRT_LINKAGE STREQUAL "dynamic")
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD")
elseif(VCPKG_CRT_LINKAGE STREQUAL "static")
set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT")
else()
message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()

else()
target_compile_options(${name} PRIVATE -Wno-unused-result -Wno-parentheses)
endif()
12 changes: 12 additions & 0 deletions ports/ampl-asl/install-extra-headers.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 35d248d..8a85aa7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -317,6 +317,7 @@ if(BUILD_CPP)
endif()

install(FILES ${ASL_HEADERS} ${ASL_SOURCE_DIR}/opcode.hd ${ASL_SOURCE_DIR}/r_opn.hd
+ ${GENERATED_INCLUDE_DIR}/stdio1.h ${GENERATED_INCLUDE_DIR}/arith.h
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already open a PR to upstream: ampl/asl#4

DESTINATION include/asl COMPONENT asl)
install(FILES ${ASL2_HEADERS} ${ASL2_SOURCE_DIR}/opcode.hd ${ASL2_SOURCE_DIR}/r_opn.hd
DESTINATION include/asl2 COMPONENT asl)
39 changes: 39 additions & 0 deletions ports/ampl-asl/install-targets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a85aa7..c0619bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -247,8 +247,8 @@ endif()

macro(createSingleASL name sourcedir sources)
add_library(${name} STATIC ${${sources}} ${GENERATED_INCLUDE_DIR}/arith.h)
- target_include_directories(${name} PUBLIC ${GENERATED_INCLUDE_DIR}
- ${sourcedir})
+ target_include_directories(${name} PUBLIC $<BUILD_INTERFACE:${GENERATED_INCLUDE_DIR}>
+ $<BUILD_INTERFACE:${sourcedir}> $<INSTALL_INTERFACE:include>)
target_compile_definitions(${name} PRIVATE ${ASL_COMPILE_DEFINITIONS})
target_link_libraries(${name} PUBLIC ${CMAKE_DL_LIBS})
if(NOT WIN32)
@@ -322,14 +322,16 @@ install(FILES ${ASL_HEADERS} ${ASL_SOURCE_DIR}/opcode.hd ${ASL_SOURCE_DIR}/r_opn
install(FILES ${ASL2_HEADERS} ${ASL2_SOURCE_DIR}/opcode.hd ${ASL2_SOURCE_DIR}/r_opn.hd
DESTINATION include/asl2 COMPONENT asl)

-install(TARGETS asl asl2 DESTINATION lib COMPONENT asl)
+install(TARGETS asl asl2 EXPORT unofficial-asl-config DESTINATION lib COMPONENT asl)
if(BUILD_MT_LIBS)
- install(TARGETS asl-mt asl2-mt DESTINATION lib COMPONENT asl)
+ install(TARGETS asl-mt asl2-mt EXPORT unofficial-asl-config DESTINATION lib COMPONENT asl)
endif()
if(MSVC AND BUILD_DYNRT_LIBS)
- install(TARGETS asl-dynrt asl2-dynrt DESTINATION lib COMPONENT asl)
+ install(TARGETS asl-dynrt asl2-dynrt EXPORT unofficial-asl-config DESTINATION lib COMPONENT asl)
endif()
if(TARGET aslcpp)
install(FILES ${ASL_CPP_HEADERS} DESTINATION include/aslcpp COMPONENT asl)
- install(TARGETS aslcpp DESTINATION lib COMPONENT asl)
-endif()
\ No newline at end of file
+ install(TARGETS aslcpp EXPORT unofficial-asl-config DESTINATION lib COMPONENT asl)
+endif()
+
+install(EXPORT unofficial-asl-config DESTINATION share/unofficial-asl)
\ No newline at end of file
37 changes: 37 additions & 0 deletions ports/ampl-asl/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_fail_port_install(ON_TARGET "UWP")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ampl/asl
REF 934d34719c8a620fcf16ae5a3c00c326eb22e748
SHA512 b6fcb3dcb53a53d975666db1643d7ea518246e8fb6745621ce4b63de4393f7767844e9241baa6fdf1a45c241a9aa0866844c47deec0020313278128cccff6869
HEAD_REF master
PATCHES
workaround-msvc-optimizer-ice.patch
fix-crt-linkage.patch # CRT linkage uses C/CXX FLAGS in vcpkg
install-extra-headers.patch
install-targets.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBUILD_MCMODELLARGE=OFF
-DBUILD_DYNRT_LIBS=OFF # CRT linkage uses C/CXX FLAGS in vcpkg
-DBUILD_MT_LIBS=OFF # CRT linkage uses C/CXX FLAGS in vcpkg
-DBUILD_CPP=ON
)

vcpkg_install_cmake()

vcpkg_copy_pdbs()

vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-asl TARGET_PATH share/unofficial-asl)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

# from ampl-mp license
file(INSTALL ${CURRENT_PORT_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
60 changes: 60 additions & 0 deletions ports/ampl-asl/workaround-msvc-optimizer-ice.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
diff --git a/src/solvers/avltree.c b/src/solvers/avltree.c
index 7a9adab..a75da90 100644
--- a/src/solvers/avltree.c
+++ b/src/solvers/avltree.c
@@ -54,6 +54,10 @@ AVL_Tree {
void (*Free)(void*);
};

+#if defined(_MSC_VER) && _MSC_VER < 1917
+#pragma optimize("", off)
+#endif
+
AVL_Tree*
AVL_Tree_alloc2(void *v, AVL_Elcomp cmp, void *(*Malloc)(size_t), void (*Free)(void*))
{
diff --git a/src/solvers/sphes.c b/src/solvers/sphes.c
index a50065f..6e6eedc 100644
--- a/src/solvers/sphes.c
+++ b/src/solvers/sphes.c
@@ -461,6 +461,10 @@ compar(const void *a, const void *b)
#undef del_mblk
#define del_mblk(b,c) Del_mblk_ASL(a,b,(Char*)(c))

+#if defined(_MSC_VER) && _MSC_VER < 1917
+#pragma optimize("", off)
+#endif
+
static void
new_Hesoprod(ASL_pfgh *asl, ograd *L, ograd *R, real coef)
{
diff --git a/src/solvers2/avltree.c b/src/solvers2/avltree.c
index 7a9adab..a75da90 100644
--- a/src/solvers2/avltree.c
+++ b/src/solvers2/avltree.c
@@ -54,6 +54,10 @@ AVL_Tree {
void (*Free)(void*);
};

+#if defined(_MSC_VER) && _MSC_VER < 1917
+#pragma optimize("", off)
+#endif
+
AVL_Tree*
AVL_Tree_alloc2(void *v, AVL_Elcomp cmp, void *(*Malloc)(size_t), void (*Free)(void*))
{
diff --git a/src/solvers2/sphes.c b/src/solvers2/sphes.c
index dd2edff..ebdd3af 100644
--- a/src/solvers2/sphes.c
+++ b/src/solvers2/sphes.c
@@ -855,6 +855,10 @@ compar(const void *a, const void *b)
#undef del_mblk
#define del_mblk(c) Del_mblk_ASL(a,(Char*)(c))

+#if defined(_MSC_VER) && _MSC_VER < 1917
+#pragma optimize("", off)
+#endif
+
static void
new_Hesoprod(EvalWorkspace *ew, int nov, int *ov, real *oc, int nR, int *Rov, real *Roc, real coef)
{
4 changes: 3 additions & 1 deletion ports/ampl-mp/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
Source: ampl-mp
Version: 2019-03-21-1
Version: 2020-11-11
Homepage: https://github.com/ampl/mp
Description: An open-source library for mathematical programming
Build-Depends: ampl-asl
Supports: !uwp
12 changes: 7 additions & 5 deletions ports/ampl-mp/disable-matlab-mex.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
--- a/src/asl/CMakeLists.txt 2019-02-08 16:42:50.793071700 -0600
+++ b/src/asl/CMakeLists.txt 2019-02-08 16:44:04.960894500 -0600
@@ -266,7 +266,7 @@ endif ()
diff --git a/src/asl/CMakeLists.txt b/src/asl/CMakeLists.txt
index b7d7ecf..c31a032 100644
--- a/src/asl/CMakeLists.txt
+++ b/src/asl/CMakeLists.txt
@@ -59,7 +59,7 @@ endif ()

target_link_libraries(asl ${CMAKE_DL_LIBS})
target_link_libraries(aslmp ${CMAKE_DL_LIBS})

-find_package(MATLAB)
+set(MATLAB_FOUND)
if (MATLAB_FOUND)
if (MATLAB_FOUND AND MATLAB_BUILD)
set(matlab_asl asl)
if (MSVC)
39 changes: 39 additions & 0 deletions ports/ampl-mp/fix-arm-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92089a3..d4c6762 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -257,9 +257,15 @@ if (CMAKE_CROSSCOMPILING)
COMMAND ${CMAKE_COMMAND} -E echo
"warning: cannot re-generate ${MP_EXPR_INFO_FILE}")
else ()
+ if (ARITHCHK_EXEC)
+ add_custom_command(OUTPUT ${MP_EXPR_INFO_FILE}
+ COMMAND ${WINE} ${ARITHCHK_EXEC} ${MP_EXPR_INFO_FILE}
+ DEPENDS gen-expr-info)
+ else()
add_custom_command(OUTPUT ${MP_EXPR_INFO_FILE}
COMMAND ${WINE} $<TARGET_FILE:gen-expr-info> ${MP_EXPR_INFO_FILE}
DEPENDS gen-expr-info)
+ endif()
endif ()

add_prefix(MP_HEADERS include/mp/
@@ -359,3 +365,4 @@ endif()
install(DIRECTORY include/mp DESTINATION include)
install(TARGETS mp DESTINATION lib RUNTIME DESTINATION bin)
install(FILES LICENSE.rst DESTINATION share/mp)
+install(TARGETS gen-expr-info RUNTIME DESTINATION bin)
\ No newline at end of file
diff --git a/src/amplsig/CMakeLists.txt b/src/amplsig/CMakeLists.txt
index 81312e9..f44c847 100644
--- a/src/amplsig/CMakeLists.txt
+++ b/src/amplsig/CMakeLists.txt
@@ -14,6 +14,6 @@ find_library(WS2_32_LIBRARY Ws2_32
PATHS ${WIN_LIBRARY_DIR} NO_DEFAULT_PATH)
if (WS2_32_LIBRARY)
add_ampl_library(amplsig amplsig.cc)
- message(WS2_32_LIBRARY ${WS2_32_LIBRARY})
- target_link_libraries(amplsig mp ${WS2_32_LIBRARY})
+ message(WS2_32_LIBRARY ws2_32)
+ target_link_libraries(amplsig mp ws2_32)
endif ()
42 changes: 42 additions & 0 deletions ports/ampl-mp/fix-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 904cfb1..13f11cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,6 +61,8 @@ set_cache(BUILD "" STRING
if (BUILD)
if (BUILD STREQUAL all)
set(MP_MODULES all)
+ elseif (BUILD STREQUAL no)
+ set(MP_MODULES)
else ()
string(REGEX MATCHALL "[^,]+" MP_MODULES "${BUILD}")
endif ()
@@ -200,7 +202,7 @@ function (add_mp_library name)
add_dependencies(${name} ${add_mp_library_DEPENDS})
endif ()
# Add library linked with dynamic runtime.
- if (MSVC)
+ if (0)
add_library(${name}-dynrt ${libtype} EXCLUDE_FROM_ALL
${add_mp_library_UNPARSED_ARGUMENTS} ${dynrt-objects})
target_compile_options(${name}-dynrt PUBLIC /MD$<$<CONFIG:Debug>:d>)
@@ -308,16 +310,17 @@ if (RT_LIBRARY)
target_link_libraries(mp ${RT_LIBRARY})
endif ()

+if (MP_VARIADIC_TEMPLATES)
# Check if variadic templates are working and not affected by GCC bug 39653:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39653
check_cxx_source_compiles("
template <class T, class ...Types>
struct S { typedef typename S<Types...>::type type; };
int main() {}" MP_VARIADIC_TEMPLATES)
-
-if (MP_VARIADIC_TEMPLATES)
+ if (MP_VARIADIC_TEMPLATES)
add_executable(nl-example src/nl-example.cc)
target_link_libraries(nl-example mp)
+ endif()
endif ()

add_subdirectory(doc)
28 changes: 28 additions & 0 deletions ports/ampl-mp/fix-dependency-asl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 13f11cb..92089a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -323,9 +323,9 @@ check_cxx_source_compiles("
endif()
endif ()

+find_package(unofficial-asl CONFIG REQUIRED)
add_subdirectory(doc)
add_subdirectory(src/amplsig)
-add_subdirectory(src/asl)
add_subdirectory(src/cp)
add_subdirectory(solvers)

diff --git a/src/cp/cp.cc b/src/cp/cp.cc
index d4adc35..ca8f35b 100644
--- a/src/cp/cp.cc
+++ b/src/cp/cp.cc
@@ -24,7 +24,7 @@
#include <cstring>
#include <limits>
#include "mp/format.h"
-#include "funcadd.h"
+#include <asl/funcadd.h>

namespace {
void error(arglist *al, const char *message) {
Loading