Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shad0wshayd3 committed Aug 15, 2023
0 parents commit 3542416
Show file tree
Hide file tree
Showing 25 changed files with 1,090 additions and 0 deletions.
100 changes: 100 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignArrayOfStructures: Left
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: Consecutive
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Right
AlignOperands: Align
AllowAllArgumentsOnNextLine: False
AllowAllParametersOfDeclarationOnNextLine: False
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: False
AllowShortEnumsOnASingleLine: False
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Inline
AllowShortLoopsOnASingleLine: False
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: False
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: False
BinPackParameters: False
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: True
AfterClass: True
AfterControlStatement: Always
AfterEnum: True
AfterFunction: True
AfterNamespace: True
AfterStruct: True
AfterUnion: True
AfterExternBlock: True
BeforeCatch: True
BeforeElse: True
BeforeLambdaBody: True
BeforeWhile: True
IndentBraces: False
SplitEmptyFunction: False
SplitEmptyRecord: False
SplitEmptyNamespace: False
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: True
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: False
ColumnLimit: 0
CompactNamespaces: False
Cpp11BracedListStyle: False
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: Always
FixNamespaceComments: False
IncludeBlocks: Preserve
IndentAccessModifiers: False
IndentCaseBlocks: True
IndentCaseLabels: True
IndentExternBlock: AfterExternBlock
IndentGotoLabels: False
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: True
KeepEmptyLinesAtTheStartOfBlocks: False
LambdaBodyIndentation: Signature
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PPIndentWidth: 1
PackConstructorInitializers: NextLine
PointerAlignment: Left
QualifierAlignment: Custom
QualifierOrder: ['inline', 'static', 'const', 'type']
ReferenceAlignment: Left
ReflowComments: False
SeparateDefinitionBlocks: Always
SortIncludes: CaseInsensitive
SpaceAfterCStyleCast: False
SpaceAfterLogicalNot: False
SpaceAfterTemplateKeyword: False
SpaceBeforeAssignmentOperators: True
SpaceBeforeCaseColon: False
SpaceBeforeCpp11BracedList: False
SpaceBeforeCtorInitializerColon: True
SpaceBeforeInheritanceColon: True
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: True
SpaceBeforeSquareBrackets: False
SpaceInEmptyBlock: False
SpaceInEmptyParentheses: False
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInCStyleCastParentheses: False
SpacesInConditionalStatement: False
SpacesInContainerLiterals: True
SpacesInParentheses: False
SpacesInSquareBrackets: False
Standard: Latest
TabWidth: 4
UseCRLF: True
UseTab: AlignWithSpaces
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[*]
charset = utf-8
insert_final_newline = true

[*.{hpp,cpp}]
indent_style = tab
indent_size = 4

[{CMakeLists.txt,*.cmake,*.cmake.in}]
indent_style = tab
indent_size = 4

[*.{json,yml}]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
33 changes: 33 additions & 0 deletions .github/workflows/maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Scripted maintenance

on: [ push, pull_request_target ]

jobs:
maintenance:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: ${{ runner.temp }}/llvm
key: llvm-14

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "14"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}

- name: Run clang-format
run: find -type f \( -name *.h -o -name *.cpp \) | xargs clang-format -style=file -i

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: maintenance
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "extern/BethesdaCMakeModules"]
path = extern/BethesdaCMakeModules
url = https://github.com/shad0wshayd3/BethesdaCMakeModules.git
[submodule "extern/CommonLibF4"]
path = extern/CommonLibF4
url = https://github.com/shad0wshayd3/CommonLibF4.git
74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.22)
set(NAME "BakaSurvivalSettings")
set(VERSION 1.0.0)

# ---- Options ----

option(COPY_BUILD "Copy the build output to the Fallout 4 directory." OFF)

# ---- Cache build vars ----

macro(set_from_environment VARIABLE)
if (NOT DEFINED ${VARIABLE} AND DEFINED ENV{${VARIABLE}})
set(${VARIABLE} $ENV{${VARIABLE}})
endif()
endmacro()

macro(find_commonlib_path)
if (CommonLibName AND NOT ${CommonLibName} STREQUAL "")
# Check extern
find_path(CommonLibPath
NAMES
include/REL/Relocation.h
PATHS
extern/${CommonLibName}
extern/${CommonLibName}/${CommonLibName}
)
if (${CommonLibName} STREQUAL "CommonLibName-NOTFOUND")
#Check path
set_from_environment(${CommonLibName}Path)
set(CommonLibName ${${CommonLibName}Path})
endif()
endif()
endmacro()

set_from_environment(VCPKG_ROOT)
if (NOT DEFINED VCPKG_ROOT)
message(
WARNING
"Variable VCPKG_ROOT is not set. Continuing without vcpkg."
)
endif()

set_from_environment(Fallout4Path)
set(CommonLibName "CommonLibF4")
find_commonlib_path("CommonLibF4")

message(
STATUS
"Building for Fallout 4 at ${Fallout4Path} with ${CommonLibName} at ${CommonLibPath}."
)

set(Boost_USE_STATIC_RUNTIME OFF CACHE BOOL "")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE STRING "")

# ---- Project ----

project(
${NAME}
VERSION ${VERSION}
LANGUAGES CXX
)

# ---- Include guards ----

if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there."
)
endif()

# ---- Subdirectories ----

add_subdirectory(src)
65 changes: 65 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"configurePresets": [
{
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Release"
}
},
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
}
},
{
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": {
"type": "STRING",
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
"VCPKG_OVERLAY_PORTS": {
"type": "STRING",
"value": "${sourceDir}/cmake/ports/"
}
},
"hidden": true,
"name": "vcpkg"
},
{
"cacheVariables": {
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
},
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static"
}
},
"hidden": true,
"name": "windows"
},
{
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX",
"CMAKE_CXX_FLAGS_RELEASE": "/O2 /DNDEBUG"
},
"generator": "Visual Studio 17 2022",
"inherits": [
"cmake-dev",
"vcpkg",
"windows"
],
"name": "vs2022-windows-vcpkg",
"toolset": "v143"
}
],
"version": 2
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 shad0wshayd3

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions cmake/Version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace Version
{
inline constexpr std::size_t MAJOR = @PROJECT_VERSION_MAJOR@;
inline constexpr std::size_t MINOR = @PROJECT_VERSION_MINOR@;
inline constexpr std::size_t PATCH = @PROJECT_VERSION_PATCH@;
inline constexpr auto NAME = "@PROJECT_VERSION@"sv;
inline constexpr auto PROJECT = "@PROJECT_NAME@"sv;
}
18 changes: 18 additions & 0 deletions cmake/ports/autotoml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO shad0wshayd3/AutoTOML
REF fc0ba2364334503684c4d4dbda6bd10c35dde1fb
SHA512 36e8d2d7f042256723b28865067a7317b4783a419c16c62c02a0b5b4ed1e2256d4ed485a0a921bcd5b74ab74007f6d619e1cf06f63eccf386ea56b7d87785a25
HEAD_REF master
)

vcpkg_cmake_configure(SOURCE_PATH ${SOURCE_PATH})
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/AutoTOML)

file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug
${CURRENT_PACKAGES_DIR}/lib
)

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
17 changes: 17 additions & 0 deletions cmake/ports/autotoml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "autotoml",
"version-string": "2021-12-18",
"homepage": "https://github.com/shad0wshayd3/AutoTOML",
"license": "MIT",
"dependencies": [
"tomlplusplus",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
Loading

0 comments on commit 3542416

Please sign in to comment.