Skip to content

Commit

Permalink
Add MinGW support (#1540)
Browse files Browse the repository at this point in the history
* rssguard.rc: avoid redefinition warnings

* use fully qualified name for std::move

* mingw use fhs structure

* adjust default setting

* cmake: initial support for mingw
  • Loading branch information
raedrizqie authored Nov 22, 2024
1 parent 4cf3bc8 commit ce69e78
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 22 deletions.
2 changes: 2 additions & 0 deletions resources/rssguard.rc.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#include <windows.h>

#ifdef _MSC_VER
#define VS_FF_DEBUG 0x00000001L
#define VOS__WINDOWS32 0x00000004L
#define VFT_UNKNOWN 0x00000000L
#define VFT2_UNKNOWN 0x00000000L
#endif

IDI_ICON1 ICON "@[email protected]"

Expand Down
6 changes: 5 additions & 1 deletion src/cmake_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ function(prepare_rssguard_plugin plugin_target_name)
${LIBRSSGUARD_SOURCE_PATH}
)

if(WIN32 OR OS2)
if(MSVC 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)
include (GNUInstallDirs)
install(TARGETS ${plugin_target_name}
Expand Down
14 changes: 7 additions & 7 deletions src/librssguard-gmail/src/3rd-party/mimesis/mimesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,16 +865,16 @@ namespace Mimesis {

Part part;

part.preamble = move(preamble);
part.epilogue = move(epilogue);
part.parts = move(parts);
part.boundary = move(boundary);
part.preamble = std::move(preamble);
part.epilogue = std::move(epilogue);
part.parts = std::move(parts);
part.boundary = std::move(boundary);
part.multipart = true;
part.set_header("Content-Type", get_header("Content-Type"));
part.set_header("Content-Disposition", get_header("Content-Disposition"));
erase_header("Content-Disposition");
part.crlf = crlf;
parts.emplace_back(move(part));
parts.emplace_back(std::move(part));
}
else {
multipart = true;
Expand All @@ -888,7 +888,7 @@ namespace Mimesis {
part.set_header("Content-Type", get_header("Content-Type"));
part.set_header("Content-Disposition", get_header("Content-Disposition"));
erase_header("Content-Disposition");
part.body = move(body);
part.body = std::move(body);
}
}

Expand Down Expand Up @@ -919,7 +919,7 @@ namespace Mimesis {
set_header("Content-Disposition", part.get_header("Content-Disposition"));

if (part.multipart) {
parts = move(part.parts);
parts = std::move(part.parts);
}
else {
multipart = false;
Expand Down
14 changes: 7 additions & 7 deletions src/librssguard-reddit/src/3rd-party/mimesis/mimesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,16 +865,16 @@ namespace Mimesis {

Part part;

part.preamble = move(preamble);
part.epilogue = move(epilogue);
part.parts = move(parts);
part.boundary = move(boundary);
part.preamble = std::move(preamble);
part.epilogue = std::move(epilogue);
part.parts = std::move(parts);
part.boundary = std::move(boundary);
part.multipart = true;
part.set_header("Content-Type", get_header("Content-Type"));
part.set_header("Content-Disposition", get_header("Content-Disposition"));
erase_header("Content-Disposition");
part.crlf = crlf;
parts.emplace_back(move(part));
parts.emplace_back(std::move(part));
}
else {
multipart = true;
Expand All @@ -888,7 +888,7 @@ namespace Mimesis {
part.set_header("Content-Type", get_header("Content-Type"));
part.set_header("Content-Disposition", get_header("Content-Disposition"));
erase_header("Content-Disposition");
part.body = move(body);
part.body = std::move(body);
}
}

Expand Down Expand Up @@ -919,7 +919,7 @@ namespace Mimesis {
set_header("Content-Disposition", part.get_header("Content-Disposition"));

if (part.multipart) {
parts = move(part.parts);
parts = std::move(part.parts);
}
else {
multipart = false;
Expand Down
10 changes: 8 additions & 2 deletions src/librssguard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -623,14 +623,20 @@ if(APPLE)
)
elseif(WIN32)
target_link_libraries(rssguard PUBLIC
Shell32.lib
shell32
odbc32
)
endif()

if(WIN32 OR OS2)
if(MSVC OR OS2)
install(TARGETS rssguard DESTINATION .)
set(HEADERS_FOLDER "include/librssguard")
elseif(MINGW)
include (GNUInstallDirs)
install(TARGETS rssguard
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
set(HEADERS_FOLDER "${CMAKE_INSTALL_INCLUDEDIR}/librssguard")
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
include (GNUInstallDirs)
install(TARGETS rssguard DESTINATION ${CMAKE_INSTALL_LIBDIR})
Expand Down
5 changes: 5 additions & 0 deletions src/librssguard/miscellaneous/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,12 @@ 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() {
Expand Down
5 changes: 5 additions & 0 deletions src/librssguard/miscellaneous/pluginfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ QStringList PluginFactory::pluginPaths() const {
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
Expand Down
4 changes: 2 additions & 2 deletions src/librssguard/miscellaneous/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ DKEY Node::ID = "nodejs";

DKEY Node::NodeJsExecutable = QSL("nodejs_executable_") + OS_ID;

#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
#if (defined(Q_OS_WIN) && defined(_MSC_VER)) || defined(Q_OS_OS2)
DVALUE(QString) Node::NodeJsExecutableDef = "node.exe";
#else
DVALUE(QString) Node::NodeJsExecutableDef = "node";
#endif

DKEY Node::NpmExecutable = QSL("npm_executable_") + OS_ID;

#if defined(Q_OS_WIN)
#if defined(Q_OS_WIN) && defined(_MSC_VER)
DVALUE(QString) Node::NpmExecutableDef = "npm.cmd";
#elif defined(Q_OS_OS2)
DVALUE(QString) Node::NpmExecutableDef = "npm.exe";
Expand Down
8 changes: 5 additions & 3 deletions src/rssguard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ if(APPLE)
)
elseif(WIN32)
target_link_libraries(app PUBLIC
Shell32.lib
odbc32.lib
shell32
odbc32
)
endif()

if(WIN32)
if(MSVC)
install(TARGETS app DESTINATION .)
install(FILES ${CMAKE_SOURCE_DIR}/resources/graphics/${CMAKE_PROJECT_NAME}.ico
DESTINATION .
Expand All @@ -55,6 +55,8 @@ if(WIN32)
)
elseif(OS2)
install(TARGETS app DESTINATION .)
elseif(MINGW)
install(TARGETS app DESTINATION ${CMAKE_INSTALL_BINDIR})
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
include (GNUInstallDirs)
install(TARGETS app
Expand Down

0 comments on commit ce69e78

Please sign in to comment.