new cmake build option tailored for msys2 flavor of rssguard

This commit is contained in:
Martin Rotter 2024-11-27 09:48:04 +01:00
parent cc674a367c
commit 8b5f7ec1e8
7 changed files with 20 additions and 28 deletions

View file

@ -20,6 +20,8 @@
#
# Variables:
# BUILD_WITH_QT6 - Build either with Qt 6 or Qt 5.
# BUILD_MSYS2 - Build RSS Guard for MSYS2 distribution, this particularly
# enables relevant MSYS2 FHS tweaks.
# USE_SYSTEM_SQLITE - Use system-wide SQLite3 library and header file. Defaults to "ON".
# NO_UPDATE_CHECK - Disable automatic checking for new application updates.
# IS_FLATPAK_BUILD - Set to "ON" when building RSS Guard with Flatpak.
@ -118,6 +120,7 @@ endif()
# Global compilation switches.
option(BUILD_WITH_QT6 "Build application with Qt 6." ON)
option(BUILD_MSYS2 "Build application for MSYS2 ecosystem." OFF)
option(USE_SYSTEM_SQLITE "Use system-wide SQLite3 library." ON)
option(NO_LITE "Enable QtWebEngine and other more demanding components." ON)
option(UPDATE_TRANSLATIONS "Call lupdate to update translation files from source (Qt 6 only)." OFF)
@ -288,6 +291,10 @@ if(IS_FLATPAK_BUILD)
add_compile_definitions(IS_FLATPAK_BUILD)
endif()
if(BUILD_MSYS2)
add_compile_definitions(BUILD_MSYS2)
endif()
# Configure and copy some needed files.
if(WIN32)
configure_file(

View file

@ -28,13 +28,9 @@ function(prepare_rssguard_plugin plugin_target_name)
${LIBRSSGUARD_SOURCE_PATH}
)
if(MSVC OR OS2)
if((WIN32 AND NOT BUILD_MSYS2) OR OS2)
install(TARGETS ${plugin_target_name} DESTINATION plugins)
elseif(MINGW)
include (GNUInstallDirs)
install(TARGETS ${plugin_target_name}
DESTINATION ${CMAKE_INSTALL_DATADIR}/rssguard/plugins)
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
elseif((MINGW AND BUILD_MSYS2) OR (UNIX AND NOT APPLE AND NOT ANDROID))
include (GNUInstallDirs)
install(TARGETS ${plugin_target_name}
DESTINATION ${CMAKE_INSTALL_LIBDIR}/rssguard

View file

@ -628,10 +628,10 @@ elseif(WIN32)
)
endif()
if(MSVC OR OS2)
if((WIN32 AND NOT BUILD_MSYS2) OR OS2)
install(TARGETS rssguard DESTINATION .)
set(HEADERS_FOLDER "include/librssguard")
elseif(MINGW)
elseif(MINGW AND BUILD_MSYS2)
include (GNUInstallDirs)
install(TARGETS rssguard
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}

View file

@ -579,12 +579,7 @@ QString Application::userDataAppFolder() const {
// In "app" folder, we would like to separate all user data into own subfolder,
// therefore stick to "data" folder in this mode.
#ifdef _MSC_VER
return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("data%1").arg(major_version));
#else
return QDir::toNativeSeparators(applicationDirPath() + QDir::separator() + QSL("..") + QDir::separator() +
QSL("share") + QDir::separator() + QSL(APP_LOW_NAME) + QDir::separator() + QSL("data%1").arg(major_version));
#endif
}
QString Application::userDataFolder() {

View file

@ -73,16 +73,11 @@ QList<ServiceEntryPoint*> PluginFactory::loadPlugins() const {
QStringList PluginFactory::pluginPaths() const {
QStringList paths;
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD) || defined(BUILD_MSYS2)
paths << QCoreApplication::applicationDirPath() + QDir::separator() + QL1S("..") + QDir::separator() +
QL1S(RSSGUARD_LIBDIR) + QDir::separator() + QL1S(APP_LOW_NAME);
#elif defined(Q_OS_WIN)
#ifdef _MSC_VER
paths << QCoreApplication::applicationDirPath() + QDir::separator() + QL1S("plugins");
#else
paths << QCoreApplication::applicationDirPath() + QDir::separator() + QL1S("..") + QDir::separator() +
QL1S("share") + QDir::separator() + QL1S(APP_LOW_NAME) + QDir::separator() + QL1S("plugins");
#endif
#else
paths << QCoreApplication::applicationDirPath();
#endif

View file

@ -31,7 +31,7 @@ DKEY Node::ID = "nodejs";
DKEY Node::NodeJsExecutable = QSL("nodejs_executable_") + OS_ID;
#if (defined(Q_OS_WIN) && defined(_MSC_VER)) || defined(Q_OS_OS2)
#if (defined(Q_OS_WIN) && !defined(BUILD_MSYS2)) || defined(Q_OS_OS2)
DVALUE(QString) Node::NodeJsExecutableDef = "node.exe";
#else
DVALUE(QString) Node::NodeJsExecutableDef = "node";
@ -39,7 +39,7 @@ DVALUE(QString) Node::NodeJsExecutableDef = "node";
DKEY Node::NpmExecutable = QSL("npm_executable_") + OS_ID;
#if defined(Q_OS_WIN) && defined(_MSC_VER)
#if defined(Q_OS_WIN) && !defined(BUILD_MSYS2)
DVALUE(QString) Node::NpmExecutableDef = "npm.cmd";
#elif defined(Q_OS_OS2)
DVALUE(QString) Node::NpmExecutableDef = "npm.exe";
@ -620,6 +620,7 @@ SettingsProperties Settings::determineProperties() {
SettingsProperties properties;
properties.m_settingsSuffix = QDir::separator() + QSL(APP_CFG_PATH) + QDir::separator() + QSL(APP_CFG_FILE);
const QString app_path = qApp->userDataAppFolder();
const QString home_path = qApp->userDataHomeFolder();
const QString custom_path = qApp->customDataFolder();
@ -630,10 +631,10 @@ SettingsProperties Settings::determineProperties() {
properties.m_baseDirectory = custom_path;
}
else {
// We will use PORTABLE settings only and only if it is available and NON-PORTABLE
// We will use PORTABLE settings only if it is available and NON-PORTABLE
// settings was not initialized before.
#if defined(Q_OS_UNIX)
// DO NOT use portable settings for *nix, it is really not used on that platform.
#if defined(Q_OS_UNIX) || defined(BUILD_MSYS2)
// DO NOT use portable settings for *nix or MSYS2, it is really not used on those platforms.
const bool will_we_use_portable_settings = false;
#else
const QString exe_path = qApp->applicationDirPath();

View file

@ -41,7 +41,7 @@ elseif(WIN32)
)
endif()
if(MSVC)
if(WIN32 AND NOT BUILD_MSYS2)
install(TARGETS app DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/resources/graphics/${CMAKE_PROJECT_NAME}.ico
DESTINATION .
@ -55,9 +55,7 @@ if(MSVC)
)
elseif(OS2)
install(TARGETS app DESTINATION .)
elseif(MINGW)
install(TARGETS app DESTINATION ${CMAKE_INSTALL_BINDIR})
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
elseif((MINGW AND BUILD_MSYS2) OR (UNIX AND NOT APPLE AND NOT ANDROID))
include (GNUInstallDirs)
install(TARGETS app
DESTINATION ${CMAKE_INSTALL_BINDIR}