Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Exit-9B committed Mar 26, 2022
0 parents commit bfa2722
Show file tree
Hide file tree
Showing 43 changed files with 1,773 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignConsecutiveMacros: 'false'
AlignEscapedNewlines: Left
AlignOperands: DontAlign
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'false'
AllowAllConstructorInitializersOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'true'
AlwaysBreakTemplateDeclarations: 'Yes'
BinPackArguments: 'false'
BinPackParameters: 'false'
BraceWrapping:
AfterCaseLabel: 'true'
AfterClass: 'true'
AfterControlStatement: 'false'
AfterEnum: 'true'
AfterExternBlock: 'true'
AfterFunction: 'true'
AfterNamespace: 'true'
AfterStruct: 'true'
AfterUnion: 'true'
BeforeCatch: 'false'
BeforeElse: 'true'
BeforeLambdaBody: 'true'
IndentBraces: 'false'
SplitEmptyFunction: 'true'
SplitEmptyNamespace: 'true'
SplitEmptyRecord: 'true'
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: 'true'
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
BreakStringLiterals: 'true'
ColumnLimit: 99
CompactNamespaces: 'false'
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true'
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: 'false'
DeriveLineEnding: 'true'
DerivePointerAlignment: 'false'
DisableFormat: 'false'
FixNamespaceComments: 'false'
IncludeBlocks: Preserve
IndentCaseBlocks: 'false'
IndentCaseLabels: 'false'
IndentGotoLabels: 'false'
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: 'true'
KeepEmptyLinesAtTheStartOfBlocks: 'true'
Language: Cpp
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PenaltyBreakAssignment: 200
PenaltyReturnTypeOnItsOwnLine: 1000
PointerAlignment: Left
ReflowComments : 'true'
SortIncludes: 'true'
SortUsingDeclarations: 'true'
SpaceAfterCStyleCast: 'false'
SpaceAfterLogicalNot: 'false'
SpaceAfterTemplateKeyword: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeCpp11BracedList: 'false'
SpaceBeforeCtorInitializerColon: 'true'
SpaceBeforeInheritanceColon: 'true'
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: 'true'
SpaceBeforeSquareBrackets: 'false'
SpaceInEmptyBlock: 'false'
SpaceInEmptyParentheses: 'false'
SpacesBeforeTrailingComments: 2
SpacesInAngles: 'false'
SpacesInCStyleCastParentheses: 'false'
SpacesInConditionalStatement: 'false'
SpacesInContainerLiterals: 'true'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
Standard: c++17
TabWidth: 4
UseCRLF: 'true'
UseTab: AlignWithSpaces

...
21 changes: 21 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{c,cpp,cxx,h,hpp,hxx,inl,ixx}]
indent_style = tab
indent_size = 4

[*.cmake]
indent_style = tab
indent_size = 4

[*.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/CommonLibSSE"]
path = external/CommonLibSSE
url = https://github.com/Ryan-rsm-McKenzie/CommonLibSSE.git
131 changes: 131 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
cmake_minimum_required(VERSION 3.20)

project(
DynamicArmorVariants
VERSION 1.0.0
LANGUAGES CXX
)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(
FATAL_ERROR
"In-source builds are not allowed."
)
endif()

get_filename_component(
Skyrim64Path
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Bethesda Softworks\\Skyrim Special Edition;installed path]"
ABSOLUTE CACHE
)

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${Skyrim64Path}/Data" CACHE PATH
"Install path prefix (e.g. Skyrim Data directory or Mod Organizer virtual directory)."
FORCE
)
endif()

if(CMAKE_GENERATOR MATCHES "Visual Studio")
option(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD "Include INSTALL target to default build." OFF)
endif()

list(APPEND CMAKE_IGNORE_PATH "${PROJECT_BINARY_DIR}")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")

include(AddCXXFiles)

add_library("${PROJECT_NAME}" SHARED)

target_compile_features(
"${PROJECT_NAME}"
PRIVATE
cxx_std_20
)

add_cxx_files("${PROJECT_NAME}")

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/src/Plugin.h.in
${CMAKE_CURRENT_BINARY_DIR}/src/Plugin.h
@ONLY
)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY
)

target_sources(
"${PROJECT_NAME}"
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/src/Plugin.h
${CMAKE_CURRENT_BINARY_DIR}/version.rc
.clang-format
.editorconfig
README.md
vcpkg.json
)

target_precompile_headers(
${PROJECT_NAME}
PRIVATE
src/PCH/PCH.h
)

target_include_directories(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src
)

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
target_compile_options(
"${PROJECT_NAME}"
PRIVATE
"/sdl" # Enable Additional Security Checks
"/utf-8" # Set Source and Executable character sets to UTF-8
"/Zi" # Debug Information Format

"/permissive-" # Standards conformance
"/Zc:preprocessor" # Enable preprocessor conformance mode

"/wd4200" # nonstandard extension used : zero-sized array in struct/union

"$<$<CONFIG:DEBUG>:>"
"$<$<CONFIG:RELEASE>:/Zc:inline;/JMC-;/Ob3>"
)

target_link_options(
"${PROJECT_NAME}"
PRIVATE
"$<$<CONFIG:DEBUG>:/INCREMENTAL;/OPT:NOREF;/OPT:NOICF>"
"$<$<CONFIG:RELEASE>:/INCREMENTAL:NO;/OPT:REF;/OPT:ICF;/DEBUG:FULL>"
)
endif()

add_compile_definitions(SKSE_SUPPORT_XBYAK)

add_subdirectory("external/CommonLibSSE" CommonLibSSE EXCLUDE_FROM_ALL)

find_package(jsoncpp CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(tsl-ordered-map CONFIG REQUIRED)
find_package(xbyak CONFIG REQUIRED)

target_link_libraries(
${PROJECT_NAME}
PRIVATE
CommonLibSSE::CommonLibSSE
jsoncpp_static
spdlog::spdlog
)

install(
FILES "$<TARGET_FILE:${PROJECT_NAME}>"
DESTINATION "SKSE/Plugins"
)
81 changes: 81 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"configurePresets": [
{
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Debug"
}
},
"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"
}
},
"hidden": true,
"name": "vcpkg"
},
{
"cacheVariables": {
"CMAKE_MSVC_RUNTIME_LIBRARY": {
"type": "STRING",
"value": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
},
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
}
},
"hidden": true,
"name": "windows"
},
{
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX"
},
"generator": "Visual Studio 16 2019",
"inherits": [
"cmake-dev",
"vcpkg",
"windows"
],
"name": "vs2019-windows",
"toolset": "v142"
},
{
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4 /WX"
},
"generator": "Visual Studio 17 2022",
"inherits": [
"cmake-dev",
"vcpkg",
"windows"
],
"name": "vs2022-windows",
"toolset": "v143"
}
],
"version": 3
}
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 Parapets

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.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Framework for mods to define variants of armors by swapping armor addons
dynamically at runtime.

## Requirements
* [CMake](https://cmake.org/)
* Add this to your `PATH`
* [Vcpkg](https://github.com/microsoft/vcpkg)
* Add the environment variable `VCPKG_ROOT` with the value as the path to the folder containing vcpkg
* [Visual Studio Community 2022](https://visualstudio.microsoft.com/)
* Desktop development with C++

## Register Visual Studio as a Generator
* Open `x64 Native Tools Command Prompt`
* Run `cmake`
* Close the cmd window

## Building
```
git clone https://github.com/Ryan-rsm-McKenzie/ExamplePlugin-CommonLibSSE
cd ExamplePlugin-CommonLibSSE
git submodule init
git submodule update
cmake --preset vs2022-windows
cmake --build build --config Release
```
Loading

0 comments on commit bfa2722

Please sign in to comment.