Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ThirdEyeSqueegee committed May 9, 2024
0 parents commit 6111afa
Show file tree
Hide file tree
Showing 24 changed files with 1,643 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 @@
---
BasedOnStyle: WebKit
AlignAfterOpenBracket: Align
AlignArrayOfStructures: Right
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowShortCompoundRequirementOnASingleLine: true
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowBreakBeforeNoexceptSpecifier: OnlyWithParen
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __declspec
- __cdecl
- __stdcall
- __fastcall
- __try
- __except
- __assume
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: MultiLine
AfterEnum: true
AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAdjacentStringLiterals: false
BreakBeforeBraces: Custom
BreakConstructorInitializers: BeforeColon
ColumnLimit: 180
FixNamespaceComments: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: CRLF
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
QualifierAlignment: Custom
QualifierOrder:
- inline
- static
- constexpr
- const
- volatile
- restrict
- friend
- type
SeparateDefinitionBlocks: Always
SpaceBeforeCpp11BracedList: false
SpaceInEmptyBlock: false
TabWidth: 4
UseTab: Never
---
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[*]
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true

[*.{h,cmake,cpp}]
indent_style = space
indent_size = 4

[*.json]
indent_style = space
indent_size = 2
32 changes: 32 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Prettier

on:
push:
branches: main
paths:
- "**.json"
- "**.yml"
workflow_dispatch:

permissions:
contents: write

jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run Prettier
uses: actionsx/prettier@v3
with:
args: --write "${{ github.workspace }}/*.json"

- name: Add & Commit
uses: EndBug/add-and-commit@v9
with:
message: "ci: formatting"
default_author: github_actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/testbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Test Build

on:
push:
branches: main
paths:
- "**.h"
- "**.cpp"
- "**.yml"
workflow_dispatch:

env:
VCPKG_COMMIT_ID: 28b1cf627c0570b3e094192df2fce31a3a2bc1d3

jobs:
test-build:
runs-on: windows-latest
strategy:
matrix:
preset:
- debug
- release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get CMake
uses: lukka/get-cmake@latest

- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}

- name: Initialize submodules
run: git submodule update --init --recursive

- name: Run CMake
uses: lukka/run-cmake@v10
with:
configurePreset: build-${{ matrix.preset }}-msvc
buildPreset: ${{ matrix.preset }}-msvc
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build
*ReSharper*
.vs
.idea
contrib/Plugin*
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "extern/CommonLibSSE-NG"]
path = extern/CommonLibSSE-NG
url = https://github.com/alandtse/CommonLibVR
branch = ng
120 changes: 120 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
cmake_minimum_required(VERSION 3.29)
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")

project(
DynamicWait
VERSION 1.0.0
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF)
set(CMAKE_OPTIMIZE_DEPENDENCIES ON)

include(GNUInstallDirs)

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

set(PUBLIC_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME})

# Add headers
file(
GLOB_RECURSE
headers
${CMAKE_CURRENT_SOURCE_DIR}/include/*.h
${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp
)
list(REMOVE_ITEM headers ${CMAKE_CURRENT_SOURCE_DIR}/include/PCH.h)

# Add sources
file(
GLOB_RECURSE
sources
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cc
${CMAKE_CURRENT_BINARY_DIR}/version.rc
)

source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${headers} ${sources}
)

set(BUILD_TESTS OFF)
add_subdirectory(extern/CommonLibSSE-NG)
include(extern/CommonLibSSE-NG/cmake/CommonLibSSE.cmake)

add_commonlibsse_plugin(
${PROJECT_NAME}
AUTHOR ThirdEyeSqueegee
SOURCES ${headers} ${sources}
)

add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

find_path(SIMPLEINI_INCLUDE_DIRS "SimpleIni.h")

# target_link_libraries(
# ${PROJECT_NAME}
# PRIVATE
# SomeLibrary::SomeLibrary
# )
target_include_directories(
${PROJECT_NAME}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/src>
$<INSTALL_INTERFACE:src>
${SIMPLEINI_INCLUDE_DIRS}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)

target_precompile_headers(
${PROJECT_NAME}
PRIVATE
include/PCH.h
${SIMPLEINI_INCLUDE_DIRS}/SimpleIni.h
)

install(
DIRECTORY ${PUBLIC_HEADER_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

if (CMAKE_BUILD_TYPE STREQUAL Debug)
set(BUILD_NAME Debug)
else ()
set(BUILD_NAME Release)
endif ()

add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/skse/plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/skse/plugins
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_PDB_FILE:${PROJECT_NAME}> ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/skse/plugins
COMMAND
${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Config/${PROJECT_NAME}.ini ${CMAKE_CURRENT_SOURCE_DIR}/contrib/Plugin${BUILD_NAME}/skse/plugins
)

file(GLOB_RECURSE OUTPUT_DLLS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.dll)
file(GLOB_RECURSE OUTPUT_PDBS ${CMAKE_CURRENT_SOURCE_DIR}/contrib/**/*.pdb)

set_property(
TARGET ${PROJECT_NAME}
APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${OUTPUT_DLLS} ${OUTPUT_PDBS}
)
Loading

0 comments on commit 6111afa

Please sign in to comment.