Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Baalaandaa committed Jan 12, 2025
2 parents 03d9f81 + 8fc0096 commit 0b0862b
Show file tree
Hide file tree
Showing 306 changed files with 6,397 additions and 8,772 deletions.
5 changes: 4 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,11 @@ BreakBeforeBraces: Custom
NamespaceIndentation: All
BinPackArguments: false
BinPackParameters: false
ReferenceAlignment: Left
AlwaysBreakTemplateDeclarations: MultiLine
AlignArrayOfStructures: Right
AllowAllArgumentsOnNextLine: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignConsecutiveDeclarations: true
IncludeBlocks: Preserve
AllowShortBlocksOnASingleLine: Empty
55 changes: 55 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---

Checks: '-*,cppcoreguidelines-avoid-goto,cppcoreguidelines-pro-type-const-cast, google-runtime-int, modernize-use-nullptr, readability-container-size-empty, readability-redundant-control-flow, readability-identifier-naming, readability-implicit-bool-conversion, google-explicit-constructor'

CheckOptions:
- key: readability-identifier-naming.NamespaceCase
value: CamelCase
- key: readability-identifier-naming.ClassCase
value: CamelCase
- key: readability-identifier-naming.StructCase
value: CamelCase
- key: readability-identifier-naming.TypedefCase
value: CamelCase
- key: readability-identifier-naming.TypeAliasCase
value: CamelCase
- key: readability-identifier-naming.FunctionCase
value: CamelCase
- key: readability-identifier-naming.ParameterCase
value: lower_case
- key: readability-identifier-naming.VariableCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberCase
value: lower_case
- key: readability-identifier-naming.PrivateMemberSuffix
value: '_'
- key: readability-identifier-naming.GlobalConstantCase
value: CamelCase
- key: readability-identifier-naming.GlobalConstantPrefix
value: k
- key: readability-identifier-naming.StaticConstantCase
value: CamelCase
- key: readability-identifier-naming.StaticConstantPrefix
value: k
- key: readability-identifier-naming.ConstexprVariableCase
value: CamelCase
- key: readability-identifier-naming.ConstexprVariablePrefix
value: k
- key: readability-identifier-naming.TypeTemplateParameterCase
value: CamelCase
- key: readability-simplify-boolean-expr.ChainedConditionalReturn
value: '1'
- key: readability-simplify-boolean-expr.ChainedConditionalAssignment
value: '1'
- key: readability-identifier-naming.TypeTemplateParameterIgnoredRegexp
value: expr-type
- key: readability-identifier-naming.StaticVariableCase
value: CamelCase
- key: readability-identifier-naming.StaticVariablePrefix
value: 's'
- key: readability-identifier-naming.GlobalVariableCase
value: CamelCase
- key: readability-identifier-naming.GlobalVariablePrefix
value: 'g'
- key: readability-identifier-naming.PublicMemberCase
value: CamelCase
114 changes: 114 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Checks

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
BuildWindows:
runs-on: windows-latest
name: Build Windows
strategy:
fail-fast: false
matrix:
build_type: [RelWithDebInfo]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install clang
uses: msys2/setup-msys2@v2
with:
location: D:\
update: true
install: >-
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-ninja
- name: Add msys to path
run: |
echo "D:\msys64\clang64\bin\" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
- name: Build
uses: threeal/[email protected]
with:
source-dir: ${{ github.workspace }}
build-dir: ${{ github.workspace }}/build
generator: Ninja
cxx-compiler: clang++
c-compiler: clang
build-args: --target DummyEditor --parallel 16 --config ${{ matrix.build_type }}
options: CMAKE_BUILD_TYPE=${{ matrix.build_type }} DE_FORCE_NO_PCH=ON
BuildUbuntu:
runs-on: ubuntu-latest
name: Build Ubuntu
strategy:
fail-fast: false
matrix:
build_type: [RelWithDebInfo]
c_compiler: [clang-19]
cpp_compiler: [clang++-19]
steps:
- name: Install Packages
run: |
sudo apt update
sudo apt install libwayland-dev libxkbcommon-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgtk-3-dev ninja-build
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Build
uses: threeal/[email protected]
with:
source-dir: ${{ github.workspace }}
build-dir: ${{ github.workspace }}/build
generator: Ninja
cxx-compiler: ${{ matrix.cpp_compiler }}
c-compiler: ${{ matrix.c_compiler }}
build-args: --target DummyEditor --parallel 16 --config ${{ matrix.build_type }}
options: CMAKE_BUILD_TYPE=${{ matrix.build_type }} DE_FORCE_NO_PCH=ON
Linter:
runs-on: ubuntu-latest
name: Clang Tidy
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install Packages
run: |
sudo apt update
sudo apt install libwayland-dev libxkbcommon-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgtk-3-dev
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 19 all
- name: Configure Cmake
uses: threeal/[email protected]
with:
source-dir: ${{ github.workspace }}
build-dir: ${{ github.workspace }}/build
generator: Unix Makefiles
cxx-compiler: clang++-19
c-compiler: clang-19
options: CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXPORT_COMPILE_COMMANDS=ON DE_FORCE_NO_PCH=ON
run-build: false
- uses: cpp-linter/cpp-linter-action@v2
id: linter
with:
style: 'file'
tidy-checks: ''
verbosity: info
version: 18
files-changed-only: false
database: '${{ github.workspace }}/build'
repo-root: '${{ github.workspace }}'
ignore: 'build/**|Examples/**|Sandbox/**|DummyEngine/Platform/**|DummyEditor/Platform/**'
step-summary: true
- name: Check Linter Results
if: steps.linter.outputs.checks-failed > 0
run: exit 1
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ DummyEngine/Presets

Sandbox/imgui.ini
Sandbox/DummyEditor
Sandbox/TestASAN
Sandbox/TestLSAN
Sandbox/TestMSAN
Sandbox/TestTSAN
Sandbox/Logs/**
Sandbox/Cache/**
Sandbox/**.dll
Expand All @@ -20,3 +24,4 @@ Sandbox/**.dylib
Sandbox/**.so**
Sandbox/*.yml

Config.cmake
39 changes: 20 additions & 19 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
[submodule "DummyEngine/Libs/GLM"]
path = DummyEngine/Libs/GLM
[submodule "Dependencies/GLM"]
path = Dependencies/GLM
url = https://github.com/g-truc/glm
[submodule "DummyEngine/Libs/GLFW"]
path = DummyEngine/Libs/GLFW
[submodule "Dependencies/GLFW"]
path = Dependencies/GLFW
url = https://github.com/glfw/glfw
[submodule "DummyEngine/Libs/STB_IMAGE"]
path = DummyEngine/Libs/STB_IMAGE
[submodule "Dependencies/STB_IMAGE"]
path = Dependencies/STB_IMAGE
url = https://github.com/nothings/stb
[submodule "DummyEngine/Libs/YAML"]
path = DummyEngine/Libs/YAML
[submodule "Dependencies/YAML"]
path = Dependencies/YAML
url = https://github.com/jbeder/yaml-cpp
[submodule "DummyEngine/Libs/ASSIMP"]
path = DummyEngine/Libs/ASSIMP
[submodule "Dependencies/ASSIMP"]
path = Dependencies/ASSIMP
url = https://github.com/assimp/assimp
[submodule "DummyEngine/Libs/GLAD"]
path = DummyEngine/Libs/GLAD
[submodule "Dependencies/GLAD"]
path = Dependencies/GLAD
url = https://github.com/Mag1str02/GLAD
[submodule "DummyEngine/Libs/IMGUI"]
path = DummyEngine/Libs/IMGUI
[submodule "Dependencies/IMGUI"]
path = Dependencies/IMGUI
url = https://github.com/Mag1str02/DummyEngine_ImGui
[submodule "DummyEngine/Libs/NFD"]
path = DummyEngine/Libs/NFD
[submodule "Dependencies/NFD"]
path = Dependencies/NFD
url = https://github.com/btzy/nativefiledialog-extended.git
[submodule "DummyEngine/Libs/OpenAL"]
path = DummyEngine/Libs/OpenAL
url = https://github.com/kcat/openal-soft
[submodule "Dependencies/TRACY"]
path = Dependencies/TRACY
url = https://github.com/Mag1str02/Tracy-Profiler
branch = client_only_0.11.1
8 changes: 8 additions & 0 deletions CMake/All.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if (EXISTS ${CMAKE_SOURCE_DIR}/Config.cmake)
include(Config.cmake)
endif()

include(CMake/Options.cmake)
include(CMake/Platform.cmake)
include(CMake/Utils.cmake)
include(CMake/Compiler.cmake)
67 changes: 67 additions & 0 deletions CMake/Compiler.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fno-omit-frame-pointer")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../Sandbox)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../Sandbox)

# Precompiled headers and libc++
set(ENABLE_PRECOMPILED_HEADERS OFF)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(ENABLE_PRECOMPILED_HEADERS ON)
endif()
if (${DE_FORCE_NO_PCH})
set(ENABLE_PRECOMPILED_HEADERS OFF)
endif()

# Clang Tidy
if(DE_CLANG_TIDY_RUN_ON_COMPILATION)
find_program(CLANG_TIDY_EXE NAMES "clang-tidy" "clang-tidy-17" "clang-tidy-18" "clang-tidy-19" REQUIRED)
set(CLANG_TIDY_COMMAND "${CLANG_TIDY_EXE}" "-p" "${CMAKE_CURRENT_SOURCE_DIR}/build")
if (DE_CLANG_TIDY_WARNINGS_AS_ERRORS)
set(CLANG_TIDY_COMMAND ${CLANG_TIDY_COMMAND} "--warnings-as-errors=*")
endif()
message(STATUS "CLANG_TIDY_COMMAND: [${CLANG_TIDY_COMMAND}]")
endif()

# Sanitizers https://clang.llvm.org/docs/UsersManual.html#controlling-code-generation
if (DE_ENABLE_ASAN AND DE_ENABLE_TSAN)
message(FATAL_ERROR "ASAN and TSAN cannot be used simultaneously")
endif()
if (DE_ENABLE_ASAN AND DE_ENABLE_MSAN)
message(FATAL_ERROR "ASAN and MSAN cannot be used simultaneously")
endif()
if (DE_ENABLE_TSAN AND DE_ENABLE_MSAN)
message(FATAL_ERROR "TSAN and MSAN cannot be used simultaneously")
endif()
if (DE_ENABLE_UBSAN)
add_compile_options(-fsanitize=undefined)
add_link_options(-fsanitize=undefined)
endif()
if (DE_ENABLE_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
if (DE_ENABLE_TSAN)
if (DE_PLATFORM STREQUAL "WINDOWS")
message(FATAL_ERROR "Cannot use TSAN on Windows")
endif()
add_compile_options(-fsanitize=thread)
add_link_options(-fsanitize=thread)
endif()
if (DE_ENABLE_MSAN)
if (DE_PLATFORM STREQUAL "WINDOWS")
message(FATAL_ERROR "Cannot use MSAN on Windows")
endif()
add_compile_options(-fsanitize=memory)
add_link_options(-fsanitize=memory)
endif()

# Warnings
function(add_warnings TARGET)
target_compile_options(${TARGET} PUBLIC -Wall -Wextra -Wpedantic -Wno-extra-semi -Wno-missing-field-initializers -Werror)
if (ENABLE_PRECOMPILED_HEADERS)
target_compile_options(${TARGET} PUBLIC -Winvalid-pch)
endif()
endfunction(add_warnings)
6 changes: 6 additions & 0 deletions CMake/Format.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os
import subprocess
for root, dirs, files in os.walk("."):
for file in files:
if file.endswith(".cpp") or file.endswith(".hpp") or file.endswith(".c") or file.endswith(".h"):
subprocess.run(["clang-format", "-i", "-style=file", os.path.join(root, file)])
20 changes: 20 additions & 0 deletions CMake/Options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
macro(set_option option help value)
option(${option} ${help} ${value})
if(${option})
message(STATUS "${option}: ON")
else()
message(STATUS "${option}: OFF")
endif()
endmacro()


message(STATUS "---Confiring-Project-Options-----------------------------------------------------------------")
set_option(DE_FORMAT_BEFORE_BUILD "Runs clang-format on DummyEngine and DummyEditor before build" OFF)
set_option(DE_CLANG_TIDY_RUN_ON_COMPILATION "Run clang tidy during compilation" OFF)
set_option(DE_CLANG_TIDY_WARNINGS_AS_ERRORS "Set clang warnings as errors" OFF)
set_option(DE_FORCE_NO_PCH "Prevent PCH" OFF)
set_option(DE_ENABLE_UBSAN "Enable UBSAN" OFF)
set_option(DE_ENABLE_ASAN "Enable ASAN" OFF)
set_option(DE_ENABLE_TSAN "Enable TSAN" OFF)
set_option(DE_ENABLE_MSAN "Enable MSAN" OFF)
message(STATUS "---Confired-Project-Options------------------------------------------------------------------")
9 changes: 6 additions & 3 deletions platform.cmake → CMake/Platform.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
if(WIN32)
set(CMAKE_PLATFORM "WINDOWS")
message(STATUS "Platform WINDOWS")
set(DE_PLATFORM "WINDOWS")
add_compile_definitions(DE_PLATFORM_WINDOWS)
endif()
if(UNIX AND NOT APPLE)
set(CMAKE_PLATFORM "LINUX")
message(STATUS "Platform LINUX")
set(DE_PLATFORM "LINUX")
add_compile_definitions(DE_PLATFORM_LINUX)
endif()
if(APPLE)
set(CMAKE_PLATFORM "MACOS")
message(STATUS "Platform MACOS")
set(DE_PLATFORM "MACOS")
add_compile_definitions(DE_PLATFORM_MACOS)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING "Minimum OS X deployment version")
endif()
Expand Down
Loading

0 comments on commit 0b0862b

Please sign in to comment.