Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: 'true'

- name: Setup .NET Core SDK
uses: actions/[email protected]
Expand Down Expand Up @@ -135,6 +137,8 @@ jobs:
steps:
- name: Checkout
uses: actions/[email protected]
with:
submodules: 'true'

- name: Setup .NET Core SDK
uses: actions/[email protected]
Expand Down Expand Up @@ -245,6 +249,8 @@ jobs:

- name: Checkout
uses: actions/[email protected]
with:
submodules: 'true'

- name: Setup .NET Core SDK
uses: actions/[email protected]
Expand Down Expand Up @@ -311,6 +317,8 @@ jobs:

- name: Checkout repository
uses: actions/[email protected]
with:
submodules: 'true'

- name: Setup .NET Core SDK
uses: actions/[email protected]
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "dynalo"]
path = gm_dotnet_native/external_includes/dynalo
url = https://github.com/Stat1cV01D/dynalo.git
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ Gmod.NET is making use of or borrows code from the following projects:

4. [Libsodium](http://libsodium.org) by [Frank Denis](https://github.com/jedisct1) (ISC License)

5. [dynalo](https://github.com/Stat1cV01D/dynalo) originally by [maddouri](https://github.com/maddouri/dynalo) (MIT License)

See other copyright notices in the NOTICE file.
149 changes: 149 additions & 0 deletions gm_dotnet_native/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@

---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
#AlignConsecutiveAssignments: AcrossComments
#AlignConsecutiveDeclarations: AcrossComments
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLambdasOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
#BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakInheritanceList: BeforeComma
BreakStringLiterals: true
ColumnLimit: 140
CommentPragmas: '^ IWYU pragma:|^!|^:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
# C stdlib
- Regex: '^<c[[:alnum:]]+>$'
Priority: 1
# C++ stdlib
- Regex: '^<(algorithm|any|array|bit|bitset|deque|exception|execution|filesystem|forward_list|fstream|functional|future|initializer_list|iomanip|ios|iostream|istream|iterator|limits|list|locale|map|memory_resource|memory|mutex|new|numeric|optional|ostream|queue|random|ranges|ratio|regex|scoped_allocator|set|shared_mutex|span|sstream|stack|stdexcept|streambuf|string_view|string|strstream|syncstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector)>$'
Priority: 2
# C++ stdlib (experimental)
- Regex: '^<experimental/[[:alnum:]]+>$'
Priority: 3
# Windows.h
- Regex: '^<[Ww]indows.h>$'
Priority: 8
# Global
- Regex: '^<.+>$'
Priority: 9
# Local (private)
- Regex: '^"private/.+"$'
Priority: 10
# Local
- Regex: '^".+"$'
Priority: 11
IncludeIsMainRegex: '(Test)?$'
#IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequires: true
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: Wrapped
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakString: 600
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Left
ReflowComments: false
SortIncludes: true #CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Before
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpaceBeforeInheritanceColon: false
SpaceBeforeParens: Never
SpaceBeforeRangeBasedForLoopColon: false
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros: [emit]
StatementMacros: [Q_UNUSED]
TabWidth: 4
UseTab: Never
27 changes: 22 additions & 5 deletions gm_dotnet_native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,24 @@ set(NET_CORE_VERSION "1.0.0" CACHE STRING "Version of bundled .NET Core Runtime"

#Project name
project(gm_dotnet_native)
add_library(gm_dotnet_native SHARED src/gm_dotnet.cpp dotnethelper-src/cleanup_function_type.h)
add_library(dotnethelper SHARED dotnethelper-src/dotnethelper.cpp dotnethelper-src/cleanup_function_type.h
dotnethelper-src/LuaAPIExposure.h dotnethelper-src/LuaAPIExposure.cpp)
add_library(gm_dotnet_native SHARED
src/gm_dotnet.cpp
dotnethelper-src/cleanup_function_type.h
utils/path.cpp
)
add_library(dotnethelper SHARED
dotnethelper-src/dotnethelper.cpp
dotnethelper-src/cleanup_function_type.h
dotnethelper-src/LuaAPIExposure.h
dotnethelper-src/LuaAPIExposure.cpp
dotnethelper-src/hostfxr_interop.cpp
utils/path.cpp
)
#Set up external include libraries
include_directories ("${EXTERNAL_INCLUDES_PATH}")
include_directories ("${EXTERNAL_INCLUDES_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}")
add_subdirectory ("${EXTERNAL_INCLUDES_PATH}/dynalo")
target_link_libraries(gm_dotnet_native PUBLIC dynalo)
target_link_libraries(dotnethelper PUBLIC dynalo)
#Set up compile definitions
target_compile_definitions(gm_dotnet_native PUBLIC SEM_VERSION="${SEM_VERSION}")
target_compile_definitions(dotnethelper PUBLIC SEM_VERSION="${SEM_VERSION}")
Expand All @@ -37,7 +50,11 @@ set_target_properties(dotnethelper PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_C
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../build)
#Add linux helper lib
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_library(linuxhelper SHARED linux-helper-src/segv_signal_handler.h linux-helper-src/segv_signal_handler.cpp)
add_library(linuxhelper SHARED
linux-helper-src/segv_signal_handler.h
linux-helper-src/segv_signal_handler.cpp
utils/path.cpp
)
set_target_properties(linuxhelper PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../build
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../build)
endif()
Expand Down
5 changes: 1 addition & 4 deletions gm_dotnet_native/dotnethelper-src/LuaAPIExposure.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
//
// Created by Gleb Krasilich on 06.10.2019.
//
#pragma once

#ifndef GM_DOTNET_NATIVE_LUAAPIEXPOSURE_H
#define GM_DOTNET_NATIVE_LUAAPIEXPOSURE_H
#include <GarrysMod/Lua/Interface.h>
#include <GarrysMod/Lua/LuaBase.h>

Expand Down Expand Up @@ -333,5 +332,3 @@ double export_check_number(GarrysMod::Lua::ILuaBase * lua, int iStackPos);
/// \param lua ILuaBase pointer
/// \param val function to push on stack
void export_push_c_function_safe(GarrysMod::Lua::ILuaBase * lua, GarrysMod::Lua::CFunc safe_wrapper, GarrysMod::Lua::CFunc val);

#endif //GM_DOTNET_NATIVE_LUAAPIEXPOSURE_H
5 changes: 1 addition & 4 deletions gm_dotnet_native/dotnethelper-src/cleanup_function_type.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
//
// Created by glebc on 11.10.2020.
//
#pragma once

#ifndef GM_DOTNET_NATIVE_CLEANUP_FUNCTION_TYPE_H
#define GM_DOTNET_NATIVE_CLEANUP_FUNCTION_TYPE_H
#include <GarrysMod/Lua/LuaBase.h>

typedef void(*cleanup_function_fn)(GarrysMod::Lua::ILuaBase* lua);

#endif //GM_DOTNET_NATIVE_CLEANUP_FUNCTION_TYPE_H
Loading