Skip to content
Merged
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
131 changes: 131 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
BasedOnStyle: LLVM

AccessModifierOffset: -4

AlignAfterOpenBracket : Align

AlignConsecutiveAssignments : true

AlignConsecutiveDeclarations : true

AlignConsecutiveMacros : true

AlignEscapedNewlines : Right

AlignOperands : true

AlignTrailingComments : true

AllowAllParametersOfDeclarationOnNextLine : false

AllowShortBlocksOnASingleLine : true

AllowShortCaseLabelsOnASingleLine : true

AllowShortFunctionsOnASingleLine : All

AllowShortIfStatementsOnASingleLine : Never

AlwaysBreakAfterReturnType : All

AlwaysBreakBeforeMultilineStrings : true

AlwaysBreakTemplateDeclarations : Yes

BinPackArguments : false

BinPackParameters : false

BreakBeforeBraces : Custom

BraceWrapping :
AfterClass : true
AfterControlStatement : true
AfterCaseLabel : true
AfterEnum : true
AfterFunction : true
AfterNamespace : true
AfterStruct : true
AfterUnion : true
AfterExternBlock : true
BeforeCatch : true
BeforeElse : true
SplitEmptyFunction : false
SplitEmptyRecord : false
SplitEmptyNamespace : false

BreakBeforeBinaryOperators : None

BreakBeforeTernaryOperators : false

BreakConstructorInitializers : AfterColon

BreakInheritanceList : AfterColon

BreakStringLiterals : false

CompactNamespaces : false

ConstructorInitializerAllOnOneLineOrOnePerLine : true

ConstructorInitializerIndentWidth : 4

ContinuationIndentWidth : 4

ExperimentalAutoDetectBinPacking : true

ColumnLimit : 100

Cpp11BracedListStyle : true

FixNamespaceComments : true

IndentAccessModifiers: false

IndentCaseLabels : true

IndentWidth: 4

IndentWrappedFunctionNames : false

KeepEmptyLinesAtTheStartOfBlocks : true

Language : Cpp

MaxEmptyLinesToKeep : 1

NamespaceIndentation : All

PointerAlignment : Left

ReflowComments : true

SpaceBeforeAssignmentOperators : true

SpaceBeforeCtorInitializerColon : false

SpaceBeforeInheritanceColon : true

SpaceBeforeParens : ControlStatements

SpaceBeforeRangeBasedForLoopColon : false

SpaceInEmptyParentheses : false

SpacesBeforeTrailingComments : 1

SpacesInAngles : false

SpacesInCStyleCastParentheses : false

SpacesInContainerLiterals : false

SpacesInParentheses : false

SpacesInSquareBrackets : false

SortIncludes : true

Standard : Auto

UseTab : Never
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bld/
[Oo]bj/
[Ll]og/
[Ll]ogs/
out/

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
71 changes: 71 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
cmake_minimum_required(VERSION 3.30)

# de-duplicate linker inputs
cmake_policy(SET CMP0156 NEW)

cmake_policy(SET CMP0082 NEW)

project(m)

set(M_SOURCE_ROOT ${CMAKE_CURRENT_SOURCE_DIR})

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD "23")

if(MSVC)
add_compile_options(/bigobj)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded)
endif()

include(Common)

## Git (and its revision)
find_package(Git QUIET) # if we don't find git or FindGit.cmake is not on the system we ignore it.
## GetGitRevisionDescription module to retreive branch and revision information from Git
## Starting with Git 1.9 the module will be part of official cMake distribution, until then it has to be
## part of the application
## The Git module will trigger a reconfiguration for each pull that will bring a new revision on the local repository
set (VCS_REVISION "-1")
if(GIT_FOUND)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
message(STATUS "GIT branch ${GIT_REFSPEC}")
message(STATUS "GIT revision ${GIT_SHA1}")
set (VCS_REVISION ${GIT_SHA1})
endif()

# Set the version number of your project here (format is MAJOR.MINOR.PATCHLEVEL - e.g. 1.0.0)
set(VERSION_MAJOR "0")
set(VERSION_MINOR "0")
set(VERSION_PATCH "1")
set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})

include(FetchContent)

FetchContent_Declare(GSL
GIT_REPOSITORY "https://github.com/microsoft/GSL"
GIT_TAG "v4.1.0"
GIT_SHALLOW ON
)

FetchContent_MakeAvailable(GSL)

FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.16.0
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

enable_testing()

include_directories(
${gsl_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/src/include
)

add_subdirectory(src)

109 changes: 109 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
"value": "/MD /Ob1 /O2 /DNDEBUG",
"type": "STRING"
}
]
},
{
"name": "arm64-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_arm64" ],
"variables": [
{
"name": "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
"value": "/MD /Ob1 /O2 /DNDEBUG",
"type": "STRING"
}
]
},
{
"name": "x64-Rel-NoOpt",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "--rerun-failed --output-on-failure",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
"value": "/MD /Od /Ob1 /DNDEBUG",
"type": "STRING"
}
]
},
{
"name": "arm64-Rel-NoOpt",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_arm64" ],
"variables": [
{
"name": "CMAKE_CXX_FLAGS_RELWITHDEBINFO",
"value": "/MD /Od /Ob1 /DNDEBUG",
"type": "STRING"
}
]
},
{
"name": "x64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ]
},
{
"name": "arm64-Clang-Release",
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_arm64_x64" ]
}
]
}
22 changes: 22 additions & 0 deletions CppProperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"configurations": [
{
"inheritEnvironments": [
"msvc_x64"
],
"name": "x64-Rel-NoOpt",
"includePath": [
"${env.INCLUDE}",
"${workspaceRoot}\\**"
],
"defines": [
"WIN32",
"NDEBUG",
"UNICODE",
"_UNICODE"
],
"compilerSwitches": "/std:c++latest",
"intelliSenseMode": "windows-msvc-x64"
}
]
}
Loading