[Groonga-commit] groonga/groonga at 1c473d1 [master] windows: fix GetProcessMemoryInfo() usage

Back to archive index
Kouhei Sutou null+****@clear*****
Wed Mar 20 08:49:48 JST 2019


Kouhei Sutou	2019-03-20 08:49:48 +0900 (Wed, 20 Mar 2019)

  Revision: 1c473d1c2ce903488e2c023db2bab72aa49a5d01
  https://github.com/groonga/groonga/commit/1c473d1c2ce903488e2c023db2bab72aa49a5d01

  Message:
    windows: fix GetProcessMemoryInfo() usage

  Modified files:
    configure.ac
    lib/CMakeLists.txt
    lib/Makefile.am
    lib/memory.c

  Modified: configure.ac (+1 -2)
===================================================================
--- configure.ac    2019-03-19 18:14:56 +0900 (5e20390fa)
+++ configure.ac    2019-03-20 08:49:48 +0900 (f24bd7409)
@@ -644,7 +644,7 @@ int main(int argc, char **argv)
 # MinGW
 if test "$os_win32" = "yes"; then
   WINDOWS_LDFLAGS="-mwindows"
-  WINDOWS_LIBS="-ladvapi32 -lws2_32 -ldbghelp"
+  WINDOWS_LIBS="-ladvapi32 -lws2_32 -ldbghelp -lpsapi"
 else
   WINDOWS_LDFLAGS=
   WINDOWS_LIBS=
@@ -1471,7 +1471,6 @@ GRN_DEFS="$GRN_DEFS -DGRN_DEFAULT_DOCUMENT_ROOT=\\\"\"\$(GRN_DEFAULT_DOCUMENT_RO
 GRN_DEFS="$GRN_DEFS -DGRN_DEFAULT_RELATIVE_DOCUMENT_ROOT=\\\"\"\$(GRN_DEFAULT_RELATIVE_DOCUMENT_ROOT)\"\\\""
 AC_SUBST(GRN_DEFS)
 CFLAGS="$CFLAGS $OPT_CFLAGS "
-LIBS="$LIBS $WINDOWS_LIBS"
 AC_DEFINE_UNQUOTED(CONFIGURE_OPTIONS, "$ac_configure_args", "specified configure options")
 
 # For groonga.org

  Modified: lib/CMakeLists.txt (+7 -0)
===================================================================
--- lib/CMakeLists.txt    2019-03-19 18:14:56 +0900 (5379e1b4d)
+++ lib/CMakeLists.txt    2019-03-20 08:49:48 +0900 (c4a80bef1)
@@ -105,6 +105,13 @@ set(GRN_ALL_LIBRARIES
     ${DBGHELP_LIBS}
     ${MRUBY_LIBS}
     ${ONIGMO_LIBS})
+if(WIN32)
+  list(APPEND GRN_ALL_LIBRARIES
+    -ladvapi32
+    -lws2_32
+    -lgdbhelp
+    -lpsapi)
+endif()
 if(GRN_EMBED)
   set(GRN_EMBEDDED_PLUGIN_LIBRARIES "")
   if(GRN_WITH_MECAB)

  Modified: lib/Makefile.am (+2 -1)
===================================================================
--- lib/Makefile.am    2019-03-19 18:14:56 +0900 (b5f855217)
+++ lib/Makefile.am    2019-03-20 08:49:48 +0900 (a3bf68471)
@@ -70,7 +70,8 @@ libgroonga_la_LIBADD +=				\
 	$(LIBLZ4_LIBS)				\
 	$(LIBZSTD_LIBS)				\
 	$(ATOMIC_LIBS)				\
-	$(ARROW_LIBS)
+	$(ARROW_LIBS)				\
+	$(WINDOWS_LIBS)
 
 nfkc_dump_SOURCES =				\
 	nfkc_dump.c

  Modified: lib/memory.c (+6 -0)
===================================================================
--- lib/memory.c    2019-03-19 18:14:56 +0900 (28236ed2f)
+++ lib/memory.c    2019-03-20 08:49:48 +0900 (ea67accbd)
@@ -20,6 +20,12 @@
 
 #include <stdio.h>
 
+#ifdef WIN32
+/* For Windows Server 2018 or earlier. */
+# define PSAPI_VERSION 1
+# include <psapi.h>
+#endif
+
 uint64_t
 grn_memory_get_usage(grn_ctx *ctx)
 {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20190320/169b3c7c/attachment-0001.html>


More information about the Groonga-commit mailing list
Back to archive index