-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
123 lines (104 loc) · 3.4 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
version: 3
vars:
SFML_VER: SFML-2.6.1 # The sfml version, and the extracted folder name
SFML_ROOT: ./lib # The root directory to extract the file
FILE_BCON: .bear-config.json
FILE_COMP: compile_commands.json
FILE_TIDY: .clang-tidy
FILE_FORM: .clang-format
FILE_DL: "{{.SFML_ROOT}}/sfml-lib.tar.gz"
FILES_SRC: ./src/*/*.c*
FILES_CPP: ./src/*.c*
FILES_HPP: ./src/*/*.h*
DIR_BIN: ./bin
DEBUG_EXE: "{{.DIR_BIN}}/debug.exe"
FINAL_EXE: "{{.DIR_BIN}}/program.exe"
SFML_PATH: "{{.SFML_ROOT}}/{{.SFML_VER}}"
SFML_LIB: "{{.SFML_PATH}}/lib"
SFML_INC: "{{.SFML_PATH}}/include"
FLAGS_W: -Wall -Wextra -pedantic -std=c++20
FLAGS_L: -I{{.SFML_INC}} {{.SFML_LIB}}/libsfml-*[!-d].so -lFLAC -Wl,-rpath={{.SFML_LIB}}
FLAGS_T: --checks=modern*,performance*,read*
NOTIMP: "Not Implemented yet!"
tasks:
# Download the SFML library
setup-download-lib:
env:
LINUXAMD: https://www.sfml-dev.org/files/{{.SFML_VER}}-linux-gcc-64-bit.tar.gz
cmds:
- cmd: echo "Now downloading library" && mkdir -p {{.SFML_ROOT}} && wget -O {{.FILE_DL}} $LINUXAMD && tar -xf {{.FILE_DL}} -C {{.SFML_ROOT}};
platforms: [linux/amd64]
status:
- test -d {{.SFML_PATH}}
# Prepare the file `.clang-format`
setup-clang-format:
cmds:
- cmd: clang-format --dump-config > {{.FILE_FORM}}
platforms: [linux/amd64]
status:
- test -f {{.FILE_FORM}}
# Prepare the file `.clang-tidy`
setup-clang-tidy:
cmds:
- task: setup-download-lib
- task: build
- cmd: clang-tidy --checks='{{.FLAGS_T}}' --dump-config > {{.FILE_TIDY}}
status:
- test -f {{.FILE_TIDY}}
# Creates the bin folder
setup-bin-dir:
cmds:
- cmd: mkdir -p {{.DIR_BIN}}
status:
- test -d {{.DIR_BIN}}
# Prepares all clang config files
setup:
deps: [setup-clang-tidy, setup-clang-format]
# Builds a debug executable file for the game
debug:
cmds:
- cmd: clang++ -MJ {{.FILE_COMP}} {{.FLAGS_W}} -g -o {{.DEBUG_EXE}} {{.FILES_CPP}} {{.FILES_SRC}} {{.FLAGS_L}}
- cmd: sed -i '1i[' ./{{FILE_COMP}}
- cmd: echo "]" >> ./{{FILE_COMP}}
deps: [setup-download-lib, setup-bin-dir]
sources:
- '{{.FILES_SRC}}'
- '{{.FILES_CPP}}'
- '{{.FILES_HPP}}'
method: checksum
status:
- test -f {{.DEBUG_EXE}}
# Prepare the build file for the game
build:
cmds:
- cmd: clang++ -MJ {{.FILE_COMP}} {{.FLAGS_W}} -O3 -o {{.FINAL_EXE}} {{.FILES_CPP}} {{.FILES_SRC}} {{.FLAGS_L}}
- cmd: sed -i '1i[' ./{{.FILE_COMP}}
- cmd: echo "]" >> ./{{.FILE_COMP}}
deps: [setup-download-lib, setup-bin-dir]
sources:
- '{{.FILES_SRC}}'
- '{{.FILES_CPP}}'
- '{{.FILES_HPP}}'
method: checksum
status:
- test -f {{.FINAL_EXE}}
# Runs the game executable
run:
cmds:
- cmd: '{{.FINAL_EXE}}'
deps: [build]
# Deletes the config files
clean:
cmds:
- cmd: rm -f {{.DIR_BIN}}/*.exe {{.FILE_BCON}} {{.FILE_COMP}} {{.FILE_FORM}} {{.FILE_DL}}
platforms: [linux/amd64]
- cmd: echo {{.NOTIMP}} && test
platforms: [windows, darwin]
# Runs clang-tidy for the project
tidy:
cmds:
- cmd: clang-tidy --config-file={{.FILE_TIDY}} {{.FILES_CPP}} {{.FILES_CPP}} {{.FILES_SRC}} {{.FILES_HPP}}
# Runs clang-format for the project
format:
cmds:
- cmd: clang-format -i {{.FILES_SRC}} {{.FILES_CPP}} {{.FILES_HPP}}