1.1 --- a/CMakeLists.txt Thu Apr 02 14:07:38 2015 +0200
1.2 +++ b/CMakeLists.txt Tue Apr 28 18:07:07 2015 +0200
1.3 @@ -66,6 +66,10 @@
1.4 FIND_PACKAGE(Doxygen)
1.5 FIND_PACKAGE(Ghostscript)
1.6
1.7 +IF(WIN32)
1.8 + SET(LEMON_WIN32 TRUE)
1.9 +ENDIF(WIN32)
1.10 +
1.11 SET(LEMON_ENABLE_GLPK YES CACHE STRING "Enable GLPK solver backend.")
1.12 SET(LEMON_ENABLE_ILOG YES CACHE STRING "Enable ILOG (CPLEX) solver backend.")
1.13 SET(LEMON_ENABLE_COIN YES CACHE STRING "Enable COIN solver backend.")
2.1 --- a/lemon/bits/windows.cc Thu Apr 02 14:07:38 2015 +0200
2.2 +++ b/lemon/bits/windows.cc Tue Apr 28 18:07:07 2015 +0200
2.3 @@ -21,7 +21,7 @@
2.4
2.5 #include<lemon/bits/windows.h>
2.6
2.7 -#ifdef WIN32
2.8 +#ifdef LEMON_WIN32
2.9 #ifndef WIN32_LEAN_AND_MEAN
2.10 #define WIN32_LEAN_AND_MEAN
2.11 #endif
2.12 @@ -40,7 +40,7 @@
2.13 #else
2.14 #include <unistd.h>
2.15 #include <ctime>
2.16 -#ifndef WIN32
2.17 +#ifndef LEMON_WIN32
2.18 #include <sys/times.h>
2.19 #endif
2.20 #include <sys/time.h>
2.21 @@ -55,7 +55,7 @@
2.22 double &utime, double &stime,
2.23 double &cutime, double &cstime)
2.24 {
2.25 -#ifdef WIN32
2.26 +#ifdef LEMON_WIN32
2.27 static const double ch = 4294967296.0e-7;
2.28 static const double cl = 1.0e-7;
2.29
2.30 @@ -94,11 +94,11 @@
2.31 std::string getWinFormattedDate()
2.32 {
2.33 std::ostringstream os;
2.34 -#ifdef WIN32
2.35 +#ifdef LEMON_WIN32
2.36 SYSTEMTIME time;
2.37 GetSystemTime(&time);
2.38 char buf1[11], buf2[9], buf3[5];
2.39 - if (GetDateFormat(MY_LOCALE, 0, &time,
2.40 + if (GetDateFormat(MY_LOCALE, 0, &time,
2.41 ("ddd MMM dd"), buf1, 11) &&
2.42 GetTimeFormat(MY_LOCALE, 0, &time,
2.43 ("HH':'mm':'ss"), buf2, 9) &&
2.44 @@ -120,7 +120,7 @@
2.45
2.46 int getWinRndSeed()
2.47 {
2.48 -#ifdef WIN32
2.49 +#ifdef LEMON_WIN32
2.50 FILETIME time;
2.51 GetSystemTimeAsFileTime(&time);
2.52 return GetCurrentProcessId() + time.dwHighDateTime + time.dwLowDateTime;
2.53 @@ -132,7 +132,7 @@
2.54 }
2.55
2.56 WinLock::WinLock() {
2.57 -#ifdef WIN32
2.58 +#ifdef LEMON_WIN32
2.59 CRITICAL_SECTION *lock = new CRITICAL_SECTION;
2.60 InitializeCriticalSection(lock);
2.61 _repr = lock;
2.62 @@ -142,7 +142,7 @@
2.63 }
2.64
2.65 WinLock::~WinLock() {
2.66 -#ifdef WIN32
2.67 +#ifdef LEMON_WIN32
2.68 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
2.69 DeleteCriticalSection(lock);
2.70 delete lock;
2.71 @@ -150,14 +150,14 @@
2.72 }
2.73
2.74 void WinLock::lock() {
2.75 -#ifdef WIN32
2.76 +#ifdef LEMON_WIN32
2.77 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
2.78 EnterCriticalSection(lock);
2.79 #endif
2.80 }
2.81
2.82 void WinLock::unlock() {
2.83 -#ifdef WIN32
2.84 +#ifdef LEMON_WIN32
2.85 CRITICAL_SECTION *lock = static_cast<CRITICAL_SECTION*>(_repr);
2.86 LeaveCriticalSection(lock);
2.87 #endif
3.1 --- a/lemon/bits/windows.h Thu Apr 02 14:07:38 2015 +0200
3.2 +++ b/lemon/bits/windows.h Tue Apr 28 18:07:07 2015 +0200
3.3 @@ -19,6 +19,7 @@
3.4 #ifndef LEMON_BITS_WINDOWS_H
3.5 #define LEMON_BITS_WINDOWS_H
3.6
3.7 +#include <lemon/config.h>
3.8 #include <string>
3.9
3.10 namespace lemon {
3.11 @@ -34,7 +35,7 @@
3.12 WinLock();
3.13 ~WinLock();
3.14 void lock();
3.15 - void unlock();
3.16 + void unlock();\
3.17 private:
3.18 void *_repr;
3.19 };
4.1 --- a/lemon/config.h.in Thu Apr 02 14:07:38 2015 +0200
4.2 +++ b/lemon/config.h.in Tue Apr 28 18:07:07 2015 +0200
4.3 @@ -1,6 +1,11 @@
4.4 +#ifndef LEMON_CONFIG_H
4.5 +#define LEMON_CONFIG_H
4.6 +
4.7 #define LEMON_VERSION "@PROJECT_VERSION@"
4.8 #cmakedefine LEMON_HAVE_LONG_LONG 1
4.9
4.10 +#cmakedefine LEMON_WIN32 1
4.11 +
4.12 #cmakedefine LEMON_HAVE_LP 1
4.13 #cmakedefine LEMON_HAVE_MIP 1
4.14 #cmakedefine LEMON_HAVE_GLPK 1
4.15 @@ -9,14 +14,16 @@
4.16 #cmakedefine LEMON_HAVE_CLP 1
4.17 #cmakedefine LEMON_HAVE_CBC 1
4.18
4.19 -#define _LEMON_CPLEX 1
4.20 -#define _LEMON_CLP 2
4.21 -#define _LEMON_GLPK 3
4.22 -#define _LEMON_SOPLEX 4
4.23 -#define _LEMON_CBC 5
4.24 +#define LEMON_CPLEX_ 1
4.25 +#define LEMON_CLP_ 2
4.26 +#define LEMON_GLPK_ 3
4.27 +#define LEMON_SOPLEX_ 4
4.28 +#define LEMON_CBC_ 5
4.29
4.30 -#cmakedefine LEMON_DEFAULT_LP _LEMON_@LEMON_DEFAULT_LP@
4.31 -#cmakedefine LEMON_DEFAULT_MIP _LEMON_@LEMON_DEFAULT_MIP@
4.32 +#cmakedefine LEMON_DEFAULT_LP LEMON_@LEMON_DEFAULT_LP@_
4.33 +#cmakedefine LEMON_DEFAULT_MIP LEMON_@LEMON_DEFAULT_MIP@_
4.34
4.35 #cmakedefine LEMON_USE_PTHREAD 1
4.36 #cmakedefine LEMON_USE_WIN32_THREADS 1
4.37 +
4.38 +#endif
5.1 --- a/lemon/graph_to_eps.h Thu Apr 02 14:07:38 2015 +0200
5.2 +++ b/lemon/graph_to_eps.h Tue Apr 28 18:07:07 2015 +0200
5.3 @@ -25,7 +25,7 @@
5.4 #include<algorithm>
5.5 #include<vector>
5.6
5.7 -#ifndef WIN32
5.8 +#ifndef LEMON_WIN32
5.9 #include<sys/time.h>
5.10 #include<ctime>
5.11 #else
5.12 @@ -674,7 +674,7 @@
5.13
5.14 {
5.15 os << "%%CreationDate: ";
5.16 -#ifndef WIN32
5.17 +#ifndef LEMON_WIN32
5.18 timeval tv;
5.19 gettimeofday(&tv, 0);
5.20
6.1 --- a/lemon/lp.h Thu Apr 02 14:07:38 2015 +0200
6.2 +++ b/lemon/lp.h Tue Apr 28 18:07:07 2015 +0200
6.3 @@ -22,19 +22,19 @@
6.4 #include<lemon/config.h>
6.5
6.6
6.7 -#if LEMON_DEFAULT_LP == _LEMON_GLPK || LEMON_DEFAULT_MIP == _LEMON_GLPK
6.8 +#if LEMON_DEFAULT_LP == LEMON_GLPK_ || LEMON_DEFAULT_MIP == LEMON_GLPK_
6.9 #include <lemon/glpk.h>
6.10 #endif
6.11 -#if LEMON_DEFAULT_LP == _LEMON_CPLEX || LEMON_DEFAULT_MIP == _LEMON_CPLEX
6.12 +#if LEMON_DEFAULT_LP == LEMON_CPLEX_ || LEMON_DEFAULT_MIP == LEMON_CPLEX_
6.13 #include <lemon/cplex.h>
6.14 #endif
6.15 -#if LEMON_DEFAULT_LP == _LEMON_SOPLEX
6.16 +#if LEMON_DEFAULT_LP == LEMON_SOPLEX_
6.17 #include <lemon/soplex.h>
6.18 #endif
6.19 -#if LEMON_DEFAULT_LP == _LEMON_CLP
6.20 +#if LEMON_DEFAULT_LP == LEMON_CLP_
6.21 #include <lemon/clp.h>
6.22 #endif
6.23 -#if LEMON_DEFAULT_MIP == _LEMON_CBC
6.24 +#if LEMON_DEFAULT_MIP == LEMON_CBC_
6.25 #include <lemon/cbc.h>
6.26 #endif
6.27
6.28 @@ -49,8 +49,8 @@
6.29 ///The default LP solver identifier.
6.30 ///\ingroup lp_group
6.31 ///
6.32 - ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX,
6.33 - ///\c _LEMON_SOPLEX or \c LEMON__CLP
6.34 + ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_,
6.35 + ///\c LEMON_SOPLEX_ or \c LEMON_CLP_
6.36 #define LEMON_DEFAULT_LP SOLVER
6.37 ///The default LP solver
6.38
6.39 @@ -65,8 +65,8 @@
6.40 ///The default MIP solver identifier.
6.41 ///\ingroup lp_group
6.42 ///
6.43 - ///Currently, the possible values are \c _LEMON_GLPK, \c LEMON__CPLEX
6.44 - ///or \c _LEMON_CBC
6.45 + ///Currently, the possible values are \c LEMON_GLPK_, \c LEMON_CPLEX_
6.46 + ///or \c LEMON_CBC_
6.47 #define LEMON_DEFAULT_MIP SOLVER
6.48 ///The default MIP solver.
6.49
6.50 @@ -76,20 +76,20 @@
6.51 ///Currently, it is either \c GlpkMip, \c CplexMip , \c CbcMip
6.52 typedef GlpkMip Mip;
6.53 #else
6.54 -#if LEMON_DEFAULT_LP == _LEMON_GLPK
6.55 +#if LEMON_DEFAULT_LP == LEMON_GLPK_
6.56 typedef GlpkLp Lp;
6.57 -#elif LEMON_DEFAULT_LP == _LEMON_CPLEX
6.58 +#elif LEMON_DEFAULT_LP == LEMON_CPLEX_
6.59 typedef CplexLp Lp;
6.60 -#elif LEMON_DEFAULT_LP == _LEMON_SOPLEX
6.61 +#elif LEMON_DEFAULT_LP == LEMON_SOPLEX_
6.62 typedef SoplexLp Lp;
6.63 -#elif LEMON_DEFAULT_LP == _LEMON_CLP
6.64 +#elif LEMON_DEFAULT_LP == LEMON_CLP_
6.65 typedef ClpLp Lp;
6.66 #endif
6.67 -#if LEMON_DEFAULT_MIP == _LEMON_GLPK
6.68 +#if LEMON_DEFAULT_MIP == LEMON_GLPK_
6.69 typedef GlpkMip Mip;
6.70 -#elif LEMON_DEFAULT_MIP == _LEMON_CPLEX
6.71 +#elif LEMON_DEFAULT_MIP == LEMON_CPLEX_
6.72 typedef CplexMip Mip;
6.73 -#elif LEMON_DEFAULT_MIP == _LEMON_CBC
6.74 +#elif LEMON_DEFAULT_MIP == LEMON_CBC_
6.75 typedef CbcMip Mip;
6.76 #endif
6.77 #endif
7.1 --- a/lemon/random.h Thu Apr 02 14:07:38 2015 +0200
7.2 +++ b/lemon/random.h Tue Apr 28 18:07:07 2015 +0200
7.3 @@ -62,6 +62,8 @@
7.4 #ifndef LEMON_RANDOM_H
7.5 #define LEMON_RANDOM_H
7.6
7.7 +#include <lemon/config.h>
7.8 +
7.9 #include <algorithm>
7.10 #include <iterator>
7.11 #include <vector>
7.12 @@ -71,7 +73,7 @@
7.13 #include <lemon/math.h>
7.14 #include <lemon/dim2.h>
7.15
7.16 -#ifndef WIN32
7.17 +#ifndef LEMON_WIN32
7.18 #include <sys/time.h>
7.19 #include <ctime>
7.20 #include <sys/types.h>
7.21 @@ -605,7 +607,7 @@
7.22 /// it uses the \c seedFromTime().
7.23 /// \return Currently always \c true.
7.24 bool seed() {
7.25 -#ifndef WIN32
7.26 +#ifndef LEMON_WIN32
7.27 if (seedFromFile("/dev/urandom", 0)) return true;
7.28 #endif
7.29 if (seedFromTime()) return true;
7.30 @@ -625,7 +627,7 @@
7.31 /// \param file The source file
7.32 /// \param offset The offset, from the file read.
7.33 /// \return \c true when the seeding successes.
7.34 -#ifndef WIN32
7.35 +#ifndef LEMON_WIN32
7.36 bool seedFromFile(const std::string& file = "/dev/urandom", int offset = 0)
7.37 #else
7.38 bool seedFromFile(const std::string& file = "", int offset = 0)
7.39 @@ -647,7 +649,7 @@
7.40 /// random sequence.
7.41 /// \return Currently always \c true.
7.42 bool seedFromTime() {
7.43 -#ifndef WIN32
7.44 +#ifndef LEMON_WIN32
7.45 timeval tv;
7.46 gettimeofday(&tv, 0);
7.47 seed(getpid() + tv.tv_sec + tv.tv_usec);
8.1 --- a/lemon/time_measure.h Thu Apr 02 14:07:38 2015 +0200
8.2 +++ b/lemon/time_measure.h Tue Apr 28 18:07:07 2015 +0200
8.3 @@ -23,7 +23,9 @@
8.4 ///\file
8.5 ///\brief Tools for measuring cpu usage
8.6
8.7 -#ifdef WIN32
8.8 +#include <lemon/config.h>
8.9 +
8.10 +#ifdef LEMON_WIN32
8.11 #include <lemon/bits/windows.h>
8.12 #else
8.13 #include <unistd.h>
8.14 @@ -102,7 +104,7 @@
8.15 ///Read the current time values of the process
8.16 void stamp()
8.17 {
8.18 -#ifndef WIN32
8.19 +#ifndef LEMON_WIN32
8.20 timeval tv;
8.21 gettimeofday(&tv, 0);
8.22 rtime=tv.tv_sec+double(tv.tv_usec)/1e6;