From 7aed9b8cba91eaf0df63de24900630d03c57713d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eduardo=20Mac=C3=AAdo?= Date: Sat, 25 Jan 2025 00:39:32 -0300 Subject: [PATCH] Add macOS CMake presets This should easy the build process on macOS by providing a set of presets that can be used to build the project with a single command. The release preset sets the compiler optimization level to O1 because O2 and above crashes the client when starting up. --- CMakePresets.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index 3bfe0beb0d..06fb7a37e8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -101,6 +101,40 @@ "TOGGLE_PRE_COMPILED_HEADER": "OFF", "SPEED_UP_BUILD_UNITY": "OFF" } + }, + { + "name": "macos-release", + "displayName": "macOS - Release", + "description": "Sets Ninja generator, compilers, build and install directory and set build type as release", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "type": "FILEPATH" + }, + "BUILD_STATIC_LIBRARY": "ON", + "CMAKE_BUILD_TYPE": "Release", + "OPTIONS_ENABLE_SCCACHE": "ON", + "CMAKE_CXX_FLAGS_RELEASE": "-O1 -DNDEBUG" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-debug", + "inherits": "macos-release", + "displayName": "macOS - Debug", + "description": "Build Debug Mode", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "DEBUG_LOG": "ON", + "ASAN_ENABLED": "ON", + "BUILD_STATIC_LIBRARY": "OFF" + } } ], "buildPresets": [ @@ -123,6 +157,14 @@ { "name": "windows-debug", "configurePreset": "windows-debug" + }, + { + "name": "macos-release", + "configurePreset": "macos-release" + }, + { + "name": "macos-debug", + "configurePreset": "macos-debug" } ] }