Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master engine #15

Merged
merged 47 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
70265fe
refactor(engine): refactor the whole project for the build of physics
VegetableDog-humble May 7, 2023
4216281
refactor(dependency): Move some dependecies into the project
VegetableDog-humble May 7, 2023
a753cda
Merge pull request #14 from Simple-XX/refactor-dependency
VegetableDog-humble May 7, 2023
4a0b3b4
fix(ignore): fix the problems of gitignore
VegetableDog-humble May 7, 2023
c4a75ed
Merge pull request #17 from Simple-XX/refactor-dependency
VegetableDog-humble May 7, 2023
1893a73
build: update cmake
MRNIU Oct 27, 2023
b37db87
build: update cmake
MRNIU Oct 27, 2023
6943a7b
build: update cmake
MRNIU Oct 27, 2023
2e237ae
build: update cmake build system
MRNIU Oct 30, 2023
c9f9348
tools: add clang-tidy and clang-format
MRNIU Oct 30, 2023
fbbaa49
refactor: move codes and update cmake
MRNIU Oct 30, 2023
a8df3b9
Merge pull request #19 from MRNIU/master-engine
MRNIU Oct 30, 2023
e37e40a
fix: run demo2d
MRNIU Oct 30, 2023
ec47c77
fix: run demo3d
MRNIU Oct 30, 2023
5eecf66
Merge pull request #20 from MRNIU/master-engine
MRNIU Oct 30, 2023
2513e06
build: update cmake build system
MRNIU Oct 31, 2023
2c1e3b9
build: update cmake
MRNIU Oct 31, 2023
6921593
build: update cmake, build engine on osx but demo2d cannot find glut
MRNIU Oct 31, 2023
71e3c75
fix: build demo2d on osx
MRNIU Oct 31, 2023
dab0861
fix: build demo3d on osx
MRNIU Oct 31, 2023
ee07640
comment: add file header; refactor: include dir
MRNIU Oct 31, 2023
350fc8f
style: format code with llvm code style
MRNIU Oct 31, 2023
2f2240c
comment: header file guard
MRNIU Oct 31, 2023
9930759
Delete BuildProject_will_del directory
MRNIU Nov 1, 2023
911f96e
build: cmake init
MRNIU Nov 1, 2023
d824e4d
fix: add default case
MRNIU Nov 1, 2023
aece702
fix: add std::
MRNIU Nov 1, 2023
9cc38e6
build: passed on ubuntu
MRNIU Nov 2, 2023
c33b98d
build: cmake update
MRNIU Nov 2, 2023
026aa67
build: cmake update
MRNIU Nov 3, 2023
752b20c
style: update include order
MRNIU Nov 3, 2023
2db4d2b
style: update include order
MRNIU Nov 3, 2023
33b77b6
style: update include order
MRNIU Nov 3, 2023
eb85c05
comment: update file header
MRNIU Nov 3, 2023
1429c33
comment: update file header
MRNIU Nov 7, 2023
21baddf
comment: update file header
MRNIU Nov 7, 2023
17c708e
refactor: move collision detect to independent dir; test: remove redu…
MRNIU Nov 7, 2023
b3a5529
refactor: remove unused codes
MRNIU Nov 7, 2023
a0253ec
refactor: remove dtk namespace
MRNIU Nov 7, 2023
2660d5a
refactor: rename lowcase
MRNIU Nov 7, 2023
f0b82dc
refactor: rename lowcase
MRNIU Nov 7, 2023
4312312
refactor: move dtk to src/
MRNIU Nov 7, 2023
1adb151
refactor: use constexpr
MRNIU Nov 7, 2023
5f3f64b
fix: dtk boost link
MRNIU Nov 7, 2023
b52f8c4
ci: try to fix github ci
MRNIU Nov 7, 2023
f34b08c
ci: try to fix github ci
MRNIU Nov 7, 2023
d7d3cae
doc: add badge
MRNIU Nov 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

# This file is a part of Simple-XX/SimplePhysicsEngine
# (https://github.com/Simple-XX/SimplePhysicsEngine).
#
# CMakeLists.txt for Simple-XX/SimplePhysicsEngine.

---
# @version clang-format version 15
# @see https://clang.llvm.org/docs/ClangFormatStyleOptions.html
# 使用 LLVM 规范
BasedOnStyle: LLVM
...
28 changes: 28 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

# This file is a part of Simple-XX/SimplePhysicsEngine
# (https://github.com/Simple-XX/SimplePhysicsEngine).
#
# .clang-tidy for Simple-XX/SimplePhysicsEngine.

---
Checks: '-*,\
bugprone-*,\
clang-analyzer-*,\
cppcoreguidelines-*,\
hicpp-*,\
llvm-*,\
misc-*
modernize-*,\
performance-*,\
portability-*,\
readability-*,\
-cppcoreguidelines-pro-type-reinterpret-cast,\
-bugprone-easily-swappable-parameters,\
-llvm-header-guard,\
-misc-non-private-member-variables-in-classes,\
-cppcoreguidelines-non-private-member-variables-in-classes,\
-readability-identifier-length,\
-cppcoreguidelines-avoid-non-const-global-variables'
HeaderFilterRegex: '^${sourceDir}/src'
AnalyzeTemporaryDtors: true
...
80 changes: 80 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# This file is a part of Simple-XX/SimplePhysicsEngine
# (https://github.com/Simple-XX/SimplePhysicsEngine).
#
# workflow.yml for Simple-XX/SimplePhysicsEngine.

name: build

on:
- push
- pull_request
- release

env:
CMAKE_BUILD_TYPE: Release

jobs:
build_docs:
name: Build and publish documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck lcov
sudo apt install --fix-missing -y gcc g++ libspdlog-dev libcgal-dev freeglut3-dev libboost-all-dev libvtk9-dev qtbase5-dev xorg-dev libglu1-mesa-dev

- name: Build
run: |
cmake --preset=build
cmake --build build --target doc

- name: Publish
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{github.workspace}}/doc/html

build_ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt update
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck lcov
sudo apt install --fix-missing -y gcc g++ libspdlog-dev libcgal-dev freeglut3-dev libboost-all-dev libvtk9-dev qtbase5-dev xorg-dev libglu1-mesa-dev

- name: Build
run: |
cmake --preset=build
cmake --build build --target all
cmake --build build --target coverage

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
files: build/coverage/coverage.info
verbose: true

build_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
brew install doxygen graphviz llvm cppcheck lcov spdlog boost freeglut glfw vtk cgal
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy"

- name: Build
run: |
cmake --preset=build
cmake --build build --target all
cmake --build build --target coverage
29 changes: 16 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

# This file is a part of Simple-XX/SimplePhysicsEngine
# (https://github.com/Simple-XX/SimplePhysicsEngine).
#
# .gitignore for Simple-XX/SimplePhysicsEngine.

# Prerequisites
*.d

Expand All @@ -14,7 +20,6 @@
# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
Expand All @@ -24,7 +29,6 @@
*.lai
*.la
*.a
*.lib

# Executables
*.exe
Expand All @@ -36,16 +40,15 @@
*.vs
*.chm

clang-build
build
clang-build
build/

install
install/

example
example/

demo/FEMsimulation/build
simulation/build
*.o
.DS_Store
build
cmake-build*
.gdbinit
.vscode
.idea
3rd
Doxyfile
src/include/config.h
70 changes: 37 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
cmake_minimum_required(VERSION 3.0)

project(dtk)

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install" CACHE STRING "Installation directory of library files")

#Installation directory of library files
set(DTK_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}")

#Installation directory for CMake configuration files
set(DTK_INSTALL_CMAKEDIR "${CMAKE_BINARY_DIR}")

#Installation directory for header files
set(DTK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")

if("${DTK_INSTALL_LIBDIR}" STREQUAL "")
set(DTK_INSTALL_LIBDIR "lib")
endif()

if("${DTK_INSTALL_CMAKEDIR}" STREQUAL "")
set(DTK_INSTALL_CMAKEDIR "bin")
endif()

if("${DTK_INSTALL_INCLUDEDIR}" STREQUAL "")
set(DTK_INSTALL_INCLUDEDIR "include")
endif()

set(DTK_INSTALL_INCLUDEDIR "include")

message("DTK_INSTALL_LIBDIR : ${DTK_INSTALL_LIBDIR}")
message("DTK_INSTALL_INCLUDEDIR : ${DTK_INSTALL_INCLUDEDIR}")
message("DTK_INSTALL_CMAKEDIR: ${DTK_INSTALL_CMAKEDIR}")
# This file is a part of Simple-XX/SimplePhysicsEngine
# (https://github.com/Simple-XX/SimplePhysicsEngine).
#
# CMakeLists.txt for Simple-XX/SimplePhysicsEngine.

# 设置最小 cmake 版本
cmake_minimum_required(VERSION 3.27 FATAL_ERROR)

# 设置项目名与版本
project(SimplePhysicsEngine
VERSION 0.0.1
DESCRIPTION "A simple physics engine in developing..."
HOMEPAGE_URL "https://github.com/Simple-XX/SimplePhysicsEngine"
)

# 禁止原地编译
if (${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
# 如果你看到这句话,cmake 此时已经在根目录下生成了一些临时文件,你需要删除它们
# CMakeFiles, CMakeCache.txt
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif ()

# 设置辅助 cmake 脚本路径
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

# 导入函数
include(functions)
# 导入第三方依赖
include(3rd)
# 导入配置
include(project_config)
include(compile_config)

add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(doc)
64 changes: 64 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 27,
"patch": 0
},
"configurePresets": [
{
"name": "std",
"description": "This preset makes sure the project actually builds with at least the specified standard",
"hidden": true,
"cacheVariables": {
"CMAKE_C_EXTENSIONS": "OFF",
"CMAKE_C_STANDARD": "17",
"CMAKE_C_STANDARD_REQUIRED": "ON",
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_CXX_STANDARD": "20",
"CMAKE_CXX_STANDARD_REQUIRED": "ON"
}
},
{
"name": "configurePresets_base",
"hidden": true,
"inherits": [
"std"
],
"displayName": "configurePresets_base",
"description": "base configurePresets",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": {
"type": "BOOL",
"value": "ON"
},
"EXECUTABLE_OUTPUT_PATH": {
"type": "STRING",
"value": "${sourceDir}/build/bin"
},
"LIBRARY_OUTPUT_PATH": {
"type": "STRING",
"value": "${sourceDir}/build/lib"
},
"COVERAGE_OUTPUT_DIR": {
"type": "STRING",
"value": "${sourceDir}/build/coverage"
},
"VTK_OPT": {
"type": "BOOL",
"value": "FALSE"
}
}
},
{
"name": "build",
"hidden": false,
"inherits": [
"configurePresets_base"
],
"displayName": "build",
"description": "build"
}
]
}
Loading
Loading