Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_commit: v1.6.10
_commit: v1.6.11
_src_path: gh:serious-scaffold/ss-cpp
author_email: msclock@qq.com
author_name: msclock
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pre-commit:
_PRESET_ARGS = --preset $(PRESET)

cmake-configure:
cmake -S . $(_PRESET_ARGS) $(CONFIGURE) $(if $(FRESH_CMAKE_CACHE),--fresh)
cmake -S . $(_PRESET_ARGS) $(CONFIGURE)

cmake-build-template-%:
cmake --build $(_PRESET_ARGS) --target $*
Expand Down Expand Up @@ -72,13 +72,13 @@ test-build-test-install: test-build-test cmake-install cmake-uninstall
test-build-test-install-ccov: test-build-test-install cmake-build-template-ccov-all

test-coverage:
$(MAKE) test-build-test-install-ccov CONFIGURE="-DBUILD_TESTING=ON -DCODE_COVERAGE=ON $(CONFIGURE)" FRESH_CMAKE_CACHE=1
$(MAKE) test-build-test-install-ccov CONFIGURE="-DBUILD_TESTING=ON -DCODE_COVERAGE=ON $(CONFIGURE) --fresh"

test-valgrind:
$(MAKE) test-build-memcheck CONFIGURE="-DBUILD_TESTING=ON -DUSE_VALGRIND=ON $(CONFIGURE)" FRESH_CMAKE_CACHE=1
$(MAKE) test-build-memcheck CONFIGURE="-DBUILD_TESTING=ON -DUSE_VALGRIND=ON $(CONFIGURE) --fresh"

test-sanitizer-template-%:
$(MAKE) test-build-test CONFIGURE="-DBUILD_TESTING=ON -DUSE_SANITIZER=$* $(CONFIGURE)" FRESH_CMAKE_CACHE=1
$(MAKE) test-build-test CONFIGURE="-DBUILD_TESTING=ON -DUSE_SANITIZER=$* $(CONFIGURE) --fresh"

test-sanitizer-address: test-sanitizer-template-address

Expand All @@ -91,10 +91,10 @@ test-sanitizer-undefined: test-sanitizer-template-undefined
test-sanitizer: test-sanitizer-template-address test-sanitizer-template-leak test-sanitizer-template-memory test-sanitizer-template-undefined

test-cppcheck:
$(MAKE) test-build CONFIGURE="-DBUILD_TESTING=ON -DUSE_CPPCHECK=ON $(CONFIGURE)" FRESH_CMAKE_CACHE=1
$(MAKE) test-build CONFIGURE="-DBUILD_TESTING=ON -DUSE_CPPCHECK=ON $(CONFIGURE) --fresh"

test-clang-tidy:
$(MAKE) test-build CONFIGURE="-DBUILD_TESTING=ON -DUSE_CLANGTIDY=ON $(CONFIGURE)" FRESH_CMAKE_CACHE=1
$(MAKE) test-build CONFIGURE="-DBUILD_TESTING=ON -DUSE_CLANGTIDY=ON $(CONFIGURE) --fresh"

########################################################################################
# Documentation
Expand Down
53 changes: 53 additions & 0 deletions cmake/presets/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,21 @@
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_VERBOSE_MAKEFILE": "FALSE"
}
},
{
"name": "base-config",
"hidden": true,
"inherits": [
"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": [
Expand All @@ -28,6 +43,18 @@
"hidden": true,
"inherits": "ninja",
"configurePreset": "base"
},
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"configurePreset": "base-config"
},
{
"name": "base-config-debug",
"hidden": true,
"inherits": "ninja-config-debug",
"configurePreset": "base-config"
}
],
"testPresets": [
Expand All @@ -43,6 +70,32 @@
"noTestsAction": "error",
"stopOnFailure": true
}
},
{
"name": "base-config-relwithdebinfo",
"hidden": true,
"inherits": "ninja-config-relwithdebinfo",
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
},
{
"name": "base-config-debug",
"hidden": true,
"inherits": "ninja-config-debug",
"configurePreset": "base-config",
"output": {
"outputOnFailure": true
},
"execution": {
"noTestsAction": "error",
"stopOnFailure": true
}
}
]
}
43 changes: 25 additions & 18 deletions cmake/presets/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,46 @@
"inherits": [
"base"
]
},
{
"name": "default-config",
"inherits": [
"base-config"
]
}
],
"buildPresets": [
{
"name": "default",
"inherits": "base",
"configurePreset": "default"
},
{
"name": "default-config-relwithdebinfo",
"inherits": "base-config-relwithdebinfo",
"configurePreset": "default-config"
},
{
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
}
],
"testPresets": [
{
"name": "default",
"inherits": "base",
"configurePreset": "default"
}
],
"workflowPresets": [
},
{
"name": "default",
"steps": [
{
"type": "configure",
"name": "default"
},
{
"type": "build",
"name": "default"
},
{
"type": "test",
"name": "default"
}
]
"name": "default-config-relwithdebinfo",
"inherits": "base-config-relwithdebinfo",
"configurePreset": "default-config"
},
{
"name": "default-config-debug",
"inherits": "base-config-debug",
"configurePreset": "default-config"
}
]
}
22 changes: 17 additions & 5 deletions cmake/presets/generators/ninja.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"generator": "Ninja"
},
{
"name": "ninja-multi-config",
"name": "ninja-config",
"hidden": true,
"generator": "Ninja Multi-Config"
}
Expand All @@ -19,10 +19,16 @@
"configurePreset": "ninja"
},
{
"name": "ninja-multi-config",
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-multi-config",
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
],
"testPresets": [
Expand All @@ -32,10 +38,16 @@
"configurePreset": "ninja"
},
{
"name": "ninja-multi-config",
"name": "ninja-config-relwithdebinfo",
"hidden": true,
"configurePreset": "ninja-multi-config",
"configurePreset": "ninja-config",
"configuration": "RelWithDebInfo"
},
{
"name": "ninja-config-debug",
"hidden": true,
"configurePreset": "ninja-config",
"configuration": "Debug"
}
]
}
19 changes: 0 additions & 19 deletions cmake/presets/x64-linux-gcc.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,5 @@
"inherits": "base",
"configurePreset": "x64-linux-gcc"
}
],
"workflowPresets": [
{
"name": "x64-linux-gcc",
"steps": [
{
"type": "configure",
"name": "x64-linux-gcc"
},
{
"type": "build",
"name": "x64-linux-gcc"
},
{
"type": "test",
"name": "x64-linux-gcc"
}
]
}
]
}
19 changes: 0 additions & 19 deletions cmake/presets/x64-linux-llvm.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,5 @@
"inherits": "base",
"configurePreset": "x64-linux-llvm"
}
],
"workflowPresets": [
{
"name": "x64-linux-llvm",
"steps": [
{
"type": "configure",
"name": "x64-linux-llvm"
},
{
"type": "build",
"name": "x64-linux-llvm"
},
{
"type": "test",
"name": "x64-linux-llvm"
}
]
}
]
}
19 changes: 0 additions & 19 deletions cmake/presets/x64-mingw-dynamic-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,5 @@
"inherits": "base",
"configurePreset": "x64-mingw-dynamic-windows-mingw"
}
],
"workflowPresets": [
{
"name": "x64-mingw-dynamic-windows-mingw",
"steps": [
{
"type": "configure",
"name": "x64-mingw-dynamic-windows-mingw"
},
{
"type": "build",
"name": "x64-mingw-dynamic-windows-mingw"
},
{
"type": "test",
"name": "x64-mingw-dynamic-windows-mingw"
}
]
}
]
}
19 changes: 0 additions & 19 deletions cmake/presets/x64-mingw-static-windows-mingw.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,5 @@
"inherits": "base",
"configurePreset": "x64-mingw-static-windows-mingw"
}
],
"workflowPresets": [
{
"name": "x64-mingw-static-windows-mingw",
"steps": [
{
"type": "configure",
"name": "x64-mingw-static-windows-mingw"
},
{
"type": "build",
"name": "x64-mingw-static-windows-mingw"
},
{
"type": "test",
"name": "x64-mingw-static-windows-mingw"
}
]
}
]
}
30 changes: 24 additions & 6 deletions cmake/vcpkg/bootstrap/vcpkg_bootstrap.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ function(_vcpkg_checkout vcpkg_root vcpkg_ref)
message(STATUS "vcpkg checkout to ${vcpkg_ref}")

if(EXISTS "${vcpkg_root}/.git/shallow")
message(WARNING "vcpkg is shallow, unshallowing...")
message(
WARNING
"vcpkg is shallow now and unshallow to retrieve the Git tree object hash for a specific version port......"
)
execute_process(
COMMAND ${GIT_EXECUTABLE} fetch --unshallow
WORKING_DIRECTORY ${vcpkg_root}
Expand Down Expand Up @@ -78,7 +81,24 @@ function(_vcpkg_tool_bootstrap vcpkg_root)
RESULT_VARIABLE result)

if(NOT result EQUAL "0")
message(FATAL_ERROR "${bootstrap_cmd} failed with ${result}")
if(CMAKE_HOST_UNIX)
message(STATUS "Retry to build vcpkg from source...")
set(bootstrap_impl "${vcpkg_root}/scripts/bootstrap.sh")
file(READ "${bootstrap_impl}" file_contents)
string(REPLACE [[elif [ "$ARCH" = "x86_64" ]; then]]
[[elif [ "$ARCH" = "" ]; then]] file_contents
"${file_contents}")
file(WRITE "${bootstrap_impl}" "${file_contents}")

execute_process(
COMMAND ${bootstrap_cmd} -disableMetrics
WORKING_DIRECTORY ${vcpkg_root}
RESULT_VARIABLE result)
endif()

if(NOT result EQUAL "0")
message(FATAL_ERROR "${bootstrap_cmd} failed with ${result}")
endif()
endif()
endfunction()

Expand Down Expand Up @@ -109,7 +129,7 @@ function(_vcpkg_upgrade vcpkg_root vcpkg_repo vcpkg_ref)

message(STATUS "Upgrade vcpkg")
message(STATUS "vcpkg current commit: ${current_git_hash}")
message(STATUS "vcpkg release: ${vcpkg_ref}")
message(STATUS "vcpkg target commit: ${vcpkg_ref}")

execute_process(
COMMAND ${GIT_EXECUTABLE} remote set-url origin ${vcpkg_repo}
Expand All @@ -136,9 +156,7 @@ endfunction()

# find root
function(_vcpkg_find_root cache_dir_name out_vcpkg_root)
if(DEFINED ENV{VCPKG_ROOT} AND NOT "$ENV{VCPKG_ROOT}" STREQUAL "")
set(root "$ENV{VCPKG_ROOT}")
elseif("${__vcpkg_bootstrap_host}" STREQUAL "Windows")
if("${__vcpkg_bootstrap_host}" STREQUAL "Windows")
set(root "$ENV{LOCALAPPDATA}/vcpkg/projects/${cache_dir_name}/cache")
else()
set(root "$ENV{HOME}/.cache/vcpkg/projects/${cache_dir_name}")
Expand Down
Loading
Loading