WSL/SLF GitLab Repository
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
snow-models
meteoio
Commits
aa50376d
Commit
aa50376d
authored
Jun 02, 2014
by
Mathias Bavay
Browse files
Trying a better set of pre-processor variables (those should be automaticaly defined by cmake)
parent
ba96b57e
Changes
12
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
aa50376d
...
...
@@ -24,7 +24,6 @@ INCLUDE("${CMAKE_SOURCE_DIR}/tools/cmake/BuildVersion.cmake")
BuildVersion
()
IF
(
MSVC
)
ADD_DEFINITIONS
(
/DMSVC
)
#SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "limited configs" FORCE)
SET
(
WARNINGS
"/W4"
)
#SET(EXTRA_WARNINGS "/Wp64") #/Wall
...
...
@@ -71,7 +70,6 @@ ENDIF(MSVC)
IF
(
UNIX
)
IF
(
APPLE
)
SET
(
PLATFORM
"-DAPPLE"
)
SET
(
DLL_EXT
"dylib*"
)
SET
(
STAT_EXT
"a"
)
SET
(
EXTRA_WARNINGS
"
${
EXTRA_WARNINGS
}
-Wno-sign-conversion"
)
#for now, keep clang quiet
...
...
@@ -79,21 +77,11 @@ IF(UNIX)
#set(CMAKE_OSX_SYSROOT iphoneos2.2.1) #for IOS
#set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) #for IOS
ELSE
(
APPLE
)
IF
(
CYGWIN
)
SET
(
PLATFORM
"-DLINUX -DCYGWIN"
)
ELSE
(
CYGWIN
)
SET
(
PLATFORM
"-DLINUX"
)
ENDIF
(
CYGWIN
)
SET
(
DLL_EXT
"so*"
)
SET
(
STAT_EXT
"a"
)
ENDIF
(
APPLE
)
ELSE
(
UNIX
)
IF
(
WIN32
)
IF
(
MINGW
)
SET
(
PLATFORM
"-DMSWIN -DMINGW"
)
ELSE
(
MINGW
)
SET
(
PLATFORM
"-DMSWIN"
)
ENDIF
(
MINGW
)
SET
(
DLL_EXT
"dll"
)
SET
(
STAT_EXT
"a"
)
ENDIF
(
WIN32
)
...
...
@@ -135,7 +123,7 @@ IF(POPC)
SET
(
POPC_FLAGS
"-cxxmain"
)
ENDIF
(
POPC
)
SET
(
CMAKE_CXX_FLAGS
"
${
POPC_FLAGS
}
${
_VERSION
}
${
ARCH
}
${
PLATFORM
}
"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS
"
${
POPC_FLAGS
}
${
_VERSION
}
${
ARCH
}
"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_RELEASE
"
${
OPTIM
}
"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_DEBUG
"
${
DEBUG
}
${
WARNINGS
}
${
EXTRA_WARNINGS
}
"
CACHE STRING
""
FORCE
)
SET
(
CMAKE_CXX_FLAGS_CXXFLAGS
"$ENV{CXXFLAGS}"
CACHE STRING
""
FORCE
)
...
...
meteoio/FileUtils.cc
View file @
aa50376d
...
...
@@ -20,7 +20,7 @@
#include
<cstdio>
#include
<fstream>
#ifdef
MSWIN
#if
def
ined _WIN32 || defined __MINGW32__
#include
<windows.h>
#include
"Shlwapi.h"
//removing two macros defined in windows.h
...
...
@@ -62,7 +62,7 @@ std::string cleanPath(std::string in_path, const bool& resolve)
std
::
replace
(
in_path
.
begin
(),
in_path
.
end
(),
'\\'
,
'/'
);
return
in_path
;
}
else
{
#ifdef
MSWIN
#if
def
ined _WIN32 || defined __MINGW32__
//if this would not suffice, see http://pdh11.blogspot.ch/2009/05/pathcanonicalize-versus-what-it-says-on.html
char
**
ptr
=
NULL
;
char
*
out_buff
=
(
char
*
)
calloc
(
MAX_PATH
,
sizeof
(
char
));
...
...
@@ -139,12 +139,17 @@ bool validFileName(const std::string& filename)
return
true
;
}
#ifdef MSWIN
bool
isAbsolutePath
(
const
std
::
string
&
in_path
)
{
#if defined _WIN32 || defined __MINGW32__ || defined __CYGWIN__
return
(
in_path
.
size
()
>=
2
&&
in_path
[
1
]
==
':'
);
#else
return
(
in_path
.
size
()
>=
1
&&
in_path
[
0
]
==
'/'
);
#endif
}
#if defined _WIN32 || defined __MINGW32__
bool
fileExists
(
const
std
::
string
&
filename
)
{
return
(
GetFileAttributes
(
filename
.
c_str
()
)
!=
INVALID_FILE_ATTRIBUTES
);
...
...
@@ -183,11 +188,6 @@ void readDirectory(const std::string& path, std::list<std::string>& dirlist, con
FindClose
(
hFind
);
}
#else
bool
isAbsolutePath
(
const
std
::
string
&
in_path
)
{
return
(
in_path
.
size
()
>=
1
&&
in_path
[
0
]
==
'/'
);
}
bool
fileExists
(
const
std
::
string
&
filename
)
{
struct
stat
buffer
;
...
...
meteoio/GeneratorAlgorithms.h
View file @
aa50376d
...
...
@@ -25,7 +25,7 @@
#include
<set>
#include
<string>
#ifdef MS
V
C
#ifdef
_
MSC
_VER
#pragma warning(disable:4512) //we don't need any = operator!
#endif
...
...
meteoio/IOExceptions.cc
View file @
aa50376d
...
...
@@ -18,7 +18,7 @@
#include
<meteoio/IOExceptions.h>
#include
<string.h>
#if defined(
LINUX
) && !defined(ANDROID) && !defined(CYGWIN)
#if defined(
__linux
) && !defined(ANDROID) && !defined(
__
CYGWIN
__
)
#include
<execinfo.h>
//needed for the backtracing of the stack
#if defined(__GNUC__)
#include
<sstream>
...
...
@@ -28,12 +28,12 @@
#include
<meteoio/MessageBoxX11.h>
#endif
#endif
#if defined
(MSWIN)
#if defined
_WIN32 || defined __MINGW32__
#include
<windows.h>
#undef max
#undef min
#endif
#if defined(APPLE) && defined(MSG_BOX)
#if defined(
__
APPLE
__
) && defined(MSG_BOX)
#include
<CoreFoundation/CoreFoundation.h>
#endif
...
...
@@ -43,15 +43,15 @@ namespace mio {
#if defined(MSG_BOX)
void
messageBox
(
const
std
::
string
&
msg
)
{
#if defined(
LINUX
) && !defined(ANDROID) && !defined(CYGWIN)
#if defined(
__linux
) && !defined(ANDROID) && !defined(
__
CYGWIN
__
)
const
string
box_msg
=
msg
+
"
\n\n
Please check the terminal for more information!"
;
MessageBoxX11
(
"Oops, something went wrong!"
,
box_msg
.
c_str
());
#endif
#if defined
(MSWIN)
#if defined
_WIN32 || defined __MINGW32__
const
string
box_msg
=
msg
+
"
\n\n
Please check the terminal for more information!"
;
MessageBox
(
NULL
,
box_msg
.
c_str
(),
TEXT
(
"Oops, something went wrong!"
),
MB_OK
|
MB_ICONERROR
);
#endif
#if defined(APPLE)
#if defined(
__
APPLE
__
)
const
string
box_msg
=
msg
+
"
\n\n
Please check the terminal for more information!"
;
const
void
*
keys
[]
=
{
kCFUserNotificationAlertHeaderKey
,
kCFUserNotificationAlertMessageKey
};
...
...
@@ -71,7 +71,7 @@ IOException::IOException(const std::string& message, const std::string& position
IOException
::
IOException
(
const
std
::
string
&
message
,
const
std
::
string
&
position
)
:
msg
(),
full_output
()
#endif
{
#if defined
(MS
WIN
)
#if defined
_WIN32 || defined __MINGW32__ || defined __CYG
WIN
__
const
char
*
delim
=
strrchr
(
position
.
c_str
(),
'\\'
);
#else
const
char
*
delim
=
strrchr
(
position
.
c_str
(),
'/'
);
...
...
@@ -79,7 +79,7 @@ IOException::IOException(const std::string& message, const std::string& position
const
std
::
string
where
=
(
position
.
empty
())
?
"unknown position"
:
((
delim
)
?
delim
+
1
:
position
);
msg
=
"["
+
where
+
"] "
+
message
;
#if defined(
LINUX
) && !defined(ANDROID) && !defined(CYGWIN)
#if defined(
__linux
) && !defined(ANDROID) && !defined(
__
CYGWIN
__
)
void
*
tracearray
[
25
];
//maximal size for backtrace: 25 pointers
const
int
tracesize
=
backtrace
(
tracearray
,
25
);
//obtains backtrace for current thread
char
**
symbols
=
backtrace_symbols
(
tracearray
,
tracesize
);
//translate pointers to strings
...
...
meteoio/MessageBoxX11.cc
View file @
aa50376d
...
...
@@ -8,7 +8,7 @@
version is entirely leak proof! (According to valgrind)
*/
#ifdef
LINUX
#ifdef
__linux
#include
<X11/X.h>
#include
<X11/Xlib.h>
...
...
meteoio/MessageBoxX11.h
View file @
aa50376d
#ifndef MESSAGEBOXX11_H
#define MESSAGEBOXX11_H
#ifdef
LINUX
#ifdef
__linux
void
MessageBoxX11
(
const
char
*
title
,
const
char
*
text
);
#endif
#endif
\ No newline at end of file
#endif
meteoio/ResamplingAlgorithms.h
View file @
aa50376d
...
...
@@ -27,7 +27,7 @@
#include
<vector>
#include
<map>
#ifdef MS
V
C
#ifdef
_
MSC
_VER
#pragma warning(disable:4512) //we don't need any = operator!
#endif
...
...
meteoio/Timer.cc
View file @
aa50376d
...
...
@@ -18,7 +18,7 @@
*/
#include
<stdio.h>
#ifdef
MSWIN
#if
def
ined _WIN32 || defined __MINGW32__
#include
<windows.h>
#undef max
#undef min
...
...
@@ -86,7 +86,7 @@ double Timer::getElapsed() const {
return
elapsed
;
}
#ifdef
MSWIN
#if
def
ined _WIN32 || defined __MINGW32__
long
double
Timer
::
getCurrentTime
()
const
{
SYSTEMTIME
systemTime
;
GetSystemTime
(
&
systemTime
);
...
...
@@ -113,7 +113,7 @@ long double Timer::getCurrentTime() const {
#endif
#if
ndef MSWIN
#if
!defined _WIN32 && !defined __MINGW32__
const
int
UsageTimer
::
who
=
RUSAGE_SELF
;
UsageTimer
::
UsageTimer
()
:
start_usage
(),
current_usage
(),
user_time
(
0.
),
sys_time
(
0.
),
elapsed
(
0.
),
is_running
(
false
)
{}
...
...
meteoio/Timer.h
View file @
aa50376d
...
...
@@ -22,7 +22,7 @@
#ifndef __TIMER_H__
#define __TIMER_H__
#if
ndef MSWIN
#if
!defined _WIN32 && !defined __MINGW32__
#include
<sys/resource.h>
#endif
...
...
@@ -54,7 +54,7 @@ protected:
bool
isRunning
;
};
#if
ndef MSWIN
#if
!defined _WIN32 && !defined __MINGW32__
/**
* @class UsageTimer
* @author Thomas Egger
...
...
meteoio/exports.h
View file @
aa50376d
...
...
@@ -20,7 +20,7 @@
#define __EXPORTS_H__
// Generic helper definitions for shared library support
#if defined
MS
WIN || defined __CYGWIN__
#if defined
_
WIN
32 || defined __MINGW32__
|| defined __CYGWIN__
#define MIO_HELPER_DLL_IMPORT __declspec(dllimport)
#define MIO_HELPER_DLL_EXPORT __declspec(dllexport)
#define MIO_HELPER_DLL_LOCAL
...
...
meteoio/meteofilters/ProcessingBlock.h
View file @
aa50376d
...
...
@@ -23,7 +23,7 @@
#include
<string>
#include
<set>
#ifdef MS
V
C
#ifdef
_
MSC
_VER
#pragma warning(disable:4512) //we don't need any = operator!
#endif
...
...
meteoio/plugins/PNGIO.cc
View file @
aa50376d
...
...
@@ -341,7 +341,7 @@ void PNGIO::setFile(const std::string& filename, png_structp& png_ptr, png_infop
}
// Setup Exception handling
#ifdef MS
V
C
#ifdef
_
MSC
_VER
#pragma warning(disable:4611) //the setjmp of libpng has been set up so that it can safely be called from c++
#endif
if
(
setjmp
(
png_jmpbuf
(
png_ptr
)))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment