Skip to content

Commit

Permalink
chore: update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Dup4 committed Jun 14, 2022
1 parent 0040232 commit 0b96655
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 11 deletions.
19 changes: 18 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,27 @@
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"clangd.arguments": [
"--compile-commands-dir=./build",
"--background-index",
"--header-insertion=iwyu",
"--all-scopes-completion",
"--completion-style=detailed",
"--cross-file-rename",
"--enable-config",
"--pretty",
"--clang-tidy",
"--pch-storage=memory",
],
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"comment": "#505050",
}
},
"files.associations": {
"BUILD": "starlark",
"__bit_reference": "cpp",
Expand Down
36 changes: 26 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@

all:
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake -S. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DBENCHMARK_ENABLE_TESTING=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build build -j

debug:
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake -S. -Bbuild \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build build -j

tests:
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DBENCHMARK_ENABLE_TESTING=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -Dsnapshot_build_tests=ON
tests: clean_test build_tests
unittest: clean_test run_unittest
benchmark: clean_test run_benchmark

build_tests:
cmake -S. -Bbuild \
-DCMAKE_BUILD_TYPE=Release \
-DBENCHMARK_ENABLE_TESTING=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-Dsnapshot_build_tests=ON
cmake --build build -j

unittest:
find ./build/test -name "*.gcda" -print0 | xargs -0 rm
run_unittest:
./build/bin/unit_test

benchmark:
find ./build/test -name "*.gcda" -print0 | xargs -0 rm
run_benchmark:
./build/bin/unit_benchmark

.PHONY: clean
clean:
rm -rf ./build

clean_test:
if [ -d ./build/test ]; then \
find ./build/test -name "*.gcda" -print0 | xargs -0 rm -f; \
fi

.PHONY: clean clean_test

0 comments on commit 0b96655

Please sign in to comment.