Skip to content

Commit

Permalink
Merge pull request #10 from viniciusalmada/dev
Browse files Browse the repository at this point in the history
Update main version
  • Loading branch information
viini42 authored Apr 21, 2024
2 parents abb7805 + b32fb7c commit f5e0191
Show file tree
Hide file tree
Showing 181 changed files with 16,096 additions and 2,833 deletions.
42 changes: 42 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
Checks: '
-*,
bugprone-*,
cert-*,
clang-analyzer-*,
cppcoreguidelines-*,
misc-*,
modernize-*,
performance-*,
readability-*,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-special-member-functions,
-misc-confusable-identifiers,
-misc-include-cleaner,
-modernize-use-trailing-return-type,
-readability-braces-around-statements,
-readability-identifier-length,
-readability-uppercase-literal-suffix,
'
# REVISIT -cppcoreguidelines-macro-usage,
WarningsAsErrors: "*,-cppcoreguidelines-pro-type-reinterpret-cast,-*-use-default-member-init"
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
#HeaderFilterRegex: 'ge_*'
AnalyzeTemporaryDtors: true
FormatStyle: file
SystemHeaders: false
UseColor: true
CheckOptions:
misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic: true
...

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build*/
cmake-build-*/
*.ini
.idea/
.idea/
.cache/
.fleet
7 changes: 7 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[submodule "vendor/imgui"]
path = vendor/imgui
url = https://github.com/ocornut/imgui.git
branch = docking
[submodule "vendor/vcpkg"]
path = vendor/vcpkg
url = https://github.com/microsoft/vcpkg
27 changes: 20 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
cmake_minimum_required(VERSION 3.24)

if (NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
message(STATUS "Defining vcpkg as toolchain file")
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/vendor/vcpkg/scripts/buildsystems/vcpkg.cmake)
message(STATUS ${CMAKE_TOOLCHAIN_FILE})
endif ()

project(Grapengine CXX)

set(CMAKE_CXX_SCAN_FOR_MODULES OFF)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
add_compile_options(-fdiagnostics-color=always -fansi-escape-codes)
endif ()
endif ()

set(ENGINE_NAME Grapengine)
set(ENGINE_INCLUDE ${CMAKE_SOURCE_DIR}/include/Grapengine)
include(CompilationOptions.cmake)

# #############################################################################
# Engine
add_subdirectory(src)
add_subdirectory(Grapengine)

# #############################################################################
# App
add_subdirectory(app)
add_subdirectory(Wineglass)

# #############################################################################
# Tests
add_subdirectory(tests)
add_subdirectory(Grapengine/tests)
146 changes: 146 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "h_default",
"binaryDir": "${sourceDir}/build-${presetName}",
"hidden": true,
"generator": "Ninja"
},
{
"name": "h_debug",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "h_release",
"hidden": true,
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "h_toolchain-msvc",
"hidden": true,
"vendor": {
"jetbrains.com/clion": {
"toolchain": "MSVC"
}
}
},
{
"name": "h_toolchain-clang",
"hidden": true,
"vendor": {
"jetbrains.com/clion": {
"toolchain": "CLANG"
}
}
},
{
"name": "h_toolchain-gcc",
"hidden": true,
"vendor": {
"jetbrains.com/clion": {
"toolchain": "GCC"
}
}
},
{
"name": "microsoft-cl-debug",
"inherits": [
"h_default",
"h_debug",
"h_toolchain-msvc"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl"
}
},
{
"name": "microsoft-cl-release",
"inherits": [
"h_default",
"h_release",
"h_toolchain-msvc"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "cl"
}
},
{
"name": "llvm-clang-cl-debug",
"inherits": [
"h_default",
"h_debug",
"h_toolchain-clang"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang-cl"
}
},
{
"name": "llvm-clang-cl-release",
"inherits": [
"h_default",
"h_release",
"h_toolchain-clang"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang-cl"
}
},
{
"name": "llvm-clang-gcc-debug",
"inherits": [
"h_default",
"h_debug",
"h_toolchain-clang"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "llvm-clang-gcc-release",
"inherits": [
"h_default",
"h_release",
"h_toolchain-clang"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "gnu-gcc-debug",
"inherits": [
"h_default",
"h_debug",
"h_toolchain-gcc"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
},
{
"name": "gnu-gcc-release",
"hidden": false,
"inherits": [
"h_default",
"h_release",
"h_toolchain-gcc"
],
"cacheVariables": {
"CMAKE_CXX_COMPILER": "g++"
}
}
]
}
69 changes: 69 additions & 0 deletions CompilationOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
add_library(GrapengineCompileOptions INTERFACE)

message(STATUS "GRAPENGINE: Setting up compiler flags = ${CMAKE_CXX_COMPILER_ID}:${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(GrapengineCompileOptions INTERFACE GE_MSVC_COMPILER)
target_compile_options(GrapengineCompileOptions INTERFACE
/Wall # Enable most common warnings
/W4 # Set warning level 4 (highest warning level)
/wd4625 # Copy constructor implicitly deleted
/wd4626 # Copy assignment operator implicitly deleted
/wd5026 # Move constructor operator implicitly deleted
/wd5027 # Move assignment operator implicitly deleted
/wd4820 # bytes padding
/wd4711 # inline expansion
/wd4710 # not inlined (??)
/wd5039 # extern C
/wd4061 # explicitly handled by case
/wd4868 # enforce left-to-right
/wd5045 # insert Spectre mitigation
$<$<CONFIG:Release>:/WX> # Treat warnings as errors
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_definitions(GrapengineCompileOptions INTERFACE GE_GCC_COMPILER)
target_compile_options(GrapengineCompileOptions INTERFACE
-Wall # Enable most common warnings
-Wextra # Enable extra warnings
-Wempty-body
-Wpedantic # Issue all the warnings demanded by strict ISO C and ISO C++
$<$<CONFIG:Release>:-Werror> # Treat warnings as errors
-Wconversion # Warn for implicit conversions that may change the value
-Wsign-conversion # Warn for signed-to-unsigned conversion
-Wunreachable-code # Warn if the compiler detects code that will never be executed
-Wunused # Warn about variables or functions that are defined but never used
-Wunused-parameter # Warn about unused function parameters
-Wunused-variable # Warn about unused variables
-Wfloat-equal # Warn if floating-point values are compared for equality
-Wshadow # Warn whenever a local variable shadows another local variable
-Wuninitialized # Warn about uninitialized variables
-Wmaybe-uninitialized # Warn about variables that may be uninitialized
-Wunused-label # Warn when a label is declared but not used
-Wsuggest-override # Warn if a function could be marked override
-Wnon-virtual-dtor # Warn when a class has a non-virtual destructor
)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
target_compile_definitions(GrapengineCompileOptions INTERFACE GE_CLANG_COMPILER)
target_compile_options(GrapengineCompileOptions INTERFACE
-Wall # Enable most warning messages
-Wextra # Enable some extra warning messages
-Wpedantic # Warn about non-portable constructs
$<$<CONFIG:Release>:-Werror> # Treat warnings as errors
-Wshadow # Warn whenever a local variable shadows another local variable
-Wconversion # Warn for implicit conversions that may change the value
-Wsign-conversion # Warn for implicit conversions that may change the sign
-Wformat=2 # Check printf/scanf format strings
-Wundef # Warn if an undefined identifier is evaluated in an #if directive
-Wunreachable-code # Warn if code will never be executed
-Wunused # Warn about unused functions, variables, etc.
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-exit-time-destructors

)
else ()
message(FATAL_ERROR "Unsupported CLANG frontend (CMAKE_CXX_COMPILER_FRONTEND_VARIANT = ${CMAKE_CXX_COMPILER_FRONTEND_VARIANT})")
endif ()
else ()
message(FATAL_ERROR "Unsupported compiler (CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID})")
endif ()
Loading

0 comments on commit f5e0191

Please sign in to comment.