gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Better Win CodeBlock/MinGW support (#418) - Remove -ansi compilation flag - Don't include sys/times.h when WIN32 is defined
0 2 0
default
2 files changed with 3 insertions and 1 deletions:
↑ Collapse diff ↑
Ignore white space 48 line context
... ...
@@ -30,49 +30,49 @@
30 30
  ELSE()
31 31
    IF(HG_REVISION_PATH STREQUAL "")
32 32
      SET(HG_REVISION_ID ${HG_REVISION})
33 33
    ELSE()
34 34
      SET(HG_REVISION_ID ${HG_REVISION_PATH}.${HG_REVISION})
35 35
    ENDIF()
36 36
  ENDIF()
37 37
  SET(LEMON_VERSION ${HG_REVISION_ID} CACHE STRING "LEMON version string.")
38 38
ENDIF()
39 39

	
40 40
SET(PROJECT_VERSION ${LEMON_VERSION})
41 41

	
42 42
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
43 43

	
44 44
FIND_PACKAGE(Doxygen)
45 45
FIND_PACKAGE(Ghostscript)
46 46
FIND_PACKAGE(GLPK 4.33)
47 47
FIND_PACKAGE(CPLEX)
48 48
FIND_PACKAGE(COIN)
49 49

	
50 50
IF(DEFINED ENV{LEMON_CXX_WARNING})
51 51
  SET(CXX_WARNING $ENV{LEMON_CXX_WARNING})
52 52
ELSE()
53 53
  IF(CMAKE_COMPILER_IS_GNUCXX)
54
    SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
54
    SET(CXX_WARNING "-Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas")
55 55
    SET(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-ggdb")
56 56
    SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
57 57
  ELSEIF(MSVC)
58 58
    # This part is unnecessary 'casue the same is set by the lemon/core.h.
59 59
    # Still keep it as an example.
60 60
    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
61 61
    # Suppressed warnings:
62 62
    # C4250: 'class1' : inherits 'class2::member' via dominance
63 63
    # C4355: 'this' : used in base member initializer list
64 64
    # C4503: 'function' : decorated name length exceeded, name was truncated
65 65
    # C4800: 'type' : forcing value to bool 'true' or 'false'
66 66
    #        (performance warning)
67 67
    # C4996: 'function': was declared deprecated
68 68
  ELSE()
69 69
    SET(CXX_WARNING "-Wall -W")
70 70
  ENDIF()
71 71
ENDIF()
72 72
SET(LEMON_CXX_WARNING_FLAGS ${CXX_WARNING} CACHE STRING "LEMON warning flags.")
73 73

	
74 74
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LEMON_CXX_WARNING_FLAGS}")
75 75

	
76 76
SET( CMAKE_CXX_FLAGS_MAINTAINER "-Werror -ggdb" CACHE STRING
77 77
    "Flags used by the C++ compiler during maintainer builds."
78 78
    FORCE )
Ignore white space 6 line context
... ...
@@ -19,49 +19,51 @@
19 19
///\file
20 20
///\brief Some basic non-inline functions and static global data.
21 21

	
22 22
#include<lemon/bits/windows.h>
23 23

	
24 24
#ifdef WIN32
25 25
#ifndef WIN32_LEAN_AND_MEAN
26 26
#define WIN32_LEAN_AND_MEAN
27 27
#endif
28 28
#ifndef NOMINMAX
29 29
#define NOMINMAX
30 30
#endif
31 31
#ifdef UNICODE
32 32
#undef UNICODE
33 33
#endif
34 34
#include <windows.h>
35 35
#ifdef LOCALE_INVARIANT
36 36
#define MY_LOCALE LOCALE_INVARIANT
37 37
#else
38 38
#define MY_LOCALE LOCALE_NEUTRAL
39 39
#endif
40 40
#else
41 41
#include <unistd.h>
42 42
#include <ctime>
43
#ifndef WIN32
43 44
#include <sys/times.h>
45
#endif
44 46
#include <sys/time.h>
45 47
#endif
46 48

	
47 49
#include <cmath>
48 50
#include <sstream>
49 51

	
50 52
namespace lemon {
51 53
  namespace bits {
52 54
    void getWinProcTimes(double &rtime,
53 55
                         double &utime, double &stime,
54 56
                         double &cutime, double &cstime)
55 57
    {
56 58
#ifdef WIN32
57 59
      static const double ch = 4294967296.0e-7;
58 60
      static const double cl = 1.0e-7;
59 61

	
60 62
      FILETIME system;
61 63
      GetSystemTimeAsFileTime(&system);
62 64
      rtime = ch * system.dwHighDateTime + cl * system.dwLowDateTime;
63 65

	
64 66
      FILETIME create, exit, kernel, user;
65 67
      if (GetProcessTimes(GetCurrentProcess(),&create, &exit, &kernel, &user)) {
66 68
        utime = ch * user.dwHighDateTime + cl * user.dwLowDateTime;
67 69
        stime = ch * kernel.dwHighDateTime + cl * kernel.dwLowDateTime;
0 comments (0 inline)