Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ install/
*.glb
*.history
..bfg-report
!data/compat/*.glb
*.gch
11 changes: 2 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,6 @@ if(Boost_FOUND)
add_definitions(-DHUB_USE_BOOST)
endif()

find_package(Eigen3 QUIET)
if(Eigen3_FOUND)
add_definitions(-DHUB_USE_EIGEN3)
link_libraries(Eigen3::Eigen)
include_directories(${EIGEN3_INCLUDE_DIR})
endif()

find_package(TBB QUIET)
set(HUB_TBB_TARGET)
if(TBB_FOUND)
Expand Down Expand Up @@ -264,8 +257,8 @@ endif()
add_custom_target(
hub-format
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND scripts/format-all.sh
COMMENT "Format sources")
COMMAND scripts/format-project.sh
COMMENT "Format project")
custom_target_added(format)

option(HUB_ENABLE_WRAPPER "Enable wrapper" OFF)
Expand Down
Binary file added data/compat/sensor.glb
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/cmake-cat-empty-comments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

cd $(git rev-parse --show-toplevel)

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*') -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
echo "-------------------------------- $file"

cat $file | grep -n '^ *#[^ ].*$' || sleep 0
Expand Down
11 changes: 10 additions & 1 deletion scripts/cmake-format-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@

cd $(git rev-parse --show-toplevel)

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
CI_CMAKE_FORMAT_VERSION="0.6.13"

# echo "using cmake-format : $(cmake-format --version)"
CMAKE_FORMAT_VERSION=$(cmake-format --version)
if [ "$CMAKE_FORMAT_VERSION" != "$CI_CMAKE_FORMAT_VERSION" ]; then
echo "cmake-format need to be compatible with CI version : $CI_CMAKE_FORMAT_VERSION"
exit 1
fi

for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*' ) -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
echo "$file"

cmake-format -i $file
Expand Down
19 changes: 17 additions & 2 deletions scripts/cmake-remove-empty-comments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@

cd $(git rev-parse --show-toplevel)

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
# echo -n '#
# #should be deleted
# # should be deleted
# # should be deleted
# #
# #should be deleted
# # should be deleted
# #
# #should be deleted
# # should be deleted
# ' >> "scripts/test/CMakeLists.txt"

scripts/cmake-format-all.sh

for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*') -type f \( -name "CMakeLists.txt" -o -name "*.cmake" \)); do
echo "$file"

sed -i '/^[ \t]*# *$/d' $file
# sed -i '/^ *#[^ ].*$/d' $file
# sed -i '/^ *# [^A-Z^#].*$/d' $file
sed -i '/^ *# [^A-Z^#^c].*$/d' $file
sed -i '/^[ \t]*# [^A-Z^#^c].*$/d' $file
done
15 changes: 0 additions & 15 deletions scripts/format-all.sh

This file was deleted.

8 changes: 4 additions & 4 deletions scripts/cleanup-project.sh → scripts/format-project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

cd $(git rev-parse --show-toplevel)

./scripts/cmake-remove-empty-comments.sh
./scripts/cmake-format-all.sh
scripts/source-remove-empty-comments.sh
scripts/source-format-all.sh

./scripts/source-remove-empty-comments.sh
./scripts/source-format-all.sh
scripts/cmake-remove-empty-comments.sh
scripts/cmake-format-all.sh


2 changes: 1 addition & 1 deletion scripts/source-cat-empty-comments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

cd $(git rev-parse --show-toplevel)

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*') -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
echo "-------------------------------- $file"

cat $file | grep '^ *//[^ ^/].*$' || sleep 0
Expand Down
35 changes: 32 additions & 3 deletions scripts/source-format-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,42 @@
# rootPath=$(dirname "$rootPath")
# done
# cd $rootPath
CLANG_FORMAT_EXE=clang-format

if [ -e "/opt/clang-format-static/clang-format-14" ]; then
CLANG_FORMAT_EXE="/opt/clang-format-static/clang-format-14"
fi

CI_CLANG_FORMAT_VERSION="14.0.0"

TMP=$($CLANG_FORMAT_EXE --version | awk -F' ' '{print $NF}')
CLANG_FORMAT_VERSION_MAJOR=$(echo $TMP | awk -F'[.-]' '{print $1}')
CLANG_FORMAT_VERSION_MINOR=$(echo $TMP | awk -F'[.-]' '{print $2}')
CLANG_FORMAT_VERSION_PATCH=$(echo $TMP | awk -F'[.-]' '{print $3}')
CLANG_FORMAT_VERSION=$CLANG_FORMAT_VERSION_MAJOR.$CLANG_FORMAT_VERSION_MINOR.$CLANG_FORMAT_VERSION_PATCH
# echo $CLANG_FORMAT_VERSION
if [ "$CLANG_FORMAT_VERSION" != "$CI_CLANG_FORMAT_VERSION" ]; then
echo "clang-format need to be compatible with CI version : $CI_CLANG_FORMAT_VERSION"
exit 1
fi


cd $(git rev-parse --show-toplevel)

export PATH="/opt/clang-format-static:$PATH"
# export PATH="/opt/clang-format-static:$PATH"

# echo "using clang-format : $(clang-format --version)"

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*') -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
echo "$file"

clang-format-11 -i --style=file $file
# clang-format-11 -i --style=file $file

# clang-format on ubuntu ci is on version 14.0.0
# if [ -e "/opt/clang-format-static/clang-format-14" ]; then
# clang-format-14 -i --style=file $file
# else
# clang-format -i --style=file $file
# fi
$CLANG_FORMAT_EXE -i --style=file $file
done
20 changes: 17 additions & 3 deletions scripts/source-remove-empty-comments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@

cd $(git rev-parse --show-toplevel)

for file in $(find $(cat scripts/source_dirs.txt) -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
echo -n '//
//should be deleted
// should be deleted
// should be deleted
//
//should be deleted
// should be deleted
//
//should be deleted
// should be deleted
' >> "scripts/test/example.hpp"

for file in $(find $(cat scripts/source_dirs.txt | grep -v '^*') -type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.h" -o -name "*.inl" \)); do
echo "$file"

sed -i '/^ *\/\/[^ ^\/].*$/d' $file
sed -i '/^[ \t]*\/\/[^ ^\/].*$/d' $file # //a
# sed -i '/^ *\/\/ [ ].*$/d' $file
sed -i '/^ *\/\/ [^A-Z].*$/d' $file
sed -i '/^[ \t]*\/\/ [^A-Z^c].*$/d' $file # // auou, protect // cppcheck-suppress and // clang-format
sed -i '/^[ \t]*\/\/ *$/d' $file # // remove empty comment

done
17 changes: 9 additions & 8 deletions scripts/source_dirs.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
src/
tests/
examples/
CMakeLists.txt
doc/
wrapper/
bin/
cmake/
* src/
* tests/
* examples/
* CMakeLists.txt
* doc/
* wrapper/
* bin/
* cmake/
scripts/test/
13 changes: 13 additions & 0 deletions scripts/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# # Still alive :

# # hello

# # Still alive :

# Hello

# # Still alive :

# cmake-format

# # End of file
19 changes: 19 additions & 0 deletions scripts/test/example.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@




// Still alive :
// Hello

// Still alive :
/// comment

// Still alive :
// cppcheck-suppress noExplicitConstructor

// Still alive :
// clang-format off



// End of file
4 changes: 3 additions & 1 deletion src/core/Any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ class SRC_API Any
/// \param other
/// \return
///
bool operator!=( const Any& other ) const { return !( *this == other ); }
bool operator!=( const Any& other ) const {
return !( *this == other );
}
#endif

private:
Expand Down
8 changes: 6 additions & 2 deletions src/core/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ class Buffer<Type, Size, StaticMemory> : public BufferBase<Type, Size, StaticMem

#if CPP_VERSION >= 20
using Span = typename BufferBase<Type, Size, StaticMemory>::Span;
Span getSpan() override { return Span { m_array.begin(), m_array.end() }; }
Span getSpan() override {
return Span { m_array.begin(), m_array.end() };
}
#endif

private:
Expand Down Expand Up @@ -198,7 +200,9 @@ class Buffer<Type, Size, DynamicMemory> : public BufferBase<Type, Size, DynamicM

#if CPP_VERSION >= 20
using Span = typename BufferBase<Type, Size, DynamicMemory>::Span;
Span getSpan() override { return std::span<Type, Size> { m_vector.begin(), m_vector.end() }; }
Span getSpan() override {
return std::span<Type, Size> { m_vector.begin(), m_vector.end() };
}
#endif

private:
Expand Down
11 changes: 7 additions & 4 deletions src/core/Format.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,13 @@ struct Mat4 {
///
bool operator==( const Mat4& other ) const {
return m_array == other.m_array;
// return !memcmp( data, other.data, 64 );
}

///
/// \brief data
/// \return
///
const float * data() const {
const float* data() const {
return m_array.data();
}

Expand Down Expand Up @@ -260,7 +259,9 @@ struct Vec3 {
///
/// \brief name
///
static constexpr auto name() { return "Vec3"; };
static constexpr auto name() {
return "Vec3";
};
///
/// \brief operator ==
/// \param other
Expand Down Expand Up @@ -329,7 +330,9 @@ struct Vec4 {
///
/// \brief name
///
static constexpr auto name() { return "Vec4"; };
static constexpr auto name() {
return "Vec4";
};
///
/// \brief operator ==
/// \param other
Expand Down
Loading