Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
Language: Cpp
BasedOnStyle: Google
AccessModifierOffset: -4
AlignEscapedNewlines: Left
AlignTrailingComments: true
AlignAfterOpenBracket: true
AllowAllArgumentsOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: "Yes"
AlignArrayOfStructures: Left
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterEnum: false
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
ColumnLimit: 0
DerivePointerAlignment: false
#EmptyLineAfterAccessModifier: Leave
#EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: true
FixNamespaceComments: false
IndentCaseLabels: true
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 10
NamespaceIndentation: All
PenaltyBreakComment: 20
PenaltyExcessCharacter: 5
PointerAlignment: Middle
SortUsingDeclarations: false
SpaceAfterTemplateKeyword: false
SpaceBeforeCpp11BracedList: true
SpacesBeforeTrailingComments: 1
UseTab: Never
71 changes: 71 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Lint & Test

on:
push:
branches:
- main

pull_request:
types:
- opened
- reopened
- synchronize

jobs:
# test:
# runs-on: ubuntu-latest

# steps:
# - uses: actions/checkout@v4

# - name: Install dependencies
# run: sudo apt-get install -y build-essential gcc-multilib g++-multilib

# - name: Install gcovr
# run: pip install gcovr

# - name: Setup project
# run: cmake -S ${TEST_DIR} -B ${BUILD_DIR} -DCMAKE_BUILD_TYPE=Debug

# - name: Build
# run: cmake --build ${BUILD_DIR}

# # - name: Test
# # working-directory: build
# # run: ctest -V

# - name: Test with Coverage
# working-directory: build
# run: cmake --build ${BUILD_DIR} --target os_test_coverage

lint:
runs-on: ubuntu-latest

strategy:
matrix:
folder:
- src
- include
- tests

steps:
- uses: actions/checkout@v4

- name: Lint ${{ matrix.folder }}
uses: jidicula/clang-format-action@v4.14.0
with:
clang-format-version: "20"
check-path: ${{ matrix.folder }}

increment_version:
name: Increment Version
uses: automas-dev/reusable-workflows/.github/workflows/increment_version.yml@main
if: github.ref == 'refs/heads/main'
secrets: inherit

needs:
# - test
- lint

permissions:
contents: write
59 changes: 14 additions & 45 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,52 +1,21 @@
# Some rules taken from https://github.com/github/gitignore/blob/master/CMake.gitignore
# Created by https://www.gitignore.io/api/visualstudiocode
# Edit at https://www.gitignore.io/?templates=visualstudiocode

# IDE's
.vscode/
tags

# Compiled Object files
**/.DS_Store
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll
### VisualStudioCode ###
.vscode/**/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Compiled Static libraries
*.lai
*.la
*.a
*.lib
### VisualStudioCode Patch ###
# Ignore all local history of files
**/.history

# Executables
*.exe
*.out
*.app

**/cmake-build-debug
**/CMakeCache.txt
**/cmake_install.cmake
**/install_manifest.txt
**/CMakeFiles/
**/CTestTestfile.cmake
**/Makefile
**/*.cbp
**/CMakeScripts
**/compile_commands.json

## Local
# End of https://www.gitignore.io/api/visualstudiocode

tags
compile_commands.json
.idea/

build/
install/
Release/
Debug/
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

CC=/usr/bin/gcc
CXX=/usr/bin/g++
CONFIG=Debug
TARGET=all

all: config build

config:
cmake --no-warn-unused-cli \
-DCMAKE_BUILD_TYPE=${CONFIG} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
-DCMAKE_C_COMPILER=${CC} \
-DCMAKE_CXX_COMPILER=${CXX} \
-S${PWD} \
-B${PWD}/build \
-G Ninja

build:
cmake --build ${PWD}/build --config ${CONFIG} --target ${TARGET}

install:
cmake --install ${PWD}/build --config ${CONFIG}

lint:
@find src include tests -name '*.c' -or -name '*.h' -or -name '*.cpp' -or -name '*.hpp' | xargs clang-format --dry-run --Werror --sort-includes

format:
@find src include tests -name '*.c' -or -name '*.h' -or -name '*.cpp' -or -name '*.hpp' | xargs clang-format -i --Werror --sort-includes

.PHONY: config build install lint format
2 changes: 1 addition & 1 deletion src/Wavefront.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ namespace wavefront {
material->texSpecular = token.value;
}
} break;
case 'B': // map_Bump
case 'B': // map_Bump
case 'b': { // map_bump
material->texNormal = token.value;
} break;
Expand Down
2 changes: 1 addition & 1 deletion src/WavefrontParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace wavefront {
while (end < str.size() && (maxcount-- > 0)) {
while (end < str.size()) {
if (str[end] == delim) {
parts.push_back(str.substr(start, end-start));
parts.push_back(str.substr(start, end - start));
start = ++end;
break;
}
Expand Down