Skip to content

Commit b058561

Browse files
committed
Merge branch 'feature/workflow' into develop
2 parents cde14ef + 38e125a commit b058561

File tree

3 files changed

+41
-11
lines changed

3 files changed

+41
-11
lines changed

.github/workflows/cmake.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ jobs:
4141
run: ./vcpkg install gsl:x64-linux gtest:x64-linux benchmark:x64-linux fmt:x64-linux
4242

4343
- name: Configure CMake
44-
run: cmake --preset linux-${{env.BUILD_TYPE_LOWERCASE}} -S ${{github.workspace}}/cpp-algorithm -B ${{github.workspace}}/cpp-algorithm/out/build/linux-x64-${{env.BUILD_TYPE_LOWERCASE}}
44+
working-directory: ${{github.workspace}}/cpp-algorithm
45+
run: make configure
4546

4647
- name: Build
47-
working-directory: ${{github.workspace}}/cpp-algorithm/out/build/linux-x64-${{env.BUILD_TYPE_LOWERCASE}}
48-
run: cmake --build . --config ${{env.BUILD_TYPE}} --target all --parallel 6
48+
working-directory: ${{github.workspace}}/cpp-algorithm
49+
run: make build
4950

5051
- name: Test
51-
working-directory: ${{github.workspace}}/cpp-algorithm/out/build/linux-x64-${{env.BUILD_TYPE_LOWERCASE}}
52-
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
52+
working-directory: ${{github.workspace}}/cpp-algorithm
53+
run: make test

cpp-algorithm/.gitignore

+1-6
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,5 @@ fabric.properties
128128
.idea/
129129
.vs/
130130
.vscode/
131-
out/
132-
cmake-build-debug/
133-
cmake-build-debug-visual-studio/
134-
cmake-build-release/
135-
cmake-build-release-visual-studio/
136-
Folder.DotSettings.user
137131
README_link.md
132+
!/Makefile

cpp-algorithm/Makefile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
BUILD_TYPE:=debug
2+
3+
UNAME_S:=$(shell uname -s)
4+
ifeq ($(UNAME_S),Linux)
5+
PRESET_NAME:=linux-$(BUILD_TYPE)
6+
else ifeq ($(UNAME_S),Darwin)
7+
PRESET_NAME:=macos-$(BUILD_TYPE)
8+
else ifeq ($(UNAME_S),Windows_NT)
9+
PRESET_NAME:=windows-$(BUILD_TYPE)
10+
else
11+
$(error Unsupported platform: $(UNAME_S))
12+
endif
13+
14+
BUILD_DIR:=$(PWD)/out/build/$(PRESET_NAME)
15+
16+
.PHONY: default
17+
default:
18+
@echo "Please specify the target"
19+
20+
.PHONY: clean
21+
clean:
22+
rm -rf $(BUILD_DIR)
23+
24+
.PHONY: configure
25+
configure:
26+
cmake --preset $(PRESET_NAME)
27+
28+
.PHONY: build
29+
build:
30+
cmake --build $(BUILD_DIR) --target all --parallel 6
31+
32+
.PHONY: test
33+
test:
34+
ctest --test-dir $(BUILD_DIR)

0 commit comments

Comments
 (0)