mirror of
https://github.com/theoludwig/libcproject.git
synced 2025-05-21 23:21:15 +02:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
e844600214 | |||
ba5dddcf2f | |||
3b9d137df4 | |||
471cb862f5 | |||
892cc71391 | |||
86ae85f130 | |||
3fb77f70cb | |||
469859001e | |||
6932907f05 | |||
9fc4cd9139 |
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@ -20,3 +20,12 @@ jobs:
|
|||||||
- run: 'make test'
|
- run: 'make test'
|
||||||
- run: 'make lint'
|
- run: 'make lint'
|
||||||
- run: 'make clean'
|
- run: 'make clean'
|
||||||
|
|
||||||
|
lint-commit:
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- uses: 'actions/checkout@v3.0.0'
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: 'wagoid/commitlint-github-action@v5.3.0'
|
||||||
|
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@ -12,6 +12,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: 'Import GPG key'
|
- name: 'Import GPG key'
|
||||||
uses: 'crazy-max/ghaction-import-gpg@v4'
|
uses: 'crazy-max/ghaction-import-gpg@v4'
|
||||||
@ -21,7 +22,7 @@ jobs:
|
|||||||
git_commit_gpgsign: true
|
git_commit_gpgsign: true
|
||||||
|
|
||||||
- name: 'Install Build Tools'
|
- name: 'Install Build Tools'
|
||||||
run: 'sudo apt-get install --yes build-essential gcc make clang-format'
|
run: 'sudo apt-get install --yes build-essential gcc make clang-format doxygen doxygen-gui doxygen-doc graphviz'
|
||||||
|
|
||||||
- run: 'make set_version'
|
- run: 'make set_version'
|
||||||
|
|
||||||
@ -31,7 +32,7 @@ jobs:
|
|||||||
node-version: 'lts/*'
|
node-version: 'lts/*'
|
||||||
|
|
||||||
- name: 'Install Release Tools'
|
- name: 'Install Release Tools'
|
||||||
run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge'
|
run: 'npm install --save-dev semantic-release @commitlint/cli @commitlint/config-conventional @semantic-release/git @semantic-release/exec @saithodev/semantic-release-backmerge vercel'
|
||||||
|
|
||||||
- run: 'rm --force package.json package-lock.json'
|
- run: 'rm --force package.json package-lock.json'
|
||||||
|
|
||||||
@ -41,3 +42,13 @@ jobs:
|
|||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }}
|
GIT_COMMITTER_NAME: ${{ secrets.GIT_NAME }}
|
||||||
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }}
|
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_EMAIL }}
|
||||||
|
|
||||||
|
- name: 'Generate Documentation'
|
||||||
|
run: 'make documentation'
|
||||||
|
|
||||||
|
- name: 'Deploy to Vercel'
|
||||||
|
run: 'npx vercel ./documentation/html --token="${VERCEL_TOKEN}" --prod'
|
||||||
|
env:
|
||||||
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
||||||
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||||
|
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,6 @@
|
|||||||
build
|
build
|
||||||
bin
|
bin
|
||||||
|
documentation
|
||||||
.vscode
|
.vscode
|
||||||
*.out
|
*.out
|
||||||
*.o
|
*.o
|
||||||
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "doxygen-awesome-css"]
|
||||||
|
path = doxygen-awesome-css
|
||||||
|
url = https://github.com/jothepro/doxygen-awesome-css.git
|
28
Doxyfile
Normal file
28
Doxyfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
DOXYFILE_ENCODING = UTF-8
|
||||||
|
PROJECT_NAME = libcproject
|
||||||
|
PROJECT_BRIEF = "C static library easier to use than $(libc) (C standard library)."
|
||||||
|
OUTPUT_DIRECTORY = documentation
|
||||||
|
OUTPUT_LANGUAGE = English
|
||||||
|
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||||
|
INPUT = ./
|
||||||
|
INPUT_ENCODING = UTF-8
|
||||||
|
USE_MDFILE_AS_MAINPAGE = README.md
|
||||||
|
FILE_PATTERNS = *.h \
|
||||||
|
README.md
|
||||||
|
HTML_EXTRA_STYLESHEET = doxygen-awesome-css/doxygen-awesome.css
|
||||||
|
|
||||||
|
RECURSIVE = YES
|
||||||
|
EXCLUDE = test doxygen-awesome-css node_modules
|
||||||
|
GENERATE_LATEX = NO
|
||||||
|
GENERATE_TREEVIEW = YES
|
||||||
|
EXAMPLE_PATTERNS = *
|
||||||
|
SOURCE_BROWSER = YES
|
||||||
|
INLINE_SIMPLE_STRUCTS = YES
|
||||||
|
EXTRACT_ALL = YES
|
||||||
|
EXTRACT_STATIC = YES
|
||||||
|
SORT_MEMBER_DOCS = NO
|
||||||
|
FULL_SIDEBAR = NO
|
||||||
|
DISABLE_INDEX = NO
|
||||||
|
INLINE_SOURCES = YES
|
||||||
|
LAYOUT_FILE = DoxygenLayout.xml
|
||||||
|
HTML_INDEX_NUM_ENTRIES = 1
|
57
DoxygenLayout.xml
Normal file
57
DoxygenLayout.xml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<doxygenlayout version="1.0">
|
||||||
|
<!-- Generated by doxygen 1.9.1 -->
|
||||||
|
<!-- Navigation index tabs for HTML output -->
|
||||||
|
<navindex>
|
||||||
|
<tab type="mainpage" visible="yes" title=""/>
|
||||||
|
<tab type="pages" visible="yes" title="" intro=""/>
|
||||||
|
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||||
|
</navindex>
|
||||||
|
|
||||||
|
<!-- Layout definition for a file page -->
|
||||||
|
<file>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<includes visible="$SHOW_INCLUDE_FILES"/>
|
||||||
|
<includegraph visible="$INCLUDE_GRAPH"/>
|
||||||
|
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
|
||||||
|
<sourcelink visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<interfaces visible="yes" title=""/>
|
||||||
|
<classes visible="yes" title=""/>
|
||||||
|
<structs visible="yes" title=""/>
|
||||||
|
<exceptions visible="yes" title=""/>
|
||||||
|
<namespaces visible="yes" title=""/>
|
||||||
|
<constantgroups visible="yes" title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<sequences title=""/>
|
||||||
|
<dictionaries title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
<membergroups visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
<memberdef>
|
||||||
|
<inlineclasses title=""/>
|
||||||
|
<defines title=""/>
|
||||||
|
<typedefs title=""/>
|
||||||
|
<sequences title=""/>
|
||||||
|
<dictionaries title=""/>
|
||||||
|
<enums title=""/>
|
||||||
|
<functions title=""/>
|
||||||
|
<variables title=""/>
|
||||||
|
</memberdef>
|
||||||
|
<authorsection/>
|
||||||
|
</file>
|
||||||
|
|
||||||
|
<!-- Layout definition for a directory page -->
|
||||||
|
<directory>
|
||||||
|
<briefdescription visible="yes"/>
|
||||||
|
<directorygraph visible="yes"/>
|
||||||
|
<memberdecl>
|
||||||
|
<dirs visible="yes"/>
|
||||||
|
<files visible="yes"/>
|
||||||
|
</memberdecl>
|
||||||
|
<detaileddescription title=""/>
|
||||||
|
</directory>
|
||||||
|
</doxygenlayout>
|
28
Makefile
28
Makefile
@ -4,41 +4,47 @@ CC_FLAGS = -Wall -Wextra -Wfloat-equal -Wundef -Werror -std=c17 -pedantic -pedan
|
|||||||
LIB = ./build/${LIBRARY_NAME}.a
|
LIB = ./build/${LIBRARY_NAME}.a
|
||||||
LIB_CC_FLAGS = -L. -l:${LIB}
|
LIB_CC_FLAGS = -L. -l:${LIB}
|
||||||
LIB_SOURCES = $(wildcard lib/*.c)
|
LIB_SOURCES = $(wildcard lib/*.c)
|
||||||
|
LIB_OBJECTS = $(patsubst %.c, %.o, $(LIB_SOURCES))
|
||||||
TEST_SOURCES = $(wildcard test/*.c)
|
TEST_SOURCES = $(wildcard test/*.c)
|
||||||
|
TEST_OBJECTS = $(patsubst %.c, %.o, $(TEST_SOURCES))
|
||||||
HEADER_FILES = $(wildcard lib/*.h) $(wildcard test/*.h) ./${LIBRARY_NAME}.h
|
HEADER_FILES = $(wildcard lib/*.h) $(wildcard test/*.h) ./${LIBRARY_NAME}.h
|
||||||
MAIN_EXECUTABLE = bin/main.exe
|
MAIN_EXECUTABLE = bin/main.exe
|
||||||
SET_VERSION_EXECUTABLE = bin/set_version.exe
|
SET_VERSION_EXECUTABLE = bin/set_version.exe
|
||||||
TEST_EXECUTABLE = bin/test.exe
|
TEST_EXECUTABLE = bin/test.exe
|
||||||
|
|
||||||
.PHONY: all
|
build/%.o: %.c
|
||||||
all: ${LIB_SOURCES}
|
mkdir --parents ./build/lib ./build/test
|
||||||
mkdir --parents ./build
|
${CC} ${CC_FLAGS} -c $< -o $@
|
||||||
${CC} ${CC_FLAGS} -c ${LIB_SOURCES}
|
|
||||||
|
${LIB}: $(addprefix build/, ${LIB_OBJECTS})
|
||||||
rm --force ${LIB}
|
rm --force ${LIB}
|
||||||
ar -rcs ${LIB} *.o
|
ar -rcs ${LIB} $(addprefix build/, ${LIB_OBJECTS})
|
||||||
rm --recursive --force *.o
|
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run: all ./main.c
|
run: ${LIB} ./main.c
|
||||||
mkdir --parents ./bin
|
mkdir --parents ./bin
|
||||||
${CC} ${CC_FLAGS} -o ${MAIN_EXECUTABLE} ./main.c ${LIB_CC_FLAGS}
|
${CC} ${CC_FLAGS} -o ${MAIN_EXECUTABLE} ./main.c ${LIB_CC_FLAGS}
|
||||||
./${MAIN_EXECUTABLE} ${ARGS}
|
./${MAIN_EXECUTABLE} ${ARGS}
|
||||||
|
|
||||||
.PHONY: set_version
|
.PHONY: set_version
|
||||||
set_version: all ./set_version.c
|
set_version: ${LIB} ./set_version.c
|
||||||
mkdir --parents ./bin
|
mkdir --parents ./bin
|
||||||
${CC} ${CC_FLAGS} -o ${SET_VERSION_EXECUTABLE} ./set_version.c ${LIB_CC_FLAGS}
|
${CC} ${CC_FLAGS} -o ${SET_VERSION_EXECUTABLE} ./set_version.c ${LIB_CC_FLAGS}
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: all ${TEST_SOURCES}
|
test: ${LIB} $(addprefix build/, ${TEST_OBJECTS})
|
||||||
mkdir --parents ./bin
|
mkdir --parents ./bin
|
||||||
${CC} ${CC_FLAGS} -o ${TEST_EXECUTABLE} ${TEST_SOURCES} ${LIB_CC_FLAGS}
|
${CC} ${CC_FLAGS} -o ${TEST_EXECUTABLE} $(addprefix build/, ${TEST_OBJECTS}) ${LIB_CC_FLAGS}
|
||||||
./${TEST_EXECUTABLE}
|
./${TEST_EXECUTABLE}
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
clang-format --Werror --dry-run ${LIB_SOURCES} ${TEST_SOURCES} ${HEADER_FILES} ./main.c
|
clang-format --Werror --dry-run ${LIB_SOURCES} ${TEST_SOURCES} ${HEADER_FILES} ./main.c
|
||||||
|
|
||||||
|
.PHONY: documentation
|
||||||
|
documentation:
|
||||||
|
doxygen ./Doxyfile
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm --recursive --force ./build ./bin *.out *.o *.exe *.a
|
rm --recursive --force ./build ./bin ./documentation
|
||||||
|
@ -22,18 +22,22 @@ C is a low-level programming language and we often end up reinventing the wheel
|
|||||||
|
|
||||||
**libcproject** solve this by providing common functions or data structures (`dictionary`, `linked_list`, `queue`, `stack`, etc.) we might need in our C projects.
|
**libcproject** solve this by providing common functions or data structures (`dictionary`, `linked_list`, `queue`, `stack`, etc.) we might need in our C projects.
|
||||||
|
|
||||||
|
[Online documentation](https://libcproject.vercel.app/).
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- [GNU coreutils](https://www.gnu.org/software/coreutils/)
|
- [GNU coreutils](https://www.gnu.org/software/coreutils/)
|
||||||
- [GNU binutils](https://www.gnu.org/software/binutils/)
|
- [GNU binutils](https://www.gnu.org/software/binutils/)
|
||||||
- [GNU gcc](https://gcc.gnu.org/)
|
- [GNU gcc](https://gcc.gnu.org/)
|
||||||
- [GNU make](https://www.gnu.org/software/make/)
|
- [GNU make](https://www.gnu.org/software/make/)
|
||||||
- [clang-format](https://clang.llvm.org/docs/ClangFormat.html)
|
- [ClangFormat](https://clang.llvm.org/docs/ClangFormat.html)
|
||||||
|
- [Doxygen](https://www.doxygen.nl/)
|
||||||
|
|
||||||
For example on GNU/Linux Ubuntu:
|
For example on GNU/Linux Ubuntu:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo apt-get install build-essential gcc make clang-format
|
sudo apt-get install build-essential gcc make clang-format
|
||||||
|
sudo apt-get install doxygen doxygen-gui doxygen-doc graphviz
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -43,6 +47,7 @@ make # to compile
|
|||||||
make run # to run main
|
make run # to run main
|
||||||
make test # to run unit tests
|
make test # to run unit tests
|
||||||
make lint # to lint the code
|
make lint # to lint the code
|
||||||
|
make documentation # to generate the documentation
|
||||||
make clean # to clean up
|
make clean # to clean up
|
||||||
|
|
||||||
nm ./build/libcproject.a # to see the symbols
|
nm ./build/libcproject.a # to see the symbols
|
||||||
|
1
doxygen-awesome-css
Submodule
1
doxygen-awesome-css
Submodule
Submodule doxygen-awesome-css added at a3c119b479
Reference in New Issue
Block a user