GRIB-92: MSVC++ project for GRIB API

This commit is contained in:
Shahram Najm 2013-04-09 11:46:01 +01:00
parent b581dd7ec8
commit a00a68304c
20 changed files with 1597 additions and 25 deletions

View File

@ -366,7 +366,9 @@ EXTRA_DIST = README AUTHORS NOTICE LICENSE ChangeLog version.sh html \
data/simple_bitmap.grib \
data/second_ord_rbr.grib1 \
perf/jmeter.awk \
perf/time.sh
perf/time.sh \
windows/msvc/grib_api.sln \
windows/msvc/grib_api_lib/grib_api_lib.vcproj
perf_dir = @abs_builddir@/perf

View File

@ -297,6 +297,7 @@ list( APPEND grib_api_srcs
jgribapi_GribIterator.h
md5.h
md5.c
grib_windef.h
)
# list( APPEND grib_api_extra_srcs

View File

@ -302,6 +302,7 @@ CLEANFILES = libgrib_api.la
noinst_HEADERS = grib_api_internal.h \
md5.h \
grib_windef.h \
grib_emoslib.h \
grib_api_prototypes.h \
grib_dumper_class.h \

View File

@ -540,7 +540,7 @@ static int pack_string(grib_accessor* a, const char* buffer, size_t *len)
size_t size = 1;
typedef int (*cmpproc)(const char*, const char*);
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
cmpproc cmp = a->flags | GRIB_ACCESSOR_FLAG_LOWERCASE ? strcasecmp : strcmp;
#else
/* Microsoft Windows Visual Studio support */

View File

@ -26,7 +26,7 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
#include <sys/times.h>
#endif
#include <math.h>

View File

@ -60,12 +60,14 @@ extern "C" {
#include <sys/types.h>
#include <sys/stat.h>
#ifndef _WIN32
/* Microsoft Windows Visual Studio support */
#include "grib_windef.h"
#ifndef GRIB_ON_WINDOWS
# include <dirent.h>
# include <unistd.h>
# include <inttypes.h>
#else
/* Microsoft Windows Visual Studio support */
# include <direct.h>
# include <io.h>

View File

@ -11,7 +11,7 @@
#include "grib_api_internal.h"
#include <errno.h>
#include <stdlib.h>
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
#include <unistd.h>
#else
#include <fcntl.h> /* Windows: for _O_BINARY */
@ -315,7 +315,7 @@ grib_context* grib_context_get_default(){
/* On UNIX, when we read from a file we get exactly what is in the file on disk.
* But on Windows a file can be opened in binary or text mode. In binary mode the system behaves exactly as in UNIX.
*/
#ifdef _MSC_VER
#ifdef GRIB_ON_WINDOWS
_set_fmode(_O_BINARY);
#endif
@ -420,7 +420,7 @@ grib_context* grib_context_new(grib_context* parent)
static char* resolve_path(grib_context* c, char* path)
{
char* result = NULL;
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
result = grib_context_strdup(c, path);
#else
char resolved[DEF_PATH_MAXLEN+1];
@ -435,7 +435,7 @@ static char* resolve_path(grib_context* c, char* path)
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
/* in order to have multiple definitions directories */
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
# define DEFS_PATH_DELIMITER_CHAR ';'
# define DEFS_PATH_DELIMITER_STR ";"
#else

View File

@ -153,7 +153,7 @@ int grib_jasper_encode(grib_context *c, j2k_encode_helper *helper) {
if( helper->compression != 0)
{
/* Lossy */
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
snprintf (opts, MAXOPTSSIZE, "mode=real\nrate=%f", 1.0/helper->compression);
#else
/* Microsoft Windows Visual Studio support */

View File

@ -9,7 +9,7 @@
*/
#include "grib_api_internal.h"
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
# include <sys/time.h>
# include <time.h>
# include <sys/resource.h>

View File

@ -14,7 +14,7 @@
***************************************************************************/
#include "grib_api_internal.h"
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
/* Microsoft Windows Visual Studio support. Implementation of Unix rint() */
double rint(double x)
{

19
src/grib_windef.h Normal file
View File

@ -0,0 +1,19 @@
/*
* Copyright 2005-2012 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#ifndef grib_windef_H
#define grib_windef_H
/* Microsoft Windows Visual Studio support */
#if defined(_WIN32) && defined(_MSC_VER)
# define GRIB_ON_WINDOWS
#endif
#endif

View File

@ -12,13 +12,12 @@
*/
#include <stdlib.h>
#ifndef _WIN32
#include <stdint.h>
#endif
#include "grib_windef.h"
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
typedef unsigned __int64 UnsignedInt64;
#else
# include <stdint.h>
typedef uint64_t UnsignedInt64;
#endif

View File

@ -71,7 +71,7 @@ int main(int argc, char *argv[]) { return grib_tool(argc,argv);}
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
/* in order to have multiple samples directories */
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
# define SAMPLES_PATH_DELIMITER_CHAR ';'
# define SAMPLES_PATH_DELIMITER_STR ";"
#else

View File

@ -14,7 +14,7 @@
*/
#include "grib_tools.h"
#ifdef _WIN32
#ifdef GRIB_ON_WINDOWS
/* Microsoft Windows Visual Studio support */
#include "wingetopt.h"
#endif

View File

@ -482,7 +482,7 @@ static int grib_tool_index(grib_runtime_options* options) {
return 0;
}
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
static int scan(grib_context* c,grib_runtime_options* options,const char* dir) {
struct dirent *s;
DIR *d;
@ -543,7 +543,7 @@ static int process(grib_context* c,grib_runtime_options* options,const char* pat
int stat_val=0;
int ioerr=0;
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
stat_val = lstat(path,&s);
#else
stat_val = stat(path,&s);

View File

@ -10,7 +10,7 @@
#include "grib_api_internal.h"
#include <stdio.h>
#ifndef _WIN32
#ifndef GRIB_ON_WINDOWS
# include <unistd.h>
#endif
#include <string.h>

View File

@ -8,11 +8,11 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
#ifdef _WIN32
/* Microsoft Windows Visual Studio support */
#include "wingetopt.h"
#ifdef GRIB_ON_WINDOWS
#include "string.h"
#include "wingetopt.h"
char *optarg; /* global argument pointer */
int optind = 0; /* global argv index */

View File

@ -11,7 +11,10 @@
#ifndef WINGETOPT_H
#define WINGETOPT_H
#ifdef _WIN32
/* Microsoft Windows Visual Studio support */
#include "grib_windef.h"
#ifdef GRIB_ON_WINDOWS
/* Microsoft Windows Visual Studio support */
extern int optind, opterr;
extern char *optarg;

26
windows/msvc/grib_api.sln Normal file
View File

@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grib_api_lib", "grib_api_lib\grib_api_lib.vcproj", "{3DE8B13F-7DFE-48ED-9158-B34D774500EC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|Win32.ActiveCfg = Debug|Win32
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|Win32.Build.0 = Debug|Win32
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|x64.ActiveCfg = Debug|x64
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Debug|x64.Build.0 = Debug|x64
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|Win32.ActiveCfg = Release|Win32
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|Win32.Build.0 = Release|Win32
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|x64.ActiveCfg = Release|x64
{3DE8B13F-7DFE-48ED-9158-B34D774500EC}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff