-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite NLopt 2.9 workaround for NLopt 2.10 (#254)
- Loading branch information
Showing
3 changed files
with
14 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,24 +8,20 @@ module NLopt | |
using CEnum: @cenum | ||
using NLopt_jll: libnlopt | ||
|
||
# [email protected] removed the LD_LBFGS_NOCEDAL enum. | ||
# See https://github.com/stevengj/nlopt/issues/584 for details. | ||
function _is_version_newer_than_2_9() | ||
major, minor, bugfix = Ref{Cint}(), Ref{Cint}(), Ref{Cint}() | ||
@ccall libnlopt.nlopt_version( | ||
major::Ptr{Cint}, | ||
minor::Ptr{Cint}, | ||
bugfix::Ptr{Cint}, | ||
)::Cvoid | ||
return (major[] > 2) || (major[] == 2 && minor[] >= 9) | ||
############################################################################ | ||
|
||
function version() | ||
major, minor, patch = Ref{Cint}(), Ref{Cint}(), Ref{Cint}() | ||
nlopt_version(major, minor, patch) | ||
return VersionNumber(major[], minor[], patch[]) | ||
end | ||
|
||
include("libnlopt.jl") | ||
|
||
############################################################################ | ||
# Mirrors of NLopt's C enum constants: | ||
|
||
@static if _is_version_newer_than_2_9() | ||
@static if v"2.9" ≤ version() < v"2.10" | ||
@enum Algorithm::Cint begin | ||
GN_DIRECT = 0 | ||
GN_DIRECT_L | ||
|
@@ -37,7 +33,7 @@ include("libnlopt.jl") | |
GN_ORIG_DIRECT_L | ||
GD_STOGO | ||
GD_STOGO_RAND | ||
# LD_LBFGS_NOCEDAL | ||
# LD_LBFGS_NOCEDAL: temporarily removed in nlopt 2.9 (nlopt#584) | ||
LD_LBFGS | ||
LN_PRAXIS | ||
LD_VAR1 | ||
|
@@ -446,12 +442,6 @@ numevals(o::Opt) = nlopt_get_numevals(o) | |
|
||
############################################################################ | ||
|
||
function version() | ||
major, minor, patch = Ref{Cint}(), Ref{Cint}(), Ref{Cint}() | ||
nlopt_version(major, minor, patch) | ||
return VersionNumber(major[], minor[], patch[]) | ||
end | ||
|
||
const NLOPT_VERSION = version() | ||
|
||
############################################################################ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters