Skip to content

Commit

Permalink
perf: use ss-cmake (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: l.feng <[email protected]>
  • Loading branch information
msclock authored Dec 8, 2024
1 parent 5b4e44b commit d89ff5d
Show file tree
Hide file tree
Showing 27 changed files with 447 additions and 210 deletions.
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"
}
]
}
]
}
69 changes: 59 additions & 10 deletions copier.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
---
# Copier will load all these files
!include includes/copier.*.yml
---
_exclude:
- .copier-answers.*.yml
- copier.*.yml

_envops:
block_end_string: '%]'
block_start_string: '[%'
Expand Down Expand Up @@ -133,16 +141,6 @@ docs_type:
help: 'Choose the type of documentation to generate:'
type: str

use_cpm:
default: false
help: Whether to use CPM to manage C++ dependencies that will break up vcpkg dependency management.
type: bool

use_conan:
default: false
help: Whether to use conan to manage C++ dependencies that will break up vcpkg dependency management.
type: bool

compiled:
default: true
help: Whether to add _core compiled module.
Expand Down Expand Up @@ -229,3 +227,54 @@ default_py:
value: '3.13'
help: 'Choose the default Python version for development, documentation generation, and package build:'
type: str


# Override ss-cmake variables

ss_cmake_repo_name:
default: '{{ repo_name }}'
help: 'Provide a name for the repository:'
type: str
when: false

ss_cmake_repo_url:
default: '[% from pathjoin("includes", "variable.jinja") import repo_url with context %]{{ repo_url() }}'
help: 'Provide a url for the repository:'
type: str
when: false

ss_cmake_project_description:
default: '{{ project_description }}'
help: 'Provide a brief description for the project:'
type: str
when: false

ss_cmake_configure_coverage:
default: false
help: Whether to configure coverage in cmake integration for C++.
type: bool
when: false

ss_cmake_configure_version:
default: '{{ compiled }}'
help: Whether to configure to detect git version in cmake integration for C++
type: bool
when: false

ss_cmake_configure_warnings_and_hardening:
default: '{{ compiled }}'
help: Whether to configure warnings and hardening compiling options in cmake integrationo for C++
type: bool
when: false

ss_cmake_use_cpm:
default: false
help: Whether to use CPM to manage C++ dependencies that will break up vcpkg dependency management.
type: bool
when: '{{ compiled == true }}'

ss_cmake_use_conan:
default: false
help: Whether to use conan to manage C++ dependencies that will break up vcpkg dependency management.
type: bool
when: '{{ compiled == true }}'
2 changes: 2 additions & 0 deletions includes/copier-answers-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ use_cpm: false
min_py: '3.8'
max_py: '3.13'
default_py: '3.10'
ss_cmake_use_cpm: false
ss_cmake_use_conan: false
3 changes: 3 additions & 0 deletions template/.copier-answers.ss-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
_commit: v0.0.4
_src_path: https://github.com/serious-scaffold/ss-cmake
Loading

0 comments on commit d89ff5d

Please sign in to comment.