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 a guide for compiling in Windows #287

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mahyaret
Copy link

Hi,
Thanks for your awesome repo. I compiled this project in Windows and faced bunch of issues. I tried to address them in this guide. BTW, for compiling, I had to add the header file.
I thought these descriptions would help other users too, so I've opened this pull request.
Thanks again,
Mahyar

3. Create a folder named "nlopt" inside `C:\Octave\Octave-X.X.X.X\mingw64\lib\cmake`
4. Copy `NLoptConfig.cmake`, `NLoptConfigVersion.cmake`, `NLoptLibraryDepends.cmake`, and `NLoptLibraryDepends-release.cmake` from `build` and `build\CMakeFiles\Export\lib\cmake\nlopt`, respectively, to `C:\Octave\Octave-X.X.X.X\mingw64\lib\cmake`
5. Copy `nlopt.pc` from `build` to `C:\Octave\Octave-X.X.X.X\mingw64\lib\pkgconfig`
6. Copy `libnlopt.dll.a` from `build` to `C:\Octave\Octave-X.X.X.X\mingw64\lib`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you pass a -L flag to mkoctfile?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't, unless I did not understand your point completely...

2. Download [`nlopt_optimize-oct.cc`](https://github.com/stevengj/nlopt/raw/master/src/octave/nlopt_optimize-oct.cc) and put it in the same directory as the `.dll` and `.dll.a` files.
3. Compile the Octave plugin (`.oct` file) with `mkoctfile -lnlopt --output nlopt_optimize.oct nlopt_optimize-oct.cc` (`mkoctfile` is a program included with Octave).
4. Finally, move `libnlopt.dll` to the *octave*``bin` directory (the location of `octave.exe`) so that Octave can find it.
1. Copy `libnlopt.dll` from `build` to `C:\Octave\Octave-X.X.X.X\mingw64\bin`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you just do make DESTDIR=C:\Octave\Octave-X.X.X.X\mingw64 install to install everything?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It did not work for me. That's why I went for MSYS path...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

@@ -0,0 +1,47 @@
---
# NLopt on Windows
---
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this file get included accidentally?

@@ -0,0 +1,192 @@
#define NLOPT_OPTIMIZE_USAGE \
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is supposed to be generated by cmake, no?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not for me, I had to add it manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants