| OS | C++ | Fortran | Python | CSharp Example | .NET |
|:-------- | :---: | :------: | :----: | :----: | :----: |
| Linux | |
|
| (1) |
|
| MacOS |
|
|
| (1) |
|
| Windows |
| (2) |
|
|
|
(1) CMake C# is currently only supported for Microsoft Visual Studio 11 2012 and
later. You can still build and run the HiGHS C# nuget package on Linux and MacOS with dotnet
, see the workflows in the .NET column. It is only the CSharp example build with CMake that is not supported for Unix generators.
(2) Not tested yet.
Contents
HiGHS can be built from source using CMake: http://www.cmake.org/. CMake works by generating native Makefiles or build projects that can be used in the compiler environment of your choice.
HiGHS can be built as a standalone project or it could be incorporated into an existing CMake project.
You'll need:
CMake >= 3.15
.Here is a list of the supported compilers:
clang
g++
icc
MSVC
To build the C++ library and executable run
cd HiGHS
cmake -S. -B build
cmake --build build --parallel
This generates HiGHS in the build
directory and creates the executable build/bin/highs
, or build/bin/Release/highs.exe
on Windows. To perform a quick test to see whether the compilation was successful, run ctest
from within the build folder.
ctest
On Windows, the configuration type must be specified:
ctest -C Release
The default installation location may need administrative permissions. To install, after building and testing, run
cmake --install build
form the root directory.
To install in a specified installation directory run CMake with the
CMAKE_INSTALL_PREFIX
flag set:
cmake -S. -B build -DCMAKE_INSTALL_PREFIX=/path/to/highs_install
cmake --build build --parallel
cmake --install build
By default, CMake builds the debug version of the binaries. These are generated in a directory Debug
. To build a release version, add the option --config Release
cmake -S . -B build
cmake --build build --config Release
It is also possible to specify a specific Visual studio version to build with:
cmake -G "Visual Studio 17 2022" -S . -B build
cmake --build build
When building under Windows, some extra options are available. One is building a 32 bit version or a 64 bit version. The default build is 64 bit. To build 32 bit, the following commands can be used from the HiGHS/
directory:
cmake -A Win32 -S . -B buildWin32
cmake --build buildWin32
Another thing specific for windows is the calling convention, particularly important for the HiGHS dynamic library (dll). The default calling convention in windows is cdecl calling convention, however, dlls are most often compiled with stdcall. Most applications which expect stdcall, can't access dlls with cdecl and vice versa. To change the default calling convention from cdecl to stdcall the following option can be added
cmake -DSTDCALL=ON -S . -B build
cmake --build build
There are several options that can be passed to CMake to modify how the code
is built.
To set these options and parameters, use -D<Parameter_name>=<value>
.
All CMake options are passed at configure time, i.e., by running
cmake -S. -B<your_chosen_build_directory> -DOPTION_ONE=ON -DOPTION_TWO=OFF ...
before running cmake --build <your_chosen_build_directory>
For example, to generate build files in a new subdirectory called 'build', run:
cmake -S. -Bbuild
and then build with:
cmake --build build
Following is a list of available options:
| CMake Option | Default Value | Note |
|:-------------|:--------------|:-----|
| CMAKE_BUILD_TYPE
| Release | see CMake documentation here |
| BUILD_SHARED_LIBS
| ON(*) | Build shared libraries (.so or .dyld). * OFF by default on Windows |
| BUILD_CXX
| ON | Build C++ |
| FORTRAN
| OFF | Build Fortran interface |
| CSHARP
| OFF | Build CSharp wrapper |
| BUILD_DOTNET
| OFF | Build .Net package |
| PYTHON_BUILD_SETUP
| OFF | Build Python bindings. Called at pip install
from pyproject.toml |
| ZLIB
| ON | Use ZLIB if available |
| ALL_TESTS
| OFF | Run unit tests and extended instance test set |
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.