aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhihaoy <43971430+zhihaoy@users.noreply.github.com>2019-02-11 14:12:10 -0600
committerVictor Romero <romerosanchezv@gmail.com>2019-02-11 12:12:10 -0800
commite6b174ed58b42b6f7cb5c376612add552c04531f (patch)
tree3e2b9b23b7fb5c3618c3f3be9402b6882558ab0b
parentd82f37b4bfc1422d4601fbb63cbd553c925f7014 (diff)
downloadvcpkg-e6b174ed58b42b6f7cb5c376612add552c04531f.tar.gz
vcpkg-e6b174ed58b42b6f7cb5c376612add552c04531f.zip
[ampl-mp] Add new port (#5331)
* [ampl-mp] Add new port This port aims for solver development, so it does not build any existing solver modules. The shared library build is disabled for now because it has some problem on Windows. closes: #4491 * [ampl-mp] Disable MATLAB MEX support
-rw-r--r--ports/ampl-mp/CONTROL3
-rw-r--r--ports/ampl-mp/disable-matlab-mex.patch11
-rw-r--r--ports/ampl-mp/install-targets.patch44
-rw-r--r--ports/ampl-mp/portfile.cmake42
-rw-r--r--ports/ampl-mp/workaround-msvc-optimizer-ice.patch14
5 files changed, 114 insertions, 0 deletions
diff --git a/ports/ampl-mp/CONTROL b/ports/ampl-mp/CONTROL
new file mode 100644
index 000000000..8a8c27b3f
--- /dev/null
+++ b/ports/ampl-mp/CONTROL
@@ -0,0 +1,3 @@
+Source: ampl-mp
+Version: 2019-02-08
+Description: An open-source library for mathematical programming
diff --git a/ports/ampl-mp/disable-matlab-mex.patch b/ports/ampl-mp/disable-matlab-mex.patch
new file mode 100644
index 000000000..f1b8be443
--- /dev/null
+++ b/ports/ampl-mp/disable-matlab-mex.patch
@@ -0,0 +1,11 @@
+--- 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 ()
+
+ target_link_libraries(asl ${CMAKE_DL_LIBS})
+
+-find_package(MATLAB)
++set(MATLAB_FOUND)
+ if (MATLAB_FOUND)
+ set(matlab_asl asl)
+ if (MSVC)
diff --git a/ports/ampl-mp/install-targets.patch b/ports/ampl-mp/install-targets.patch
new file mode 100644
index 000000000..8538920b7
--- /dev/null
+++ b/ports/ampl-mp/install-targets.patch
@@ -0,0 +1,44 @@
+--- a/CMakeLists.txt 2019-02-09 04:38:25.756325900 -0600
++++ b/CMakeLists.txt 2019-02-09 04:39:55.299417600 -0600
+@@ -289,6 +289,8 @@ add_prefix(MP_SOURCES src/
+ add_mp_library(mp ${MP_HEADERS} ${MP_SOURCES} ${MP_EXPR_INFO_FILE}
+ COMPILE_DEFINITIONS MP_DATE=${MP_DATE} MP_SYSINFO="${MP_SYSINFO}"
+ INCLUDE_DIRECTORIES src OBJECT_LIBRARIES format)
++set_property(TARGET mp PROPERTY
++ INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include>)
+ set_target_properties(mp PROPERTIES
+ VERSION ${MP_VERSION} SOVERSION ${MP_VERSION_MAJOR})
+
+@@ -385,5 +387,10 @@ if(BUILD_TESTING)
+ endif()
+
+ install(DIRECTORY include/mp DESTINATION include)
+-install(TARGETS mp DESTINATION lib RUNTIME DESTINATION bin)
++install(TARGETS mp EXPORT unofficial-mp-targets
++ DESTINATION lib RUNTIME DESTINATION bin)
+ install(FILES LICENSE.rst DESTINATION share/mp)
++install(EXPORT unofficial-mp-targets
++ FILE unofficial-mp-config.cmake
++ NAMESPACE unofficial::mp::
++ DESTINATION share/unofficial-mp)
+--- a/src/asl/CMakeLists.txt 2019-02-09 04:38:27.196322600 -0600
++++ b/src/asl/CMakeLists.txt 2019-02-09 04:39:32.119889500 -0600
+@@ -235,6 +235,10 @@ add_mp_library(asl-extra OBJECT ${ASL_SO
+
+ add_mp_library(asl STATIC OBJECT_LIBRARIES asl-core asl-extra
+ LIBRARIES mp INCLUDE_DIRECTORIES ${ASL_INCLUDE_DIRS})
++set_property(TARGET asl PROPERTY
++ INTERFACE_INCLUDE_DIRECTORIES
++ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR};${PROJECT_SOURCE_DIR}/src/asl/solvers>
++ $<INSTALL_INTERFACE:include>)
+
+ if (NOT WIN32)
+ target_link_libraries(asl m)
+@@ -353,4 +357,6 @@ endif ()
+ install(FILES ${ASL_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/arith.h
+ solvers/opcode.hd solvers/r_opn.hd
+ DESTINATION include/asl)
+-install(TARGETS asl tableproxy DESTINATION lib RUNTIME DESTINATION bin)
++install(TARGETS tableproxy DESTINATION lib RUNTIME DESTINATION bin)
++install(TARGETS asl EXPORT unofficial-mp-targets
++ DESTINATION lib RUNTIME DESTINATION bin)
diff --git a/ports/ampl-mp/portfile.cmake b/ports/ampl-mp/portfile.cmake
new file mode 100644
index 000000000..45bcb6478
--- /dev/null
+++ b/ports/ampl-mp/portfile.cmake
@@ -0,0 +1,42 @@
+include(vcpkg_common_functions)
+
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ampl/mp
+ REF d305155b047b69fc5c6e5fda8630c753d7973b9a
+ SHA512 2c8ffd6de946a6f8ea94a8e0c00f03f67753ad99534e0d5fcaaaeb472fe76a3383324bcb628a31d8c01bc5f60254790f5508c8394096a4f05672f814dbd6fe2e
+ HEAD_REF master
+ PATCHES
+ disable-matlab-mex.patch
+ workaround-msvc-optimizer-ice.patch
+ install-targets.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DBUILD=asl
+ -DBUILD_TESTING=OFF
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(
+ CONFIG_PATH share/unofficial-mp
+ TARGET_PATH share/unofficial-mp
+)
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools)
+file(RENAME ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/tools/${PORT})
+file(REMOVE_RECURSE
+ ${CURRENT_PACKAGES_DIR}/debug/bin
+ ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share
+ ${CURRENT_PACKAGES_DIR}/share/mp)
+
+configure_file(${SOURCE_PATH}/LICENSE.rst
+ ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+vcpkg_copy_pdbs()
+vcpkg_test_cmake(PACKAGE_NAME unofficial-mp)
diff --git a/ports/ampl-mp/workaround-msvc-optimizer-ice.patch b/ports/ampl-mp/workaround-msvc-optimizer-ice.patch
new file mode 100644
index 000000000..cd55be8c0
--- /dev/null
+++ b/ports/ampl-mp/workaround-msvc-optimizer-ice.patch
@@ -0,0 +1,14 @@
+--- a/src/asl/CMakeLists.txt 2019-02-07 22:45:15.191909400 -0600
++++ b/src/asl/CMakeLists.txt 2019-02-07 22:47:10.364936600 -0600
+@@ -216,6 +216,11 @@ add_mp_library(asl-core OBJECT ${ASL_COR
+ COMPILE_DEFINITIONS ${ASL_COMPILE_DEFINITIONS}
+ INCLUDE_DIRECTORIES ${CMAKE_CURRENT_BINARY_DIR})
+
++if (MSVC)
++ set_source_files_properties(solvers/avltree.c solvers/sphes.c
++ PROPERTIES COMPILE_OPTIONS /Od)
++endif ()
++
+ # Public ASL headers.
+ set(ASL_HEADERS aslbuilder.h aslexpr.h aslexpr-visitor.h
+ aslproblem.h aslinterface.h ${CMAKE_CURRENT_BINARY_DIR}/stdio1.h)