diff --git a/Common/Timer.cpp b/Common/Timer.cpp index 689a47b102d9e5a580c3d1474031425faad07d8c..1bef406c9c69355d9e5cef04a4398882ee0b9d44 100644 --- a/Common/Timer.cpp +++ b/Common/Timer.cpp @@ -1,4 +1,4 @@ -// $Id: Timer.cpp,v 1.14 2005-06-20 17:02:45 geuzaine Exp $ +// $Id: Timer.cpp,v 1.15 2005-08-31 21:44:44 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -19,6 +19,8 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. +#if !defined(WIN32) || defined(__CYGWIN__) + #include <time.h> // FIXME: for sgi and maybe others #include <sys/time.h> #include <unistd.h> @@ -29,3 +31,15 @@ long GetTime() gettimeofday(&tp, (struct timezone *)0); return (long)tp.tv_sec * 1000000 + (long)tp.tv_usec; } + +#else // pure windows + +#include "Gmsh.h" + +long GetTime() +{ + Msg(GERROR, "GetTime not implemented on Windows without Cygwin"); + return 1; +} + +#endif diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 342aa1ef5c9b4560f27fc1f8b1460a09853bd275..5cc545ca0159e611d6bc4f038d8a6e86d0cc9f89 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.367 2005-08-09 23:41:12 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.368 2005-08-31 21:44:44 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -3223,12 +3223,16 @@ void solver_command_cb(CALLBACK_ARGS) void solver_kill_cb(CALLBACK_ARGS) { +#if !defined(WIN32) || defined(__CYGWIN__) int num = (int)(long)data; if(SINFO[num].pid > 0) { kill(SINFO[num].pid, 9); Msg(INFO, "Killed %s pid %d", SINFO[num].name, SINFO[num].pid); } SINFO[num].pid = -1; +#else + Msg(WARNING, "Killing processes not supported on Windows without Cygwin"); +#endif } void solver_choose_executable_cb(CALLBACK_ARGS) diff --git a/Fltk/Message.cpp b/Fltk/Message.cpp index 352405214cfa71d3436d3d781d790902e951f33c..aaddf3aa6ae0d00b37223097bb3372c95c2fa0c3 100644 --- a/Fltk/Message.cpp +++ b/Fltk/Message.cpp @@ -1,4 +1,4 @@ -// $Id: Message.cpp,v 1.64 2005-03-11 08:56:38 geuzaine Exp $ +// $Id: Message.cpp,v 1.65 2005-08-31 21:44:44 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -19,10 +19,12 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. +#if !defined(WIN32) || defined(__CYGWIN__) #include <unistd.h> #include <signal.h> #include <sys/time.h> #include <sys/resource.h> +#endif #if defined(__APPLE__) #define RUSAGE_SELF 0 @@ -45,6 +47,7 @@ extern Context_T CTX; void Signal(int sig_num) { +#if !defined(WIN32) || defined(__CYGWIN__) switch (sig_num) { case SIGSEGV: Msg(FATAL1, "Segmentation violation (invalid memory reference)"); @@ -64,6 +67,7 @@ void Signal(int sig_num) Msg(FATAL, "Unknown signal"); break; } +#endif } // General purpose message routine @@ -212,8 +216,10 @@ void Msg(int level, char *fmt, ...) void Exit(int level) { +#if !defined(WIN32) || defined(__CYGWIN__) // delete the temp file unlink(CTX.tmp_filename_fullpath); +#endif if(level){ // in case of an abnormal exit, force the abort directly @@ -264,12 +270,18 @@ void Exit(int level) void GetResources(long *s, long *us, long *mem) { +#if !defined(WIN32) || defined(__CYGWIN__) static struct rusage r; getrusage(RUSAGE_SELF, &r); *s = (long)r.ru_utime.tv_sec; *us = (long)r.ru_utime.tv_usec; *mem = (long)r.ru_maxrss; +#else + *s = 0; + *us = 0; + *mem = 0; +#endif } void PrintResources(long s, long us, long mem) diff --git a/Fltk/Solvers.cpp b/Fltk/Solvers.cpp index 8b6dbec46ea583d2cbc0508a83f822e003f263d6..d090bea271b4dcc739f55cadbb39f2592e7fc382 100644 --- a/Fltk/Solvers.cpp +++ b/Fltk/Solvers.cpp @@ -1,4 +1,4 @@ -// $Id: Solvers.cpp,v 1.38 2005-08-22 00:29:11 geuzaine Exp $ +// $Id: Solvers.cpp,v 1.39 2005-08-31 21:44:44 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -20,6 +20,12 @@ // Please report all bugs and problems to <gmsh@geuz.org>. #include "Gmsh.h" +#include "Solvers.h" + +SolverInfo SINFO[MAXSOLVERS]; + +#if !defined(WIN32) || defined(__CYGWIN__) + #include "GmshServer.h" // FIXME: this should be removed (and we should set the socket options @@ -35,7 +41,6 @@ int GmshServer::s; #include <unistd.h> #include "OpenFile.h" -#include "Solvers.h" #include "GmshUI.h" #include "GUI.h" #include "Mesh.h" @@ -45,8 +50,6 @@ int GmshServer::s; extern Context_T CTX; extern GUI *WID; -SolverInfo SINFO[MAXSOLVERS]; - // This routine polls the socket file descriptor every pollint // milliseconds until data is avalable; when nothing is available, we // just tend to pending GUI events. The routine returns 0 if data is @@ -278,3 +281,13 @@ int Solver(int num, char *args) return 1; } + +#else // pure windows + +int Solver(int num, char *args) +{ + Msg(GERROR, "Solver interface not available on Windows without Cygwin"); + return 1; +} + +#endif diff --git a/Parallel/Makefile b/Parallel/Makefile index 0865c14d1ec1ace0ee735a0d06ff8ab9167dc19c..1fcf800a30a864d629f0be864dc7decc7870be5f 100644 --- a/Parallel/Makefile +++ b/Parallel/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.20 2005-07-15 10:31:06 geuzaine Exp $ +# $Id: Makefile,v 1.21 2005-08-31 21:44:44 geuzaine Exp $ # # Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle # @@ -22,7 +22,7 @@ include ../variables LIB = ../lib/libGmshParallel.a -INCLUDE = +INCLUDE = -I../Common -I../DataStr CFLAGS = ${OPTIM} ${FLAGS} ${INCLUDE} SRC = ParUtil.cpp diff --git a/Parallel/ParUtil.cpp b/Parallel/ParUtil.cpp index fe037af62a383f67b4571dca2c78b1185074b59b..56108a86dcd0e9b90e398b0ad6b8bab6b940e89d 100644 --- a/Parallel/ParUtil.cpp +++ b/Parallel/ParUtil.cpp @@ -1,4 +1,4 @@ -// $Id: ParUtil.cpp,v 1.12 2005-06-20 17:02:46 geuzaine Exp $ +// $Id: ParUtil.cpp,v 1.13 2005-08-31 21:44:44 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -19,15 +19,14 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +#include "Gmsh.h" #include "ParUtil.h" -#ifdef HAVE_PARALLEL -#include "mpi.h" -#else -#include <time.h> // FIXME: for sgi and maybe others -#include <sys/time.h> + +#if defined(HAVE_PARALLEL) +# include "mpi.h" +#elif !defined(WIN32) || defined(__CYGWIN__) +# include <time.h> // FIXME: for sgi and maybe others +# include <sys/time.h> #endif ParUtil *ParUtil::Instance() @@ -69,7 +68,7 @@ double ParUtil::wTime() const { #ifdef HAVE_PARALLEL return MPI_Wtime(); -#else +#elif !defined(WIN32) || defined(__CYGWIN__) struct timeval tp; struct timezone tzp; double timeval; @@ -80,6 +79,9 @@ double ParUtil::wTime() const timeval = timeval + (double)((double).000001 * (double)tp.tv_usec); return (timeval); +#else + Msg(GERROR, "wTime not implemented on Windows without Cygwin"); + return 1.; #endif } diff --git a/Parallel/ParUtil.h b/Parallel/ParUtil.h index bc8399224491c9085c1de39f4a2ef72a8e13c139..b26a91a9e73905854a368b89bcc6dbc6d0bf6577 100644 --- a/Parallel/ParUtil.h +++ b/Parallel/ParUtil.h @@ -20,8 +20,6 @@ // // Please report all bugs and problems to <gmsh@geuz.org>. -#include <stdio.h> - /** ParUtil is a Singleton. It gives some general services for parallel implementation. diff --git a/configure b/configure index 1ff03be1bf3f4a579e8b4f6db0db6f00b0060899..872d69f19545e3812261cf7b7f95c8c3f2cbe8c5 100755 --- a/configure +++ b/configure @@ -850,6 +850,7 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-gsl use GSL as numerical toolkit (default=yes) --enable-gui build the graphical user interface (default=yes) + --enable-cygwin use the Cygwin library on Windows (default=yes) --enable-parallel enable parallel version (default=no) --enable-triangle compile Triangle if available (default=yes) --enable-netgen compile Netgen if available (default=yes) @@ -1362,6 +1363,11 @@ fi; if test "${enable_gui+set}" = set; then enableval="$enable_gui" +fi; +# Check whether --enable-cygwin or --disable-cygwin was given. +if test "${enable_cygwin+set}" = set; then + enableval="$enable_cygwin" + fi; # Check whether --enable-parallel or --disable-parallel was given. if test "${enable_parallel+set}" = set; then @@ -4408,7 +4414,12 @@ GMSH_LIBS="${GMSH_LIBS} -lm" case "$UNAME" in CYGWIN* | MINGW*) - LINKER="${LINKER} -Wl,--subsystem,windows -mwindows" + LINKER="${LINKER} -mwindows" + if test "x$enable_cygwin" = "xno"; then + FLAGS="${FLAGS} -mno-cygwin -DHAVE_NO_DLL" + LINKER="${LINKER} -mno-cygwin" + UNAME="${UNAME}-no-cygwin" + fi if test "x$enable_gui" != "xno"; then GMSH_LIBS="${GMSH_LIBS} Fltk/Win32Icon.res" fi @@ -4982,9 +4993,10 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs diff --git a/configure.in b/configure.in index b446dce865c702eb2783e3430c7e2dc1251918bb..ce85e6e22102c251ea5b73f78ef505d1c6aa4f94 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -dnl $Id: configure.in,v 1.75 2005-08-22 12:00:32 geuzaine Exp $ +dnl $Id: configure.in,v 1.76 2005-08-31 21:44:44 geuzaine Exp $ dnl dnl Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle dnl @@ -57,6 +57,9 @@ AC_ARG_ENABLE(gsl, AC_ARG_ENABLE(gui, AC_HELP_STRING([--enable-gui], [build the graphical user interface (default=yes)])) +AC_ARG_ENABLE(cygwin, + AC_HELP_STRING([--enable-cygwin], + [use the Cygwin library on Windows (default=yes)])) AC_ARG_ENABLE(parallel, AC_HELP_STRING([--enable-parallel], [enable parallel version (default=no)])) @@ -422,7 +425,12 @@ dnl Modify defaults according to OS case "$UNAME" in CYGWIN* | MINGW*) - LINKER="${LINKER} -Wl,--subsystem,windows -mwindows" + LINKER="${LINKER} -mwindows" + if test "x$enable_cygwin" = "xno"; then + FLAGS="${FLAGS} -mno-cygwin -DHAVE_NO_DLL" + LINKER="${LINKER} -mno-cygwin" + UNAME="${UNAME}-no-cygwin" + fi if test "x$enable_gui" != "xno"; then GMSH_LIBS="${GMSH_LIBS} Fltk/Win32Icon.res" fi