diff --git a/scotch_6.0.3/mingw.patch.complete b/scotch_6.0.3/mingw.patch.complete new file mode 100644 index 00000000..e69de29b diff --git a/scotch_6.0.3/src/Makefile b/scotch_6.0.3/src/Makefile index 6c84c946..65de6ced 100644 --- a/scotch_6.0.3/src/Makefile +++ b/scotch_6.0.3/src/Makefile @@ -55,6 +55,8 @@ Makefile.inc : include Makefile.inc +CPLIB ?= $(LIB) + prefix ?= /usr/local bindir ?= $(prefix)/bin includedir ?= $(prefix)/include @@ -115,7 +117,7 @@ install : required $(bindir) $(includedir) $(libdir) $(mandir)/man1 -$(CP) -f ../bin/[agm]*$(EXE) $(bindir) -$(CP) -f ../bin/d[agm]*$(EXE) $(bindir) -$(CP) -f ../include/*scotch*.h $(includedir) - -$(CP) -f ../lib/*scotch*$(LIB) $(libdir) + -$(CP) -f ../lib/*scotch*$(CPLIB) $(libdir) -$(CP) -Rf ../man/* $(mandir) clean : required diff --git a/scotch_6.0.3/src/Makefile.inc b/scotch_6.0.3/src/Makefile.inc index 6821a949..77a430a4 120000 --- a/scotch_6.0.3/src/Makefile.inc +++ b/scotch_6.0.3/src/Makefile.inc @@ -1 +1,42 @@ -../../etc/wmakeFiles/scotch/Makefile.inc.i686_pc_linux2.shlib-OpenFOAM-64Int32 \ No newline at end of file +.SUFFIXES: .dll .a .def + +GENERAL_RULES = $(WM_DIR)/rules/General +RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER) +sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) +sinclude $(RULES)/mplib$(WM_MPLIB) + +EXE = .exe +#MJ LIB = .a +LIB = .dll +CPLIB = .* +OBJ = .o + +CCS = $(WM_CC) -m$(WM_ARCH_OPTION) -std=c99 +CCP = $(WM_CC) -m$(WM_ARCH_OPTION) -std=c99 +CCD = $(CCS) +CFLAGS = -O3 -Wall -Dlinux -DCOMMON_WINDOWS -DNDEBUG -DWIN64 -DLITTLE_ENDIAN -Drestrict=__restrict -DCOMMON_RANDOM_RAND -DCOMMON_STUB_FORK -D'pipe(pfds)=_pipe(pfds,1024,0x8000)' -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -I$(WM_COMPILER_DIR)/include $(PINC) $(PFLAGS) +# -DCOMMON_TIMING_OLD + +LDFLAGS_P1 = -L$(FOAM_LIBBIN)/ -lz -lm +LIBLDFLAGS = -shared $(LDFLAGS_P1) -Wl,--output-def,$(*).def,--out-implib,$(*).a,--enable-auto-import,--strip-all +LDFLAGS = $(LDFLAGS_P1) -Wl,--enable-auto-import,--force-exe-suffix,--strip-all + +LDFLAGS_P1_PT = $(PLIBS) $(LDFLAGS_P1) +LIBLDFLAGS_PT = -shared $(LDFLAGS_P1_PT) -Wl,--output-def,$(*).def,--out-implib,$(*).a,--enable-auto-import,--strip-all +LDFLAGS_PT = $(LDFLAGS_P1_PT) $(LDFLAGS) + +AR = $(CCS) +ARFLAGS = $(LIBLDFLAGS) -o +ARSFLAGS = -L./ -lscotcherr $(LDFLAGS_P1) +ARPFLAGS = -L./ -lptscotcherr -lscotch $(LDFLAGS_P1_PT) +ARSMFLAGS = -L../libscotch/ -lscotch $(LDFLAGS_P1) +ARPMFLAGS = -L../libscotch/ -lscotch -lptscotch $(LDFLAGS_P1_PT) +CAT = cat +CP = cp +LEX = flex -Pscotchyy -olex.yy.c +LN = ln +MAKE = make +MKDIR = mkdir +MV = mv +RANLIB = echo +YACC = bison -pscotchyy -y -b y diff --git a/scotch_6.0.3/src/libscotch/Makefile b/scotch_6.0.3/src/libscotch/Makefile index 073ac010..7afb12ca 100644 --- a/scotch_6.0.3/src/libscotch/Makefile +++ b/scotch_6.0.3/src/libscotch/Makefile @@ -39,6 +39,8 @@ libdir = ../../lib include ../Makefile.inc +CPLIB ?= $(LIB) + %$(OBJ) : %.c $(CC) $(CFLAGS) $(CLIBFLAGS) -c $(<) -o $(@) @@ -55,17 +57,17 @@ scotch : $(MAKE) CC="$(CCS)" CCD="$(CCS)" \ scotch.h \ scotchf.h \ - libscotch$(LIB) \ libscotcherr$(LIB) \ - libscotcherrexit$(LIB) + libscotcherrexit$(LIB) \ + libscotch$(LIB) ptscotch : scotch $(MAKE) CFLAGS="$(CFLAGS) -DSCOTCH_PTSCOTCH" CC="$(CCP)" \ ptscotch.h \ ptscotchf.h \ - libptscotch$(LIB) \ libptscotcherr$(LIB) \ - libptscotcherrexit$(LIB) + libptscotcherrexit$(LIB) \ + libptscotch$(LIB) install : $(includedir)/scotch.h \ $(includedir)/scotchf.h \ @@ -77,7 +79,7 @@ ptinstall : install \ $(libdir)/libptscotch$(LIB) clean : - -$(RM) *~ *$(OBJ) lib*$(LIB) parser_yy.c parser_ly.h parser_ll.c *scotch.h *scotchf.h y.output *dummysizes$(EXE) + -$(RM) *~ *$(OBJ) lib*$(LIB) lib*.def lib*.a parser_yy.c parser_ly.h parser_ll.c *scotch.h *scotchf.h y.output *dummysizes$(EXE) realclean : clean @@ -99,10 +101,10 @@ $(includedir)/ptscotchf.h : ptscotchf.h -$(CP) ptscotchf.h $(includedir) $(libdir)/libscotch$(LIB) : libscotch$(LIB) - -$(CP) libscotch$(LIB) libscotcherr*$(LIB) $(libdir) + -$(CP) libscotch$(CPLIB) libscotcherr*$(CPLIB) $(libdir) $(libdir)/libptscotch$(LIB) : libptscotch$(LIB) - -$(CP) libptscotch$(LIB) libptscotcherr*$(LIB) $(libdir) + -$(CP) libptscotch$(CPLIB) libptscotcherr*$(CPLIB) $(libdir) ## ## Library dependencies. @@ -2963,7 +2965,7 @@ ptscotchf.h : ptdummysizes$(EXE) \ ./ptdummysizes$(EXE) library_pt_f.h ptscotchf.h libscotch$(LIB) : $(LIBSCOTCHDEPS) - $(AR) $(ARFLAGS) $(@) $(?) + $(AR) $(ARFLAGS) $(@) $(?) $(ARSFLAGS) -$(RANLIB) $(@) libscotcherr$(LIB) : library_error$(OBJ) @@ -2975,13 +2977,13 @@ libscotcherrexit$(LIB) : library_error_exit$(OBJ) -$(RANLIB) $(@) libptscotch$(LIB) : $(LIBPTSCOTCHDEPS) - $(AR) $(ARFLAGS) $(@) $(?) + $(AR) $(ARFLAGS) $(@) $(?) $(ARPFLAGS) -$(RANLIB) $(@) libptscotcherr$(LIB) : library_error_pt$(OBJ) - $(AR) $(ARFLAGS) $(@) $(?) + $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS_P1_PT) -$(RANLIB) $(@) libptscotcherrexit$(LIB) : library_error_exit_pt$(OBJ) - $(AR) $(ARFLAGS) $(@) $(?) + $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS_P1_PT) -$(RANLIB) $(@) diff --git a/scotch_6.0.3/src/libscotch/library_dgraph_stat.c b/scotch_6.0.3/src/libscotch/library_dgraph_stat.c index 450c33fd..996c9b5c 100644 --- a/scotch_6.0.3/src/libscotch/library_dgraph_stat.c +++ b/scotch_6.0.3/src/libscotch/library_dgraph_stat.c @@ -62,8 +62,14 @@ ** The static variables. */ +#if defined(WIN32) || defined(WIN64) +#define DEFERRED_ADDRESS(address) 0 +#else +#define DEFERRED_ADDRESS(address) address +#endif + static int dgraphstatblentab[2] = { 7, 3 }; -static MPI_Datatype dgraphstattypetab[2] = { GNUM_MPI, MPI_DOUBLE }; +static MPI_Datatype dgraphstattypetab[2] = { DEFERRED_ADDRESS(GNUM_MPI), DEFERRED_ADDRESS(MPI_DOUBLE) }; /************************************/ /* */ @@ -147,6 +153,12 @@ double * edlodltptr) double edlolocdlt; int o; +#if defined(WIN32) || defined(WIN64) + //Had to re-route the initiallization of dgraphstattypetab, for compatibility with MinGW dllimports + dgraphstattypetab[0] = GNUM_MPI; + dgraphstattypetab[1] = MPI_DOUBLE; +#endif + srcgrafptr = (Dgraph *) grafptr; velolocdlt = 0.0L; diff --git a/scotch_6.0.3/src/libscotchmetis/Makefile b/scotch_6.0.3/src/libscotchmetis/Makefile index d81d02c0..09520ec7 100644 --- a/scotch_6.0.3/src/libscotchmetis/Makefile +++ b/scotch_6.0.3/src/libscotchmetis/Makefile @@ -40,6 +40,8 @@ libdir = ../../lib include ../Makefile.inc +CPLIB ?= $(LIB) + %$(OBJ) : %.c $(CC) $(CFLAGS) $(CLIBFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@) @@ -62,14 +64,14 @@ ptscotch : install : scotch -$(CP) metis.h $(includedir) - -$(CP) libscotchmetis$(LIB) $(libdir) + -$(CP) libscotchmetis$(CPLIB) $(libdir) ptinstall : ptscotch -$(CP) parmetis.h $(includedir) - -$(CP) libptscotchparmetis$(LIB) $(libdir) + -$(CP) libptscotchparmetis$(CPLIB) $(libdir) clean : - -$(RM) *~ *$(OBJ) lib*$(LIB) + -$(RM) *~ *$(OBJ) lib*$(LIB) lib*.a lib*.def realclean : clean @@ -129,12 +131,12 @@ libptscotchparmetis$(LIB) : parmetis_dgraph_order$(OBJ) \ parmetis_dgraph_order_f$(OBJ) \ parmetis_dgraph_part$(OBJ) \ parmetis_dgraph_part_f$(OBJ) - $(AR) $(ARFLAGS) $(@) $(^) + $(AR) $(ARFLAGS) $(@) $(^) $(ARPMFLAGS) -$(RANLIB) $(@) libscotchmetis$(LIB) : metis_graph_order$(OBJ) \ metis_graph_order_f$(OBJ) \ metis_graph_part$(OBJ) \ metis_graph_part_f$(OBJ) - $(AR) $(ARFLAGS) $(@) $(^) + $(AR) $(ARFLAGS) $(@) $(^) $(ARSMFLAGS) -$(RANLIB) $(@) diff --git a/scotch_6.0.3/src/scotch/Makefile b/scotch_6.0.3/src/scotch/Makefile index e1862420..93b35f9b 100644 --- a/scotch_6.0.3/src/scotch/Makefile +++ b/scotch_6.0.3/src/scotch/Makefile @@ -40,14 +40,21 @@ libdir = ../../lib include ../Makefile.inc +ifeq ("$(SCOTCHLIB)","ptscotch") +LDFLAGS_PT ?= $(LDFLAGS) +LDFLAGSX = $(LDFLAGS_PT) +else +LDFLAGSX = $(LDFLAGS) +endif + %$(EXE) : %$(OBJ) - $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS) + $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGSX) %$(OBJ) : %.c $(CC) $(CFLAGS) -I$(includedir) -I../libscotch -c $(<) -o $(@) %$(EXE) : %.c - $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGS) + $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -o $(@) -L$(libdir) -l$(SCOTCHLIB) -lscotch -l$(SCOTCHLIB)errexit $(LDFLAGSX) ## ## Project rules. @@ -205,7 +212,7 @@ dgpart$(EXE) : dgmap.c \ $(libdir)/libptscotch$(LIB) \ $(libdir)/libptscotcherrexit$(LIB) \ dgmap.h - $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LDFLAGS) + $(CC) $(CFLAGS) -I$(includedir) -I../libscotch $(<) -DSCOTCH_COMPILE_PART -o $(@) -L$(libdir) -lptscotch -lscotch -lptscotcherrexit $(LDFLAGSX) dgscat$(EXE) : dgscat.c \ ../libscotch/module.h \