diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 0000000..ff518db --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 27, + "patch": 0 + }, + "include": [ + "cmake/presets/os-linux.json", + "cmake/presets/os-macos.json", + "cmake/presets/os-windows.json" + ] +} diff --git a/autogen.sh b/autogen.sh deleted file mode 100755 index 0a2e094..0000000 --- a/autogen.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /bin/bash -set -ex - -if [[ -x "$(command -v realpath)" ]]; then - ROOTDIR="$(realpath $(dirname $0))" -else - ROOTDIR="$(dirname $0)" -fi - -BUILD_TYPE="${1:-Debug}" -WORKDIR="build" -if [[ "${BUILD_TYPE}" != "Debug" ]]; then - WORKDIR="release" -fi - -mkdir -p "${ROOTDIR}/${WORKDIR}" -cd "${ROOTDIR}/${WORKDIR}" - -exec cmake "${ROOTDIR}" \ - -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ - -DCMAKE_CXX_FLAGS="-fdiagnostics-color=always" \ - -GNinja - diff --git a/cmake/presets/common.json b/cmake/presets/common.json new file mode 100644 index 0000000..818e692 --- /dev/null +++ b/cmake/presets/common.json @@ -0,0 +1,18 @@ +{ + "version": 6, + "configurePresets": [ + { "name": "debug", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, + { "name": "release", "hidden": true, "cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" } }, + { "name": "arch-native", "hidden": true, "cacheVariables": { "CMAKE_CXX_FLAGS": "-march=native" } }, + { "name": "clang", "hidden": true, "cacheVariables": { "CMAKE_CXX_COMPILER": "clang++" } }, + { "name": "gcc", "hidden": true, "cacheVariables": { "CMAKE_CXX_COMPILER": "g++" } }, + { + "name": "libunicode-common", + "hidden": true, + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "PEDANTIC_COMPILER": "ON" + } + } + ] +} diff --git a/cmake/presets/os-linux.json b/cmake/presets/os-linux.json new file mode 100644 index 0000000..86cd05b --- /dev/null +++ b/cmake/presets/os-linux.json @@ -0,0 +1,61 @@ +{ + "version": 6, + "include": [ "common.json" ], + "configurePresets": [ + { + "name": "linux-common", + "inherits": "libunicode-common", + "generator": "Ninja", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "linux-clang-debug", + "displayName": "Linux (Clang) Debug", + "inherits": ["linux-common", "debug", "clang"] + }, + { + "name": "linux-clang-release", + "displayName": "Linux (Clang) Release", + "inherits": ["linux-common", "release", "clang"] + }, + { + "name": "linux-gcc-debug", + "displayName": "Linux (GCC) Debug", + "inherits": ["linux-common", "debug", "gcc"] + }, + { + "name": "linux-gcc-release", + "displayName": "Linux (GCC) Release", + "inherits": ["linux-common", "release", "gcc"] + }, + { + "name": "linux-native-clang-release", + "displayName": "Linux (Clang, Native arch, Release)", + "inherits": ["linux-common", "release", "arch-native", "clang"] + }, + { + "name": "linux-native-gcc-release", + "displayName": "Linux (GCC, Native arch, Release)", + "inherits": ["linux-common", "release", "arch-native", "gcc"] + } + ], + "buildPresets": [ + { "name": "linux-clang-debug", "configurePreset": "linux-clang-debug" }, + { "name": "linux-clang-release", "configurePreset": "linux-clang-release" }, + { "name": "linux-gcc-debug", "configurePreset": "linux-gcc-debug" }, + { "name": "linux-gcc-release", "configurePreset": "linux-gcc-release" }, + { "name": "linux-native-clang-release", "configurePreset": "linux-native-clang-release" }, + { "name": "linux-native-gcc-release", "configurePreset": "linux-native-gcc-release" } + ], + "testPresets": [ + { "name": "linux-clang-debug", "configurePreset": "linux-clang-debug", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } }, + { "name": "linux-clang-release", "configurePreset": "linux-clang-release", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } }, + { "name": "linux-gcc-debug", "configurePreset": "linux-gcc-debug", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } }, + { "name": "linux-gcc-release", "configurePreset": "linux-gcc-release", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } } + ] +} diff --git a/cmake/presets/os-macos.json b/cmake/presets/os-macos.json new file mode 100644 index 0000000..25dcfa1 --- /dev/null +++ b/cmake/presets/os-macos.json @@ -0,0 +1,27 @@ +{ + "version": 6, + "include": [ "common.json" ], + "configurePresets": [ + { + "name": "macos-common", + "inherits": "libunicode-common", + "generator": "Ninja", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { "name": "macos-debug", "displayName": "MacOS Debug", "inherits": ["macos-common", "debug"] }, + { "name": "macos-release", "displayName": "MacOS Release", "inherits": ["macos-common", "release"] } + ], + "buildPresets": [ + { "name": "macos-debug", "configurePreset": "macos-debug" }, + { "name": "macos-release", "configurePreset": "macos-release" } + ], + "testPresets": [ + { "name": "macos-debug", "configurePreset": "macos-debug", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } }, + { "name": "macos-release", "configurePreset": "macos-release", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } } + ] +} diff --git a/cmake/presets/os-windows.json b/cmake/presets/os-windows.json new file mode 100644 index 0000000..c4d41aa --- /dev/null +++ b/cmake/presets/os-windows.json @@ -0,0 +1,39 @@ +{ + "version": 6, + "include": [ "common.json" ], + "configurePresets": [ + { + "name": "windows-common", + "inherits": "libunicode-common", + "displayName": "Windows - common settings", + "hidden": true, + "binaryDir": "${sourceDir}/out/build/${presetName}", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "x64-windows", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_VERBOSE_MAKEFILE": "ON", + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/../vcpkg/scripts/buildsystems/vcpkg.cmake" + } + }, + { "name": "windows-cl-debug", "inherits": ["windows-common", "debug"], "displayName": "Windows (MSVC) Debug", "description": "Using MSVC compiler (64-bit)" }, + { "name": "windows-cl-release", "inherits": ["windows-common", "release"], "displayName": "Windows (MSVC) Release", "description": "Using MSVC compiler (64-bit)" }, + { "name": "windows-clang-common", "inherits": ["windows-common"], "hidden": true, "toolset": "ClangCL,host=x64" }, + { "name": "windows-clang-debug", "inherits": ["windows-clang-common", "debug"], "displayName": "Windows (ClangCL) Debug", "description": "Using Clang compiler (64-bit)" }, + { "name": "windows-clang-release", "inherits": ["windows-clang-common", "release"], "displayName": "Windows (ClangCL) Release", "description": "Using Clang compiler (64-bit)" } + ], + "buildPresets": [ + { "name": "windows-cl-debug", "displayName": "x64 (MSVC) Debug", "configurePreset": "windows-cl-debug", "configuration": "Debug" }, + { "name": "windows-cl-release", "displayName": "x64 (MSVC) RelWithDebInfo", "configurePreset": "windows-cl-release", "configuration": "RelWithDebInfo" }, + { "name": "windows-clang-debug", "displayName": "x64 (Clang) Debug", "configurePreset": "windows-clang-debug", "configuration": "Debug" }, + { "name": "windows-clang-release", "displayName": "x64 (Clang) RelWithDebInfo", "configurePreset": "windows-clang-release", "configuration": "RelWithDebInfo" } + ], + "testPresets": [ + { "name": "windows-cl-debug", "configurePreset": "windows-cl-debug", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } }, + { "name": "windows-cl-release", "configurePreset": "windows-cl-release", "output": {"outputOnFailure": true}, "execution": { "noTestsAction": "error", "stopOnFailure": true } } + ] +}