WSL/SLF GitLab Repository

Commit a05be23e authored by Mathias Bavay's avatar Mathias Bavay
Browse files

Small type conversion fixes for osX as well as CMake fixes for osX and Windows

parent 6a1729e9
......@@ -2,6 +2,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
#SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/tools/cmake/")
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/tools/cmake/")
PROJECT(meteoio)
# Version of library
SET(VERSION_MAJOR 2 CACHE INTERNAL "")
SET(VERSION_MINOR 4 CACHE INTERNAL "")
......@@ -11,12 +12,6 @@ SET(POPCC popcc)
SET(LIBPREFIX "lib") #make sure ALL plugins are libXXX for ALL plateforms
SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib") #for Visual C++ import libraries
PROJECT(meteoio)
ADD_SUBDIRECTORY(meteoio/plugins)
ADD_SUBDIRECTORY(meteoio/meteolaws)
ADD_SUBDIRECTORY(meteoio/meteofilters)
ADD_SUBDIRECTORY(meteoio)
###########################################################
#platform specific. First, compiler specific flags, then system specific flags
OPTION(BUILD_SHARED_LIBS "Set to ON to build dynamic libraries" ON)
......@@ -54,10 +49,6 @@ ELSE(MSVC)
ELSE(POPC)
SET(EXTRA_WARNINGS "-Wextra -pedantic -Weffc++ ${DEEP_WARNINGS}") #-Weffc++
ENDIF(POPC)
IF(APPLE)
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -Wno-sign-conversion -Wno-shorten-64-to-32") #for now, keep clang quiet
SET(EXTRA_LINK_FLAGS "-framework CoreFoundation")
ENDIF(APPLE)
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID)
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -ansi") #Android does not like ansi...
IF(WIN32) #for gcc on windows
......@@ -82,7 +73,8 @@ IF(UNIX)
SET(PLATFORM "-DAPPLE")
SET(DLL_EXT "dylib*")
SET(STAT_EXT "a")
#SET(CMAKE_SHARED_LINKER_FLAGS "-framework CoreFoundation") #bug in cmake: this has no effect for frameworks
SET(EXTRA_WARNINGS "${EXTRA_WARNINGS} -Wno-sign-conversion") #for now, keep clang quiet
SET(CMAKE_SHARED_LINKER_FLAGS "-framework CoreFoundation")
#set(CMAKE_OSX_SYSROOT iphoneos2.2.1) #for IOS
#set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) #for IOS
ELSE(APPLE)
......@@ -144,6 +136,12 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${DEBUG} ${WARNINGS} ${EXTRA_WARNINGS}" CACHE STRING
MESSAGE(STATUS "DEBUG CXXFLAGS : ${CMAKE_CXX_FLAGS_DEBUG}")
MESSAGE(STATUS "RELEASE CXXFLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
#Add subdirectory, so they can inherit all variables defined above
ADD_SUBDIRECTORY(meteoio/plugins)
ADD_SUBDIRECTORY(meteoio/meteolaws)
ADD_SUBDIRECTORY(meteoio/meteofilters)
ADD_SUBDIRECTORY(meteoio)
###########################################################
#plugins
SET(PLUGIN_A3DIO ON CACHE BOOL "Compilation A3DIO ON or OFF")
......
......@@ -400,7 +400,7 @@ template<class P> std::iostream& operator<<(std::iostream& os, const Array2D<P>&
os.write(reinterpret_cast<const char*>(&array.keep_nodata), sizeof(array.keep_nodata));
os.write(reinterpret_cast<const char*>(&array.nx), sizeof(array.nx));
os.write(reinterpret_cast<const char*>(&array.ny), sizeof(array.ny));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), array.nx*array.ny*sizeof(P));
os.write(reinterpret_cast<const char*>(&array.vecData[0]), (array.nx*array.ny)*sizeof(P));
return os;
}
......@@ -409,7 +409,7 @@ template<class P> std::iostream& operator>>(std::iostream& is, Array2D<P>& array
is.read(reinterpret_cast<char*>(&array.nx), sizeof(array.nx));
is.read(reinterpret_cast<char*>(&array.ny), sizeof(array.ny));
array.vecData.resize(array.nx*array.ny);
is.read(reinterpret_cast<char*>(&array.vecData[0]), array.nx*array.ny*sizeof(P)); //30 times faster than assign() or copy()
is.read(reinterpret_cast<char*>(&array.vecData[0]), (array.nx*array.ny)*sizeof(P)); //30 times faster than assign() or copy()
return is;
}
......
......@@ -180,10 +180,10 @@ void ResamplingAlgorithms2D::cubicBSpline(Grid2DObject &o_grid, const Grid2DObje
double F = 0., max=-std::numeric_limits<double>::max(), min=std::numeric_limits<double>::max();
unsigned int avg_count = 0;
for(int n=-1; n<=2; n++) {
for(int m=-1; m<=2; m++) {
for(short n=-1; n<=2; n++) {
for(short m=-1; m<=2; m++) {
if(((signed)org_ii+m)<0 || ((signed)org_ii+m)>=(signed)org_ncols || ((signed)org_jj+n)<0 || ((signed)org_jj+n)>=(signed)org_nrows) continue;
const double pixel = i_grid((signed)org_ii+m, (signed)org_jj+n);
const double pixel = i_grid(org_ii+m, org_jj+n);
if(pixel!=IOUtils::nodata) {
F += pixel * BSpline_weight(m-dx) * BSpline_weight(dy-n);
avg_count++;
......
......@@ -390,7 +390,7 @@ void GeotopIO::parseMetaData(const std::string& head, const std::string& datastr
void GeotopIO::readMetaData(const std::string& metafile) {
//vector indexes correspond to meteo data
int x = 0, y = 1, lat = 2, lon = 3, elv = 4;
size_t x = 0, y = 1, lat = 2, lon = 3, elv = 4;
std::vector<std::string> tmpvec;
unsigned int stationNumber = 1; //Since the stations don't have a name, they will be numbered
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment