From 39210af3e59c929cba6de2d39ef1c32835f6388b Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Thu, 29 May 2025 11:04:36 +0200 Subject: Move to VCPKG (#2068) * Remove SConscript related files. * Force-load translations from uibase and gamebryo/creation. * Bring githubpp here and add a standalone preset. * Switch VersionInfo -> Version for ModOrganizer2. (#2063) * Add pre-commit hook. * Use 7zip build from VCPKG registry. * Use archive.dll from the bin folder instead of dlls. --- src/shared/SConscript | 23 --------------- src/shared/directoryentry.h | 3 +- src/shared/shared.pro | 70 --------------------------------------------- src/shared/shared.qbs | 20 ------------- src/shared/util.cpp | 36 ++++++++++++++--------- src/shared/util.h | 7 +++-- 6 files changed, 29 insertions(+), 130 deletions(-) delete mode 100644 src/shared/SConscript delete mode 100644 src/shared/shared.pro delete mode 100644 src/shared/shared.qbs (limited to 'src/shared') diff --git a/src/shared/SConscript b/src/shared/SConscript deleted file mode 100644 index 24ca5b19..00000000 --- a/src/shared/SConscript +++ /dev/null @@ -1,23 +0,0 @@ -Import('env') - -env = env.Clone() - -env.AppendUnique(CPPDEFINES = [ - 'UNICODE', - '_UNICODE', - '_CRT_SECURE_NO_WARNINGS', - 'BOOST_DISABLE_ASSERTS', - 'NDEBUG' -]) - -env.AppendUnique(CPPPATH = [ - '../bsatk', - '${BOOSTPATH}', - '.' # Seriously! -]) - -# Not sure if renaming this helps much as it's static -env.StaticLibrary('mo_shared', env.Glob('*.cpp')) - -#res = env['QT_USED_MODULES'] -#Return('res') diff --git a/src/shared/directoryentry.h b/src/shared/directoryentry.h index 42aef8c7..cb8d5c78 100644 --- a/src/shared/directoryentry.h +++ b/src/shared/directoryentry.h @@ -20,8 +20,9 @@ along with Mod Organizer. If not, see . #ifndef MO_REGISTER_DIRECTORYENTRY_INCLUDED #define MO_REGISTER_DIRECTORYENTRY_INCLUDED +#include + #include "fileregister.h" -#include namespace env { diff --git a/src/shared/shared.pro b/src/shared/shared.pro deleted file mode 100644 index 517e1e86..00000000 --- a/src/shared/shared.pro +++ /dev/null @@ -1,70 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2011-05-03T18:35:56 -# -#------------------------------------------------- - -QT -= gui core -#QT += core - -TARGET = mo_shared -TEMPLATE = lib -CONFIG += staticlib c++11 - - -!include(../LocalPaths.pri) { - message("paths to required libraries need to be set up in LocalPaths.pri") -} - -SOURCES += \ - inject.cpp \ - windows_error.cpp \ - error_report.cpp \ - directoryentry.cpp \ - util.cpp \ - appconfig.cpp \ - leaktrace.cpp \ - stackdata.cpp - -HEADERS += \ - inject.h \ - windows_error.h \ - error_report.h \ - directoryentry.h \ - util.h \ - appconfig.h \ - appconfig.inc \ - leaktrace.h \ - stackdata.h - - -# only for custom leak detection -#DEFINES += TRACE_LEAKS -#LIBS += -lDbgHelp - -msvc:QMAKE_CXXFLAGS_DEBUG -= -Zi -msvc:QMAKE_CXXFLAGS_DEBUG += -Z7 - -CONFIG(debug, debug|release) { - LIBS += -L$$OUT_PWD/../bsatk/debug - LIBS += -lDbgHelp - msvc:PRE_TARGETDEPS += $$OUT_PWD/../bsatk/debug/bsatk.lib -} else { - LIBS += -L$$OUT_PWD/../bsatk/release - msvc:PRE_TARGETDEPS += $$OUT_PWD/../bsatk/release/bsatk.lib -} - -gcc:QMAKE_CXXFLAGS += -Wno-unknown-pragmas -march=i686 -fno-tree-vectorize - -LIBS += -lbsatk - -DEFINES += UNICODE _UNICODE _CRT_SECURE_NO_WARNINGS - -DEFINES += BOOST_DISABLE_ASSERTS NDEBUG - -# QMAKE_CXXFLAGS += /analyze - -INCLUDEPATH += ../bsatk "$${BOOSTPATH}" - -OTHER_FILES += \ - SConscript diff --git a/src/shared/shared.qbs b/src/shared/shared.qbs deleted file mode 100644 index 1fa471a0..00000000 --- a/src/shared/shared.qbs +++ /dev/null @@ -1,20 +0,0 @@ -import qbs.base 1.0 - -StaticLibrary { - name: { - print(qbs.getenv("BOOSTPATH") + "/stage/lib") - return 'Shared' - } - - Depends { name: 'cpp' } - Depends { name: 'BSAToolkit' } - - cpp.defines: [] - cpp.libraryPaths: [ qbs.getenv("BOOSTPATH") + "/stage/lib" ] - cpp.includePaths: [ '../bsatk', qbs.getenv("BOOSTPATH") ] - files: [ - '*.h', - '*.cpp', - '*.inc' - ] -} diff --git a/src/shared/util.cpp b/src/shared/util.cpp index f17c21b9..0d9788a2 100644 --- a/src/shared/util.cpp +++ b/src/shared/util.cpp @@ -21,7 +21,7 @@ along with Mod Organizer. If not, see . #include "../env.h" #include "../mainwindow.h" #include "windows_error.h" -#include +#include #include #include @@ -208,10 +208,12 @@ std::wstring GetFileVersionString(const std::wstring& fileName) } } -VersionInfo createVersionInfo() +Version createVersionInfo() { VS_FIXEDFILEINFO version = GetFileVersion(env::thisProcessPath().native()); + std::optional releaseType; + if (version.dwFileFlags & VS_FF_PRERELEASE) { // Pre-release builds need annotating QString versionString = @@ -227,21 +229,29 @@ VersionInfo createVersionInfo() } } + if (!noLetters) { + // trust the string to make sense + return Version::parse(versionString, Version::ParseMode::MO2); + } + if (noLetters) { - // Default to pre-alpha when release type is unspecified - return VersionInfo( - version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF, - version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF, - VersionInfo::RELEASE_PREALPHA); + // default to development when release type is unspecified + releaseType = Version::Development; } else { - // Trust the string to make sense - return VersionInfo(versionString); } - } else { - // Non-pre-release builds just need their version numbers reading - return VersionInfo(version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF, - version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF); } + + const int major = version.dwFileVersionMS >> 16, + minor = version.dwFileVersionMS & 0xFFFF, + patch = version.dwFileVersionLS >> 16, + subpatch = version.dwFileVersionLS & 0xFFFF; + + std::vector> prereleases; + if (releaseType) { + prereleases.push_back(*releaseType); + } + + return Version(major, minor, patch, subpatch, std::move(prereleases)); } QString getUsvfsDLLVersion() diff --git a/src/shared/util.h b/src/shared/util.h index 1bc6bd47..4764643e 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -21,9 +21,10 @@ along with Mod Organizer. If not, see . #define UTIL_H #include -#include #include -#include + +#include +#include class Executable; @@ -48,7 +49,7 @@ std::wstring ToLowerCopy(std::wstring_view text); bool CaseInsensitiveEqual(const std::wstring& lhs, const std::wstring& rhs); -MOBase::VersionInfo createVersionInfo(); +MOBase::Version createVersionInfo(); QString getUsvfsVersionString(); void SetThisThreadName(const QString& s); -- cgit v1.3.1