changeset 638:af963ff03c06

Misc: various MinGW fixes
author David Demelier <markand@malikania.fr>
date Sat, 17 Mar 2018 19:29:42 +0100
parents 7632483ca971
children d12a87c0e3f6
files cmake/IrccdSystem.cmake cmake/function/IrccdDefineTest.cmake irccdctl/CMakeLists.txt libcommon/irccd/ini.cpp libcommon/irccd/system.cpp libirccd-js/CMakeLists.txt libirccd/CMakeLists.txt libirccd/irccd/daemon/service/transport_service.cpp
diffstat 8 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/cmake/IrccdSystem.cmake	Thu Mar 15 14:04:51 2018 +0100
+++ b/cmake/IrccdSystem.cmake	Sat Mar 17 19:29:42 2018 +0100
@@ -171,10 +171,12 @@
 # If HAVE_GETLOGIN is defined, include:
 #
 # #include <unistd.h>
-check_function_exists(getlogin HAVE_GETLOGIN)
+if (NOT IRCCD_SYSTEM_WINDOWS)
+    check_function_exists(getlogin HAVE_GETLOGIN)
 
-if (NOT HAVE_UNISTD_H)
-    set(HAVE_GETLOGIN FALSE)
+    if (NOT HAVE_UNISTD_H)
+        set(HAVE_GETLOGIN FALSE)
+    endif ()
 endif ()
 
 # getpid() function
--- a/cmake/function/IrccdDefineTest.cmake	Thu Mar 15 14:04:51 2018 +0100
+++ b/cmake/function/IrccdDefineTest.cmake	Sat Mar 17 19:29:42 2018 +0100
@@ -53,7 +53,7 @@
         APPEND
         TEST_LIBRARIES
             libirccd-test
-            Boost::unit_test_framework
+            ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
     )
 
     # Executable
--- a/irccdctl/CMakeLists.txt	Thu Mar 15 14:04:51 2018 +0100
+++ b/irccdctl/CMakeLists.txt	Sat Mar 17 19:29:42 2018 +0100
@@ -92,5 +92,5 @@
     TARGET irccdctl
     DESCRIPTION "Irccd controller."
     SOURCES ${SOURCES}
-    LIBRARIES Boost::timer libirccdctl
+    LIBRARIES ${Boost_TIMER_LIBRARY} libirccdctl
 )
--- a/libcommon/irccd/ini.cpp	Thu Mar 15 14:04:51 2018 +0100
+++ b/libcommon/irccd/ini.cpp	Sat Mar 17 19:29:42 2018 +0100
@@ -24,9 +24,11 @@
 #include <sstream>
 #include <stdexcept>
 
+#include <irccd/sysconfig.hpp>
+
 // for PathIsRelative.
 #if defined(IRCCD_SYSTEM_WINDOWS)
-#  include <Shlwapi.h>
+#  include <shlwapi.h>
 #endif
 
 #include "ini.hpp"
--- a/libcommon/irccd/system.cpp	Thu Mar 15 14:04:51 2018 +0100
+++ b/libcommon/irccd/system.cpp	Sat Mar 17 19:29:42 2018 +0100
@@ -210,9 +210,10 @@
 #if defined(IRCCD_SYSTEM_WINDOWS)
     char folder[MAX_PATH] = {0};
 
-    if (SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, folder) == S_OK)
-        path = folder + "\\irccd\\config";
-    else
+    if (SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, folder) == S_OK) {
+        path /= folder;
+        path /= "\\irccd\\config";
+    } else
         path = ".";
 #else
     try {
@@ -244,8 +245,10 @@
 #if defined(IRCCD_SYSTEM_WINDOWS)
     char folder[MAX_PATH] = {0};
 
-    if (SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, folder) == S_OK)
-        path = folder + "\\irccd\\share";
+    if (SHGetFolderPathA(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, folder) == S_OK) {
+        path /= folder;
+        path /= "\\irccd\\share";
+    }
 #else
     try {
         path = xdg().data_home();
--- a/libirccd-js/CMakeLists.txt	Thu Mar 15 14:04:51 2018 +0100
+++ b/libirccd-js/CMakeLists.txt	Sat Mar 17 19:29:42 2018 +0100
@@ -64,7 +64,7 @@
         ${HEADERS}
         ${SOURCES}
     LIBRARIES
-        Boost::timer
+        ${Boost_TIMER_LIBRARY}
         extern-duktape
         libirccd
     PUBLIC_INCLUDES
--- a/libirccd/CMakeLists.txt	Thu Mar 15 14:04:51 2018 +0100
+++ b/libirccd/CMakeLists.txt	Sat Mar 17 19:29:42 2018 +0100
@@ -125,8 +125,9 @@
         ${HEADERS}
         ${SOURCES}
     LIBRARIES
-        Boost::timer
         Threads::Threads
+        ${Boost_TIMER_LIBRARY}
+        $<$<BOOL:${IRCCD_SYSTEM_WINDOWS}>:mswsock>
         $<$<BOOL:${IRCCD_SYSTEM_LINUX}>:dl>
         $<$<BOOL:${IRCCD_SYSTEM_MAC}>:resolv>
         libcommon
--- a/libirccd/irccd/daemon/service/transport_service.cpp	Thu Mar 15 14:04:51 2018 +0100
+++ b/libirccd/irccd/daemon/service/transport_service.cpp	Sat Mar 17 19:29:42 2018 +0100
@@ -130,11 +130,11 @@
 
 std::unique_ptr<transport_server> load_transport_unix(boost::asio::io_service& service, const ini::section& sc)
 {
-    using boost::asio::local::stream_protocol;
-
     assert(sc.key() == "transport");
 
 #if !defined(IRCCD_SYSTEM_WINDOWS)
+    using boost::asio::local::stream_protocol;
+
     ini::section::const_iterator it = sc.find("path");
 
     if (it == sc.end())
@@ -148,6 +148,7 @@
 
     return std::make_unique<local_transport_server>(std::move(acceptor));
 #else
+    (void)service;
     (void)sc;
 
     throw std::invalid_argument("unix transports not supported on on this platform");