Skip to content

Commit

Permalink
chore(deps): update dependency https://github.com/serious-scaffold/ss…
Browse files Browse the repository at this point in the history
…-cmake to v0.0.11 (#435)

* chore(deps): update dependency https://github.com/serious-scaffold/ss-cmake to v0.0.11

* Resolve conflicts

Signed-off-by: l.feng <[email protected]>

---------

Signed-off-by: l.feng <[email protected]>
Co-authored-by: serious-scaffold[bot] <160990600+serious-scaffold[bot]@users.noreply.github.com>
Co-authored-by: l.feng <[email protected]>
  • Loading branch information
serious-scaffold[bot] and msclock authored Jan 2, 2025
1 parent de98156 commit dfffcea
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 278 deletions.
16 changes: 1 addition & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,14 @@ project(
HOMEPAGE_URL "https://github.com/serious-scaffold/ss-cpp"
DESCRIPTION "A continuously evolving basic template for cpp development.")

set(CMAKE_CXX_STANDARD
20
CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED
ON
CACHE BOOL "C++ standard required")
set(CMAKE_CXX_EXTENSIONS
OFF
CACHE BOOL "C++ extensions")

# Source includes from vcpkg
include_directories(${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include)

# Project default module
find_package(cmake-modules REQUIRED)
include(cmake-modules/ProjectDefault)

# Project custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(ConfigureWarningsAndHardening)
include(ConfigureVersion)
include(ConfigureDocs)
include(ConfigureCoverage)
include(ConfigureDocs)

add_subdirectory(src)
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
#[[
This file configures the following things:
- dynamic tools: sanitizers, valgrind.
- static tools: clang-tidy, cppcheck.
- compiler flags
- hardening options
ProjectOptions.cmake - Defines project-specific options for CMake.
]]

include_guard(GLOBAL)
set(CMAKE_CXX_STANDARD
20
CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED
ON
CACHE BOOL "C++ standard required")
set(CMAKE_CXX_EXTENSIONS
OFF
CACHE BOOL "C++ extensions")

# ##############################################################################
# Sanitizer
# Sanitizer - cmake-modules/build/Sanitizer.cmake
# ##############################################################################

set(USE_SANITIZER
OFF
CACHE BOOL "Enable sanitizer")

include(cmake-modules/build/Sanitizer)

# ##############################################################################
# Valgrind
# Valgrind - cmake-modules/test/Valgrind.cmake
# ##############################################################################

set(USE_VALGRIND
Expand All @@ -37,20 +38,16 @@ set(USE_VALGRIND_OPTIONS
# Valgrind is unacceptably slow.
CACHE STRING "valgrind options.")

include(cmake-modules/test/Valgrind)

# ##############################################################################
# Clang-Tidy
# Clang-Tidy - cmake-modules/build/ClangTidy.cmake
# ##############################################################################

set(USE_CLANGTIDY
OFF
CACHE BOOL "Enable Clang-Tidy")

include(cmake-modules/build/ClangTidy)

# ##############################################################################
# Cppcheck
# Cppcheck - cmake-modules/build/Cppcheck.cmake
# ##############################################################################

set(USE_CPPCHECK
Expand All @@ -61,16 +58,8 @@ set(USE_CPPCHECK_SUPPRESSION_FILE
CACHE STRING
"Customize the path to the Cppcheck suppressions file of the project")

include(cmake-modules/build/Cppcheck)

# ##############################################################################
# CompilerFlags
# ##############################################################################

include(cmake-modules/build/CompilerFlags)

# ##############################################################################
# Hardening
# Hardening - cmake-modules/build/Hardening.cmake
# ##############################################################################

# Comment `-Wl,-z,nodlopen` for dlopen call
Expand Down Expand Up @@ -105,9 +94,8 @@ if(NOT MSVC)

set(USE_HARDENING_LINKS
-fstack-protector-strong # Enable stack protector
"-fsanitize=undefined -fsanitize-minimal-runtime" # Enable minimal runtime
# undefined behavior sanitizer -Wl,-z,nodlopen # Restrict dlopen(3) calls
# to shared objects
"-fsanitize=undefined -fsanitize-minimal-runtime"
# -Wl,-z,nodlopen # Restrict dlopen(3) calls to shared objects
-Wl,-z,noexecstack # Enable data execution prevention by marking stack
# memory as non-executable
-Wl,-z,relro # Mark relocation table entries resolved at load-time as
Expand All @@ -116,5 +104,3 @@ if(NOT MSVC)
# read-only. It impacts startup performance
CACHE STRING "Additional hardening linking flags for GCC/Clang")
endif()

include(cmake-modules/build/Hardening)
80 changes: 43 additions & 37 deletions cmake/presets/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,68 @@
"toolchains/vcpkg.json"
],
"configurePresets": [
{
"name": "base-common",
"hidden":true,
"binaryDir":"${sourceDir}/out/build/${presetName}",
"installDir":"${sourceDir}/out/install/${presetName}",
"cacheVariables":{
"CMAKE_COMPILE_WARNING_AS_ERROR":false,
"CMAKE_EXPORT_COMPILE_COMMANDS":true,
"CMAKE_VERBOSE_MAKEFILE":"FALSE"
}
},
{
"name": "base",
"hidden": true,
"inherits": [
"base-common",
"ninja",
"vcpkg"
],
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_COMPILE_WARNING_AS_ERROR": false,
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_VERBOSE_MAKEFILE": "FALSE"
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "base-config",
"hidden": true,
"inherits": [
"base-common",
"ninja-config",
"vcpkg"
],
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"CMAKE_COMPILE_WARNING_AS_ERROR": false,
"CMAKE_VERBOSE_MAKEFILE": "FALSE"
}
]
}
],
"buildPresets": [
{
"name": "base",
"hidden": true,
"inherits": "ninja",
"configurePreset": "base"
},
{
"name": "base-config-debug",
"hidden": true,
"configurePreset": "base-config",
"configuration": "Debug"
},
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"configurePreset": "base-config"
"configurePreset": "base-config",
"configuration": "RelWithDebInfo"
},
{
"name": "base-config-debug",
"name": "base-config-release",
"hidden": true,
"inherits": "ninja-config-debug",
"configurePreset": "base-config"
"configurePreset": "base-config",
"configuration": "Release"
}
],
"testPresets": [
{
"name": "base",
"hidden": true,
"inherits": "ninja",
"configurePreset": "base",
"output": {
"outputOnFailure": true
Expand All @@ -74,28 +79,29 @@
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"inherits": [
"base"
],
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
"configuration": "RelWithDebInfo"
},
{
"name": "base-config-debug",
"hidden": true,
"inherits": "ninja-config-debug",
"inherits": [
"base"
],
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
"configuration": "Debug"
},
{
"name": "base-config-release",
"hidden": true,
"inherits": [
"base"
],
"configurePreset": "base-config",
"configuration": "Release"
}
]
}
10 changes: 10 additions & 0 deletions cmake/presets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
},
{
"name": "default-config-release",
"inherits": "base-config-release",
"configurePreset": "default-config"
}
],
"testPresets": [
Expand All @@ -49,6 +54,11 @@
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
},
{
"name": "default-config-release",
"inherits": "base-config-release",
"configurePreset": "default-config"
}
]
}
38 changes: 0 additions & 38 deletions cmake/presets/generators/ninja.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,5 @@
"hidden": true,
"generator": "Ninja Multi-Config"
}
],
"buildPresets": [
{
"name": "ninja",
"hidden": true,
"configurePreset": "ninja"
},
{
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
],
"testPresets": [
{
"name": "ninja",
"hidden": true,
"configurePreset": "ninja"
},
{
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
]
}
4 changes: 4 additions & 0 deletions cmake/vcpkg/bootstrap/vcpkg_bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ function(_vcpkg_bootstrap)
"${arg_UNPARSED_ARGUMENTS}")
endif()

if(NOT DEFINED arg_REPO)
set(arg_REPO https://github.com/microsoft/vcpkg.git)
endif()

find_package(Git QUIET REQUIRED)

if(DEFINED CACHE{_VCPKG_ROOT})
Expand Down
13 changes: 8 additions & 5 deletions cmake/vcpkg/bootstrap/vcpkg_load_triplet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -207,19 +207,22 @@ macro(_vcpkg_load_triplet)
set(_community_triplet "triplets/community/${VCPKG_TARGET_TRIPLET}.cmake")

if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${_triplet}")
include("${CMAKE_CURRENT_LIST_DIR}/${_triplet}")
set(_load_triplet "${CMAKE_CURRENT_LIST_DIR}/${_triplet}")
elseif(EXISTS "${_VCPKG_ROOT}/${_triplet}")
include("${_VCPKG_ROOT}/${_triplet}")
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${_community_triplet}")
include("${CMAKE_CURRENT_LIST_DIR}/${_community_triplet}")
set(_load_triplet "${_VCPKG_ROOT}/${_triplet}")
elseif(EXISTS "${_VCPKG_ROOT}/${_community_triplet}")
include("${_VCPKG_ROOT}/${_community_triplet}")
set(_load_triplet "${_VCPKG_ROOT}/${_community_triplet}")
else()
message(
FATAL_ERROR
"Triplet ${VCPKG_TARGET_TRIPLET} not found at ${CMAKE_CURRENT_LIST_DIR}/${_triplet} or ${_VCPKG_ROOT}/${_triplet}"
)
endif()

message(STATUS "Loading triplet: ${_load_triplet}")
include(${_load_triplet})

unset(_triplet)
unset(_community_triplet)
unset(_load_triplet)
endmacro(_vcpkg_load_triplet)
3 changes: 1 addition & 2 deletions cmake/vcpkg/vcpkg.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,4 @@ set(VCPKG_VERBOSE

file(READ ${CMAKE_SOURCE_DIR}/vcpkg.json _vcpkg_json)
string(JSON _builtin_baseline GET ${_vcpkg_json} builtin-baseline)
vcpkg_configure(CACHE_DIR_NAME ss-cpp REPO
https://github.com/microsoft/vcpkg.git REF ${_builtin_baseline})
vcpkg_configure(CACHE_DIR_NAME ss-cpp REF ${_builtin_baseline})
1 change: 0 additions & 1 deletion copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ repo_host:
[%- endif %]
help: 'Specify the host of the self-managed GitLab:'
type: str
when: '{{ repo_platform == "gitlab-self-managed" }}'

page_host:
default: |-
Expand Down
1 change: 1 addition & 0 deletions includes/copier-answers-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ header_target: header
organization_name: Serious Scaffold
project_description: A continuously evolving basic template for cpp development.
project_name: Serious Scaffold Cpp
repo_host: github.com
repo_name: ss-cpp
repo_namespace: serious-scaffold
repo_platform: github
Expand Down
2 changes: 1 addition & 1 deletion template/.copier-answers.ss-cmake.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.0.7
_commit: v0.0.11
_src_path: https://github.com/serious-scaffold/ss-cmake
Loading

0 comments on commit dfffcea

Please sign in to comment.