Initial commit

This commit is contained in:
2025-12-19 20:08:22 +00:00
commit 2a30c0d77b
12 changed files with 444 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
srcs/Version.h
# ---> CMake
bin/*
build/*
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
# ---> Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# ---> Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# ---> macOS
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
+41
View File
@@ -0,0 +1,41 @@
{
// Place your esEngine workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Guard": {
"prefix": "esGuard",
"scope": "cpp",
"body": [
"#ifndef ${WORKSPACE_NAME/(\\w+)/${1:/upcase}${1:+_}/g}${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${3:/upcase}${3:+_}/g}${TM_FILENAME/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${1:/upcase}${2:+_}${3:/upcase}${3:+_}/g}GUARD",
"#define ${WORKSPACE_NAME/(\\w+)/${1:/upcase}${1:+_}/g}${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${3:/upcase}${3:+_}/g}${TM_FILENAME/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${1:/upcase}${2:+_}${3:/upcase}${3:+_}/g}GUARD",
"\nnamespace ${WORKSPACE_NAME}\n{",
"\tnamespace ${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/$3/g}\n\t{",
"\n\t} // ${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/$3/g}",
"} // ${WORKSPACE_NAME}",
"\n#endif // ${WORKSPACE_NAME/(\\w+)/${1:/upcase}${1:+_}/g}${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${3:/upcase}${3:+_}/g}${TM_FILENAME/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/${1:/upcase}${2:+_}${3:/upcase}${3:+_}/g}GUARD",
]
},
"Namespace": {
"prefix": "esNamespace",
"scope": "cpp",
"body": [
"\nnamespace ${WORKSPACE_NAME}\n{",
"\tnamespace ${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/$3/g}\n\t{",
"\n\t} // ${TM_DIRECTORY/(\\w+)(?!\\w*$)|(\\W)|(\\w+)/$3/g}",
"} // ${WORKSPACE_NAME}"
]
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"C_Cpp.errorSquiggles": "disabled"
}
+191
View File
@@ -0,0 +1,191 @@
# CMakeList.txt : Top-level CMake project file, do global configuration
# and include sub-projects here.
#
cmake_minimum_required (VERSION 3.10)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/tools/cmake)
include(SubDirList)
get_filename_component(PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
string(REPLACE " " "_" PROJECT_DIR ${PROJECT_DIR})
project(${PROJECT_DIR})
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 1)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_BRANCH "N/A")
set(PROJECT_VERSION_COMMIT "N/A")
# Get the current working branch
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_VERSION_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Get the latest commit hash
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE PROJECT_VERSION_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PROJECT_VERSION_FULL ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}-${PROJECT_VERSION_BRANCH}-${PROJECT_VERSION_COMMIT})
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}/bin)
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/install)
set(CMAKE_CACHEFILE_DIR ${CMAKE_SOURCE_DIR}/build)
include(CTest)
enable_testing()
set(CMAKE_CXX_STANDARD 20)
set(CPACK_PROJECT_NAME ${${PROJECT_NAME}_NAME})
set(CPACK_PROJECT_VERSION ${${PROJECT_NAME}_VERSION})
include(CPack)
option(${PROJECT_NAME}_BUILD_ENGINE "Build engine library" ON)
option(${PROJECT_NAME}_BUILD_APPS "Build supplimentary applications" ON)
option(${PROJECT_NAME}_BUILD_DEPS "Build dependencies" ON)
option(ONLY_COVERAGE "Build only tests necessary for coverage" OFF)
option(LIBCPP "Build with libc++" OFF)
option(ENABLE_COVERAGE "Enable coverage reporting for gcc/clang" OFF)
option(ENABLE_ASAN "Enable address sanitizer" OFF)
option(BUILD_SHARED_LIBS "Enable compilation of shared libraries" OFF)
option(ENABLE_TESTING "Enable the building of the test" OFF)
option(ENABLE_CLANG_TIDY "Enable testing with clang-tidy" OFF)
option(ENABLE_CPPCHECK "Enable testing with cppcheck" OFF)
option(SIMPLE_BUILD "Build the project as minimally as possible" OFF)
option(BUILD_DOC "Build the project's documentation" OFF)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
option(DEBUG_LOGGING "Enabling debug logging" OFF)
add_library(project_warnings INTERFACE)
add_library(project_options INTERFACE)
if(ONLY_COVERAGE OR ENABLE_COVERAGE)
target_compile_options(project_options INTERFACE --coverage -O0 -g)
target_link_libraries(project_options INTERFACE --coverage)
endif()
if(ENABLE_ASAN)
target_compile_options(project_options INTERFACE -fsanitize=address)
target_link_libraries(project_options INTERFACE -fsanitize=address)
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(project_warnings
INTERFACE
-Wall
-Wextra
-Wshadow
-Wnon-virtual-dtor
-Wold-style-cast
-Wcast-align
-Wunused
-Woverloaded-virtual
-Wpedantic
-Wconversion
-Wsign-conversion
-Wnull-dereference
-Wdouble-promotion
-Wformat=2)
endif()
# some GCC specific warnings. These flags are added only if the used compiler is GCC.
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(project_warnings
INTERFACE
-Wmisleading-indentation
-Wduplicated-cond
-Wlogical-op
-Wuseless-cast
)
target_link_libraries(project_options INTERFACE stdc++fs)
endif()
if (${FORCE_COLORED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(project_options INTERFACE -fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(project_options INTERFACE -fcolor-diagnostics)
endif ()
endif ()
find_program(CCACHE ccache)
if(CCACHE)
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
endif()
if(ENABLE_CPPCHECK)
find_program(CPPCHECK cppcheck)
if(CPPCHECK)
set(CMAKE_CXX_CPPCHECK
${CPPCHECK}
--suppress=syntaxError
--enable=all
--inconclusive)
else()
message(SEND_ERROR "cppcheck requested but executable not found")
endif()
endif()
if(ENABLE_CLANG_TIDY)
find_program(CLANGTIDY clang-tidy)
if(CLANGTIDY)
set(CMAKE_CXX_CLANG_TIDY ${CLANGTIDY})
else()
message(SEND_ERROR "clang-tidy requested but executable not found")
endif()
endif()
if(BUILD_DOC)
find_package(Doxygen)
if (DOXYGEN_FOUND)
SET(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in)
SET(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
add_custom_target(doc ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Buidling Doxygen documentation"
VERBATIM )
else (DOXYGEN_FOUND)
message("No doxygen binary found on the system.")
SET(${BUILD_DOC} OFF)
endif ()
endif()
message(STATUS "")
message(STATUS "Summary")
#message(STATUS "")
#message(STATUS "Build libs: \t ${${PROJECT_NAME}_BUILD_DEPS}")
#message(STATUS "Build src: \t ${${PROJECT_NAME}_BUILD_ENGINE}")
message(STATUS "")
message(STATUS "Build type: \t ${CMAKE_BUILD_TYPE}")
message(STATUS "Install prefix: \t ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Testing enabled: \t ${ENABLE_TESTING}")
message(STATUS "Clang-tidy: \t ${ENABLE_CLANG_TIDY}")
message(STATUS "Cppcheck: \t ${ENABLE_CPPCHECK}")
message(STATUS "Compiler: \t ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Sanizizers: \t ${ENABLE_ASAN}")
message(STATUS "Shared libs: \t ${BUILD_SHARED_LIBS}")
message(STATUS "Build libcpp: \t ${LIBCPP}")
message(STATUS "CCache executable:\t ${CCACHE}")
message(STATUS "Building doc: \t ${BUILD_DOC}")
message(STATUS "Force color output:\t ${FORCE_COLORED_OUTPUT}")
message(STATUS "")
message(STATUS "Version: \t ${${PROJECT_NAME}_VERSION}")
message(STATUS "")
add_subdirectory("libs")
add_subdirectory("srcs")
+11
View File
@@ -0,0 +1,11 @@
zlib License
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
+3
View File
@@ -0,0 +1,3 @@
# esProject
Eugene Smile's CMake Project Template
+11
View File
@@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"cmake.generator": "Ninja",
}
}
}
+10
View File
@@ -0,0 +1,10 @@
set(TARGET_NAME ${PROJECT_NAME}_LIBS)
message(STATUS "Configuring ${TARGET_NAME} third party libraries")
set(LIBS_LIST "")
SubDirList(${CMAKE_CURRENT_LIST_DIR} LIBS_LIST)
foreach(LIB_DIR IN LISTS LIB_LIST)
message(STATUS "Adding library: ${LIB_DIR}")
add_subdirectory(${LIB_DIR})
endforeach()
+54
View File
@@ -0,0 +1,54 @@
set(TARGET_NAME ${PROJECT_NAME})
message(STATUS "Configuring ${TARGET_NAME}")
# Build configuration
configure_file(
${CMAKE_CURRENT_LIST_DIR}/Version.h.in
${CMAKE_CURRENT_LIST_DIR}/Version.h)
set(${PROJECT_NAME}_SOURCES "main.cpp")
set(${PROJECT_NAME}_INCLUDES "Version.h")
set(${PROJECT_NAME}_INCLUDE_DIRS "")
set(${PROJECT_NAME}_DEPENDENCIES "")
# Find all subdirectories
set(SUBDIRS_LIST "")
SubDirList(${CMAKE_CURRENT_LIST_DIR} SUBDIRS_LIST)
foreach(SUBDIR IN LISTS SUBDIRS_LIST)
if (NOT ${PROJECT_NAME}_BUILD_SUBDIR_${SUBDIR})
option(${PROJECT_NAME}_BUILD_SUBDIR_${SUBDIR} "Build ${SUBDIR} subdirectory" ON)
endif()
if(${PROJECT_NAME}_BUILD_SUBDIR_${SUBDIR})
file(GLOB SUBDIR_SOURCES ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.cc ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.cpp)
list(APPEND ${PROJECT_NAME}_SOURCES ${SUBDIR_SOURCES})
file(GLOB SUBDIR_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR}/*.h)
list(APPEND ${PROJECT_NAME}_INCLUDES ${SUBDIR_INCLUDES})
list(APPEND ${PROJECT_NAME}_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/${SUBDIR})
endif()
endforeach()
add_executable(${TARGET_NAME} ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_INCLUDES})
if(NOT ${${PROJECT_NAME}_DEPENDENCIES})
add_dependencies(${TARGET_NAME} ${${PROJECT_NAME}_DEPENDENCIES})
target_link_libraries(${TARGET_NAME} ${${PROJECT_NAME}_DEPENDENCIES})
endif()
#include_directories(${CMAKE_CURRENT_LIST_DIR})
#target_include_directories(${TARGET_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR})
install(TARGETS ${TARGET_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${TARGET_NAME}/
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${TARGET_NAME}/
ARCHIVE DESTINATION ${CMAKE_INSTALL_SHAREDSTATEDIR})
message(STATUS "")
message(STATUS "${TARGET_NAME} summary")
message(STATUS "")
foreach(SUBDIR IN LISTS SUBDIRS_LIST)
message(STATUS "Build subdirectory ${SUBDIR}: \t \t ${${PROJECT_NAME}_BUILD_SUBDIR_${SUBDIR}}")
endforeach()
message(STATUS "")
+6
View File
@@ -0,0 +1,6 @@
#define PROJECT_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
#define PROJECT_VERSION_MINOR @PROJECT_VERSION_MINOR@
#define PROJECT_VERSION_PATCH @PROJECT_VERSION_PATCH@
#define VERSION_BRANCH @PROJECT_VERSION_BRANCH@
#define VERSION_COMMIT @PROJECT_VERSION_COMMIT@
#define VERSION_FULL "@PROJECT_VERSION_FULL@"
+5
View File
@@ -0,0 +1,5 @@
int main(int argc, char **argv)
{
return 0;
}
+8
View File
@@ -0,0 +1,8 @@
macro(SubDirList curdir result)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
list(APPEND ${result} ${child})
endif()
endforeach()
endmacro()