From 8c2e80097ec56fd68ecc7d57653b101afcdab89a Mon Sep 17 00:00:00 2001 From: John Colvin Date: Tue, 27 Aug 2024 23:31:20 -0400 Subject: [PATCH] build (windows): Update to c++ 20 --- CMakePresets.json | 222 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 000000000..27d1a4f23 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,222 @@ +{ + "version": 4, + "cmakeMinimumRequired": { + "major": 3, + "minor": 23, + "patch": 0 + }, + + "configurePresets": [ + { + "name": "spark", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "generator": "Visual Studio 17 2022", + "binaryDir": "${sourceDir}/build", + "environment": { + "SPARK_CMAKE_CXX_FLAGS": "/MP /WX /wd4250 /wd4251 /wd4244 /wd4267 /wd4355 /wd4275 /wd4345 /bigobj /EHsc /DCURL_STATICLIB /D_WINSOCK_DEPRECATED_NO_WARNINGS /D__TBB_NO_IMPLICIT_LINKAGE /DBOOST_ALL_NO_LIB /std:c++20 /D_SCL_SECURE_NO_WARNINGS /D_CRT_SECURE_NO_WARNINGS /D_WIN32_WINNT=0x0600" + }, + "cacheVariables": { + "CMAKE_CXX_FLAGS": "$env{SPARK_CMAKE_CXX_FLAGS}", + "CMAKE_CXX_FLAGS_DEBUG": "$env{SPARK_CMAKE_CXX_FLAGS} /MTd", + "CMAKE_CXX_FLAGS_RELEASE": "$env{SPARK_CMAKE_CXX_FLAGS} /MT", + "CMAKE_CXX_STANDARD": "20", + "CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/DEBUG /OPT:REF /OPT:ICF /LTCG", + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake", + "EXTERNALS_ROOT": "${sourceDir}/externals/windows" + } + }, + + { + "name": "sparkd", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "platform": "", + "CMAKE_BUILD_WITH_INSTALL_RPATH": { + "type": "BOOL", + "value": "ON" + }, + "CMAKE_INSTALL_RPATH": ".", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}/sparkd", + "CMAKE_EXE_LINKER_FLAGS": "-Wno-undef", + "EXTERNALS_ROOT": "${sourceDir}/externals/linux", + "CMAKE_CXX_STANDARD": "17", + "WEB_TSCONFIG_NAME": "${presetName}", + "BUILD_SDK": { + "type": "BOOL", + "value": "OFF" + }, + "BUILD_WEB": { + "type": "BOOL", + "value": "ON" + } + } + }, + + { + "name": "sparkd-dev-clang", + "inherits": "sparkd", + "displayName": "Development (clang)", + "description": "Debug build compiled w/ clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": { + "type": "BOOL", + "value": "ON" + }, + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS_DEBUG": "-g -fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color -DDEBUG" + } + }, + + { + "name": "sparkd-dev-gcc", + "inherits": "sparkd", + "displayName": "Development (gcc)", + "description": "Debug build compiled w/ gcc", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": { + "type": "BOOL", + "value": "ON" + }, + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_CXX_FLAGS_DEBUG": "-g -fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color -Wno-stringop-overread -DDEBUG" + } + }, + + { + "name": "sparkd-prod-clang", + "inherits": "sparkd", + "displayName": "Production (clang)", + "description": "Release build compiled w/ clang", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color -fno-omit-frame-pointer -DNDEBUG -O3" + } + }, + + { + "name": "sparkd-prod-gcc", + "inherits": "sparkd", + "displayName": "Production (gcc)", + "description": "Release build compiled w/ gcc", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_C_COMPILER": "gcc", + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_CXX_FLAGS_RELEASE": "-fPIC -Wall -pedantic -Wextra -Werror -Wno-missing-braces -Wno-ignored-qualifiers --std=c++17 -fdiagnostics-color -Wno-stringop-overread -Wno-maybe-uninitialized -fno-omit-frame-pointer -DNDEBUG -O3" + } + }, + + { + "name": "sparkd-publish", + "inherits": "sparkd", + "displayName": "Publish", + "description": "Publish build compiled w/ gcc and ready to ship", + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++" + } + } + ], + + "buildPresets": [ + { + "name": "spark", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + }, + "hidden": true, + "jobs": 4 + }, + + { + "name": "spark-dev", + "displayName": "Development", + "inherits": "spark", + "configurePreset": "spark", + "configuration": "Debug" + }, + + { + "name": "spark-prod", + "displayName": "Production", + "inherits": "spark", + "configurePreset": "spark", + "configuration": "Release" + }, + + { + "name": "sparkd", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + }, + "hidden": true, + "jobs": 4, + "targets": [ + "data_files_dir", + "doc_manual_bundle", + "install", + "libspark", + "rapidjson_project", + "server_layout", + "sparkd", + "web_ui_bundle" + ] + }, + + { + "name": "sparkd-dev-clang", + "configurePreset": "sparkd-dev-clang", + "displayName": "Development (clang)", + "inherits": "sparkd" + }, + + { + "name": "sparkd-dev-gcc", + "configurePreset": "sparkd-dev-gcc", + "displayName": "Development (gcc)", + "inherits": "sparkd" + }, + + { + "name": "sparkd-prod-clang", + "configurePreset": "sparkd-prod-clang", + "displayName": "Production (clang)", + "inherits": "sparkd" + }, + + { + "name": "sparkd-prod-gcc", + "configurePreset": "sparkd-prod-gcc", + "displayName": "Production (gcc)", + "inherits": "sparkd" + }, + + { + "name": "sparkd-publish", + "configurePreset": "sparkd-publish", + "displayName": "Publish", + "inherits": "sparkd", + "targets": "install" + } + ] +}