Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Mod Organizer 2.5.0 #3

Merged
merged 11 commits into from
Nov 27, 2023
Merged
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
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build NIF Preview Plugin

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

jobs:
build:
runs-on: windows-2022
steps:
- name: Build NIF Preview Plugin
uses: ModOrganizer2/build-with-mob-action@master
with:
mo2-third-parties: fmt libbsarch
mo2-dependencies: cmake_common uibase
- name: Upload Build
uses: actions/upload-artifact@v3
with:
name: preview_nif
path: |
./build/modorganizer_super/${{ github.event.repository.name }}/vsbuild/src/RelWithDebInfo/preview_nif.dll
- uses: actions/upload-artifact@v3
with:
name: preview_nif
path: |
./build/modorganizer_super/${{ github.event.repository.name }}/**/data/shaders/*
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
[submodule "external/nifly"]
path = external/nifly
url = https://github.com/ousnius/nifly.git
[submodule "external/gli"]
path = external/gli
url = https://github.com/g-truc/gli.git
33 changes: 23 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.22)

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_nif)
set(project_type plugin)
set(enable_warnings OFF)

if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake)
else()
include(../cmake_common/project.cmake)
endif()
add_subdirectory(src)
FetchContent_Declare(
gli
GIT_REPOSITORY https://github.com/g-truc/gli.git
GIT_TAG master
)
set(GLI_TEST_ENABLE OFF CACHE BOOL "Build gli unit tests")
add_subdirectory(external/gli)
add_subdirectory(external/nifly)
target_link_libraries(${PROJECT_NAME} nifly gli)

FetchContent_Declare(
nifly
GIT_REPOSITORY https://github.com/ousnius/nifly.git
GIT_TAG main
)

FetchContent_MakeAvailable(gli nifly)

add_subdirectory(src)
target_link_libraries(preview_nif PRIVATE nifly gli)
72 changes: 72 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"version": 3,
"configurePresets": [
{
"name": "windows-2022",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/vsbuild",
"cacheVariables": {
"CMAKE_BUILD_TYPE": {
"type": "STRING",
"value": "Release"
},
"DEPENDENCIES_DIR": {
"type": "PATH",
"value": "${sourceDir}/../.."
},
"BOOST_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../boost_1_83_0"
},
"BOOST_LIBRARYDIR": {
"type": "PATH",
"value": "${sourceDir}/../../boost_1_83_0/lib64-msvc-14.3/lib"
},
"FMT_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../fmt-8.1.1"
},
"SPDLOG_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../spdlog-v1.10.0"
},
"LOOT_PATH": {
"type": "PATH",
"value": "${sourceDir}/../../libloot-0.22.1-win64"
},
"LZ4_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../lz4-v1.9.4"
},
"QT_ROOT": {
"type": "PATH",
"value": "C:/Qt/6.5.3/msvc2019_64"
},
"ZLIB_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../zlib-v1.3"
},
"PYTHON_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../python-3.11.5"
},
"SEVENZ_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../7zip-23.01"
},
"LIBBSARCH_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../libbsarch-0.0.9-release-x64"
},
"BOOST_DI_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../di"
},
"GTEST_ROOT": {
"type": "PATH",
"value": "${sourceDir}/../../googletest"
}
}
}
]
}
1 change: 0 additions & 1 deletion external/gli
Submodule gli deleted from 779b99
1 change: 0 additions & 1 deletion external/nifly
Submodule nifly deleted from 550483
17 changes: 9 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 3.16)
if(DEFINED DEPENDENCIES_DIR)
include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/src.cmake)
else()
include(../../cmake_common/src.cmake)
endif()
requires_library(libbsarch)
requires_project(game_features)
cmake_minimum_required(VERSION 3.22)

add_library(preview_nif SHARED)
mo2_configure_plugin(
preview_nif
WARNINGS OFF
PRIVATE_DEPENDS Qt::OpenGLWidgets fmt libbsarch uibase
)
mo2_install_target(preview_nif)
7 changes: 5 additions & 2 deletions src/NifWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <QWheelEvent>
#include <QOpenGLContext>
#include <QOpenGLFunctions_2_1>
#include <QOpenGLVersionFunctionsFactory>
using OpenGLFunctions = QOpenGLFunctions_2_1;

NifWidget::NifWidget(
Expand Down Expand Up @@ -131,7 +132,8 @@ void NifWidget::initializeGL()
update();
});

auto f = QOpenGLContext::currentContext()->versionFunctions<OpenGLFunctions>();
auto f = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_1>(
QOpenGLContext::currentContext());

f->glEnable(GL_DEPTH_TEST);
f->glDepthFunc(GL_LEQUAL);
Expand All @@ -140,7 +142,8 @@ void NifWidget::initializeGL()

void NifWidget::paintGL()
{
auto f = QOpenGLContext::currentContext()->versionFunctions<OpenGLFunctions>();
auto f = QOpenGLVersionFunctionsFactory::get<QOpenGLFunctions_2_1>(
QOpenGLContext::currentContext());
f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

for (auto& shape : m_GLShapes) {
Expand Down
Loading
Loading