You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently attempted to build libcmaes on Windows 11 using Visual Studio 2022 (MSVC) and encountered several issues. After resolving them, I wanted to share the complete build process for other Windows users.
Windows 11
Visual Studio 2022
vcpkg package manager
CMake
Steps
1. Install Dependencies using vcpkg
First, install the required dependencies using vcpkg:
The file include/libcmaes/eigenmvn.h needs to be modified to properly handle std::normal_distribution with MSVC. Locate the scalar_normal_dist_op class and replace it with the following implementation:
I recently attempted to build libcmaes on Windows 11 using Visual Studio 2022 (MSVC) and encountered several issues. After resolving them, I wanted to share the complete build process for other Windows users.
Steps
1. Install Dependencies using vcpkg
First, install the required dependencies using vcpkg:
2. Modify CMakeLists.txt
The original CMakeLists.txt needs to be modified to support MSVC compiler flags. Locate the compiler flags section and replace it with the following:
3. Modify eigenmvn.h
The file
include/libcmaes/eigenmvn.h
needs to be modified to properly handle std::normal_distribution with MSVC. Locate thescalar_normal_dist_op
class and replace it with the following implementation:4. Build the Library
Now you can build the library:
Replace
[path to vcpkg]
with your actual vcpkg installation path.Key Changes Summary
Compiler Flags: Added MSVC-specific compiler flags in CMakeLists.txt to handle the
-Wextra
flag issue.Dependencies: Used vcpkg for managing dependencies (eigen3, glog, gflags) instead of manual installation.
MSVC Compatibility: Modified the
scalar_normal_dist_op
class in eigenmvn.h to:The text was updated successfully, but these errors were encountered: