A settings file says which compiler, archiver and linker build each file type,
plus include paths, library paths, environment and properties. mkn writes a default one on its
first run; -x <file> selects another, and super: settings extends the
default. See settings.yaml for every key.
Linux
gccbuilt in CI: ubuntu-24.04
gcc / g++, C++20: much like the default settings file mkn writes on Linux
# gcc / g++, C++20: much like the default settings file mkn writes on Linux
super: settings
file:
- type: c:S
archiver: ar -cr
compiler: gcc
linker: gcc
- type: cpp:cxx:cc
archiver: ar -cr
compiler: g++ -std=c++20
linker: g++
Use: mkn build -x gcc with the file saved next to the project or in the settings directory, or download /
view on GitHub
clangbuilt in CI: ubuntu-24.04
clang / clang++, C++20. llvm-ar archives: with -O mkn adds -flto, and GNU ar cannot index clang's LTO bitcode (a static library without symbols, its references undefined at the link)
# clang / clang++, C++20. llvm-ar archives: with -O mkn adds -flto, and GNU ar cannot index
# clang's LTO bitcode (a static library without symbols, its references undefined at the link)
super: settings
file:
- type: c:S
archiver: llvm-ar -cr
compiler: clang
linker: clang
- type: cpp:cxx:cc
archiver: llvm-ar -cr
compiler: clang++ -std=c++20
linker: clang++
Use: mkn build -x clang with the file saved next to the project or in the settings directory, or download /
view on GitHub
gccmaskbuilt in CI: ubuntu-24.04
a versioned gcc (g++-14 next to the distribution's default): the mask tells mkn that g++-14 takes g++'s flags, the file entries name the binary
# a versioned gcc (g++-14 next to the distribution's default): the mask tells mkn that g++-14
# takes g++'s flags, the file entries name the binary
super: settings
compiler:
mask:
g++: g++-14
file:
- type: cpp:cxx:cc
archiver: gcc-ar-14 -cr
compiler: g++-14 -std=c++20
linker: g++-14
Use: mkn build -x gcc_versioned with the file saved next to the project or in the settings directory, or download /
view on GitHub
clangmaskbuilt in CI: ubuntu-24.04
a versioned clang (clang++-18 from apt.llvm.org or a distribution package): masked as clang++, with the llvm-ar of the same version
# a versioned clang (clang++-18 from apt.llvm.org or a distribution package): masked as clang++,
# with the llvm-ar of the same version
super: settings
compiler:
mask:
clang++: clang++-18
file:
- type: cpp:cxx:cc
archiver: llvm-ar-18 -cr
compiler: clang++-18 -std=c++20
linker: clang++-18
Use: mkn build -x clang_versioned with the file saved next to the project or in the settings directory, or download /
view on GitHub
gccccachebuilt in CI: ubuntu-24.04
gcc and g++ through ccache: unchanged sources are not compiled again, across clean builds too
# gcc and g++ through ccache: unchanged sources are not compiled again, across clean builds too
super: settings
file:
- type: c
archiver: ar -cr
compiler: ccache gcc
linker: gcc
- type: cpp:cxx:cc
archiver: ar -cr
compiler: ccache g++ -std=c++20
linker: g++
Use: mkn build -x ccache_gcc with the file saved next to the project or in the settings directory, or download /
view on GitHub
clangccachebuilt in CI: ubuntu-24.04
clang and clang++ through ccache (llvm-ar: see clang.yaml)
# clang and clang++ through ccache (llvm-ar: see clang.yaml)
super: settings
file:
- type: c
archiver: llvm-ar -cr
compiler: ccache clang
linker: clang
- type: cpp:cxx:cc
archiver: llvm-ar -cr
compiler: ccache clang++ -std=c++20
linker: clang++
Use: mkn build -x ccache_clang with the file saved next to the project or in the settings directory, or download /
view on GitHub
gccccachemoldbuilt in CI: ubuntu-24.04
faster rebuilds: ccache in front of the compiler, mold as the linker
# faster rebuilds: ccache in front of the compiler, mold as the linker
super: settings
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: ccache g++ -std=c++20
linker: g++ -fuse-ld=mold
Use: mkn build -x ccache_mold with the file saved next to the project or in the settings directory, or download /
view on GitHub
gccsanitizerbuilt in CI: ubuntu-24.04
AddressSanitizer: the flag on the compiler and the linker; tests and run get the instrumented binaries (ASAN_OPTIONS through env, e.g. detect_leaks)
# AddressSanitizer: the flag on the compiler and the linker; tests and run get the instrumented
# binaries (ASAN_OPTIONS through env, e.g. detect_leaks)
super: settings
property:
asan: -fsanitize=address -fno-omit-frame-pointer
env:
- name: ASAN_OPTIONS
mode: replace
value: detect_leaks=1
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: g++ -std=c++20 ${asan}
linker: g++ ${asan}
Use: mkn build -x asan with the file saved next to the project or in the settings directory, or download /
view on GitHub
gcccoveragebuilt in CI: ubuntu-24.04
gcc coverage: build and run the tests without -O, then report, e.g. with gcovr: mkn clean build test -x coverage gcovr -r . --object-directory bin --html-details bin/cov/index.html
# gcc coverage: build and run the tests without -O, then report, e.g. with gcovr:
# mkn clean build test -x coverage
# gcovr -r . --object-directory bin --html-details bin/cov/index.html
super: settings
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: g++ -std=c++20 --coverage -fprofile-update=atomic
linker: g++ --coverage
Use: mkn build -x coverage with the file saved next to the project or in the settings directory, or download /
view on GitHub
mpimaskbuilt in CI: ubuntu-24.04
MPI through the implementation's compiler wrapper (Open MPI, MPICH): masked as g++, the underlying compiler chosen by the wrapper (OMPI_CXX=clang++ for Open MPI)
# MPI through the implementation's compiler wrapper (Open MPI, MPICH): masked as g++, the
# underlying compiler chosen by the wrapper (OMPI_CXX=clang++ for Open MPI)
super: settings
compiler:
mask:
g++: mpicxx
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: mpicxx -std=c++20 -DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX
linker: mpicxx
Use: mkn build -x mpi with the file saved next to the project or in the settings directory, or download /
view on GitHub
CUDA compiled by clang: .cpp files as CUDA for one GPU architecture (sm_120: RTX 50xx, set yours), linked against the toolkit's cudart. llvm-ar: see clang.yaml
# CUDA compiled by clang: .cpp files as CUDA for one GPU architecture (sm_120: RTX 50xx, set
# yours), linked against the toolkit's cudart. llvm-ar: see clang.yaml
super: settings
property:
cuda.arch: 120
cuda: /usr/local/cuda
inc: ${cuda}/targets/x86_64-linux/include
path: ${cuda}/targets/x86_64-linux/lib
file:
- type: cpp:cxx:cc
archiver: llvm-ar -cr
compiler: clang++ -std=c++20 -x cuda --cuda-gpu-arch=sm_${cuda.arch} -Wno-unknown-cuda-version
linker: clang++ -lcudart
Use: mkn build -x cuda_clang with the file saved next to the project or in the settings directory, or download /
view on GitHub
CUDA compiled by nvcc, .cpp files as CUDA (-x cu); host compiler flags through -Xcompiler
# CUDA compiled by nvcc, .cpp files as CUDA (-x cu); host compiler flags through -Xcompiler
super: settings
env:
- name: PATH
value: /usr/local/cuda/bin
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: nvcc -std=c++20 -Xcompiler -fPIC -x cu --extended-lambda --expt-relaxed-constexpr
linker: nvcc -lcudart
Use: mkn build -x cuda_nvcc with the file saved next to the project or in the settings directory, or download /
view on GitHub
hiprocmmasknot built in CI
AMD HIP with ROCm under /opt/rocm: hipcc masked as g++. For a ROCm installed to /usr (a distribution package) drop env and path. --offload-arch for your GPU (rocminfo | grep gfx)
# AMD HIP with ROCm under /opt/rocm: hipcc masked as g++. For a ROCm installed to /usr (a
# distribution package) drop env and path. --offload-arch for your GPU (rocminfo | grep gfx)
super: settings
compiler:
mask:
g++: hipcc
env:
- name: PATH
value: /opt/rocm/bin
path: /opt/rocm/lib
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: hipcc -std=c++20 -fPIC
linker: hipcc -lamdhip64
Use: mkn build -x hip_rocm with the file saved next to the project or in the settings directory, or download /
view on GitHub
macOS
clangbuilt in CI: macos-latest
Apple clang (Xcode or the Command Line Tools)
# Apple clang (Xcode or the Command Line Tools)
super: settings
file:
- type: c:S
archiver: ar -cr
compiler: clang
linker: clang
- type: cpp:cxx:cc
archiver: ar -cr
compiler: clang++ -std=c++20
linker: clang++
Use: mkn build -x clang with the file saved next to the project or in the settings directory, or download /
view on GitHub
clangmaskbuilt in CI: macos-latest
Homebrew's LLVM (brew install llvm), not Apple clang: its clang++ by path, masked as clang++, with its llvm-ar (see linux/clang.yaml). /opt/homebrew is Apple silicon, /usr/local Intel
# Homebrew's LLVM (brew install llvm), not Apple clang: its clang++ by path, masked as clang++,
# with its llvm-ar (see linux/clang.yaml). /opt/homebrew is Apple silicon, /usr/local Intel
super: settings
property:
llvm: /opt/homebrew/opt/llvm/bin
compiler:
mask:
clang++: ${llvm}/clang++
file:
- type: cpp:cxx:cc
archiver: ${llvm}/llvm-ar -cr
compiler: ${llvm}/clang++ -std=c++20
linker: ${llvm}/clang++
Use: mkn build -x llvm_homebrew with the file saved next to the project or in the settings directory, or download /
view on GitHub
gccmaskbuilt in CI: macos-latest
Homebrew's gcc (brew install gcc): installed as g++-<version>, plain g++ is Apple clang
# Homebrew's gcc (brew install gcc): installed as g++-<version>, plain g++ is Apple clang
super: settings
compiler:
mask:
g++: g++-14
file:
- type: cpp:cxx:cc
archiver: ar -cr
compiler: g++-14 -std=c++20
linker: g++-14
Use: mkn build -x gcc_homebrew with the file saved next to the project or in the settings directory, or download /
view on GitHub
Windows
MSVC's cl and link find headers and libraries through the INCLUDE, LIB and PATH
environment variables, which vcvarsall.bat sets: a Developer Command Prompt or
Developer PowerShell is one with them set. From one, settings need only name the tools
(MSVC); mkn's own default settings file is then written with those paths. Without
one, and without gcc or clang, mkn cannot write that file and stops with a message pointing here:
the default settings file is then one you write, giving the same paths itself
(MSVC without a Developer prompt).
They come from two places:
|
Directory |
Include |
Libraries |
Tools |
| MSVC toolset |
<Visual Studio>/VC/Tools/MSVC/<version> |
include |
lib/<arch> |
bin/HostX64/<arch> |
| Windows SDK |
C:/Program Files (x86)/Windows Kits/10 |
Include/<version>/ucrt, um, shared |
Lib/<version>/ucrt/<arch>, um/<arch> |
|
<arch> is x64 or x86 (32 bit). The installed versions:
- Visual Studio:
"C:/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath
- MSVC toolset:
<Visual Studio>/VC/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt, or the directories in VC/Tools/MSVC
- Windows SDK: the directories in
Windows Kits/10/Include (um/windows.h in the one used)
- or all of it at once:
echo %INCLUDE% and echo %LIB% in a Developer Command Prompt
Paths with spaces (Program Files, Windows Kits): inc: and path: entries are split
like a command line, where outside quotes a backslash escapes the next character. Either quote
each path, with backslashes or forward slashes: "C:\Program Files (x86)\Windows Kits\10\Include",
or use forward slashes and escape the spaces: C:/Program\ Files\ (x86)/Windows\ Kits/10/Include.
Unquoted backslash paths do not work. Quotes need a YAML block (inc: |, one path a line): a
plain inc: "..." has YAML remove them. A property: holding a path holds it raw, spaces and
all, and the lines using it are quoted. env: values are raw too.
msvcbuilt in CI: windows-latest
MSVC: run mkn from a Developer Command Prompt / PowerShell (vcvarsall.bat), cl and link find their headers and libraries through INCLUDE and LIB. Not from Git Bash: Git's own link.exe (coreutils) comes first on its PATH. Without gcc or clang on PATH (or with MKN_CL_PREFERRED=1) the default settings file mkn writes is this, with those paths in it
# MSVC: run mkn from a Developer Command Prompt / PowerShell (vcvarsall.bat), cl and link find
# their headers and libraries through INCLUDE and LIB. Not from Git Bash: Git's own link.exe
# (coreutils) comes first on its PATH. Without gcc or clang on PATH (or with MKN_CL_PREFERRED=1)
# the default settings file mkn writes is this, with those paths in it
super: settings
file:
- type: cpp:cxx:cc:c
archiver: lib
compiler: cl -std:c++20 -EHsc
linker: link
Use: mkn build -x msvc with the file saved next to the project or in the settings directory, or download /
view on GitHub
msvcwindows sdkbuilt in CI: windows-latest
MSVC without a Developer Command Prompt: the MSVC toolset's and Windows SDK's include, library and bin directories given here, as vcvarsall.bat sets them in INCLUDE, LIB and PATH. Set the four properties for your install (see above); their values are raw, the lines using them quoted. mkn cannot write its default settings file without a Developer prompt, gcc or clang: this is it
# MSVC without a Developer Command Prompt: the MSVC toolset's and Windows SDK's include, library
# and bin directories given here, as vcvarsall.bat sets them in INCLUDE, LIB and PATH. Set the
# four properties for your install (see above); their values are raw, the lines using them quoted.
# mkn cannot write its default settings file without a Developer prompt, gcc or clang: this is it
property:
msvc: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207
sdk: C:/Program Files (x86)/Windows Kits/10
sdk.version: 10.0.26100.0
arch: x64
inc: |
"${msvc}/include"
"${sdk}/Include/${sdk.version}/ucrt"
"${sdk}/Include/${sdk.version}/um"
"${sdk}/Include/${sdk.version}/shared"
path: |
"${msvc}/lib/${arch}"
"${sdk}/Lib/${sdk.version}/ucrt/${arch}"
"${sdk}/Lib/${sdk.version}/um/${arch}"
env:
- name: PATH
value: ${msvc}/bin/HostX64/${arch}
file:
- type: cpp:cxx:cc:c
archiver: lib
compiler: cl -std:c++20 -EHsc
linker: link
Use: save as mkn's default settings file, the path its message prints: maiken/settings.yaml in %HOME%, else in %HOMEDRIVE%%HOMEPATH%; then mkn build needs no -x, or download /
view on GitHub
msvcwindows sdkx86built in CI: windows-latest
32 bit MSVC without a Developer Command Prompt: as msvc_paths.yaml with x86 libraries and the x86 hosted compiler (HostX64/x86 cross compiles from a 64 bit host as well)
# 32 bit MSVC without a Developer Command Prompt: as msvc_paths.yaml with x86 libraries and the
# x86 hosted compiler (HostX64/x86 cross compiles from a 64 bit host as well)
property:
msvc: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207
sdk: C:/Program Files (x86)/Windows Kits/10
sdk.version: 10.0.26100.0
arch: x86
inc: |
"${msvc}/include"
"${sdk}/Include/${sdk.version}/ucrt"
"${sdk}/Include/${sdk.version}/um"
"${sdk}/Include/${sdk.version}/shared"
path: |
"${msvc}/lib/${arch}"
"${sdk}/Lib/${sdk.version}/ucrt/${arch}"
"${sdk}/Lib/${sdk.version}/um/${arch}"
env:
- name: PATH
value: ${msvc}/bin/HostX86/${arch}
file:
- type: cpp:cxx:cc:c
archiver: lib
compiler: cl -std:c++20 -EHsc
linker: link
Use: save as mkn's default settings file, the path its message prints: maiken/settings.yaml in %HOME%, else in %HOMEDRIVE%%HOMEPATH%; then mkn build needs no -x, or download /
view on GitHub
msvcwindows sdknot built in CI
Visual Studio 2015 (MSVC 14.0) and older: one VC directory, VC/include, VC/lib/amd64 and VC/bin/amd64 for 64 bit (VC/lib and VC/bin for 32 bit), with a Windows 10 SDK. Written with forward slashes and backslash escaped spaces, the other form paths with spaces can take
# Visual Studio 2015 (MSVC 14.0) and older: one VC directory, VC/include, VC/lib/amd64 and
# VC/bin/amd64 for 64 bit (VC/lib and VC/bin for 32 bit), with a Windows 10 SDK. Written with
# forward slashes and backslash escaped spaces, the other form paths with spaces can take
super: settings
inc: |
C:/Program\ Files\ (x86)/Windows\ Kits/10/Include/10.0.10240.0/ucrt
C:/Program\ Files\ (x86)/Windows\ Kits/10/Include/10.0.10240.0/um
C:/Program\ Files\ (x86)/Windows\ Kits/10/Include/10.0.10240.0/shared
C:/Program\ Files\ (x86)/Microsoft\ Visual\ Studio\ 14.0/VC/include
path: |
C:/Program\ Files\ (x86)/Windows\ Kits/10/Lib/10.0.10240.0/um/x64
C:/Program\ Files\ (x86)/Windows\ Kits/10/Lib/10.0.10240.0/ucrt/x64
C:/Program\ Files\ (x86)/Microsoft\ Visual\ Studio\ 14.0/VC/lib/amd64
env:
- name: PATH
value: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64
file:
- type: cpp:cxx:cc:c
archiver: lib
compiler: cl -EHsc
linker: link
Use: mkn build -x msvc_2015 with the file saved next to the project or in the settings directory, or download /
view on GitHub
clangbuilt in CI: windows-latest
LLVM's clang on Windows (the LLVM installer, or Visual Studio's clang component) against the MSVC libraries: lld links, llvm-ar archives
# LLVM's clang on Windows (the LLVM installer, or Visual Studio's clang component) against the
# MSVC libraries: lld links, llvm-ar archives
super: settings
file:
- type: cpp:cxx:cc
archiver: llvm-ar rcs
# MSVC's STL can require a newer clang than the installed LLVM (error STL1000), the define
# allows the pair until they match again
compiler: clang++ -std=c++20 -D_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH
linker: clang++ -fuse-ld=lld
Use: mkn build -x clang with the file saved next to the project or in the settings directory, or download /
view on GitHub
C# with the .NET Framework's csc (Windows ships it under C:/Windows/Microsoft.NET)
# C# with the .NET Framework's csc (Windows ships it under C:/Windows/Microsoft.NET)
super: settings
env:
- name: PATH
value: C:/Windows/Microsoft.NET/Framework64/v4.0.30319
file:
- type: cs
compiler: csc
linker: csc
Use: mkn build -x csharp with the file saved next to the project or in the settings directory, or download /
view on GitHub