Skip to content

Commit

Permalink
Merge pull request #10 from ModOrganizer2/dev/modernize_repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 12, 2024
2 parents 01f774d + db5c3a2 commit bd825f8
Show file tree
Hide file tree
Showing 16 changed files with 396 additions and 229 deletions.
41 changes: 41 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# We'll use defaults from the LLVM style, but with 4 columns indentation.
BasedOnStyle: LLVM
IndentWidth: 2
---
Language: Cpp
DeriveLineEnding: false
UseCRLF: true
DerivePointerAlignment: false
PointerAlignment: Left
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: Empty
AlwaysBreakTemplateDeclarations: Yes
AccessModifierOffset: -2
AlignTrailingComments: true
SpacesBeforeTrailingComments: 2
NamespaceIndentation: Inner
MaxEmptyLinesToKeep: 1
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true
ColumnLimit: 88
ForEachMacros: ['Q_FOREACH', 'foreach']
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.cpp text eol=crlf
*.h text eol=crlf
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build Preview BSA

on:
push:
branches: master
pull_request:
types: [opened, synchronize, reopened]

env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
build:
runs-on: windows-2022
steps:
# https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
setup-python: false
version: 6.7.0
modules:
cache: true

- uses: actions/checkout@v4

- name: "Set environmental variables"
shell: bash
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
- name: Configure Preview BSA
shell: pwsh
run: |
cmake --preset vs2022-windows-standalone `
"-DCMAKE_PREFIX_PATH=${env:QT_ROOT_DIR}\msvc2019_64" `
"-DCMAKE_INSTALL_PREFIX=install"
- name: Build Preview BSA
run: cmake --build vsbuild --config RelWithDebInfo --target INSTALL
16 changes: 16 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Lint Preview BSA Plugin

on:
push:
pull_request:
types: [opened, synchronize, reopened]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check format
uses: ModOrganizer2/check-formatting-action@master
with:
check-path: "."
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
cmake_minimum_required(VERSION 3.16)

if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/mo2.cmake)
else()
include(${CMAKE_CURRENT_LIST_DIR}/../cmake_common/mo2.cmake)
endif()

project(preview_bsa)
add_subdirectory(src)
60 changes: 60 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"configurePresets": [
{
"errors": {
"deprecated": true
},
"hidden": true,
"name": "cmake-dev",
"warnings": {
"deprecated": true,
"dev": true
}
},
{
"cacheVariables": {
"VCPKG_MANIFEST_NO_DEFAULT_FEATURES": {
"type": "BOOL",
"value": "ON"
}
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"hidden": true,
"name": "vcpkg"
},
{
"hidden": true,
"inherits": ["vcpkg"],
"name": "vcpkg-dev"
},
{
"binaryDir": "${sourceDir}/vsbuild",
"architecture": {
"strategy": "set",
"value": "x64"
},
"cacheVariables": {
"CMAKE_CXX_FLAGS": "/EHsc /MP /W4",
"VCPKG_TARGET_TRIPLET": {
"type": "STRING",
"value": "x64-windows-static-md"
}
},
"generator": "Visual Studio 17 2022",
"inherits": ["cmake-dev", "vcpkg-dev"],
"name": "vs2022-windows",
"toolset": "v143"
},
{
"cacheVariables": {
"VCPKG_MANIFEST_FEATURES": {
"type": "STRING",
"value": "standalone"
}
},
"inherits": "vs2022-windows",
"name": "vs2022-windows-standalone"
}
],
"version": 4
}
42 changes: 0 additions & 42 deletions appveyor.yml

This file was deleted.

14 changes: 12 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
cmake_minimum_required(VERSION 3.16)

find_package(mo2-cmake CONFIG REQUIRED)
find_package(mo2-uibase CONFIG REQUIRED)

find_package(ZLIB REQUIRED)
find_package(lz4 CONFIG REQUIRED)
find_package(Boost CONFIG REQUIRED COMPONENTS thread interprocess)
find_package(mo2-dds-header CONFIG REQUIRED)
find_package(mo2-bsatk CONFIG REQUIRED)

add_library(preview_bsa SHARED)
mo2_configure_plugin(preview_bsa WARNINGS OFF PRIVATE_DEPENDS DirectXTex bsatk)
mo2_install_target(preview_bsa)
mo2_configure_plugin(preview_bsa WARNINGS 4)
target_link_libraries(preview_bsa PRIVATE mo2::uibase mo2::bsatk)
mo2_install_plugin(preview_bsa)
14 changes: 7 additions & 7 deletions src/preview_bsa_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
<context>
<name>PreviewBsa</name>
<message>
<location filename="previewbsa.cpp" line="71"/>
<location filename="previewbsa.cpp" line="64"/>
<source>Preview BSA</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbsa.cpp" line="81"/>
<location filename="previewbsa.cpp" line="74"/>
<source>Supports previewing contents of Bethesda Archive files, BSAs and BA2s</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbsa.cpp" line="92"/>
<location filename="previewbsa.cpp" line="86"/>
<source>Enable previewing of BSA file contents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbsa.cpp" line="130"/>
<source>Archive Format: %1 , Compression: %2 , File count: %3 , Version: %4 , Archive type: %5 , Archive flags: %6 , Contents flags: %7</source>
<location filename="previewbsa.cpp" line="147"/>
<source>Archive Format: %1 , Compression: %2 , File count: %3 , Version: %4 , Archive type: %5 , Archive flags: %6</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbsa.cpp" line="133"/>
<location filename="previewbsa.cpp" line="152"/>
<source>yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="previewbsa.cpp" line="133"/>
<location filename="previewbsa.cpp" line="152"/>
<source>no</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading

0 comments on commit bd825f8

Please sign in to comment.