makefilecmakenmakenlopt

How to build NLopt on Windows


I'm trying to build NLopt on Windows. To do so, I open Visual Studio 2017 Developer Command Prompt and then:

>cd C:\Users\m3\repos\
>git clone git://github.com/stevengj/nlopt
>cd nlopt
>mkdir build
>cd build
>cmake ..

Then I need to run commands make and sudo make install. Of course, Windows doesn't have GNU make, so I want to use Windows nmake as suggested here. But there I cannot find any proper Makefile to use. Am I missing something?

This is the build directory content after running cmake .. command:

>dir
 Volume in drive C has no label.
 Volume Serial Number is 3874-53A8

 Directory of C:\Users\m3\repos\nlopt\build

10/06/2020  09:45 AM    <DIR>          .
10/06/2020  09:45 AM    <DIR>          ..
10/06/2020  09:45 AM            51,498 ALL_BUILD.vcxproj
10/06/2020  09:45 AM               278 ALL_BUILD.vcxproj.filters
10/06/2020  09:44 AM    <DIR>          build_fpclassify
10/06/2020  09:45 AM            24,269 CMakeCache.txt
10/06/2020  09:45 AM    <DIR>          CMakeFiles
10/06/2020  09:45 AM             7,196 cmake_install.cmake
10/06/2020  09:45 AM             3,449 CPackConfig.cmake
10/06/2020  09:45 AM             3,690 CPackSourceConfig.cmake
10/06/2020  09:45 AM               308 CTestTestfile.cmake
10/06/2020  09:44 AM                99 fpclassify.c
10/06/2020  09:45 AM            57,561 generate-cpp.vcxproj
10/06/2020  09:45 AM               964 generate-cpp.vcxproj.filters
10/06/2020  09:45 AM            57,576 generate-fortran.vcxproj
10/06/2020  09:45 AM               967 generate-fortran.vcxproj.filters
10/06/2020  09:45 AM            11,841 INSTALL.vcxproj
10/06/2020  09:45 AM               520 INSTALL.vcxproj.filters
10/06/2020  09:45 AM    <DIR>          Matlab
10/06/2020  09:45 AM            10,624 nlopt.sln
10/06/2020  09:45 AM            79,777 nlopt.vcxproj
10/06/2020  09:45 AM             9,916 nlopt.vcxproj.filters
10/06/2020  09:45 AM               904 NLoptConfig.cmake
10/06/2020  09:45 AM               388 NLoptConfigVersion.cmake
10/06/2020  09:45 AM             3,463 NLoptLibraryDepends.cmake
10/06/2020  09:45 AM             4,955 nlopt_config.h
10/06/2020  09:45 AM            12,073 PACKAGE.vcxproj
10/06/2020  09:45 AM               520 PACKAGE.vcxproj.filters
10/06/2020  09:45 AM            11,315 RUN_TESTS.vcxproj
10/06/2020  09:45 AM               522 RUN_TESTS.vcxproj.filters
10/06/2020  09:45 AM    <DIR>          src
10/06/2020  09:45 AM    <DIR>          test
10/06/2020  09:45 AM            50,952 ZERO_CHECK.vcxproj
10/06/2020  09:45 AM               521 ZERO_CHECK.vcxproj.filters
              27 File(s)        406,146 bytes
               7 Dir(s)  274,515,578,880 bytes free


Solution

  • Well, I finally built it by opening the nlopt.sln Visual Studio Solution file inside build directory by Visual Studio. Then, using the menu Build > Build Solution for both debug and release modes ...

    Screenshot