--- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -326,6 +326,7 @@ set( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE ) set( ECCODES_ON_WINDOWS 1 ) + if ( MSVC ) # Suppress compliler warnings - see ECC-850 # Suppress warnings about using 'insecure' functions. Fixing this would require changes all over # the codebase which would damage portability. @@ -334,6 +335,7 @@ ecbuild_add_c_flags("/D_CRT_NONSTDC_NO_DEPRECATE") # Suppress C4267: warns about possible loss of data when converting 'size_t' to 'int'. ecbuild_add_c_flags("/wd4267") + endif() endif() ############################################################################### @@ -367,7 +369,7 @@ add_definitions( -DHAVE_ECCODES_CONFIG_H ) -if( CMAKE_COMPILER_IS_GNUCC ) +if( CMAKE_COMPILER_IS_GNUCC AND NOT MINGW ) ecbuild_add_c_flags("-pedantic") endif() --- a/definitions/CMakeLists.txt +++ b/definitions/CMakeLists.txt @@ -45,7 +45,7 @@ # link to the definitions. See GRIB-786 file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${INSTALL_DATA_DIR} ) if( NOT EXISTS "${CMAKE_BINARY_DIR}/${ECCODES_DEFINITION_SUFF}" ) - execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" + execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${ECCODES_DEFINITION_SUFF}" ) endif() --- a/fortran/eccodes_f90_int.f90 --- b/fortran/eccodes_f90_int.f90 @@ -100,7 +100,6 @@ codes_get_string, & codes_get_byte_array, & codes_get_int_array, & - codes_get_long_array, & codes_get_real4_array, & codes_get_real8_array end interface codes_get --- a/ifs_samples/CMakeLists.txt +++ b/ifs_samples/CMakeLists.txt @@ -14,7 +14,7 @@ execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${destination_build} ) foreach( _file ${_samples} ) get_filename_component(_filename ${_file} NAME) - execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink + execute_process( COMMAND ${CMAKE_COMMAND} -E copy ${_file} ${destination_build}/${_filename} ) endforeach() endfunction() --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -16,7 +16,7 @@ # link to the samples in the build directory. See GRIB-786 file( MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${INSTALL_DATA_DIR} ) if( NOT EXISTS "${CMAKE_BINARY_DIR}/${ECCODES_SAMPLES_SUFF}" ) - execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" + execute_process( COMMAND "${CMAKE_COMMAND}" "-E" "copy" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_BINARY_DIR}/${ECCODES_SAMPLES_SUFF}" ) endif() --- a/src/eccodes_windef.h +++ b/src/eccodes_windef.h @@ -12,7 +12,7 @@ #define eccodes_windef_H /* Microsoft Windows Visual Studio support */ -#if defined(_WIN32) && defined(_MSC_VER) +#if defined(_WIN32) #define ECCODES_ON_WINDOWS #ifndef YY_NO_UNISTD_H #define YY_NO_UNISTD_H --- a/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc +++ b/src/grib_accessor_class_data_g1second_order_general_extended_packing.cc @@ -184,7 +184,7 @@ #define MAX_NUMBER_OF_GROUPS 65534 #define EFDEBUG 0 -static const unsigned long nbits[64] = { +static const size_t nbits[64] = { 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200, 0x400, 0x800, @@ -205,7 +205,7 @@ static long number_of_bits(grib_handle* h, unsigned long x) { - const unsigned long* n = nbits; + const size_t* n = nbits; const int count = sizeof(nbits) / sizeof(nbits[0]); long i = 0; while (x >= *n) { --- a/src/grib_api_internal.h +++ b/src/grib_api_internal.h @@ -91,7 +91,9 @@ #define M_PI 3.14159265358979323846 #endif + #ifdef _MSC_VER #define R_OK 04 /* Needed for Windows */ + #endif #ifndef F_OK #define F_OK 0 --- a/src/grib_context.cc +++ b/src/grib_context.cc @@ -420,7 +420,7 @@ /* 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 ECCODES_ON_WINDOWS +#ifdef _MSC_VER _set_fmode(_O_BINARY); #endif