NLopt on Windows

From AbInitio

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:16, 16 October 2010 (edit)
Stevenj (Talk | contribs)

← Previous diff
Revision as of 21:17, 16 October 2010 (edit)
Stevenj (Talk | contribs)
(NLopt on Windows)
Next diff →
Line 15: Line 15:
* [http://ab-initio.mit.edu/nlopt/CMakeLists.txt CMakeLists.txt] and [http://ab-initio.mit.edu/nlopt/config.cmake.h.in config.cmake.h.in] * [http://ab-initio.mit.edu/nlopt/CMakeLists.txt CMakeLists.txt] and [http://ab-initio.mit.edu/nlopt/config.cmake.h.in config.cmake.h.in]
-To build the NLopt plugin for [[w:GNU Octave|GNU Octave]] (a free Matlab clone, which uses the [[NLopt Matlab Reference|same NLopt interface as in Matlab]]), you will need the following additional steps. First, download ''both'' the <code>.zip</code> file above and the main <code>.tar.gz</code> package of NLopt. Use <code>dlltool</code> (which comes with Octave in the ''octave''<code>\mingw23\bin</code> directory) to create the <code>.lib</code> import library as explained above. Unpack the NLopt .tar.gz file, and copy the <code>nlopt_optimize-oct.cc</code> from the <code>octave</code> directory, along with downloading [http://jdj.mit.edu/~stevenj/nlopt_optimize_usage.h nlopt_optimize_usage.h], and put them together with your <code>.lib</code> and <code>.dll</code> files (from the <code>.zip</code>). Compile the Octave plugin (<code>.oct</code> file) with <code>mkoctfile -lnlopt-0 --output nlopt_optimize.oct nlopt_optimize-oct.cc</code> (<code>mkoctfile</code> is a program included with Octave). Finally, move libnlopt-0.dll to the ''octave''<code>\bin</code> directory so that Octave can find it.+===Octave plugin===
 + 
 +To build the NLopt plugin for [[w:GNU Octave|GNU Octave]] (a free Matlab clone, which uses the [[NLopt Matlab Reference|same NLopt interface as in Matlab]]), you will need the following additional steps.
 + 
 +# First, download ''both'' the <code>.zip</code> file above and the main <code>.tar.gz</code> package of NLopt. Use <code>dlltool</code> (which comes with Octave in the ''octave''<code>\mingw23\bin</code> directory) to create the <code>.lib</code> import library as explained above.
 +# Unpack the NLopt .tar.gz file, and copy the <code>nlopt_optimize-oct.cc</code> from the <code>octave</code> directory, along with downloading [http://jdj.mit.edu/~stevenj/nlopt_optimize_usage.h nlopt_optimize_usage.h], and put them together with your <code>.lib</code> and <code>.dll</code> files (from the <code>.zip</code>).
 +# Compile the Octave plugin (<code>.oct</code> file) with <code>mkoctfile -lnlopt-0 --output nlopt_optimize.oct nlopt_optimize-oct.cc</code> (<code>mkoctfile</code> is a program included with Octave).
 +# Finally, move <code>libnlopt-0.dll</code> to the ''octave''<code>\bin</code> directory so that Octave can find it.
[[Category:NLopt]] [[Category:NLopt]]

Revision as of 21:17, 16 October 2010

NLopt
Download
Release notes
FAQ
NLopt manual
Introduction
Installation
Tutorial
Reference
Algorithms
License and Copyright

NLopt on Windows

NLopt works fine on Microsoft Windows computers. To simplify installation, we provide a precompiled 32-bit Windows DLL, built with MinGW (using this script):

Be sure to read the README-WINDOWS file included in this zip archive for how to build an import library for the DLL before using, by running the lib /def:libnlopt-0.def command (which comes with Microsoft compilers). If you are using GNU compilers (MinGW), run dlltool --def-input libnlopt-0.def --dllname libnlopt-0.dll --output-lib libnlopt-0.lib (dlltool comes with MinGW).

(For source code, download the main .tar.gz package.)

Alternatively, you can use the following files, provided by Benoit Scherrer (benoitscherrer ατ gmail.com), to compile NLopt from source on Windows (with the Microsoft compiler) using CMake:

Octave plugin

To build the NLopt plugin for GNU Octave (a free Matlab clone, which uses the same NLopt interface as in Matlab), you will need the following additional steps.

  1. First, download both the .zip file above and the main .tar.gz package of NLopt. Use dlltool (which comes with Octave in the octave\mingw23\bin directory) to create the .lib import library as explained above.
  2. Unpack the NLopt .tar.gz file, and copy the nlopt_optimize-oct.cc from the octave directory, along with downloading nlopt_optimize_usage.h, and put them together with your .lib and .dll files (from the .zip).
  3. Compile the Octave plugin (.oct file) with mkoctfile -lnlopt-0 --output nlopt_optimize.oct nlopt_optimize-oct.cc (mkoctfile is a program included with Octave).
  4. Finally, move libnlopt-0.dll to the octave\bin directory so that Octave can find it.
Personal tools