Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Ipopt repo #5326

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 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
78 changes: 78 additions & 0 deletions packages/c/coin-or-ipopt/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package("coin-or-ipopt")
set_homepage("https://github.com/coin-or/Ipopt")
set_description("Ipopt (Interior Point OPTimizer, pronounced eye-pea-Opt) is a software package for large-scale nonlinear optimization.")
set_license("EGPL-2.0")

add_urls("https://github.com/coin-or/Ipopt/archive/refs/tags/releases/$(version).tar.gz",
"https://github.com/coin-or/Ipopt.git")
add_versions("3.14.16", "cc8c217991240db7eb14189eee0dff88f20a89bac11958b48625fa512fe8d104")

if is_plat("linux") then
add_syslinks("pthread")
end

add_deps("gfortran", "openblas", "mumps", "coin-or-asl", "lapack", "openmp")

if not is_plat("windows") then
add_deps("autoconf", "automake", "libtool", "m4")
end

add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})

add_includedirs("include", "include/coin-or")

on_install("linux", function (package)
io.replace("configure", "ac_name=dsyev", "ac_name=LAPACKE_dsyev", {plain=true})
io.replace("configure", "ac_name=DSYEV", "ac_name=LAPACKE_dsyev", {plain=true})
io.replace("src/LinAlg/IpBlas.cpp", "IPOPT_BLAS_FUNC(s ## name,S ## NAME)", "IPOPT_BLAS_FUNC(s ## name ## _ ,S ## NAME ## _)", {plain=true})
io.replace("src/LinAlg/IpBlas.cpp", "IPOPT_BLAS_FUNC(d ## name,D ## NAME)", "IPOPT_BLAS_FUNC(d ## name ## _,D ## NAME ## _)", {plain=true})
io.replace("src/LinAlg/IpBlas.cpp", "IPOPT_BLAS_FUNC(idamax, IDAMAX)", "IPOPT_BLAS_FUNC(idamax_, IDAMAX_)", {plain=true})
io.replace("src/LinAlg/IpLapack.cpp", "IPOPT_LAPACK_FUNC(s ## name,S ## NAME)", "IPOPT_LAPACK_FUNC(s ## name ## _,S ## NAME ## _)", {plain=true})
io.replace("src/LinAlg/IpLapack.cpp", "IPOPT_LAPACK_FUNC(d ## name,D ## NAME)", "IPOPT_LAPACK_FUNC(d ## name ## _,D ## NAME ## _)", {plain=true})

local fetch_info_mumps = package:dep("mumps"):fetch()
local fetch_info_lapack = package:dep("lapack"):fetch()

local configs = {}

local lapack_flags = [[--with-lapack-lflags=-L]] .. tostring(fetch_info_lapack.linkdirs[1]) .. [[ ]]
for _, link in ipairs(fetch_info_lapack.links) do
lapack_flags = lapack_flags .. "-l" .. tostring(link) .. " "
end
lapack_flags = lapack_flags .. [[-lgfortran -lm]]
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
table.insert(configs, lapack_flags)

table.insert(configs, [[--with-mumps-cflags="-I]] .. fetch_info_mumps.sysincludedirs[1] .. [["]])
local mumps_lflags = [[--with-mumps-lflags= "]]
for _, link in ipairs(fetch_info_mumps.links) do
mumps_lflags = mumps_lflags .. "-l" .. link .. " "
end
mumps_lflags = mumps_lflags .. [[-lesmumps -lscotch -lscotcherr -lscotcherrexit -lscotchmetisv5 -lscotchmetisv3 -lpthread"]]
table.insert(configs, mumps_lflags)

table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))

if package:is_debug() then
table.insert(configs, "--enable-debug")
end

import("package.tools.autoconf").install(package, configs, {packagedeps={"mumps", "scotch", "lapack"}})
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include "IpIpoptApplication.hpp"
#include "IpSolveStatistics.hpp"
#include "IpBlas.hpp"

using namespace Ipopt;

void test() {
IpBlasDot(0, nullptr, 0, nullptr, 0);
SmartPtr<IpoptApplication> app = new IpoptApplication;
ApplicationReturnStatus status;
status = app->Initialize();
}
]]}, {configs = {languages = "c++11"}, includes = "IpIpoptApplication.hpp"}))
end)
11 changes: 10 additions & 1 deletion packages/g/gdk-pixbuf/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ package("gdk-pixbuf")
add_includedirs("include", "include/gdk-pixbuf-2.0")

add_deps("meson", "ninja")
add_deps("libpng", "libjpeg-turbo", "libtiff", "glib", "pcre2")
add_deps("libpng", "libjpeg-turbo", "glib", "pcre2")

on_load(function (package)
if package:config("shared") then
package:add("deps", "libtiff", {configs = {shared = true}})
else
package:add("deps", "libtiff")
end
end)

if is_plat("windows") then
add_syslinks("iphlpapi", "dnsapi")
add_deps("pkgconf", "libintl")
Expand Down
13 changes: 11 additions & 2 deletions packages/g/gtk3/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,17 @@ package("gtk3")

add_includedirs("include", "include/gtk-3.0")

on_load("linux", function (package)
if package:config("shared") then
package:add("deps", "gdk-pixbuf", {configs = {shared = true}})
else
package:add("deps", "gdk-pixbuf")
end
end)

add_deps("meson", "ninja")
add_deps("cairo", {configs = {glib = true}})
add_deps("glib", "gdk-pixbuf", "pango", "libepoxy", "graphene", "libxkbcommon", "libxext")
add_deps("glib", "pango", "libepoxy", "graphene", "libxkbcommon", "libxext")
add_deps("libx11", "libxfixes", "libxcursor", "libxi", "libxcomposite", "libxrandr", "libxdamage", "libxinerama", "at-spi2-core")
add_links("gtk-3", "gdk-3", "gailutil-3", "X11", "X11-cxb", "pangocairo-1.0", "pango", "rt")

Expand All @@ -31,7 +39,8 @@ package("gtk3")
io.replace("gdk/x11/gdkglcontext-x11.c", [[cairo/cairo-xlib.h]], [[cairo-xlib.h]], {plain = true})
import("package.tools.meson").install(package, configs, {packagedeps = {"libx11",
"libxext",
"libxi",
"libxi",
"pango",
"at-spi2-core",
"cairo",
"libthai",
Expand Down
5 changes: 5 additions & 0 deletions packages/l/lapack/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ package("lapack")

add_versions("v3.12.0", "eac9570f8e0ad6f30ce4b963f4f033f0f643e7c3912fc9ee6cd99120675ad48b")

if is_plat("linux") then
add_extsources("apt::liblapack-dev")
end


star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
add_deps("cmake", "gfortran")

add_links( "lapacke", "lapack", "cblas", "blas")
Expand Down
1 change: 1 addition & 0 deletions packages/m/mumps/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ package("mumps")
envs.LSCOTCH = ldflags
os.vrunv("make", {"all"}, {envs = envs})
os.cp("include/*.h", package:installdir("include"))
os.cp("libseq/*h", package:installdir("include"))
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
os.cp("lib/*.a|README", package:installdir("lib"))
os.cp("libseq/*.a", package:installdir("lib"))
end)
Expand Down
32 changes: 22 additions & 10 deletions packages/w/wxwidgets/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,21 @@ package("wxwidgets")
add_configs("vs_runtime", {description = "Set vs compiler runtime.", default = "MD", readonly = true})
add_configs("debug", {description = "Enable debug symbols.", default = false, type = "boolean", readonly = true})
else
add_urls("https://github.com/wxWidgets/wxWidgets/archive/refs/tags/$(version).tar.gz",
add_urls("https://github.com/wxWidgets/wxWidgets/releases/download/v$(version)/wxWidgets-$(version).tar.bz2",
"https://github.com/wxWidgets/wxWidgets.git")
add_versions("v3.2.0", "43480e3887f32924246eb439520a3a2bc04d7947712de1ea0590c5b58dedadd9")
add_versions("v3.2.2", "2a4ec4d1af3f22fbfd0a40b051385a5d82628d9f28bae8427f5c30d72bdaade7")
add_versions("v3.2.3", "0eb9499c06778c6746dbd4aee2a124f1995a5db331e282d15237b0046c1788af")
add_versions("v3.2.4", "b358b7f59f5b7cb934265120d114e5fd510a8b40802d00a111a85911eb5100d1")
add_versions("3.2.0", "356e9b55f1ae3d58ae1fed61478e9b754d46b820913e3bfbc971c50377c1903a")
add_versions("3.2.2", "8edf18672b7bc0996ee6b7caa2bee017a9be604aad1ee471e243df7471f5db5d")
add_versions("3.2.3", "c170ab67c7e167387162276aea84e055ee58424486404bba692c401730d1a67a")
add_versions("3.2.4", "0640e1ab716db5af2ecb7389dbef6138d7679261fbff730d23845ba838ca133e")
add_versions("3.2.5", "0ad86a3ad3e2e519b6a705248fc9226e3a09bbf069c6c692a02acf7c2d1c6b51")

add_deps("cmake")
add_deps("libjpeg", "libpng", "nanosvg", "expat", "zlib")
add_deps("libjpeg", "libpng", "nanosvg", "expat", "zlib", "pango")
if is_plat("linux") then
add_deps("gtk+3", "opengl")
add_deps("opengl")
end
end

if is_plat("macosx") then
add_defines("__WXOSX_COCOA__", "__WXMAC__", "__WXOSX__", "__WXMAC_XCODE__")
add_frameworks("AudioToolbox", "WebKit", "CoreFoundation", "Security", "Carbon", "Cocoa", "IOKit", "QuartzCore")
Expand All @@ -79,6 +80,9 @@ package("wxwidgets")
add_defines("__WXGTK3__", "__WXGTK__")
add_syslinks("pthread", "m", "dl")
add_syslinks("X11", "Xext", "Xtst", "xkbcommon")
add_links(
"pango-1.0", "pangoxft-1.0", "pangocairo-1.0", "pangoft2-1.0"
)
elseif is_plat("windows") then
add_defines("WXUSINGDLL", "__WXMSW__", "wxSUFFIX=u", "wxMSVC_VERSION=14x")
add_links(
Expand Down Expand Up @@ -110,6 +114,14 @@ package("wxwidgets")
else
package:add("deps", "libtiff")
end

if is_plat("linux") then
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
if package:config("shared") then
package:add("deps", "gtk3", {configs = {shared = true}})
else
package:add("deps", "gtk3")
end
end
end
end)

Expand Down Expand Up @@ -142,13 +154,13 @@ package("wxwidgets")
end
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("linux") then
local libgtk3 = package:dep("gtk+3"):fetch()
local libgtk3 = package:dep("gtk3"):fetch()
if libgtk3 then
table.insert(configs, "-DGTK3_INCLUDE_DIRS=" .. table.concat(libgtk3.sysincludedirs, ";"))
table.insert(configs, "-DGTK3_LIBRARIES=" .. table.concat(libgtk3.links, ";"))
end
end
import("package.tools.cmake").install(package, configs)
import("package.tools.cmake").install(package, configs, {packagedeps = {"pango", "at-spi2-core", "gtk3", "gdk-pixbuf", "glib", "harfbuzz", "cairo"}})
local version = package:version()
local subdir = "wx-" .. version:major() .. "." .. version:minor()
local setupdir = package:is_plat("macosx") and "osx" or "gtk"
Expand Down
Loading