Przeglądaj źródła

add rule to call the lib tool to generate .lib from .def

Samuel Thibault 15 lat temu
rodzic
commit
3a62b468b9
3 zmienionych plików z 44 dodań i 0 usunięć
  1. 1 0
      configure.ac
  2. 8 0
      src/Makefile.am
  3. 35 0
      src/dolib.c

+ 1 - 0
configure.ac

@@ -43,6 +43,7 @@ AC_C_RESTRICT
 
 AC_PATH_PROGS([STARPU_MS_LIB], [lib])
 AC_ARG_VAR([STARPU_MS_LIB], [Path to Microsoft's Visual Studio `lib' tool])
+AM_CONDITIONAL([STARPU_HAVE_MS_LIB], [test "x$STARPU_MS_LIB" != "x"])
 
 # on Darwin, GCC targets i386 by default, so we don't have atomic ops
 case "$target" in

+ 8 - 0
src/Makefile.am

@@ -164,3 +164,11 @@ if STARPU_USE_OPENCL
 libstarpu_la_SOURCES += drivers/opencl/driver_opencl.c
 libstarpu_la_SOURCES += drivers/opencl/driver_opencl_utils.c
 endif
+
+EXTRA_DIST = dolib.c
+
+if STARPU_HAVE_MS_LIB
+.libs/libstarpu.lib: libstarpu.la dolib
+	./dolib "$(STARPU_MS_LIB)" X86 .libs/libstarpu.def libstarpu-$(STARPU_SOVERSION) .libs/libstarpu.lib
+all-local: .libs/libstarpu.lib
+endif HWLOC_HAVE_MS_LIB

+ 35 - 0
src/dolib.c

@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2010 Université Bordeaux 1
+ * See COPYING in top-level directory.
+ */
+
+/* Wrapper to avoid msys' tendency to turn / into \ and : into ;  */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char *argv[]) {
+  char *prog, *arch, *def, *name, *lib;
+  char s[1024];
+
+  if (argc != 6) {
+    fprintf(stderr,"bad number of arguments");
+    exit(EXIT_FAILURE);
+  }
+
+  prog = argv[1];
+  arch = argv[2];
+  def = argv[3];
+  name = argv[4];
+  lib = argv[5];
+
+  snprintf(s, sizeof(s), "\"%s\" /machine:%s /def:%s /name:%s /out:%s",
+      prog, arch, def, name, lib);
+  if (system(s)) {
+    fprintf(stderr, "%s failed\n", s);
+    exit(EXIT_FAILURE);
+  }
+
+  exit(EXIT_SUCCESS);
+}