-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
160 lines (133 loc) · 4.66 KB
/
Copy pathMakefile
File metadata and controls
160 lines (133 loc) · 4.66 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#
# Helper script to build the project using CMake and CI/CD pipelines
#
# Variables
BUILD_DIR := build
.PHONY: all install dependency build run clean doc test release
all: install dependency build run doc test
# Install dependencies
dependency:
@echo "Installing dependencies..."
ifeq ($(OS), Windows_NT)
@choco install cmake llvm ninja doxygen.install
else
@sudo apt-get install -y gcc g++ cmake llvm ninja-build doxygen graphviz clang-format texlive
endif
# Dependency graph generation
dep_graph:
@echo "Generating dependency graph..."
@mkdir -p $(BUILD_DIR)
@cd $(BUILD_DIR) && cmake .. --graphviz=graph.dot
@dot -Tpng $(BUILD_DIR)/graph.dot -o $(BUILD_DIR)/graphImage.png
# Prepare the build directory
clean:
@echo "Preparing build directory..."
@rm -rf $(BUILD_DIR)
@mkdir $(BUILD_DIR)
# Build debug
build-debug:
@echo "Cleaning cmake cache..."
@rm -rf $(BUILD_DIR)/CMakeCache.txt $(BUILD_DIR)/CMakeFiles $(BUILD_DIR)/Makefile $(BUILD_DIR)/cmake_install.cmake
@echo "Configuring Debug build..."
@cmake -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
--no-warn-unused-cli \
-S . \
-B $(BUILD_DIR) \
-G "Ninja"
@echo "Building Debug..."
@cd $(BUILD_DIR) && cmake .. && cmake --build . --config Debug -j 4
@echo "========= Debug build done ========="
# Build release
build-release:
@echo "Cleaning cmake cache..."
@rm -rf $(BUILD_DIR)/CMakeCache.txt $(BUILD_DIR)/CMakeFiles $(BUILD_DIR)/Makefile $(BUILD_DIR)/cmake_install.cmake
@echo "Configuring release build..."
@cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
--no-warn-unused-cli \
-S . \
-B $(BUILD_DIR) \
-G "Ninja" \
-DENABLE_TESTS=OFF
@echo "Building release..."
@cmake --build $(BUILD_DIR) --config Release --target all -- -j 4
@echo "========= Release build done ========="
@tree $(BUILD_DIR)/Release /f
# Install the project
install:
@echo "Installing the application..."
# Create the necessary directories in the INSTALL_ROOT
@mkdir -p $(DESTDIR)/$(INSTALL_ROOT)
# Copy all the files from release build to the bin directory
@cp $(BUILD_DIR)/Release/* $(DESTDIR)/$(INSTALL_ROOT)
# Copy Shared Libraries files with (dll, so, dylib) extensions
ifeq ($(OS), Windows_NT)
@cp $(BUILD_DIR)/Release/*.dll $(DESTDIR)/$(INSTALL_ROOT)
else
@cp $(BUILD_DIR)/lib/*.so $(DESTDIR)/$(INSTALL_ROOT)
@cp $(BUILD_DIR)/lib/*.dylib $(DESTDIR)/$(INSTALL_ROOT)
endif
# Copy the desktop file to the applications directory
@cp ./resources/*.desktop $(DESTDIR)/$(INSTALL_ROOT)
# Copy the icon to the icons directory
@cp ./resources/icons/*.png $(DESTDIR)/$(INSTALL_ROOT)
@tree $(DESTDIR)/$(INSTALL_ROOT) /f
# Run the application
run:
@echo "Running the project..."
ifeq ($(OS), Windows_NT)
@./$(BUILD_DIR)/build/Debug/*.exe
else
@./$(BUILD_DIR)/build/Debug/*
endif
# Generate documentation (custom target)
html:
@echo "Generating html doxygen documentation..."
@cd $(BUILD_DIR) && cmake --build . --target html
pdf:
@echo "Generating pdf-latex doxygen documentation..."
@cd $(BUILD_DIR) && cmake --build . --target pdf
doc: html pdf
@echo "All Documentation generated successfully!"
test:
@echo "Running tests..."
@cd $(BUILD_DIR) && cmake .. -DENABLE_TESTS=ON && cmake --build . && ctest --output-on-failure
diagrams: build
ifeq ($(OS), Windows_NT)
@echo "Generating diagrams..."
mkdir -p docs/diagrams/plantuml
mkdir -p docs/diagrams/mermaid
clang-uml -g plantuml -g json -g mermaid -p
@echo "Converting .puml files to SVG and PNG..."
plantuml -tsvg -nometadata -o plantuml docs/diagrams/*.puml
plantuml -tpng -nometadata -o plantuml docs/diagrams/*.puml
@echo "Convert .mmd files to svg images"
py utils/generate_mermaid.py "docs/diagrams/*.mmd"
@echo "Format generated SVG files..."
py utils/format_svg.py docs/diagrams/plantuml/*.svg
py utils/format_svg.py docs/diagrams/mermaid/*.svg
@echo "Done!"
else
@echo "installing dependencies..."
sudo apt-get install -y plantuml npm python3 python3-pip python3-yaml
npm install -g mermaid.cli
pip install pyyaml
pip install cairosvg
@echo "installing clang-uml..."
sudo add-apt-repository ppa:bkryza/clang-uml
sudo apt update
sudo apt install clang-uml
@echo "Generating diagrams..."
mkdir -p docs/diagrams/plantuml
mkdir -p docs/diagrams/mermaid
clang-uml -g plantuml -g json -g mermaid -p
@echo "Convert .puml files to svg images"
plantuml -tsvg -nometadata -o plantuml docs/diagrams/*.puml
@echo "Convert .mmd files to svg images"
py utils/generate_mermaid.py "docs/diagrams/*.mmd"
@echo "Format generated SVG files..."
py utils/format_svg.py docs/diagrams/plantuml/*.svg
py utils/format_svg.py docs/diagrams/mermaid/*.svg
@echo "Done!"
endif