diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e19f03..660724c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.21) +cmake_minimum_required(VERSION 3.21...3.27) # This template attempts to be "fetch_content"-able # so that it works well with tools like CPM or other @@ -94,6 +94,11 @@ endif() # set the startup project for the "play" button in MSVC set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT intro) +if(ENABLE_DOXYGEN) + include(cmake/Doxygen.cmake) + myproject_enable_doxygen("") +endif() + if(CMAKE_SKIP_INSTALL_RULES) return() endif() diff --git a/CMakePresets.json b/CMakePresets.json index 5871489e..6703f241 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,8 +1,8 @@ { - "version": 3, + "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 21, + "minor": 25, "patch": 0 }, "configurePresets": [ @@ -16,7 +16,8 @@ }, { "name": "conf-windows-common", - "description": "Windows settings for MSBuild toolchain that apply to msvc and clang", + "description": + "Windows settings for MSBuild toolchain that apply to msvc and clang", "hidden": true, "inherits": "conf-common", "condition": { @@ -50,6 +51,9 @@ "Darwin" ] }, + "cacheVariables": { + "CMAKE_UNITY_BUILD": true + }, "vendor": { "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" @@ -59,7 +63,8 @@ { "name": "windows-msvc-debug-developer-mode", "displayName": "msvc Debug (Developer Mode)", - "description": "Target Windows with the msvc compiler, debug build type", + "description": + "Target Windows with the msvc compiler, debug build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", @@ -71,7 +76,8 @@ { "name": "windows-msvc-release-developer-mode", "displayName": "msvc Release (Developer Mode)", - "description": "Target Windows with the msvc compiler, release build type", + "description": + "Target Windows with the msvc compiler, release build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", @@ -83,7 +89,8 @@ { "name": "windows-msvc-debug-user-mode", "displayName": "msvc Debug (User Mode)", - "description": "Target Windows with the msvc compiler, debug build type", + "description": + "Target Windows with the msvc compiler, debug build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", @@ -95,7 +102,8 @@ { "name": "windows-msvc-release-user-mode", "displayName": "msvc Release (User Mode)", - "description": "Target Windows with the msvc compiler, release build type", + "description": + "Target Windows with the msvc compiler, release build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "cl", @@ -107,7 +115,8 @@ { "name": "windows-clang-debug", "displayName": "clang Debug", - "description": "Target Windows with the clang compiler, debug build type", + "description": + "Target Windows with the clang compiler, debug build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang-cl", @@ -123,7 +132,8 @@ { "name": "windows-clang-release", "displayName": "clang Release", - "description": "Target Windows with the clang compiler, release build type", + "description": + "Target Windows with the clang compiler, release build type", "inherits": "conf-windows-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang-cl", @@ -137,20 +147,24 @@ } }, { - "name": "unixlike-gcc-debug", + "name": "gcc-debug", "displayName": "gcc Debug", - "description": "Target Unix-like OS with the gcc compiler, debug build type", + "description": + "Target Unix-like OS with the gcc compiler, debug build type", "inherits": "conf-unixlike-common", "cacheVariables": { + "myproject_ENABLE_COVERAGE": false, + "CMAKE_SKIP_INSTALL_RULES": true, "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "unixlike-gcc-release", + "name": "gcc-release", "displayName": "gcc Release", - "description": "Target Unix-like OS with the gcc compiler, release build type", + "description": + "Target Unix-like OS with the gcc compiler, release build type", "inherits": "conf-unixlike-common", "cacheVariables": { "CMAKE_C_COMPILER": "gcc", @@ -159,20 +173,24 @@ } }, { - "name": "unixlike-clang-debug", + "name": "clang-debug", "displayName": "clang Debug", - "description": "Target Unix-like OS with the clang compiler, debug build type", + "description": + "Target Unix-like OS with the clang compiler, debug build type", "inherits": "conf-unixlike-common", "cacheVariables": { + "myproject_ENABLE_COVERAGE": false, + "CMAKE_SKIP_INSTALL_RULES": true, "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++", "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "unixlike-clang-release", + "name": "clang-release", "displayName": "clang Release", - "description": "Target Unix-like OS with the clang compiler, release build type", + "description": + "Target Unix-like OS with the clang compiler, release build type", "inherits": "conf-unixlike-common", "cacheVariables": { "CMAKE_C_COMPILER": "clang", @@ -184,7 +202,8 @@ "testPresets": [ { "name": "test-common", - "description": "Test CMake settings that apply to all configurations", + "description": + "Test CMake settings that apply to all configurations", "hidden": true, "output": { "outputOnFailure": true @@ -223,32 +242,118 @@ "configurePreset": "windows-clang-release" }, { - "name": "test-unixlike-gcc-debug", + "name": "gcc-debug", "displayName": "Strict", "description": "Enable output and stop on failure", "inherits": "test-common", - "configurePreset": "unixlike-gcc-debug" + "configurePreset": "gcc-debug" }, { - "name": "test-unixlike-gcc-release", + "name": "gcc-release", "displayName": "Strict", "description": "Enable output and stop on failure", "inherits": "test-common", - "configurePreset": "unixlike-gcc-release" + "configurePreset": "gcc-release" }, { - "name": "test-unixlike-clang-debug", + "name": "clang-debug", "displayName": "Strict", "description": "Enable output and stop on failure", "inherits": "test-common", - "configurePreset": "unixlike-clang-debug" + "configurePreset": "clang-debug" }, { - "name": "test-unixlike-clang-release", + "name": "clang-release", "displayName": "Strict", "description": "Enable output and stop on failure", "inherits": "test-common", - "configurePreset": "unixlike-clang-release" + "configurePreset": "clang-release" + } + ], + "buildPresets": [ + { + "name": "clang-release", + "configurePreset": "clang-release" + }, + { + "name": "clang-install", + "configurePreset": "clang-release", + "targets": [ + "install" + ] + }, + { + "name": "clang-debug", + "configurePreset": "clang-debug" + }, + { + "name": "gcc-release", + "configurePreset": "gcc-release" + }, + { + "name": "gcc-install", + "configurePreset": "gcc-release", + "targets": [ + "install" + ] + }, + { + "name": "gcc-debug", + "configurePreset": "gcc-debug" + } + ], + "packagePresets": [ + { + "name": "clang-release", + "configurePreset": "clang-release", + "generators": [ + "TGZ" + ] + }, + { + "name": "gcc-release", + "configurePreset": "gcc-release", + "generators": [ + "TGZ" + ] + } + ], + "workflowPresets": [ + { + "description": "Developer workflow without installation", + "name": "clang-debug", + "steps": [ + { + "type": "configure", + "name": "clang-debug" + }, + { + "type": "build", + "name": "clang-debug" + }, + { + "type": "test", + "name": "clang-debug" + } + ] + }, + { + "description": "Release workflow without test", + "name": "clang-release", + "steps": [ + { + "name": "clang-release", + "type": "configure" + }, + { + "name": "clang-release", + "type": "build" + }, + { + "name": "clang-release", + "type": "package" + } + ] } ] -} \ No newline at end of file +} diff --git a/CMakeUserPresets.json b/CMakeUserPresets.json new file mode 100644 index 00000000..78052ded --- /dev/null +++ b/CMakeUserPresets.json @@ -0,0 +1,171 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 26, + "patch": 0 + }, + "configurePresets": [ + { + "name": "default-config", + "hidden": true, + "generator": "Ninja", + "cacheVariables": { + "CMAKE_HOST_SYSTEM_PROCESSOR": "$penv{PROCESSOR_ARCHITECTURE}" + } + }, + { + "name": "common-config", + "description": "Settings for all toolchains", + "hidden": true, + "inherits": "default-config", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "ENABLE_DOXYGEN": false, + "ENABLE_CPPCHECK": false, + "ENABLE_CLANG_TIDY": false + }, + "vendor": { + "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { + "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" + } + } + }, + { + "name": "debug", + "displayName": "Debug", + "description": "Debug build type", + "inherits": "conf-unixlike-common", + "cacheVariables": { + "CMAKE_SKIP_INSTALL_RULES": true, + "CMAKE_BUILD_TYPE": "Debug", + "myproject_ENABLE_COVERAGE": true + } + }, + { + "name": "release", + "displayName": "Release", + "description": "Release build type", + "inherits": "conf-unixlike-common", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "ENABLE_DOXYGEN": true + } + } + ], + "testPresets": [ + { + "name": "common-test", + "description": + "Test CMake settings that apply to all configurations", + "hidden": true, + "output": { + "outputOnFailure": true + }, + "execution": { + "noTestsAction": "error", + "stopOnFailure": true + } + }, + { + "name": "debug", + "displayName": "Strict", + "description": "Enable output and stop on failure", + "inherits": "common-test", + "configuration": "Debug", + "configurePreset": "debug" + }, + { + "name": "release", + "displayName": "Strict", + "description": "Enable output and stop on failure", + "inherits": "common-test", + "configuration": "Release", + "configurePreset": "release" + } + ], + "buildPresets": [ + { + "name": "release", + "configurePreset": "release" + }, + { + "name": "install", + "configurePreset": "release", + "targets": [ + "install" + ] + }, + { + "name": "doxygen-docs", + "configurePreset": "release", + "targets": [ + "doxygen-docs" + ] + }, + { + "name": "debug", + "configurePreset": "debug" + } + ], + "packagePresets": [ + { + "name": "release", + "configurePreset": "release", + "generators": [ + "TGZ" + ] + } + ], + "workflowPresets": [ + { + "description": "Developer workflow without installation", + "name": "debug", + "steps": [ + { + "type": "configure", + "name": "debug" + }, + { + "type": "build", + "name": "debug" + }, + { + "type": "test", + "name": "debug" + } + ] + }, + { + "description": "Release workflow without test", + "name": "release", + "steps": [ + { + "name": "release", + "type": "configure" + }, + { + "name": "release", + "type": "build" + }, + { + "name": "release", + "type": "test" + }, + { + "name": "install", + "type": "build" + }, + { + "name": "doxygen-docs", + "type": "build" + }, + { + "name": "release", + "type": "package" + } + ] + } + ] +} diff --git a/Dependencies.cmake b/Dependencies.cmake index a84378d2..9b6f22bb 100644 --- a/Dependencies.cmake +++ b/Dependencies.cmake @@ -33,7 +33,7 @@ function(myproject_setup_dependencies) endif() if(NOT TARGET ftxui::screen) - cpmaddpackage("gh:ArthurSonzogni/FTXUI#e23dbc7473654024852ede60e2121276c5aab660") + cpmaddpackage("gh:ArthurSonzogni/FTXUI#dd6a5d371fd7a3e2937bb579955003c54b727233") endif() if(NOT TARGET tools::tools) diff --git a/ProjectOptions.cmake b/ProjectOptions.cmake index 2709aa1a..ae3a5453 100644 --- a/ProjectOptions.cmake +++ b/ProjectOptions.cmake @@ -53,9 +53,9 @@ macro(myproject_setup_options) option(myproject_ENABLE_SANITIZER_UNDEFINED "Enable undefined sanitizer" ${SUPPORTS_UBSAN}) option(myproject_ENABLE_SANITIZER_THREAD "Enable thread sanitizer" OFF) option(myproject_ENABLE_SANITIZER_MEMORY "Enable memory sanitizer" OFF) - option(myproject_ENABLE_UNITY_BUILD "Enable unity builds" OFF) - option(myproject_ENABLE_CLANG_TIDY "Enable clang-tidy" ON) - option(myproject_ENABLE_CPPCHECK "Enable cpp-check analysis" ON) + option(myproject_ENABLE_UNITY_BUILD "Enable unity builds" ON) + option(myproject_ENABLE_CLANG_TIDY "Enable clang-tidy" OFF) + option(myproject_ENABLE_CPPCHECK "Enable cpp-check analysis" OFF) option(myproject_ENABLE_PCH "Enable precompiled headers" OFF) option(myproject_ENABLE_CACHE "Enable ccache" ON) endif() diff --git a/cmake/Doxygen.cmake b/cmake/Doxygen.cmake index ed90c566..259f1891 100644 --- a/cmake/Doxygen.cmake +++ b/cmake/Doxygen.cmake @@ -49,6 +49,6 @@ function(myproject_enable_doxygen DOXYGEN_THEME) # add doxygen-docs target message(STATUS "Adding `doxygen-docs` target that builds the documentation.") - doxygen_add_docs(doxygen-docs ALL ${PROJECT_SOURCE_DIR} + doxygen_add_docs(doxygen-docs EXCLUDE_FROM_ALL ${PROJECT_SOURCE_DIR} COMMENT "Generating documentation - entry file: ${CMAKE_CURRENT_BINARY_DIR}/html/index.html") endfunction() diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0739f424..f0f3c962 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15...3.23) +cmake_minimum_required(VERSION 3.21...3.27) project(CmakeConfigPackageTests LANGUAGES CXX)