@@ -8,24 +8,20 @@ module NLopt
88using CEnum: @cenum
99using NLopt_jll: libnlopt
1010
11- # [email protected] removed the LD_LBFGS_NOCEDAL enum.12- # See https://github.com/stevengj/nlopt/issues/584 for details.
13- function _is_version_newer_than_2_9 ()
14- major, minor, bugfix = Ref {Cint} (), Ref {Cint} (), Ref {Cint} ()
15- @ccall libnlopt. nlopt_version (
16- major:: Ptr{Cint} ,
17- minor:: Ptr{Cint} ,
18- bugfix:: Ptr{Cint} ,
19- ):: Cvoid
20- return (major[] > 2 ) || (major[] == 2 && minor[] >= 9 )
11+ # ###########################################################################
12+
13+ function version ()
14+ major, minor, patch = Ref {Cint} (), Ref {Cint} (), Ref {Cint} ()
15+ nlopt_version (major, minor, patch)
16+ return VersionNumber (major[], minor[], patch[])
2117end
2218
2319include (" libnlopt.jl" )
2420
2521# ###########################################################################
2622# Mirrors of NLopt's C enum constants:
2723
28- @static if _is_version_newer_than_2_9 ()
24+ @static if v " 2.9 " ≤ version () < v " 2.10 "
2925 @enum Algorithm:: Cint begin
3026 GN_DIRECT = 0
3127 GN_DIRECT_L
@@ -37,7 +33,7 @@ include("libnlopt.jl")
3733 GN_ORIG_DIRECT_L
3834 GD_STOGO
3935 GD_STOGO_RAND
40- # LD_LBFGS_NOCEDAL
36+ # LD_LBFGS_NOCEDAL: temporarily removed in nlopt 2.9 (nlopt#584)
4137 LD_LBFGS
4238 LN_PRAXIS
4339 LD_VAR1
@@ -446,12 +442,6 @@ numevals(o::Opt) = nlopt_get_numevals(o)
446442
447443# ###########################################################################
448444
449- function version ()
450- major, minor, patch = Ref {Cint} (), Ref {Cint} (), Ref {Cint} ()
451- nlopt_version (major, minor, patch)
452- return VersionNumber (major[], minor[], patch[])
453- end
454-
455445const NLOPT_VERSION = version ()
456446
457447# ###########################################################################
0 commit comments