Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernise the build system and tests #2

Draft
wants to merge 58 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8187a2c
Add GNUmakefile and .CMakeUserPresets.json
ClausKlein Feb 25, 2024
2d62252
I use git flow, develop is the default branch
ClausKlein Feb 26, 2024
eef3d93
Use conan profile in GNUmakefile
ClausKlein Feb 26, 2024
03e8c71
Use PUBLIC FILE_SET HEADERS
ClausKlein Feb 26, 2024
952236a
TestInstalledVersion only on ubuntu CI
ClausKlein Feb 27, 2024
d18d1bc
TestInstalledVersion without clang-tidy
ClausKlein Feb 27, 2024
6022013
Cleanup
ClausKlein Feb 28, 2024
355c5b2
Try to use setup-cpp on macos-14 CI too
ClausKlein Feb 28, 2024
bd2c321
Update README.md
ClausKlein Feb 28, 2024
58bc0f2
Try to fix all errors
ClausKlein Feb 28, 2024
fcfcda3
cleanup
ClausKlein Apr 8, 2024
12036db
Add C++20 Module as Shared Libraries
ClausKlein Apr 9, 2024
720984c
Try to use clang-17 on CI
ClausKlein Apr 9, 2024
f956281
The final cut
ClausKlein Apr 9, 2024
6dc3a08
Use format lib
ClausKlein Apr 9, 2024
6e9cb75
Use clang-17 on CI
ClausKlein Apr 9, 2024
4002843
NO check readability-avoid-unconditional-preprocessor-if
ClausKlein Apr 9, 2024
5e14c37
Use fmt::fmt-header-only with CPM.cmake
ClausKlein Apr 9, 2024
7384b67
use setup-cpp only on ubuntu
ClausKlein Apr 10, 2024
bf10d52
Install llvm-17 with brew on macos
ClausKlein Apr 11, 2024
33bd5f0
Quickfix to prevent pip install on macox
ClausKlein Apr 11, 2024
99b001e
Hotfix for conon profile
ClausKlein Apr 11, 2024
8c3fba6
Prevent to install old conon version
ClausKlein Apr 11, 2024
38cd02b
Be not pedantic
ClausKlein Apr 11, 2024
767be54
Disable clang-tidy as cxx modules are not supported
ClausKlein Apr 11, 2024
fb09d45
Add TestInstalledVersion to CI for unix only
ClausKlein Apr 11, 2024
e29c12d
Install conan with brew on macos CI
ClausKlein Apr 11, 2024
d0accd6
Prevent use of clang++ on windows CI
ClausKlein Apr 11, 2024
249839d
Add gcovr.cfg
ClausKlein Apr 11, 2024
8af2b31
Need to 'export CXX=clang++' on macos CI
ClausKlein Apr 11, 2024
5e824f1
export GCOV="llvm-cov gcov"
ClausKlein Apr 11, 2024
855af5a
workflow without coverage for now
ClausKlein Apr 11, 2024
ed2bb04
Use cxx_std_23
ClausKlein Apr 12, 2024
3045da3
Do not longer use conan
ClausKlein Apr 13, 2024
2d50753
Do not use UseMultiToolTask on CI
ClausKlein Apr 13, 2024
434b43c
Do not use flags-windows preset on CI
ClausKlein Apr 13, 2024
179af39
Set CMAKE_BUILD_TYPE to Release on Windows CI
ClausKlein Apr 13, 2024
49da1a4
Do not use cmake presets on Windows
ClausKlein Apr 14, 2024
4c28c5c
Quickfix
ClausKlein Apr 14, 2024
173b533
clang-format
ClausKlein Apr 14, 2024
efe495f
Use C++20 fmt module
ClausKlein Apr 10, 2024
5305762
Use std::print() if possible
ClausKlein Apr 14, 2024
0c3ff7b
import-std-in-cmake-3-30
ClausKlein Sep 29, 2024
18fae44
Modernize std example code
ClausKlein Sep 29, 2024
e8144c0
Bump requried cmake version
ClausKlein Oct 14, 2024
8cb1bde
Use ctest --build-and-test
ClausKlein Oct 14, 2024
5ce3e74
format all files
ClausKlein Oct 14, 2024
ba16e32
Rename c++20 module to *.cppm
ClausKlein Oct 14, 2024
656e696
Add using std example
ClausKlein Oct 14, 2024
0578897
Modernize CI tools used
ClausKlein Oct 14, 2024
062a9b6
Add using std test
ClausKlein Oct 14, 2024
efd8fd0
Use windowsToolchain and workflow preset on CI
ClausKlein Oct 15, 2024
4b94163
Fix Windows workflow preset
ClausKlein Oct 15, 2024
67fd34d
No cppcheck used on windows CI
ClausKlein Oct 15, 2024
4e77f20
Setup path to dll on windows CI
ClausKlein Oct 15, 2024
9f312c4
Use generator expression for CMAKE_BUILD_TYPE
ClausKlein Nov 1, 2024
9819f7b
Add configurations list to packagePreset
ClausKlein Nov 1, 2024
dcd6ebc
Merge pull request #4 from ClausKlein/feature/import-std-in-cmake-3-30
ClausKlein Nov 1, 2024
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
137 changes: 137 additions & 0 deletions .CMakeUserPresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 28,
"patch": 0
},
"configurePresets": [
{
"name": "dev-common",
"hidden": true,
"inherits": [
"dev-mode"
],
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
"BUILD_MCSS_DOCS": false,
"BUILD_SHARED_LIBS": true
},
"environment": {
"CPM_USE_LOCAL_PACKAGES": "OFF"
}
},
{
"name": "dev-Linux",
"inherits": [
"dev-common",
"ci-linux"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "dev-Darwin",
"inherits": [
"dev-common",
"ci-darwin"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "dev-Windows",
"inherits": [
"dev-common",
"ci-win64"
],
"environment": {
"UseMultiToolTask": "ON",
"EnforceProcessCountAcrossBuilds": "ON"
}
},
{
"name": "dev",
"inherits": "dev-<hostSystemName>"
},
{
"name": "dev-coverage",
"inherits": [
"ci-coverage",
"dev-Linux"
]
},
{
"name": "dev-sanitize",
"inherits": [
"ci-sanitize",
"dev-Linux"
]
}
],
"buildPresets": [
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Debug",
"jobs": 12,
"targets": [
"all",
"all_verify_interface_header_sets",
"install"
]
}
],
"testPresets": [
{
"name": "dev",
"configurePreset": "dev",
"configuration": "Debug",
"output": {
"outputOnFailure": true
},
"execution": {
"jobs": 12,
"noTestsAction": "error"
}
}
],
"packagePresets": [
{
"name": "dev",
"configurePreset": "dev",
"configurations": [
"Debug"
],
"generators": [
"TGZ"
]
}
],
"workflowPresets": [
{
"name": "dev",
"steps": [
{
"type": "configure",
"name": "dev"
},
{
"type": "build",
"name": "dev"
},
{
"type": "test",
"name": "dev"
},
{
"type": "package",
"name": "dev"
}
]
}
]
}
195 changes: 195 additions & 0 deletions .build-errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
bash-5.2$ ninja -v fmt

[1/4] cd /Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/_deps/fmt-build &&
/usr/local/opt/llvm/bin/clang++ -std=c++20 -x c++-module --precompile -c -o fmt.pcm
/Users/clausklein/.cache/CPM/fmt/c3ebf53335b44df838d9982d1a0e35afe190e34f/src/fmt.cc
-I/Users/clausklein/.cache/CPM/fmt/c3ebf53335b44df838d9982d1a0e35afe190e34f/include

[2/4] cd /Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/_deps/fmt-build &&
/usr/local/opt/llvm/bin/clang++
-fmodule-file=/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/_deps/fmt-build/fmt.pcm -c -o fmt.o
/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/_deps/fmt-build/fmt.pcm

[3/4] : && /usr/local/opt/llvm/bin/clang++ -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2
-Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough
-Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -g -arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -dynamiclib
-Wl,-headerpad_max_install_names -m64 -compatibility_version 10.0.0 -current_version 10.2.1 -o
_deps/fmt-build/libfmtd.10.2.1.dylib -install_name @rpath/libfmtd.10.dylib _deps/fmt-build/fmt.o && :

[4/4] /usr/local/bin/cmake -E cmake_symlink_library _deps/fmt-build/libfmtd.10.2.1.dylib _deps/fmt-build/libfmtd.10.dylib
_deps/fmt-build/libfmtd.dylib && :

bash-5.2$ ninja -v Algo

[1/2] /usr/local/opt/llvm/bin/clang++ -DAlgo_EXPORTS -DFMT_HEADER_ONLY=1
-I/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev -isystem
/Users/clausklein/.cache/CPM/fmt/c3ebf53335b44df838d9982d1a0e35afe190e34f/include -Wall -Wextra -Wpedantic -Wconversion
-Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference
-Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -g
-std=c++20 -arch x86_64 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -fPIC
-fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/Algo.dir/algo-impl.cpp.o -MF
CMakeFiles/Algo.dir/algo-impl.cpp.o.d @CMakeFiles/Algo.dir/algo-impl.cpp.o.modmap -o CMakeFiles/Algo.dir/algo-impl.cpp.o -c
/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/algo-impl.cpp

FAILED: CMakeFiles/Algo.dir/algo-impl.cpp.o
/usr/local/opt/llvm/bin/clang++ -DAlgo_EXPORTS -DFMT_HEADER_ONLY=1 -I/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev -isystem /Users/clausklein/.cache/CPM/fmt/c3ebf53335b44df838d9982d1a0e35afe190e34f/include -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -Wcast-qual -Wformat=2 -Wundef -Werror=float-equal -Wshadow -Wcast-align -Wunused -Wnull-dereference -Wdouble-promotion -Wimplicit-fallthrough -Wextra-semi -Woverloaded-virtual -Wnon-virtual-dtor -Wold-style-cast -g -std=c++20 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.4.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -MD -MT CMakeFiles/Algo.dir/algo-impl.cpp.o -MF CMakeFiles/Algo.dir/algo-impl.cpp.o.d @CMakeFiles/Algo.dir/algo-impl.cpp.o.modmap -o CMakeFiles/Algo.dir/algo-impl.cpp.o -c /Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/algo-impl.cpp
/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/algo-impl.cpp:8:8: fatal error: module 'fmt' not found
8 | import fmt;
| ~~~~~~~^~~
1 error generated.
ninja: build stopped: subcommand failed.
bash-5.2$

bash-5.2$ tree _deps/
_deps/
`-- fmt-build
|-- CMakeFiles
| |-- Export
| | `-- b834597d9b1628ff12ae4314c3a2e4b8
| | |-- fmt-targets-debug.cmake
| | `-- fmt-targets.cmake
| `-- fmt.dir
|-- cmake_install.cmake
|-- fmt-config-version.cmake
|-- fmt-config.cmake
|-- fmt-targets.cmake
|-- fmt.o
|-- fmt.pc
|-- fmt.pcm
|-- libfmtd.10.2.1.dylib
|-- libfmtd.10.dylib -> libfmtd.10.2.1.dylib
`-- libfmtd.dylib -> libfmtd.10.dylib

6 directories, 12 files
bash-5.2$

bash-5.2$ clang-format -i *.json
bash-5.2$ head -50 *.ddi *.json *.modmap
==> algo-impl.cpp.o.ddi <==
{
"revision": 0,
"rules": [
{
"primary-output": "CMakeFiles/Algo.dir/algo-impl.cpp.o",
"requires": [
{
"logical-name": "fmt"
},
{
"logical-name": "algo"
}
]
}
],
"version": 1
}

==> algo-interface.cppm.o.ddi <==
{
"revision": 0,
"rules": [
{
"primary-output": "CMakeFiles/Algo.dir/algo-interface.cppm.o",
"provides": [
{
"is-interface": true,
"logical-name": "algo",
"source-path": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/algo-interface.cppm"
}
]
}
],
"version": 1
}

==> CXXDependInfo.json <==
{
"bmi-installation": null,
"compiler-frontend-variant": "GNU",
"compiler-id": "Clang",
"compiler-simulate-id": "",
"config": "Debug",
"cxx-modules":
{
"CMakeFiles/Algo.dir/algo-interface.cppm.o":
{
"bmi-only": false,
"destination": "lib/cmake/my_package/src",
"name": "CXX_MODULES",
"relative-directory": "",
"source": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/algo-interface.cppm",
"type": "CXX_MODULES",
"visibility": "PUBLIC"
}
},
"dir-cur-bld": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev",
"dir-cur-src": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules",
"dir-top-bld": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev",
"dir-top-src": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules",
"exports":
[
{
"cxx-module-info-dir": ".",
"destination": "lib/cmake/my_package",
"export-name": "Algo",
"export-prefix": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/CMakeFiles/Export/0814a8a452340fa10b4323026df361bb",
"install": true,
"namespace": ""
}
],
"forward-modules-from-target-dirs": [],
"include-dirs":
[
".",
"/Users/clausklein/.cache/CPM/fmt/c3ebf53335b44df838d9982d1a0e35afe190e34f/include"
],
"language": "CXX",
"linked-target-dirs": [],
"module-dir": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/CMakeFiles/Algo.dir"
}
==> CXXModules.json <==
{
"modules":
{
"algo":
{
"bmi": "/Users/clausklein/Workspace/cpp/cxx20/cmake-init-modules/build/dev/CMakeFiles/Algo.dir/algo.pcm",
"is-private": false
}
},
"references":
{
"algo":
{
"lookup-method": "by-name",
"path": "CMakeFiles/Algo.dir/algo.pcm"
}
},
"usages": {}
}
==> algo-impl.cpp.o.modmap <==
-fmodule-file=algo=CMakeFiles/Algo.dir/algo.pcm

==> algo-interface.cppm.o.modmap <==
-x c++-module
-fmodule-output=CMakeFiles/Algo.dir/algo.pcm
bash-5.2$ !tree
tree
.
|-- CXX.dd
|-- CXXDependInfo.json
|-- CXXModules.json
|-- algo-impl.cpp.o.ddi
|-- algo-impl.cpp.o.ddi.d
|-- algo-impl.cpp.o.modmap
|-- algo-interface.cppm.o
|-- algo-interface.cppm.o.ddi
|-- algo-interface.cppm.o.ddi.d
|-- algo-interface.cppm.o.modmap
`-- algo.pcm

1 directory, 11 files
bash-5.2$

2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: true
BreakStringLiterals: true
ColumnLimit: 80
ColumnLimit: 90
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Expand Down
13 changes: 9 additions & 4 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@
# misc-non-private-member-variables-in-classes: the options don't do anything
# modernize-use-nodiscard: too aggressive, attribute is situationally useful
Checks: "*,\
-google-readability-todo,\
google-readability-todo,\
-altera-*,\
-fuchsia-*,\
fuchsia-multiple-inheritance,\
-llvm-header-guard,\
-llvm-include-order,\
-llvmlibc-*,\
-modernize-use-nodiscard,\
-misc-non-private-member-variables-in-classes"
WarningsAsErrors: ''
modernize-use-nodiscard,\
misc-non-private-member-variables-in-classes,\
-misc-include-cleaner,\
-readability-identifier-naming,\
-readability-redundant-declaration,\
-readability-avoid-unconditional-preprocessor-if\
"
WarningsAsErrors: '*'
CheckOptions:
- key: 'bugprone-argument-comment.StrictMode'
value: 'true'
Expand Down
Loading