[metview] 03/13: New upstream release 4.6.0
Alastair McKinstry
mckinstry at moszumanska.debian.org
Thu Feb 11 19:24:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to tag debian/4.6.1-1
in repository metview.
commit 232cc65791bc775b32c76b69544b33069adb1f10
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Mon Jan 4 03:47:20 2016 +0000
New upstream release 4.6.0
---
CMakeLists.txt | 187 +++------
VERSION.cmake | 4 +-
bin/CMakeLists.txt | 3 +
bin/ecbuild | 424 +++++++++++++++++++++
cmake/FindADSM.cmake | 2 +-
cmake/FindAEC.cmake | 2 +-
cmake/FindAIO.cmake | 2 +-
cmake/FindArmadillo.cmake | 2 +-
cmake/FindCMath.cmake | 2 +-
cmake/FindDl.cmake | 2 +-
cmake/FindEMOS.cmake | 2 +-
cmake/FindFDB.cmake | 2 +-
cmake/FindHPSS.cmake | 2 +-
cmake/FindLEX.cmake | 2 +-
cmake/FindLegacyFDB.cmake | 2 +-
cmake/FindLibGFortran.cmake | 2 +-
cmake/FindNDBM.cmake | 2 +-
cmake/FindNetCDF.cmake | 2 +-
cmake/FindNetCDF3.cmake | 2 +-
cmake/FindODB.cmake | 2 +-
cmake/FindOpenJPEG.cmake | 2 +-
cmake/FindPGIFortran.cmake | 2 +-
cmake/FindPango.cmake | 2 +-
cmake/FindPangoCairo.cmake | 2 +-
cmake/FindREADLINE.cmake | 2 +-
cmake/FindRPCGEN.cmake | 2 +-
cmake/FindRealtime.cmake | 2 +-
cmake/FindSZip.cmake | 2 +-
cmake/FindTrilinos.cmake | 2 +-
cmake/FindXLFortranLibs.cmake | 2 +-
cmake/FindYACC.cmake | 2 +-
cmake/Findgrib_api.cmake | 2 +-
cmake/Findodb_api.cmake | 2 +-
cmake/Findspot.cmake | 2 +-
cmake/contrib/FindNetCDF4.cmake | 26 +-
cmake/ecbuild_add_c_flags.cmake | 80 ++++
cmake/ecbuild_add_cxx11_flags.cmake | 2 +-
cmake/ecbuild_add_cxx_flags.cmake | 80 ++++
cmake/ecbuild_add_executable.cmake | 5 +-
cmake/ecbuild_add_extra_search_paths.cmake | 2 +-
cmake/ecbuild_add_fortran_flags.cmake | 86 +++++
cmake/ecbuild_add_library.cmake | 55 ++-
cmake/ecbuild_add_option.cmake | 22 +-
cmake/ecbuild_add_persistent.cmake | 2 +-
cmake/ecbuild_add_resources.cmake | 2 +-
cmake/ecbuild_add_test.cmake | 5 +-
cmake/ecbuild_append_to_rpath.cmake | 2 +-
cmake/ecbuild_cache.cmake | 2 +-
...e.cmake => ecbuild_check_c_source_return.cmake} | 74 +---
cmake/ecbuild_check_compiler.cmake | 2 +-
cmake/ecbuild_check_cxx11.cmake | 2 +-
...cmake => ecbuild_check_cxx_source_return.cmake} | 60 +--
...e => ecbuild_check_fortran_source_return.cmake} | 66 +---
cmake/ecbuild_check_functions.cmake | 2 +-
cmake/ecbuild_check_os.cmake | 33 +-
cmake/ecbuild_config.h.in | 2 +-
cmake/ecbuild_debug_var.cmake | 2 +-
cmake/ecbuild_declare_project.cmake | 40 +-
cmake/ecbuild_define_build_types.cmake | 2 +-
cmake/ecbuild_define_options.cmake | 6 +-
cmake/ecbuild_define_paths.cmake | 2 +-
cmake/ecbuild_enable_fortran.cmake | 2 +-
cmake/ecbuild_find_lexyacc.cmake | 2 +-
cmake/ecbuild_find_mpi.cmake | 10 +-
cmake/ecbuild_find_omp.cmake | 2 +-
cmake/ecbuild_find_package.cmake | 83 ++--
cmake/ecbuild_find_perl.cmake | 2 +-
cmake/ecbuild_find_python.cmake | 2 +-
cmake/ecbuild_generate_config_headers.cmake | 2 +-
cmake/ecbuild_generate_rpc.cmake | 2 +-
cmake/ecbuild_generate_yy.cmake | 5 +-
cmake/ecbuild_get_date.cmake | 2 +-
cmake/ecbuild_get_resources.cmake | 2 +-
cmake/ecbuild_get_test_data.cmake | 49 ++-
cmake/ecbuild_install_project.cmake | 21 +-
cmake/ecbuild_links_target.cmake | 2 +-
cmake/ecbuild_list_extra_search_paths.cmake | 2 +-
cmake/ecbuild_list_macros.cmake | 2 +-
cmake/ecbuild_pkgconfig.cmake | 10 +-
cmake/ecbuild_print_summary.cmake | 2 +-
cmake/ecbuild_project_files.cmake | 2 +-
cmake/ecbuild_requires_macro_version.cmake | 2 +-
cmake/ecbuild_separate_sources.cmake | 2 +-
cmake/ecbuild_system.cmake | 20 +-
cmake/ecbuild_use_package.cmake | 72 ++--
cmake/ecbuild_version.h.in | 2 +-
cmake/ecbuild_warn_unused_files.cmake | 2 +-
cmake/include/ecbuild/boost_test_framework.h | 2 +-
cmake/sg.pl | 2 +-
scripts/CMakeLists.txt | 38 +-
scripts/metview_base.in | 3 +-
share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake | 81 ++++
share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake | 73 ++++
share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake | 76 ++++
.../app-defaults/CommonMacroFuncs/mvl_ml2hPa | 19 +-
share/metview/etc/AnnotationViewDef | 6 +
share/metview/etc/CartesianViewDef | 6 +
share/metview/etc/EPSOutputDef | 2 +-
share/metview/etc/GeoViewDef | 6 +
share/metview/etc/MCONTDef | 25 ++
share/metview/etc/MCONTRules | 11 +
share/metview/etc/MWINDDef | 65 ++--
share/metview/etc/MWINDRules | 2 +
share/metview/etc/MarsRules | 8 +-
share/metview/etc/PDFOutputDef | 2 +-
share/metview/etc/PNGOutputDef | 2 +-
share/metview/etc/PSOutputDef | 2 +-
share/metview/etc/ecmwf.def | 100 ++---
share/metview/etc/macro_templates.txt | 18 +
share/metview/etc/mars.chk | 8 +-
share/metview/etc/obsgroups.def | 1 +
share/metview/etc/reportypes.def | 7 +
share/metview/etc/rt_by_obsgroup.chk | 11 +-
share/metview/etc/uPlotTable | 6 +
src/Hovmoeller/MHovmoellerViewDef | 6 +
src/Macro/bufr.cc | 19 +-
src/Macro/grib.cc | 110 ++++++
src/Macro/include/cnetcdf.h | 1 +
src/Macro/netcdf.cc | 85 +++--
src/MagML/CMakeLists.txt | 6 +-
src/MvApp/CMakeLists.txt | 2 +-
src/Reprojection/CMakeLists.txt | 6 +-
src/StdAppManager/NetcdfPlusDef | 2 +-
src/XSection/MVProfileViewDef | 6 +
src/XSection/MXAverageViewDef | 6 +
src/XSection/MXSectionViewDef | 6 +
src/libMars/CMakeLists.txt | 72 ++--
src/libMarsClient/CMakeLists.txt | 168 ++++++++
src/libMarsClient/apibase.c | 3 +
src/libMarsClient/archive.c | 2 +-
src/libMarsClient/authenticate.c | 6 +-
src/libMarsClient/bufr.c | 12 +-
src/libMarsClient/calc.c | 6 +-
src/libMarsClient/check.c | 6 +-
src/libMarsClient/control.c | 2 +-
src/libMarsClient/dhsbase.c | 19 +-
src/libMarsClient/environ.c | 2 +-
src/libMarsClient/expand.c | 114 ++++--
src/libMarsClient/field.c | 6 +-
src/libMarsClient/filebase.c | 8 +-
src/libMarsClient/flatfilebase.c | 6 +-
src/libMarsClient/gribbase.c | 10 +-
src/libMarsClient/handler.c | 6 +-
src/libMarsClient/hash.c | 2 +-
src/libMarsClient/hidden.c | 79 +++-
src/libMarsClient/hypercube.c | 4 +-
src/libMarsClient/ibmblk.c | 5 +-
src/libMarsClient/index.c | 2 +-
src/libMarsClient/logfile.c | 2 +-
src/libMarsClient/mars.h | 2 +
src/libMarsClient/mars_client_version.c.in | 16 +
src/libMarsClient/mars_client_version.h.in | 14 +
src/libMarsClient/pproc.c | 86 ++---
src/libMarsClient/proto.h | 4 +-
src/libMarsClient/restricted.c | 2 +-
src/libMarsClient/schedule.c | 2 +-
src/libMarsClient/service.c | 6 +-
src/libMarsClient/sh2ll.c | 2 +-
src/libMarsClient/tools.c | 24 +-
src/libMetview/MvRequest.cc | 95 ++++-
src/libMetview/MvRequest.h | 21 +-
src/libMvQtGui/MvQMainWindow.cc | 4 +-
src/libMvQtUtil/MvQNetworkProxyFactory.cc | 5 +-
src/libUtil/MvAlmostObsoleteRequest.cc | 6 +-
src/uPlot/BufrDecoder.cc | 2 +-
src/uPlot/CMakeLists.txt | 18 +-
src/uPlot/CommonXSectView.cc | 8 +
src/uPlot/CommonXSectView.h | 3 +-
src/uPlot/DataBuilder.cc | 2 +-
src/uPlot/ExportDialog.cc | 8 +
src/uPlot/GeopointsDecoder.cc | 48 ++-
src/uPlot/MacroConverter.cc | 47 ++-
src/uPlot/MacroVisitor.cc | 78 ++--
src/uPlot/MagPlusService.cc | 16 +
src/uPlot/MagPlusService.h | 6 +
src/uPlot/MagicsTranslator.cc | 1 +
src/uPlot/MapView.cc | 34 +-
src/uPlot/ObjectInfo.cc | 171 +++++----
src/uPlot/ObjectList.cc | 10 +-
src/uPlot/ObjectList.h | 15 +-
src/uPlot/Page.cc | 41 +-
src/uPlot/Presentable.cc | 364 +++++++++---------
src/uPlot/Presentable.h | 2 +-
src/uPlot/SuperPage.cc | 153 +++-----
184 files changed, 2916 insertions(+), 1427 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ebebe5..006d9b8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,34 +140,30 @@ else()
set(MARS_SOURCE_PATHS ${CMAKE_SOURCE_DIR}/src/libMars # embedded in source
${CMAKE_SOURCE_DIR}/src/libMarsClient # embedded in source
${CMAKE_SOURCE_DIR}/mars-client/src # bundle
+ ${CMAKE_SOURCE_DIR}/mars_client/src # bundle
${CMAKE_SOURCE_DIR}/../client/src # in external dir
- ${CMAKE_SOURCE_DIR}/../mars-client/src) # in external dir
+ ${CMAKE_SOURCE_DIR}/../mars-client/src # in external dir
+ ${CMAKE_SOURCE_DIR}/../mars_client/src) # in external dir
endif()
+ecbuild_debug("Looking for MARS source in ${MARS_SOURCE_PATHS}")
+find_path( MARS_SOURCE request.c
+ HINTS ${MARS_SOURCE_PATHS}
+ PATH_SUFFIXES src
+ DOC "Path to MARS client source code"
+ NO_DEFAULT_PATH )
-# search each MARS path for a given source file
-set(FOUND_MARS_SOURCE false)
-foreach( mars_path ${MARS_SOURCE_PATHS} )
- if (NOT FOUND_MARS_SOURCE)
- message(STATUS "Looking for MARS source in ${mars_path}")
- if (EXISTS ${mars_path}/request.c)
- set(MARS_SOURCE_PATH ${mars_path})
- set(FOUND_MARS_SOURCE true)
- message(STATUS "Found MARS source in ${mars_path}")
- else()
- endif()
- endif()
-endforeach()
-
-if (NOT FOUND_MARS_SOURCE)
+if (MARS_SOURCE)
+ message(STATUS "Found MARS source at ${MARS_SOURCE}")
+else()
message(FATAL_ERROR "MARS source is required, but was not found in " ${MARS_SOURCE_PATHS})
endif()
# ensure the MARS client source is included in the tarball (if necessary)
-if(NOT ${MARS_SOURCE_PATH} STREQUAL ${CMAKE_SOURCE_DIR}/src/libMars)
+if(NOT ${MARS_SOURCE} STREQUAL ${CMAKE_SOURCE_DIR}/src/libMars)
list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES
- "${MARS_SOURCE_PATH}" "src/libMarsClient")
+ "${MARS_SOURCE}" "src/libMarsClient")
endif()
@@ -210,9 +206,9 @@ endif()
if(AT_ECMWF)
- find_package(FDB REQUIRED)
+ ecbuild_use_package( PROJECT FDB REQUIRED )
else()
- find_package(FDB)
+ ecbuild_use_package( PROJECT FDB )
endif()
message(STATUS "FDB: ${FDB_LIBRARIES}" )
@@ -235,6 +231,7 @@ if(ENABLE_ODB)
ecbuild_use_package( PROJECT odb_api VERSION 0.10.1 ) # requires at least this version
if( ODB_API_FOUND )
+ set( METVIEW_ODB_API_LIBRARIES Odb )
# does this version use eckit?
list(FIND ODB_API_LIBRARIES eckit ODB_ECKIT_INDEX)
@@ -260,13 +257,6 @@ if(ENABLE_ODB)
${ODB_API_INCLUDE_DIRS}/../eclib/eclib
${ODB_API_INCLUDE_DIRS}/odblib
${ECKIT_INCLUDE_DIRS})
-
- # remove eckit_cmd because it's not needed for Metview, and causes problems when linked
- # with Metview
- list(REMOVE_ITEM ODB_API_LIBRARIES eckit_cmd)
- message(STATUS "after removal of eckit_cmd:")
- message(STATUS "ODB_API_LIBRARIES: ${ODB_API_LIBRARIES}")
-
else()
if(ENABLE_MARS_ODB)
message(FATAL_ERROR "ENABLE_ODB was set, but ODB not found")
@@ -316,97 +306,21 @@ endif()
ecbuild_use_package( PROJECT libemos VERSION 4.0.5 REQUIRED )
-
-# ------------------------------------------------------------------------
-# MACRO metview_get_magics_config
-# Calls the magics-config script to query a particular piece of info
-# (MAGICS_INFO) from Magics. Output is in MAGICS_OUT
-# ------------------------------------------------------------------------
-
-macro(metview_get_magics_config MAGICS_INFO MAGICS_OUT)
-
- set(command ${MAGICS_BIN_PATH}${MAGICS_CONFIG_CMD} --${MAGICS_INFO})
-
- execute_process(COMMAND ${command}
- RESULT_VARIABLE cmdres
- OUTPUT_VARIABLE ${MAGICS_OUT}
- RESULT_VARIABLE resultvar
- ERROR_VARIABLE cmderr
- OUTPUT_STRIP_TRAILING_WHITESPACE)
-
- if(NOT "${resultvar}" STREQUAL "0")
- message(STATUS "Error running command: ${command}")
- message(STATUS "${resultvar}")
- message(STATUS "Consider supplying -DMAGICS_PATH if Magics is installed in a non-standard location")
- message(FATAL_ERROR "Aborting.")
- endif()
-
-endmacro()
-
-
-
if(ENABLE_PLOTTING)
ecbuild_use_package( PROJECT magics VERSION 2.24.3)
if( MAGICS_FOUND )
- set(MAGICS_CONFIG_CMD "magics-config")
-
- if(DEFINED MAGICS_PATH) # user supplied MAGICS_PATH
- message (STATUS "MAGICS_PATH supplied: ${MAGICS_PATH}")
- set(MAGICS_BIN_PATH "${MAGICS_PATH}/bin/") # note the trailing slash
- set(MAGICS_METGRAM_DIR "${MAGICS_BIN_PATH}")
- else()
-
- # building as part of a bundle which includes Magics?
- if(DEFINED magics_BINARY_DIR)
- set(MAGICS_BIN_PATH "${magics_BINARY_DIR}/") # note the trailing slash
- message(STATUS "Found Magics as part of the bundle: ${MAGICS_BIN_PATH}")
-
- # magics-config will not have execute permission, so make a copy
- file(COPY ${MAGICS_BIN_PATH}/magics-config
- DESTINATION ${MAGICS_BIN_PATH}/bin
- FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
- GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
- set(MAGICS_BIN_PATH "${MAGICS_BIN_PATH}/bin/") # note the trailing slash
- set(MAGICS_METGRAM_DIR "${MAGICS_subproj_dir_}/apps/metgram/") # where we find the metgram script
+ set(MAGICS_LIB_DIR "${magics_BASE_DIR}/lib")
- # if Magics is part of the bundle, then we need to manually add MAGICS_TPL_INCLUDE_DIRS
- list(APPEND MAGICS_INCLUDE_DIRS ${MAGICS_TPL_INCLUDE_DIRS})
-
- else()
- # if MAGICS_PATH was not defined, then we probably picked up Magics from
- # a system directory. We use MAGICS_CMAKE_DIR and work backwards from there
- # to find the bin directory . This assumes a standard Magics installation
- # where we have: <prefix>/bin and <prefix>/share/magics/cmake
- # so the bin directory is ${MAGICS_CMAKE_DIR}/../../../bin
-
- set(MAGICS_BIN_PATH "${MAGICS_CMAKE_DIR}/../../../bin/")
- set(MAGICS_METGRAM_DIR "${MAGICS_BIN_PATH}")
- message (STATUS "MAGICS_PATH not supplied: bin dir should be at ${MAGICS_BIN_PATH}")
- endif()
- endif()
-
-
- metview_get_magics_config("libdir" magout)
- list(APPEND MAGICS_LIBRARIES "-L${magout}")
- list(APPEND MAGICS_LIBRARIES "-L${CMAKE_BINARY_DIR}/lib") # for bundles
- set(MAGICS_LIB_DIR ${magout})
-
- list(APPEND MAGICS_LIBRARIES "MagWrapper")
- set(MAGICS_METEOGRAM_SCRIPT "${MAGICS_METGRAM_DIR}metgram")
-
- metview_get_magics_config("with-metview" magout)
- if(NOT magout STREQUAL "yes")
+ if(NOT MAGICS_HAVE_METVIEW)
message(FATAL_ERROR "Magics must be built with Metview support!")
endif()
- metview_get_magics_config("with-netcdf" magout)
- if(NOT magout STREQUAL "yes")
+ if(NOT MAGICS_HAVE_NETCDF)
message(FATAL_ERROR "Magics must be built with netCDF support!")
endif()
- metview_get_magics_config("with-odb" magout)
- if(magout STREQUAL "yes")
+ if(MAGICS_HAVE_ODB)
add_definitions(-DMETVIEW_ODB_PLOT)
else()
if(ENABLE_ODB)
@@ -414,33 +328,14 @@ if(ENABLE_PLOTTING)
endif()
endif()
- metview_get_magics_config("with-cairo" magout)
- if(NOT magout STREQUAL "yes")
+ if(NOT MAGICS_HAVE_CAIRO)
message(STATUS "NO PNG and PDF plotting support (disabled in Magics)") #xxx should be at end
endif()
- metview_get_magics_config("with-bufr" magout)
- if(NOT magout STREQUAL "yes")
+ if(NOT MAGICS_HAVE_BUFR)
message(STATUS "NO BUFR plotting support (disabled in Magics)") #xxx should be at end
endif()
- #list( APPEND METVIEW_TPLS magics )
-
-
-#message(STATUS "xMAGICS_INCLUDE_DIRS: ${MAGICS_INCLUDE_DIRS}")
-#message(STATUS "xMAGICS_EXTRA_INCLUDES: ${MAGICS_EXTRA_INCLUDES}")
-#message(STATUS "xMAGICS_TPL_INCLUDE_DIRS: ${MAGICS_TPL_INCLUDE_DIRS}")
-#message(STATUS "xMAGICS_LIBS: ${MAGICS_LIBS}")
-#message(STATUS "xMAGICS_LIBRARIES: ${MAGICS_LIBRARIES}")
-
-
-
-#get_cmake_property(_variableNames VARIABLES)
-#foreach (_variableName ${_variableNames})
-# message(STATUS "${_variableName}=${${_variableName}}")
-#endforeach()
-
-
else()
message(FATAL_ERROR "Magics was not found, and it is required if ENABLE_PLOTTING=ON. Please supply MAGICS_PATH if necessary.")
endif()
@@ -482,7 +377,6 @@ endif()
find_library(PTHREAD_LIB pthread)
if(PTHREAD_LIB)
message(STATUS "pthread found: ${PTHREAD_LIB}")
- set(METVIEW_ODB_API_LIBRARIES ${ODB_API_LIBRARIES} ${PTHREAD_LIB})
else()
message(FATAL_ERROR "library pthread not found")
endif()
@@ -680,7 +574,7 @@ endif()
set( METVIEW_STANDARD_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/src/libMetview
${CMAKE_CURRENT_SOURCE_DIR}/src/libUtil
- ${MARS_SOURCE_PATH}
+ ${MARS_SOURCE}
${CMAKE_CURRENT_SOURCE_DIR}/src/libMars
${CMAKE_CURRENT_BINARY_DIR}/src/libMars # for generated header files
${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -792,8 +686,11 @@ elseif(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
# NOTE that if we add -fdefault-real-8 then we NEED -fdefault-double-8 to avoid quadmath
ecbuild_add_fortran_flags("-fdefault-real-8 -fdefault-double-8")
endif()
+
# for grib_api.mod
-ecbuild_add_fortran_flags("-I${GRIB_API_INCLUDE_DIR}")
+if(GRIB_API_INCLUDE_DIR)
+ ecbuild_add_fortran_flags("-I${GRIB_API_INCLUDE_DIR}")
+endif()
# we have to create the share directories now, because otherwise module-specific
@@ -876,7 +773,10 @@ endmacro()
# ------------------------------------------------------------------------
# MACRO metview_script_files
# Ensures the files listed in SCRIPT_FILES are copied to the build
-# directory and that they will be installed at install time
+# directory and that they will be installed at install time.
+#
+# Searches in the current source directory, EXTRA_CONFIG_PATH if given and
+# metview-ecmwf-configs inside and parallel to the metview source root.
# ------------------------------------------------------------------------
macro(metview_script_files)
@@ -887,22 +787,25 @@ macro(metview_script_files)
foreach( script ${PAR_SCRIPT_FILES} )
- # check whether this file exists in a supplied EXTRA_CONFIG_PATH dir
- set(found_script "${script}")
- if(DEFINED EXTRA_CONFIG_PATH)
- if(EXISTS ${EXTRA_CONFIG_PATH}/${script})
- set(found_script "${EXTRA_CONFIG_PATH}/${script}")
- message(STATUS "Using ${script} from ${EXTRA_CONFIG_PATH}")
- endif()
+ find_file( SCRIPT_${script} ${script}
+ PATHS ${CMAKE_CURRENT_SOURCE_DIR}
+ ${EXTRA_CONFIG_PATH}
+ ${CMAKE_SOURCE_DIR}/metview-ecmwf-configs
+ ${CMAKE_SOURCE_DIR}/../metview-ecmwf-configs )
+
+ if( NOT SCRIPT_${script} )
+ message( FATAL_ERROR "Could not find script ${script}. Specify the path to the script with -DEXTRA_CONFIG_PATH=..." )
+ else()
+ ecbuild_debug("metview_script_files: found ${script} at ${SCRIPT_${script}}")
endif()
# we need this line to ensure that the target/dependency relationship is correct
- configure_file(${found_script} ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
+ configure_file( ${SCRIPT_${script}} ${CMAKE_BINARY_DIR}/bin COPYONLY)
# copy to the build 'bin' directory, setting exe permissions
- file(COPY ${found_script}
- DESTINATION ${CMAKE_BINARY_DIR}/bin/
+ file(COPY ${SCRIPT_${script}}
+ DESTINATION ${CMAKE_BINARY_DIR}/bin
FILE_PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ OWNER_EXECUTE GROUP_EXECUTE
)
diff --git a/VERSION.cmake b/VERSION.cmake
index 5752bc4..14a8e54 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -1,5 +1,5 @@
set(${PROJECT_NAME}_MAJOR_VERSION_STR "4")
-set(${PROJECT_NAME}_MINOR_VERSION_STR "5")
-set(${PROJECT_NAME}_REVISION_VERSION_STR "7")
+set(${PROJECT_NAME}_MINOR_VERSION_STR "6")
+set(${PROJECT_NAME}_REVISION_VERSION_STR "0")
set(${PROJECT_NAME}_VERSION_STR "${${PROJECT_NAME}_MAJOR_VERSION_STR}.${${PROJECT_NAME}_MINOR_VERSION_STR}.${${PROJECT_NAME}_REVISION_VERSION_STR}")
diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt
new file mode 100644
index 0000000..24a12cf
--- /dev/null
+++ b/bin/CMakeLists.txt
@@ -0,0 +1,3 @@
+if( ENABLE_INSTALL )
+ install( PROGRAMS ecbuild DESTINATION ${INSTALL_BIN_DIR} )
+endif()
diff --git a/bin/ecbuild b/bin/ecbuild
new file mode 100755
index 0000000..b327cde
--- /dev/null
+++ b/bin/ecbuild
@@ -0,0 +1,424 @@
+#!/bin/bash
+
+set -eua
+
+CMAKE_MIN_REQUIRED=2.8.10
+CMAKE_BUILD_VERSION=3.2.3
+
+usage()
+{
+ echo "Usage: ecbuild [--help] [--version]"
+ exit $1
+}
+
+help()
+{
+ cat <<EOF
+USAGE:
+
+ ecbuild [--help] [--version] [--toolchains]
+ ecbuild [option...] [--] [cmake-argument...] <path-to-source>
+ ecbuild [option...] [--] [cmake-argument...] <path-to-existing-build>
+
+DESCRIPTION:
+
+ ecbuild is a build system based on CMake, but providing a lot of macro's
+ to make it easier to work with. Upon execution,
+ the equivalent cmake command is printed.
+
+ ecbuild/cmake must be called from an out-of-source build directory and
+ forbids in-source builds.
+
+SYNOPSIS:
+
+ --help Display this help
+ --version Display ecbuild version
+ --toolchains Display list of pre-installed toolchains (see below)
+
+
+Available values for "option":
+
+ --cmakebin=<path>
+ Set which cmake binary to use. Default is 'cmake'
+
+ --prefix=<prefix>
+ Set the install path to <prefix>.
+ Equivalent to cmake argument "-DCMAKE_INSTALL_PREFIX=<prefix>"
+
+ --build=<build-type>
+ Set the build-type to <build-type>.
+ Equivalent to cmake argument "-DCMAKE_BUILD_TYPE=<build-type>"
+ <build-type> can be any of:
+ - debug : Lowest optimization level, useful for debugging
+ - release : Highest optimization level, for best performance
+ - bit : Highest optimization level while staying bit-reproducible
+ - ...others depending on project
+
+ --log=<log-level>
+ Set the ecbuild log-level
+ Equivalent to "-DECBUILD_LOG_LEVEL=<log-level>"
+ <log-level> can be any of:
+ - DEBUG
+ - INFO
+ - WARN
+ - ERROR
+ - CRITICAL
+ - OFF
+ Every choice outputs also the log-levels listed below itself
+
+ --static
+ Build static libraries.
+ Equivalent to "-DBUILD_SHARED_LIBS=OFF"
+
+ --dynamic
+ Build dynamic libraries (usually the default).
+ Equivalent to "-DBUILD_SHARED_LIBS=ON"
+
+ --shared (same option as --dynamic)
+ Build dynamic libraries (usually the default).
+ Equivalent to "-DBUILD_SHARED_LIBS=ON"
+
+ --toolchain=<toolchain>
+ Use a platform specific toolchain, containing settings such
+ as compilation flags, locations of commonly used dependencies.
+ <toolchain> can be the path to a custom toolchain file, or a
+ pre-installed toolchain provided with ecbuild. For a list of
+ pre-installed toolchains, run "ecbuild --toolchains".
+ Equivalent to cmake argument "-DCMAKE_TOOLCHAIN_FILE=<toolchain-file>"
+
+ --cache=<ecbuild-cache-file> (advanced)
+ A file called "ecbuild-cache.cmake" is generated during configuration.
+ This file can be moved to a safe location, and specified for future
+ builds to speed up checking of compiler/platform capabilities. Note
+ that this is only accelerating fresh builds, as cmake internally
+ caches also. Therefore this option is *not* recommended.
+
+ --build-cmake
+ Automatically download and build CMake version $CMAKE_BUILD_VERSION if the CMake
+ version found does not meet the minimum requirements (version $CMAKE_MIN_REQUIRED
+ is required). Requires an internet connection and may take a while.
+
+ --dryrun
+ Don't actually execute the cmake call, just print what would have
+ been executed.
+
+
+Available values for "cmake-argument":
+
+ Any value that can be usually passed to cmake to (re)configure the build.
+ Typically these values start with "-D".
+ example: -DENABLE_TESTS=ON -DENABLE_MPI=OFF -DECKIT_PATH=...
+
+ They can be explicitly separated from [option...] with a "--", for the case
+ there is a conflicting option with the "cmake" executable, and the latter's
+ option is requested.
+
+------------------------------------------------------------------------
+
+NOTE: When reconfiguring a build, it is only necessary to change the relevant
+options, as everything stays cached. For example:
+ > ecbuild --prefix=PREFIX .
+ > ecbuild -DENABLE_TESTS=ON .
+
+------------------------------------------------------------------------
+
+Compiling:
+
+ To compile the project with <N> threads:
+ > make -j<N>
+
+ To get verbose compilation/linking output:
+ > make VERBOSE=1
+
+Testing:
+
+ To run the project's tests
+ > ctest
+
+ Also check the ctest manual/help for more options on running tests
+
+Installing:
+
+ To install the project in location PREFIX with
+ "--prefix=PREFIX" or
+ "-DCMAKE_INSTALL_PREFIX=PREFIX"
+ > make install
+
+------------------------------------------------------------------------
+ECMWF"
+
+EOF
+ exit $1
+}
+
+INSTALL_DIR="$( cd $( dirname "${BASH_SOURCE[0]}" ) && pwd -P )"
+ECBUILD_MODULE_PATH=""
+# If there is a directory share/ecbuild/cmake relative to the parent directory
+# (as in an install tree), add it to CMAKE_MODULE_PATH
+if [ -d $INSTALL_DIR/../share/ecbuild/cmake ]; then
+ ECBUILD_MODULE_PATH="$( cd "$INSTALL_DIR/../share/ecbuild/cmake" && pwd -P )"
+# If there is a cmake subdirectory relative to the script directory (as in a
+# tarball), add it to CMAKE_MODULE_PATH
+elif [ -d $INSTALL_DIR/../cmake ]; then
+ ECBUILD_MODULE_PATH="$( cd "$INSTALL_DIR/../cmake" && pwd -P )"
+fi
+
+# Fail if we couldn't find ecBuild modules
+if [ ! -f "$ECBUILD_MODULE_PATH/VERSION.cmake" ]; then
+ echo "FATAL: ecBuild modules could not be found in either $INSTALL_DIR/../share/ecbuild/cmake or $INSTALL_DIR/../cmake" >&2
+ exit 1
+fi
+
+ADD_ECBUILD_OPTIONS="-DCMAKE_MODULE_PATH=$ECBUILD_MODULE_PATH"
+
+if [ -d $INSTALL_DIR/../share/ecbuild/toolchains ]; then
+ ECBUILD_TOOLCHAIN_DIR="$( cd "$INSTALL_DIR/../share/ecbuild/toolchains" && pwd -P )"
+elif [ -d $INSTALL_DIR/share/ecbuild/toolchains ]; then
+ ECBUILD_TOOLCHAIN_DIR="$( cd "$INSTALL_DIR/share/ecbuild/toolchains" && pwd -P )"
+fi
+
+version()
+{
+ ecbuild_version=$(cat ${ECBUILD_MODULE_PATH}/VERSION.cmake | grep ECBUILD_VERSION_STR | perl -p -e 's/.*([\d]\.[\d]\.[\d]).*/\1/' )
+ echo "ecbuild version ${ecbuild_version}"
+ command -v cmake >/dev/null 2>&1 || { exit 0; }
+ cmake --version | head -1
+ exit 0
+}
+
+log()
+{
+ log_level=$(sed 's/.*/\U&/' <<< "$1")
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_LOG_LEVEL=${log_level}"
+}
+
+toolchains()
+{
+ if [ -d $ECBUILD_TOOLCHAIN_DIR ]; then
+ cd $ECBUILD_TOOLCHAIN_DIR
+ echo "Available toolchains:"
+ ls | while read fname
+ do
+ echo " - ${fname%%.*}"
+ done
+ exit 0
+ else
+ echo "No toolchains available."
+ exit 1
+ fi
+}
+
+prefix()
+{
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_INSTALL_PREFIX=${1/#\~\//$HOME/}"
+}
+
+toolchain()
+{
+ arg=${1/#\~\//$HOME/}
+ if [ -f $arg ]; then
+ toolchain_file=$arg
+ else
+ if [ -f $ECBUILD_TOOLCHAIN_DIR/$arg.cmake ]; then
+ toolchain_file=$ECBUILD_TOOLCHAIN_DIR/$arg.cmake
+ fi
+ fi
+ if [ -z ${toolchain_file+x} ]; then
+ echo "Error:"
+ echo " Toolchain [$arg] is not valid: [$arg.cmake] cannot be"
+ echo " found in [$ECBUILD_TOOLCHAIN_DIR]"
+ exit 1
+ else
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_TOOLCHAIN_FILE=${toolchain_file}"
+ fi
+}
+
+cache()
+{
+ arg=$1
+ if [ -f $arg ]; then
+ cache_file=$( cd "$arg" && pwd -P )
+ else
+ echo "Error:"
+ echo " Cache file [$arg] is not found or is not a file."
+ exit 1
+ fi
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DECBUILD_CACHE=${cache_file}"
+}
+
+if test $# -eq 0; then
+ usage 1
+fi
+
+while test $# -gt 0; do
+
+ # Split --option=value in $opt="--option" and $val="value"
+
+ opt=""
+ val=""
+
+ case "$1" in
+ --*=*)
+ opt=`echo "$1" | sed 's/=.*//'`
+ val=`echo "$1" | sed 's/--[_a-zA-Z0-9]*=//'`
+ ;;
+ --*)
+ opt=$1
+ ;;
+ # -D*)
+ # ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS $1"
+ # ;;
+ *)
+ break
+ ;;
+ esac
+
+ # echo "debug opt: $opt $val"
+
+ # Parse options
+ case "$opt" in
+ --help)
+ help 0
+ ;;
+ --version)
+ version
+ ;;
+ --dryrun)
+ dryrun="yes"
+ ;;
+ --toolchains)
+ toolchains
+ ;;
+ --cmakebin)
+ cmakebin="$val"
+ ;;
+ --prefix)
+ prefix "$val"
+ ;;
+ --build)
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DCMAKE_BUILD_TYPE=$val"
+ ;;
+ --log)
+ log $val
+ ;;
+ --static)
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=OFF"
+ ;;
+ --dynamic)
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=ON"
+ ;;
+ --shared)
+ ADD_ECBUILD_OPTIONS="$ADD_ECBUILD_OPTIONS -DBUILD_SHARED_LIBS=ON"
+ ;;
+ --toolchain)
+ toolchain $val
+ ;;
+ --cache)
+ cache $val
+ ;;
+ --build-cmake)
+ build_cmake="yes"
+ ;;
+ --)
+ shift
+ break
+ ;;
+ *)
+ echo "unknown option: $opt"
+ usage 1
+ ;;
+ esac
+ shift
+done
+
+# If no arguments remain, set srcARG to "."
+if [ $# -eq 0 ]; then
+ srcARG="."
+fi
+
+src=${srcARG:=""}
+cmake=${cmakebin:=cmake}
+dryrun=${dryrun:=no}
+build_cmake=${build_cmake:=""}
+cmake_found=""
+cmake_version_sufficient=""
+
+
+# Check that version $1 satisfies $2
+# CMake versions have no more than 4 fields
+# (adapted from http://stackoverflow.com/a/25731924/396967)
+version_gte() {
+ [ "$2" = "$(echo -e "$1\n$2" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 -g | head -n1)" ]
+}
+
+# Check if the cmake version is sufficient
+check_cmake() {
+ # Check if cmake is available
+ if $(command -v $cmake >/dev/null 2>&1); then
+ cmake_found="yes"
+ cmake_version=$($cmake --version | head -n1 | awk '{ print $3 }')
+ echo "Found CMake version $cmake_version" >& 2
+ if version_gte $cmake_version $CMAKE_MIN_REQUIRED; then
+ cmake_version_sufficient="yes"
+ fi
+ fi
+}
+check_cmake
+# Use already built CMake if any
+if [[ ! $cmake_version_sufficient && -x bin/cmake ]]; then
+ echo "Using already built CMake in $PWD/bin/cmake" >&2
+ cmake=bin/cmake
+ check_cmake
+fi
+
+# Build CMake if requested and no sufficient version found
+if [[ ! $cmake_version_sufficient && $build_cmake ]]; then
+ echo "CMake version $CMAKE_MIN_REQUIRED is required but only $cmake_version was found." >&2
+ echo "Building CMake version ${CMAKE_BUILD_VERSION} ..." >&2
+ tarball=cmake-${CMAKE_BUILD_VERSION}.tar.gz
+ if [[ ! -r $tarball ]]; then
+ url=http://www.cmake.org/files/v${CMAKE_BUILD_VERSION:0:3}/$tarball
+ # -N Download only if the remote version of the file is newer
+ # --continue Continue an interrupted download
+ # -T 60 Time out a download attempt after 60 seconds
+ # -t 3 Only make 3 download attempts
+ wget -N --continue -T 60 -t 3 $url || {
+ echo "Failed to download CMake release $CMAKE_BUILD_VERSION." >&2
+ echo "Please download from $url" >&2
+ echo "and place $tarball in $PWD" >&2
+ exit 1
+ }
+ fi
+ tar xzf cmake-${CMAKE_BUILD_VERSION}.tar.gz
+ (
+ mkdir -p build_cmake
+ cd build_cmake
+ ../cmake-${CMAKE_BUILD_VERSION}/bootstrap --prefix=.. && make && make install
+ )
+ cmake=bin/cmake
+ check_cmake
+fi
+
+# Fail if we don't have a sufficient CMake
+if [[ ! $cmake_version_sufficient ]]; then
+ if [[ ! $cmake_found ]]; then
+ echo "CMake is required and cannot be found in the PATH." >&2
+ else
+ echo "CMake version $CMAKE_MIN_REQUIRED is required but only $cmake_version was found." >&2
+ fi
+ echo "" >&2
+ echo " Try 'module load cmake', specify a CMake binary with --cmakebin=/path/to/cmake" >&2
+ echo " or let ecbuild download and build CMake with the --build-cmake option." >&2
+ exit 1
+fi
+
+echo ""
+echo "$cmake ${ADD_ECBUILD_OPTIONS} $@ $src"
+echo ""
+
+if [ ${dryrun} == "yes" ]; then
+ echo "[DRYRUN] -- not executing"
+ exit 0
+fi
+
+$cmake ${ADD_ECBUILD_OPTIONS} "$@" $src
diff --git a/cmake/FindADSM.cmake b/cmake/FindADSM.cmake
index 76140b6..7af6723 100644
--- a/cmake/FindADSM.cmake
+++ b/cmake/FindADSM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindAEC.cmake b/cmake/FindAEC.cmake
index 28d086d..8a59037 100644
--- a/cmake/FindAEC.cmake
+++ b/cmake/FindAEC.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindAIO.cmake b/cmake/FindAIO.cmake
index 61fdcc0..c27b795 100644
--- a/cmake/FindAIO.cmake
+++ b/cmake/FindAIO.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindArmadillo.cmake b/cmake/FindArmadillo.cmake
index 4183306..a3628a5 100644
--- a/cmake/FindArmadillo.cmake
+++ b/cmake/FindArmadillo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
index 7cf6f58..cf80f85 100644
--- a/cmake/FindCMath.cmake
+++ b/cmake/FindCMath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindDl.cmake b/cmake/FindDl.cmake
index 305fff0..30db9c6 100644
--- a/cmake/FindDl.cmake
+++ b/cmake/FindDl.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2014 ECMWF.
+# © Copyright 1996-2015 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.
diff --git a/cmake/FindEMOS.cmake b/cmake/FindEMOS.cmake
index 56ee334..70028ca 100644
--- a/cmake/FindEMOS.cmake
+++ b/cmake/FindEMOS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindFDB.cmake b/cmake/FindFDB.cmake
index 6624544..9608a54 100644
--- a/cmake/FindFDB.cmake
+++ b/cmake/FindFDB.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindHPSS.cmake b/cmake/FindHPSS.cmake
index 50f95cc..a96b8d4 100644
--- a/cmake/FindHPSS.cmake
+++ b/cmake/FindHPSS.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindLEX.cmake b/cmake/FindLEX.cmake
index 34ea36c..00335c2 100644
--- a/cmake/FindLEX.cmake
+++ b/cmake/FindLEX.cmake
@@ -44,7 +44,7 @@
# This file is based on the FindFLEX CMake macro, and adapted by ECMWF
#=============================================================================
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindLegacyFDB.cmake b/cmake/FindLegacyFDB.cmake
index 0136299..f461a0e 100644
--- a/cmake/FindLegacyFDB.cmake
+++ b/cmake/FindLegacyFDB.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindLibGFortran.cmake b/cmake/FindLibGFortran.cmake
index bf9e168..200ffcb 100644
--- a/cmake/FindLibGFortran.cmake
+++ b/cmake/FindLibGFortran.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2014 ECMWF.
+# © Copyright 1996-2015 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.
diff --git a/cmake/FindNDBM.cmake b/cmake/FindNDBM.cmake
index 21cf1cf..5203ee9 100644
--- a/cmake/FindNDBM.cmake
+++ b/cmake/FindNDBM.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindNetCDF.cmake b/cmake/FindNetCDF.cmake
index b214d27..89af114 100644
--- a/cmake/FindNetCDF.cmake
+++ b/cmake/FindNetCDF.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindNetCDF3.cmake b/cmake/FindNetCDF3.cmake
index 20a5396..40e6bc0 100644
--- a/cmake/FindNetCDF3.cmake
+++ b/cmake/FindNetCDF3.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindODB.cmake b/cmake/FindODB.cmake
index bfa6905..3a1fa12 100644
--- a/cmake/FindODB.cmake
+++ b/cmake/FindODB.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2014 ECMWF.
+# © Copyright 1996-2015 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.
diff --git a/cmake/FindOpenJPEG.cmake b/cmake/FindOpenJPEG.cmake
index d692f35..82d19fb 100644
--- a/cmake/FindOpenJPEG.cmake
+++ b/cmake/FindOpenJPEG.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindPGIFortran.cmake b/cmake/FindPGIFortran.cmake
index ae2221b..7308e49 100644
--- a/cmake/FindPGIFortran.cmake
+++ b/cmake/FindPGIFortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
index 0105d7f..811cdf9 100644
--- a/cmake/FindPango.cmake
+++ b/cmake/FindPango.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindPangoCairo.cmake b/cmake/FindPangoCairo.cmake
index 611e269..7445754 100644
--- a/cmake/FindPangoCairo.cmake
+++ b/cmake/FindPangoCairo.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindREADLINE.cmake b/cmake/FindREADLINE.cmake
index 9477026..bbabe15 100644
--- a/cmake/FindREADLINE.cmake
+++ b/cmake/FindREADLINE.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindRPCGEN.cmake b/cmake/FindRPCGEN.cmake
index 98c4a98..3e25daf 100644
--- a/cmake/FindRPCGEN.cmake
+++ b/cmake/FindRPCGEN.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindRealtime.cmake b/cmake/FindRealtime.cmake
index b46b9b7..2c2a7b2 100644
--- a/cmake/FindRealtime.cmake
+++ b/cmake/FindRealtime.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindSZip.cmake b/cmake/FindSZip.cmake
index d7d6026..6e9b1a2 100644
--- a/cmake/FindSZip.cmake
+++ b/cmake/FindSZip.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindTrilinos.cmake b/cmake/FindTrilinos.cmake
index 9cc6132..a1cabce 100644
--- a/cmake/FindTrilinos.cmake
+++ b/cmake/FindTrilinos.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/FindXLFortranLibs.cmake b/cmake/FindXLFortranLibs.cmake
index 7be0070..10a68aa 100644
--- a/cmake/FindXLFortranLibs.cmake
+++ b/cmake/FindXLFortranLibs.cmake
@@ -1,4 +1,4 @@
-# © Copyright 1996-2014 ECMWF.
+# © Copyright 1996-2015 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.
diff --git a/cmake/FindYACC.cmake b/cmake/FindYACC.cmake
index dbdb191..a410c6f 100644
--- a/cmake/FindYACC.cmake
+++ b/cmake/FindYACC.cmake
@@ -41,7 +41,7 @@
# This file is based on the FindFLEX CMake macro, and adapted by ECMWF
#=============================================================================
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/Findgrib_api.cmake b/cmake/Findgrib_api.cmake
index 32a01e9..8b6cb43 100644
--- a/cmake/Findgrib_api.cmake
+++ b/cmake/Findgrib_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/Findodb_api.cmake b/cmake/Findodb_api.cmake
index 5cd2a10..2b8e800 100644
--- a/cmake/Findodb_api.cmake
+++ b/cmake/Findodb_api.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/Findspot.cmake b/cmake/Findspot.cmake
index 1edb2cd..cad0e33 100644
--- a/cmake/Findspot.cmake
+++ b/cmake/Findspot.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2012 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/contrib/FindNetCDF4.cmake b/cmake/contrib/FindNetCDF4.cmake
index adf232e..89b0337 100644
--- a/cmake/contrib/FindNetCDF4.cmake
+++ b/cmake/contrib/FindNetCDF4.cmake
@@ -22,8 +22,9 @@
# NETCDF_USE_STATIC_LIBRARIES variable is set before the call to find_package.
#
# To provide the module with a hint about where to find your NETCDF installation,
-# set the environment variable NETCDF_ROOT or NETCDF_DIR. The Find module will then
-# look in this path when searching for NETCDF executables, paths, and libraries.
+# set the CMake or environment variable NETCDF_ROOT, NETCDF_DIR, NETCDF_PATH or
+# NETCDF4_DIR. The Find module will then look in this path when searching for
+# NETCDF executables, paths, and libraries.
#
# In addition to finding the includes and libraries required to compile an NETCDF
# client application, this module also makes an effort to find tools that come
@@ -90,11 +91,12 @@ endmacro()
# try to find the NETCDF wrapper compilers
find_program( NETCDF_CONFIG_EXECUTABLE
NAMES nc-config
- HINTS ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF4_DIR
- PATHS
+ HINTS ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+ ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
PATH_SUFFIXES bin Bin
DOC "NETCDF CONFIG PROGRAM. Used only to detect NETCDF compile flags." )
mark_as_advanced( NETCDF_CONFIG_EXECUTABLE )
+ecbuild_debug("FindNetCDF4: nc-config executable = ${NETCDF_CONFIG_EXECUTABLE}")
set(output "no")
_NETCDF_CONFIG (--has-hdf5 output return)
@@ -160,10 +162,9 @@ else()
# find the NETCDF includes
foreach( INC ${NETCDF_${LANGUAGE}_INCLUDE_NAMES} )
find_path( NETCDF_${INC}_INCLUDE_DIR ${INC}
- HINTS
- ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
- ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF4_DIR
- PATHS
+ HINTS ${NETCDF_${LANGUAGE}_INCLUDE_FLAGS}
+ ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+ ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
PATH_SUFFIXES
include
Include
@@ -203,14 +204,14 @@ else()
find_library( NETCDF_${LIB}_LIBRARY_DEBUG
NAMES ${THIS_LIBRARY_SEARCH_DEBUG}
HINTS ${NETCDF_${LANGUAGE}_LIBRARY_DIRS}
- ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF4_DIR
- PATHS
+ ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+ ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
PATH_SUFFIXES lib64 Lib64 lib Lib)
find_library( NETCDF_${LIB}_LIBRARY_RELEASE
NAMES ${THIS_LIBRARY_SEARCH_RELEASE}
HINTS ${NETCDF_${LANGUAGE}_LIBRARY_DIRS}
- ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF4_DIR
- PATHS
+ ${NETCDF_ROOT} ${NETCDF_DIR} ${NETCDF_PATH} ${NETCDF4_DIR}
+ ENV NETCDF_ROOT ENV NETCDF_DIR ENV NETCDF_PATH ENV NETCDF4_DIR
PATH_SUFFIXES lib64 Lib64 lib Lib )
select_library_configurations( NETCDF_${LIB} )
# even though we adjusted the individual library names in
@@ -231,7 +232,6 @@ else()
endif()
if (NETCDF_${LIB}_LIBRARY_RELEASE OR NETCDF_${LIB}_LIBRARY_DEBUG )
else()
- # message( STATUS "\"${LIB}\" is not found." )
list( FIND NETCDF_REQUIRED ${LIB} location )
if( ${location} EQUAL -1 )
else()
diff --git a/cmake/ecbuild_add_c_flags.cmake b/cmake/ecbuild_add_c_flags.cmake
new file mode 100644
index 0000000..bef1d34
--- /dev/null
+++ b/cmake/ecbuild_add_c_flags.cmake
@@ -0,0 +1,80 @@
+# (C) Copyright 1996-2015 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_add_c_flags
+# ===================
+#
+# Add C compiler flags to CMAKE_C_FLAGS only if supported by the compiler. ::
+#
+# ecbuild_add_c_flags( <flag1> [ <flag2> ... ]
+# [ BUILD <build> ]
+# [ NAME <name> ] )
+#
+# Options
+# -------
+#
+# BUILD : optional
+# add flags to ``CMAKE_C_FLAGS_<build>`` instead of ``CMAKE_C_FLAGS``
+#
+# NAME : optional
+# name of the check (if omitted, checks are enumerated)
+#
+##############################################################################
+
+macro( ecbuild_add_c_flags m_c_flags )
+
+ set( _flags ${m_c_flags} )
+
+ if( _flags AND CMAKE_C_COMPILER_LOADED )
+ set( options )
+ set( single_value_args BUILD NAME )
+ set( multi_value_args )
+
+ cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if( NOT DEFINED N_CFLAG )
+ set( N_CFLAG 0 )
+ endif()
+
+ math( EXPR N_CFLAG '${N_CFLAG}+1' )
+
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
+ set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
+ endif()
+ else()
+ set( _flag_ok 1 )
+ endif()
+
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "C FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
+ ecbuild_debug( "C FLAG [${_flags}] added" )
+ endif()
+ else()
+ message( WARNING "Unrecognised C flag [${_flags}] -- skipping" )
+ endif()
+ endif()
+ unset( _flags )
+ unset( _flag_ok )
+endmacro()
+
+macro( cmake_add_c_flags m_c_flags )
+ message( DEPRECATION " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
+ ecbuild_add_c_flags( ${m_c_flags} )
+endmacro()
diff --git a/cmake/ecbuild_add_cxx11_flags.cmake b/cmake/ecbuild_add_cxx11_flags.cmake
index 7687bd9..a4cce91 100644
--- a/cmake/ecbuild_add_cxx11_flags.cmake
+++ b/cmake/ecbuild_add_cxx11_flags.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_add_cxx_flags.cmake b/cmake/ecbuild_add_cxx_flags.cmake
new file mode 100644
index 0000000..8393572
--- /dev/null
+++ b/cmake/ecbuild_add_cxx_flags.cmake
@@ -0,0 +1,80 @@
+# (C) Copyright 1996-2015 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_add_cxx_flags
+# =====================
+#
+# Add C++ compiler flags to CMAKE_CXX_FLAGS only if supported by compiler. ::
+#
+# ecbuild_add_cxx_flags( <flag1> [ <flag2> ... ]
+# [ BUILD <build> ]
+# [ NAME <name> ] )
+#
+# Options
+# -------
+#
+# BUILD : optional
+# add flags to ``CMAKE_CXX_FLAGS_<build>`` instead of ``CMAKE_CXX_FLAGS``
+#
+# NAME : optional
+# name of the check (if omitted, checks are enumerated)
+#
+##############################################################################
+
+macro( ecbuild_add_cxx_flags m_cxx_flags )
+
+ set( _flags ${m_cxx_flags} )
+ if( _flags AND CMAKE_CXX_COMPILER_LOADED )
+ set( options )
+ set( single_value_args BUILD NAME )
+ set( multi_value_args )
+
+ cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if( NOT DEFINED N_CXXFLAG )
+ set( N_CXXFLAG 0 )
+ endif()
+
+ math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
+
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_cxx_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
+ set( _flag_ok CXX_FLAG_TEST_${N_CXXFLAG} )
+ endif()
+ else()
+ set( _flag_ok 1 )
+ endif()
+
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "C++ FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
+ ecbuild_debug( "C++ FLAG [${_flags}] added" )
+ endif()
+ else()
+ message( STATUS "Unrecognised CXX flag [${_flags}] -- skipping" )
+ endif()
+ endif()
+ unset( _flags )
+ unset( _flag_ok )
+
+endmacro()
+
+macro( cmake_add_cxx_flags m_cxx_flags )
+ message( DEPRECATION " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
+ ecbuild_add_cxx_flags( ${m_cxx_flags} )
+endmacro()
diff --git a/cmake/ecbuild_add_executable.cmake b/cmake/ecbuild_add_executable.cmake
index d1355c3..e4e39a1 100644
--- a/cmake/ecbuild_add_executable.cmake
+++ b/cmake/ecbuild_add_executable.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -64,7 +64,8 @@
# list of targets to be built before this target
#
# CONDITION : optional
-# list of conditions, all of which must evaluate to true for this target to be built
+# conditional expression which must evaluate to true for this target to be
+# built (must be valid in a CMake ``if`` statement)
#
# NOINSTALL : optional
# do not install the executable
diff --git a/cmake/ecbuild_add_extra_search_paths.cmake b/cmake/ecbuild_add_extra_search_paths.cmake
index c8a7a77..fac96ba 100644
--- a/cmake/ecbuild_add_extra_search_paths.cmake
+++ b/cmake/ecbuild_add_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_add_fortran_flags.cmake b/cmake/ecbuild_add_fortran_flags.cmake
new file mode 100644
index 0000000..f0da53f
--- /dev/null
+++ b/cmake/ecbuild_add_fortran_flags.cmake
@@ -0,0 +1,86 @@
+# (C) Copyright 1996-2015 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.
+
+##############################################################################
+#.rst:
+#
+# ecbuild_add_fortran_flags
+# =========================
+#
+# Add Fortran compiler flags to CMAKE_Fortran_FLAGS only if supported by the
+# compiler. ::
+#
+# ecbuild_add_fortran_flags( <flag1> [ <flag2> ... ]
+# [ BUILD <build> ]
+# [ NAME <name> ] )
+#
+# Options
+# -------
+#
+# BUILD : optional
+# add flags to ``CMAKE_Fortran_FLAGS_<build>`` instead of
+# ``CMAKE_Fortran_FLAGS``
+#
+# NAME : optional
+# name of the check (if omitted, checks are enumerated)
+#
+##############################################################################
+
+include( CheckFortranCompilerFlag )
+macro( ecbuild_add_fortran_flags m_fortran_flags )
+
+ set( _flags ${m_fortran_flags} )
+
+ if( _flags AND CMAKE_Fortran_COMPILER_LOADED )
+
+ set( options )
+ set( single_value_args BUILD NAME )
+ set( multi_value_args )
+
+ cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
+
+ if( NOT DEFINED N_FortranFLAG )
+ set( N_FortranFLAG 0 )
+ endif()
+
+ math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
+
+ if( NOT ECBUILD_TRUST_FLAGS )
+ if( DEFINED _PAR_NAME )
+ check_fortran_compiler_flag( ${_flags} ${_PAR_NAME} )
+ set( _flag_ok ${${_PAR_NAME}} )
+ else()
+ check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
+ set( _flag_ok ${Fortran_FLAG_TEST_${N_FortranFLAG}} )
+ endif()
+ else()
+ set( _flag_ok 1 )
+ endif()
+
+ if( _flag_ok )
+ if( _PAR_BUILD )
+ set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
+ ecbuild_debug( "Fortran FLAG [${_flags}] added for build type ${_PAR_BUILD}" )
+ else()
+ set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
+ ecbuild_debug( "Fortran FLAG [${_flags}] added" )
+ endif()
+ else()
+ message( STATUS "Unrecognised Fortran flag [${_flags}] -- skipping" )
+ endif()
+ endif()
+
+ unset( _flags )
+ unset( _flag_ok )
+
+endmacro()
+
+macro( cmake_add_fortran_flags m_fortran_flags )
+ message( DEPRECATION " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
+ ecbuild_add_fortran_flags( ${m_fortran_flags} )
+endmacro()
diff --git a/cmake/ecbuild_add_library.cmake b/cmake/ecbuild_add_library.cmake
index 8ca43e0..dc47956 100644
--- a/cmake/ecbuild_add_library.cmake
+++ b/cmake/ecbuild_add_library.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -20,6 +20,8 @@
# [ TEMPLATES <template1> [<template2> ...] ]
# [ LIBS <library1> [<library2> ...] ]
# [ INCLUDES <path1> [<path2> ...] ]
+# [ PRIVATE_INCLUDES <path1> [<path2> ...] ]
+# [ PUBLIC_INCLUDES <path1> [<path2> ...] ]
# [ DEFINITIONS <definition1> [<definition2> ...] ]
# [ PERSISTENT <file1> [<file2> ...] ]
# [ GENERATED <file1> [<file2> ...] ]
@@ -61,8 +63,16 @@
# LIBS : optional
# list of libraries to link against (CMake targets or external libraries)
#
-# INCLUDES : optional
-# list of paths to add to include directories
+# INCLUDES : (DEPRECATED) optional
+# list of paths to add to include directories, behaves as PUBLIC_INCLUDES if CMake >= 2.8.11
+# and reverts to include_directories() for CMake < 2.8.11
+#
+# PUBLIC_INCLUDES : optional
+# list of paths to add to include directories which will be publicly exported to other projects
+#
+# PRIVATE_INCLUDES : optional
+# list of paths to add to include directories which won't be exported to other projects,
+# equivalent to using a include_directories() before calling this macro
#
# DEFINITIONS : optional
# list of definitions to add to preprocessor defines
@@ -77,11 +87,12 @@
# list of targets to be built before this target
#
# CONDITION : optional
-# list of conditions, all of which must evaluate to true for this target to be built
+# conditional expression which must evaluate to true for this target to be
+# built (must be valid in a CMake ``if`` statement)
#
# NOINSTALL : optional
# do not install the library
-#
+#
# HEADER_DESTINATION
# directory to install headers (if not specified, INSTALL_INCLUDE_DIR is used)
#
@@ -124,7 +135,7 @@ function( ecbuild_add_library_impl )
set( options NOINSTALL AUTO_VERSION )
set( single_value_args TARGET TYPE COMPONENT INSTALL_HEADERS INSTALL_HEADERS_REGEX LINKER_LANGUAGE HEADER_DESTINATION VERSION OUTPUT_NAME )
- set( multi_value_args SOURCES TEMPLATES LIBS INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
+ set( multi_value_args SOURCES TEMPLATES LIBS INCLUDES PRIVATE_INCLUDES PUBLIC_INCLUDES DEPENDS PERSISTENT DEFINITIONS INSTALL_HEADERS_LIST CFLAGS CXXFLAGS FFLAGS GENERATED CONDITION )
cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
@@ -231,6 +242,38 @@ function( ecbuild_add_library_impl )
endforeach()
endif()
+ # add private include dirs if defined
+ if( DEFINED _PAR_PRIVATE_INCLUDES )
+ if( "${CMAKE_VERSION}" VERSION_LESS "2.8.11" )
+ ecbuild_critical("ecbuild_add_library(${_PAR_TARGET}): cannot use PRIVATE_INCLUDES with CMake < 2.8.11" )
+ endif()
+ list( REMOVE_DUPLICATES _PAR_PRIVATE_INCLUDES )
+ foreach( path ${_PAR_PRIVATE_INCLUDES} ) # skip NOTFOUND
+ if( path )
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): add ${path} to include_directories")
+ target_include_directories( ${_PAR_TARGET} PRIVATE ${path} )
+ else()
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
+ endif()
+ endforeach()
+ endif()
+
+ # add public include dirs if defined
+ if( DEFINED _PAR_PUBLIC_INCLUDES )
+ if( "${CMAKE_VERSION}" VERSION_LESS "2.8.11" )
+ ecbuild_critical("ecbuild_add_library(${_PAR_TARGET}): cannot use PUBLIC_INCLUDES with CMake < 2.8.11" )
+ endif()
+ list( REMOVE_DUPLICATES _PAR_PUBLIC_INCLUDES )
+ foreach( path ${_PAR_PUBLIC_INCLUDES} ) # skip NOTFOUND
+ if( path )
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): add ${path} to include_directories")
+ target_include_directories( ${_PAR_TARGET} PUBLIC ${path} )
+ else()
+ ecbuild_debug("ecbuild_add_library(${_PAR_TARGET}): ${path} not found - not adding to include_directories")
+ endif()
+ endforeach()
+ endif()
+
# FIX: Cray compiler PIC option is not detected by CMake
get_property( _target_pic TARGET ${_PAR_TARGET} PROPERTY POSITION_INDEPENDENT_CODE )
diff --git a/cmake/ecbuild_add_option.cmake b/cmake/ecbuild_add_option.cmake
index 3561055..7728716 100644
--- a/cmake/ecbuild_add_option.cmake
+++ b/cmake/ecbuild_add_option.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -39,7 +39,7 @@
# The package specification can be either ::
#
# <package> [ <version> ... ]
-
+#
# to search for a given package with option minimum required version or ::
#
# PROJECT <name> [ VERSION <version> ... ]
@@ -47,8 +47,8 @@
# to search for an ecBuild project with optional minimum required version.
#
# CONDITION : optional
-# list of conditions, all of which must evaluate to true for this option to
-# be enabled
+# conditional expression which must evaluate to true for this option to be
+# enabled (must be valid in a CMake ``if`` statement)
#
# ADVANCED : optional
# mark the feature as advanced
@@ -58,10 +58,15 @@
#
# Features with ``DEFAULT OFF`` need to be explcitly enabled by the user with
# ``-DENABLE_<FEATURE>=ON``. If a feature is enabled, all ``REQUIRED_PACKAGES``
-# are found and every ``CONDITION`` is met, ecBuild sets the variable
+# are found and ``CONDITION`` is met, ecBuild sets the variable
# ``HAVE_<FEATURE>`` to ``ON``. This is the variable to use to check for the
# availability of the feature.
#
+# If a feature is explicitly enabled but the required packages are not found,
+# configuration fails. This only applies when configuring from *clean cache*.
+# With an already populated cache, use ``-DENABLE_<FEATURE>=REQUIRE`` to make
+# the feature a required feature (this cannot be done via the CMake GUI).
+#
##############################################################################
macro( ecbuild_add_option )
@@ -111,7 +116,12 @@ macro( ecbuild_add_option )
get_property( _in_cache CACHE ENABLE_${_p_FEATURE} PROPERTY VALUE )
- if( NOT "${ENABLE_${_p_FEATURE}}" STREQUAL "" AND _in_cache )
+ # A feature set to REQUIRE is always treated as explicitly enabled
+ if( ENABLE_${_p_FEATURE} MATCHES "REQUIRE" )
+ set( ENABLE_${_p_FEATURE} ON CACHE BOOL "" FORCE )
+ ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was required")
+ set( ${_p_FEATURE}_user_provided_input 1 CACHE BOOL "" FORCE )
+ elseif( NOT "${ENABLE_${_p_FEATURE}}" STREQUAL "" AND _in_cache )
ecbuild_debug("ecbuild_add_option(${_p_FEATURE}): ENABLE_${_p_FEATURE} was found in cache")
set( ${_p_FEATURE}_user_provided_input 1 CACHE BOOL "" )
else()
diff --git a/cmake/ecbuild_add_persistent.cmake b/cmake/ecbuild_add_persistent.cmake
index 42788c7..96c160d 100644
--- a/cmake/ecbuild_add_persistent.cmake
+++ b/cmake/ecbuild_add_persistent.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_add_resources.cmake b/cmake/ecbuild_add_resources.cmake
index 83f3c7e..da6e55a 100644
--- a/cmake/ecbuild_add_resources.cmake
+++ b/cmake/ecbuild_add_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_add_test.cmake b/cmake/ecbuild_add_test.cmake
index f651de9..6ae839a 100644
--- a/cmake/ecbuild_add_test.cmake
+++ b/cmake/ecbuild_add_test.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -100,7 +100,8 @@
# list of tests to be run before this one
#
# CONDITION : optional
-# list of conditions, all of which must evaluate to true for this target to be built
+# conditional expression which must evaluate to true for this target to be
+# built (must be valid in a CMake ``if`` statement)
#
# ENVIRONMENT : optional
# list of environment variables to set in the test environment
diff --git a/cmake/ecbuild_append_to_rpath.cmake b/cmake/ecbuild_append_to_rpath.cmake
index db1efb4..5a7bd66 100644
--- a/cmake/ecbuild_append_to_rpath.cmake
+++ b/cmake/ecbuild_append_to_rpath.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_cache.cmake b/cmake/ecbuild_cache.cmake
index 2752392..9663bca 100644
--- a/cmake/ecbuild_cache.cmake
+++ b/cmake/ecbuild_cache.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_check_c_source.cmake b/cmake/ecbuild_check_c_source_return.cmake
similarity index 74%
rename from cmake/ecbuild_check_c_source.cmake
rename to cmake/ecbuild_check_c_source_return.cmake
index 4460455..1dadca6 100644
--- a/cmake/ecbuild_check_c_source.cmake
+++ b/cmake/ecbuild_check_c_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -152,75 +152,3 @@ macro( ecbuild_check_c_source_return SOURCE )
endif()
endmacro()
-
-##############################################################################
-#.rst:
-#
-# ecbuild_add_c_flags
-# ===================
-#
-# Add C compiler flags to CMAKE_C_FLAGS only if supported by the compiler. ::
-#
-# ecbuild_add_c_flags( <flag1> [ <flag2> ... ]
-# [ BUILD <build> ]
-# [ NAME <name> ] )
-#
-# Options
-# -------
-#
-# BUILD : optional
-# add flags to ``CMAKE_C_FLAGS_<build>`` instead of ``CMAKE_C_FLAGS``
-#
-# NAME : optional
-# name of the check (if omitted, checks are enumerated)
-#
-##############################################################################
-
-macro( ecbuild_add_c_flags m_c_flags )
-
- set( _flags ${m_c_flags} )
-
- if( _flags AND CMAKE_C_COMPILER_LOADED )
- set( options )
- set( single_value_args BUILD NAME )
- set( multi_value_args )
-
- cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
-
- if( NOT DEFINED N_CFLAG )
- set( N_CFLAG 0 )
- endif()
-
- math( EXPR N_CFLAG '${N_CFLAG}+1' )
-
- if( NOT ECBUILD_TRUST_FLAGS )
- if( DEFINED _PAR_NAME )
- check_c_compiler_flag( ${_flags} ${_PAR_NAME} )
- set( _flag_ok ${${_PAR_NAME}} )
- else()
- check_c_compiler_flag( ${_flags} C_FLAG_TEST_${N_CFLAG} )
- set( _flag_ok ${C_FLAG_TEST_${N_CFLAG}} )
- endif()
- else()
- set( _flag_ok 1 )
- endif()
-
- if( _flag_ok )
- if( _PAR_BUILD )
- set( CMAKE_C_FLAGS_${_PAR_BUILD} "${CMAKE_C_FLAGS_${_PAR_BUILD}} ${_flags}" )
- else()
- set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flags}" )
- # message( STATUS "C FLAG [${_flags}] added" )
- endif()
- else()
- message( WARNING "Unrecognised C flag [${_flags}] -- skipping" )
- endif()
- endif()
- unset( _flags )
- unset( _flag_ok )
-endmacro()
-
-macro( cmake_add_c_flags m_c_flags )
- message( DEPRECATION " cmake_add_c_flags is deprecated, use ecbuild_add_c_flags instead." )
- ecbuild_add_c_flags( ${m_c_flags} )
-endmacro()
diff --git a/cmake/ecbuild_check_compiler.cmake b/cmake/ecbuild_check_compiler.cmake
index 4333abd..32ff6cc 100644
--- a/cmake/ecbuild_check_compiler.cmake
+++ b/cmake/ecbuild_check_compiler.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_check_cxx11.cmake b/cmake/ecbuild_check_cxx11.cmake
index 51c5dc6..6453786 100644
--- a/cmake/ecbuild_check_cxx11.cmake
+++ b/cmake/ecbuild_check_cxx11.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_check_cxx_source.cmake b/cmake/ecbuild_check_cxx_source_return.cmake
similarity index 78%
rename from cmake/ecbuild_check_cxx_source.cmake
rename to cmake/ecbuild_check_cxx_source_return.cmake
index ee3588b..e364918 100644
--- a/cmake/ecbuild_check_cxx_source.cmake
+++ b/cmake/ecbuild_check_cxx_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -161,61 +161,3 @@ macro( ecbuild_check_cxx_source_return SOURCE )
endif()
endmacro()
-
-##############################################################################
-#.rst:
-#
-# ecbuild_add_cxx_flags
-# =====================
-#
-# Add C++ compiler flags to CMAKE_CXX_FLAGS only if supported by compiler. ::
-#
-# ecbuild_add_cxx_flags( <flag1> [ <flag2> ... ] [ BUILD <build> ] )
-#
-# Options
-# -------
-#
-# BUILD : optional
-# add flags to ``CMAKE_CXX_FLAGS_<build>`` instead of ``CMAKE_CXX_FLAGS``
-#
-##############################################################################
-
-macro( ecbuild_add_cxx_flags m_cxx_flags )
-
- set( _flags ${m_cxx_flags} )
- if( _flags AND CMAKE_CXX_COMPILER_LOADED )
- set( options )
- set( single_value_args BUILD )
- set( multi_value_args )
-
- cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
-
- if( NOT DEFINED N_CXXFLAG )
- set( N_CXXFLAG 0 )
- endif()
-
- math( EXPR N_CXXFLAG '${N_CXXFLAG}+1' )
-
- if( NOT ECBUILD_TRUST_FLAGS )
- check_cxx_compiler_flag( ${_flags} CXX_FLAG_TEST_${N_CXXFLAG} )
- endif()
-
- if( CXX_FLAG_TEST_${N_CXXFLAG} OR ECBUILD_TRUST_FLAGS )
- if( _PAR_BUILD )
- set( CMAKE_CXX_FLAGS_${_PAR_BUILD} "${CMAKE_CXX_FLAGS_${_PAR_BUILD}} ${_flags}" )
- else()
- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_flags}" )
- # message( STATUS "C++ FLAG [${_flags}] added" )
- endif()
- else()
- message( STATUS "Unrecognised CXX flag [${_flags}] -- skipping" )
- endif()
- endif()
- unset( _flags )
-
-endmacro()
-
-macro( cmake_add_cxx_flags m_cxx_flags )
- message( DEPRECATION " cmake_add_cxx_flags is deprecated, use ecbuild_add_cxx_flags instead." )
- ecbuild_add_cxx_flags( ${m_cxx_flags} )
-endmacro()
diff --git a/cmake/ecbuild_check_fortran_source.cmake b/cmake/ecbuild_check_fortran_source_return.cmake
similarity index 76%
rename from cmake/ecbuild_check_fortran_source.cmake
rename to cmake/ecbuild_check_fortran_source_return.cmake
index 9f95502..1c50896 100644
--- a/cmake/ecbuild_check_fortran_source.cmake
+++ b/cmake/ecbuild_check_fortran_source_return.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -153,67 +153,3 @@ macro( ecbuild_check_fortran_source_return SOURCE )
endif()
endmacro()
-
-##############################################################################
-#.rst:
-#
-# ecbuild_add_fortran_flags
-# =========================
-#
-# Add Fortran compiler flags to CMAKE_Fortran_FLAGS only if supported by the
-# compiler. ::
-#
-# ecbuild_add_fortran_flags( <flag1> [ <flag2> ... ] [ BUILD <build> ] )
-#
-# Options
-# -------
-#
-# BUILD : optional
-# add flags to ``CMAKE_Fortran_FLAGS_<build>`` instead of
-# ``CMAKE_Fortran_FLAGS``
-#
-##############################################################################
-
-include( CheckFortranCompilerFlag )
-macro( ecbuild_add_fortran_flags m_fortran_flags )
-
- set( _flags ${m_fortran_flags} )
-
- if( _flags AND CMAKE_Fortran_COMPILER_LOADED )
-
- set( options )
- set( single_value_args BUILD )
- set( multi_value_args )
-
- cmake_parse_arguments( _PAR "${options}" "${single_value_args}" "${multi_value_args}" ${_FIRST_ARG} ${ARGN} )
-
- if( NOT DEFINED N_FortranFLAG )
- set( N_FortranFLAG 0 )
- endif()
-
- math( EXPR N_FortranFLAG '${N_FortranFLAG}+1' )
-
- if( NOT ECBUILD_TRUST_FLAGS )
- check_fortran_compiler_flag( ${_flags} Fortran_FLAG_TEST_${N_FortranFLAG} )
- endif()
-
- if( Fortran_FLAG_TEST_${N_FortranFLAG} OR ECBUILD_TRUST_FLAGS )
- if( _PAR_BUILD )
- set( CMAKE_Fortran_FLAGS_${_PAR_BUILD} "${CMAKE_Fortran_FLAGS_${_PAR_BUILD}} ${_flags}" )
- else()
- set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${_flags}" )
- # message( STATUS "Fortran FLAG [${_flags}] added" )
- endif()
- else()
- message( STATUS "Unrecognised Fortran flag [${_flags}] -- skipping" )
- endif()
- endif()
-
- unset( _flags )
-
-endmacro()
-
-macro( cmake_add_fortran_flags m_fortran_flags )
- message( DEPRECATION " cmake_add_fortran_flags is deprecated, use ecbuild_add_fortran_flags instead." )
- ecbuild_add_fortran_flags( ${m_fortran_flags} )
-endmacro()
diff --git a/cmake/ecbuild_check_functions.cmake b/cmake/ecbuild_check_functions.cmake
index 0369797..a3ed7a1 100644
--- a/cmake/ecbuild_check_functions.cmake
+++ b/cmake/ecbuild_check_functions.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_check_os.cmake b/cmake/ecbuild_check_os.cmake
index 399a888..942fb6b 100644
--- a/cmake/ecbuild_check_os.cmake
+++ b/cmake/ecbuild_check_os.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -181,6 +181,35 @@ if( ENABLE_OS_ENDINESS_TEST )
endif()
############################################################################################
+# enable profiling
+
+if( ENABLE_PROFILING )
+
+ if( CMAKE_C_COMPILER_ID MATCHES "GNU" )
+
+ set( _flags "-pg --coverage" )
+
+ set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flags}" )
+ set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_flags}" )
+ set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${_flags}" )
+
+ set( _trust_flags ${ECBUILD_TRUST_FLAGS} )
+ set( ECBUILD_TRUST_FLAGS ON )
+ ecbuild_add_c_flags( "${_flags}" )
+ ecbuild_add_cxx_flags( "${_flags}" )
+ ecbuild_add_fortran_flags( "${_flags}" )
+ set( ECBUILD_TRUST_FLAGS ${_trust_flags} )
+ unset( _trust_flags )
+
+ unset( _flags )
+
+ else()
+ message( WARNING "Profiling enabled but ecbuild doesn't know how to enable for this particular compiler ${CMAKE_C_COMPILER_ID}")
+ endif()
+
+endif()
+
+############################################################################################
# check operating system
set( EC_OS_NAME "UNKNOWN" )
@@ -338,5 +367,3 @@ if( ${EC_OS_NAME} MATCHES "UNKNOWN" )
endif()
endif()
-
-
diff --git a/cmake/ecbuild_config.h.in b/cmake/ecbuild_config.h.in
index 68d31f8..2a01618 100644
--- a/cmake/ecbuild_config.h.in
+++ b/cmake/ecbuild_config.h.in
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2014 ECMWF.
+ * (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_debug_var.cmake b/cmake/ecbuild_debug_var.cmake
index 7084c7c..9bb3499 100644
--- a/cmake/ecbuild_debug_var.cmake
+++ b/cmake/ecbuild_debug_var.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_declare_project.cmake b/cmake/ecbuild_declare_project.cmake
index 7b7835c..11052c6 100644
--- a/cmake/ecbuild_declare_project.cmake
+++ b/cmake/ecbuild_declare_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -13,22 +13,44 @@
# =======================
#
# Initialise an ecBuild project. A CMake project must have previously been
-# declared with ``project( <name> ... )``. Sets the following CMake variables
+# declared with ``project( <name> ... )``. ::
+#
+# ecbuild_declare_project()
+#
+# Sets the following CMake variables
# (where ``PNAME`` is the capitalised project name):
#
-# :<PNAME>_GIT_SHA1: Git revision (if project is a Git repo)
-# :<PNAME>_GIT_SHA1_SHORT: short Git revision (if project is a Git repo)
-# :<PNAME>_VERSION: version in format ``MAJOR.MINOR.PATCH``
-# :<PNAME>_VERSION_STR: version as given in ``VERSION.cmake`` or 0.0.0
-# :<PNAME>_MAJOR_VERSION: major version number
-# :<PNAME>_MINOR_VERSION: minor version number
-# :<PNAME>_PATCH_VERSION: patch version number
+# :<PNAME>_GIT_SHA1: Git revision (if project is a Git repo)
+# :<PNAME>_GIT_SHA1_SHORT: short Git revision (if project is a Git repo)
+# :<PNAME>_VERSION: version in format ``MAJOR.MINOR.PATCH``
+# :<PNAME>_VERSION_STR: version as given in ``VERSION.cmake`` or 0.0.0
+# :<PNAME>_MAJOR_VERSION: major version number
+# :<PNAME>_MINOR_VERSION: minor version number
+# :<PNAME>_PATCH_VERSION: patch version number
+# :INSTALL_BIN_DIR: relative install directory for executables
+# (default: ``bin``)
+# :INSTALL_LIB_DIR: relative install directory for libraries
+# (default: ``lib``)
+# :INSTALL_INCLUDE_DIR: relative install directory for include files
+# (default: ``include``)
+# :INSTALL_DATA_DIR: relative install directory for data
+# (default: ``share/<project_name>``)
+# :INSTALL_CMAKE_DIR: relative install directory for CMake files
+# (default: ``share/<project_name>/cmake``)
+#
+# The relative installation directories of components can be customised by
+# setting the following CMake variables on the command line or in cache:
+#
# :<PNAME>_INSTALL_BIN_DIR: directory for installing executables
# :<PNAME>_INSTALL_LIB_DIR: directory for installing libraries
# :<PNAME>_INSTALL_INCLUDE_DIR: directory for installing include files
# :<PNAME>_INSTALL_DATA_DIR: directory for installing data
# :<PNAME>_INSTALL_CMAKE_DIR: directory for installing CMake files
#
+# Using *relative* paths is recommended, which are interpreted relative to the
+# ``CMAKE_INSTALL_PREFIX``. Using absolute paths makes the build
+# non-relocatable and may break the generation of relocatable binary packages.
+#
##############################################################################
macro( ecbuild_declare_project )
diff --git a/cmake/ecbuild_define_build_types.cmake b/cmake/ecbuild_define_build_types.cmake
index f239f01..53e4de0 100644
--- a/cmake/ecbuild_define_build_types.cmake
+++ b/cmake/ecbuild_define_build_types.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_define_options.cmake b/cmake/ecbuild_define_options.cmake
index 3999db8..f7a2321 100644
--- a/cmake/ecbuild_define_options.cmake
+++ b/cmake/ecbuild_define_options.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -16,6 +16,8 @@ option( ENABLE_WARNINGS "enable compiler warnings"
option( ENABLE_LARGE_FILE_SUPPORT "build with large file support" ON )
+option( ENABLE_PROFILING "build with profiling support" OFF )
+
mark_as_advanced( ENABLE_LARGE_FILE_SUPPORT )
option( ENABLE_OS_TESTS "Run all OS tests" ON )
@@ -43,4 +45,4 @@ option( ECBUILD_USE_INCLUDE_DIRECTORIES "Forces to use global include_directorie
mark_as_advanced( ECBUILD_USE_INCLUDE_DIRECTORIES )
-set( CMAKE_NO_SYSTEM_FROM_IMPORTED ON )
\ No newline at end of file
+set( CMAKE_NO_SYSTEM_FROM_IMPORTED ON )
diff --git a/cmake/ecbuild_define_paths.cmake b/cmake/ecbuild_define_paths.cmake
index 57a3f1a..822bf71 100644
--- a/cmake/ecbuild_define_paths.cmake
+++ b/cmake/ecbuild_define_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2012 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_enable_fortran.cmake b/cmake/ecbuild_enable_fortran.cmake
index 5560148..16512e8 100644
--- a/cmake/ecbuild_enable_fortran.cmake
+++ b/cmake/ecbuild_enable_fortran.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_find_lexyacc.cmake b/cmake/ecbuild_find_lexyacc.cmake
index b74c3e1..9876097 100644
--- a/cmake/ecbuild_find_lexyacc.cmake
+++ b/cmake/ecbuild_find_lexyacc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_find_mpi.cmake b/cmake/ecbuild_find_mpi.cmake
index d7265f9..82fc4b5 100644
--- a/cmake/ecbuild_find_mpi.cmake
+++ b/cmake/ecbuild_find_mpi.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -275,7 +275,7 @@ macro( ecbuild_enable_mpi )
endif()
if( MPI_Fortran_FOUND AND NOT Fortran_COMPILER_SUPPORTS_MPI )
- include(ecbuild_check_fortran_source)
+ include( ecbuild_check_fortran_source_return )
ecbuild_add_fortran_flags("${MPI_Fortran_COMPILE_FLAGS}")
include_directories(${MPI_Fortran_INCLUDE_PATH})
endif()
@@ -308,19 +308,19 @@ macro( ecbuild_include_mpi )
endif()
if( MPI_C_FOUND AND NOT C_COMPILER_SUPPORTS_MPI )
- include( ecbuild_check_c_source )
+ include( ecbuild_check_c_source_return )
ecbuild_add_c_flags("${MPI_C_COMPILE_FLAGS}")
include_directories(${MPI_C_INCLUDE_PATH})
endif()
if( MPI_CXX_FOUND AND NOT CXX_COMPILER_SUPPORTS_MPI )
- include( ecbuild_check_cxx_source )
+ include( ecbuild_check_cxx_source_return )
ecbuild_add_cxx_flags("${MPI_CXX_COMPILE_FLAGS}")
include_directories(${MPI_CXX_INCLUDE_PATH})
endif()
if( MPI_Fortran_FOUND AND NOT Fortran_COMPILER_SUPPORTS_MPI )
- include( ecbuild_check_fortran_source )
+ include( ecbuild_check_fortran_source_return )
ecbuild_add_fortran_flags("${MPI_Fortran_COMPILE_FLAGS}")
include_directories(${MPI_Fortran_INCLUDE_PATH})
endif()
diff --git a/cmake/ecbuild_find_omp.cmake b/cmake/ecbuild_find_omp.cmake
index 2de9d74..882adfe 100644
--- a/cmake/ecbuild_find_omp.cmake
+++ b/cmake/ecbuild_find_omp.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_find_package.cmake b/cmake/ecbuild_find_package.cmake
index cec0072..b67b51d 100644
--- a/cmake/ecbuild_find_package.cmake
+++ b/cmake/ecbuild_find_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -105,13 +105,14 @@ macro( ecbuild_find_package )
# debug_var( _PAR_NAME )
- string( TOUPPER ${_PAR_NAME} PNAME )
+ string( TOUPPER ${_PAR_NAME} pkgUPPER )
+ string( TOLOWER ${_PAR_NAME} pkgLOWER )
- set( _${PNAME}_version "" )
+ set( _${pkgUPPER}_version "" )
if( _PAR_VERSION )
- set( _${PNAME}_version ${_PAR_VERSION} )
+ set( _${pkgUPPER}_version ${_PAR_VERSION} )
if( _PAR_EXACT )
- set( _${PNAME}_version ${_PAR_VERSION} EXACT )
+ set( _${pkgUPPER}_version ${_PAR_VERSION} EXACT )
endif()
endif()
@@ -126,24 +127,24 @@ macro( ecbuild_find_package )
# so lets prepend a parallel build tree to the search path if we find it
if( DEVELOPER_MODE )
- get_filename_component( _proj_bdir "${CMAKE_BINARY_DIR}/../${_PAR_NAME}" ABSOLUTE )
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - searching for ${_PAR_NAME}-config.cmake in ${_proj_bdir}")
- if( EXISTS ${_proj_bdir}/${_PAR_NAME}-config.cmake )
+ get_filename_component( _proj_bdir "${CMAKE_BINARY_DIR}/../${pkgLOWER}" ABSOLUTE )
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - searching for ${pkgLOWER}-config.cmake in ${_proj_bdir}")
+ if( EXISTS ${_proj_bdir}/${pkgLOWER}-config.cmake )
ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - found parallel build tree in ${_proj_bdir}")
- if( ${PNAME}_PATH )
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - ${PNAME}_PATH already set to ${${PNAME}_PATH}, not modifying")
+ if( ${pkgUPPER}_PATH )
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - ${pkgUPPER}_PATH already set to ${${pkgUPPER}_PATH}, not modifying")
else()
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - setting ${PNAME}_PATH to ${_proj_bdir}")
- set( ${PNAME}_PATH "${_proj_bdir}" )
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): in DEVELOPER_MODE - setting ${pkgUPPER}_PATH to ${_proj_bdir}")
+ set( ${pkgUPPER}_PATH "${_proj_bdir}" )
endif()
endif()
endif()
# Read environment variables but ONLY if the corresponding CMake variables are unset
- if( NOT DEFINED ${PNAME}_PATH AND NOT "$ENV{${PNAME}_PATH}" STREQUAL "" )
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): setting ${PNAME}_PATH=${${PNAME}_PATH} from environment")
- set( ${PNAME}_PATH "$ENV{${PNAME}_PATH}" )
+ if( NOT DEFINED ${pkgUPPER}_PATH AND NOT "$ENV{${pkgUPPER}_PATH}" STREQUAL "" )
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): setting ${pkgUPPER}_PATH=${${pkgUPPER}_PATH} from environment")
+ set( ${pkgUPPER}_PATH "$ENV{${pkgUPPER}_PATH}" )
endif()
if( NOT DEFINED ${_PAR_NAME}_PATH AND NOT "$ENV{${_PAR_NAME}_PATH}" STREQUAL "" )
@@ -156,19 +157,25 @@ macro( ecbuild_find_package )
set( ${_PAR_NAME}_DIR "$ENV{${_PAR_NAME}_DIR}" )
endif()
+ # Find packages quietly unless in DEVELOPER_MODE, LOG_LEVEL is DEBUG or the package is REQUIRED
+
+ if( NOT ( DEVELOPER_MODE OR _PAR_REQUIRED ) AND ( ECBUILD_LOG_LEVEL GREATER ${ECBUILD_DEBUG} ) )
+ set( _find_quiet QUIET )
+ endif()
+
# search user defined paths first
- if( ${_PAR_NAME}_PATH OR ${PNAME}_PATH OR ${_PAR_NAME}_DIR )
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): ${_PAR_NAME}_PATH=${${_PAR_NAME}_PATH}, ${PNAME}_PATH=${${PNAME}_PATH}, ${_PAR_NAME}_DIR=${${_PAR_NAME}_DIR}")
+ if( ${_PAR_NAME}_PATH OR ${pkgUPPER}_PATH OR ${_PAR_NAME}_DIR )
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): ${_PAR_NAME}_PATH=${${_PAR_NAME}_PATH}, ${pkgUPPER}_PATH=${${pkgUPPER}_PATH}, ${_PAR_NAME}_DIR=${${_PAR_NAME}_DIR}")
# 1) search using CONFIG mode -- try to locate a configuration file provided by the package (package-config.cmake)
if( NOT ${_PAR_NAME}_FOUND )
ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 1) search using CONFIG mode -- try to locate ${_PAR_NAME}-config.cmake")
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): using hints ${PNAME}_PATH=${${PNAME}_PATH}, ${_PAR_NAME}_PATH=${${_PAR_NAME}_PATH}, ${_PAR_NAME}_DIR=${${_PAR_NAME}_DIR}")
- find_package( ${_PAR_NAME} ${_${PNAME}_version} NO_MODULE QUIET
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): using hints ${pkgUPPER}_PATH=${${pkgUPPER}_PATH}, ${_PAR_NAME}_PATH=${${_PAR_NAME}_PATH}, ${_PAR_NAME}_DIR=${${_PAR_NAME}_DIR}")
+ find_package( ${_PAR_NAME} ${_${pkgUPPER}_version} NO_MODULE ${_find_quiet}
COMPONENTS ${_PAR_COMPONENTS}
- HINTS ${${PNAME}_PATH} ${${_PAR_NAME}_PATH} ${${_PAR_NAME}_DIR}
+ HINTS ${${pkgUPPER}_PATH} ${${_PAR_NAME}_PATH} ${${_PAR_NAME}_DIR}
NO_DEFAULT_PATH )
endif()
@@ -176,7 +183,8 @@ macro( ecbuild_find_package )
if( NOT ${_PAR_NAME}_FOUND )
ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 2) search using a file Find${_PAR_NAME}.cmake if it exists")
- find_package( ${_PAR_NAME} ${_${PNAME}_version} MODULE QUIET COMPONENTS ${_PAR_COMPONENTS} )
+ find_package( ${_PAR_NAME} ${_${pkgUPPER}_version} MODULE ${_find_quiet}
+ COMPONENTS ${_PAR_COMPONENTS} )
endif()
# is <package>_PATH was given and we don't find anything then we FAIL
@@ -185,8 +193,8 @@ macro( ecbuild_find_package )
if( ${_PAR_NAME}_PATH )
message( FATAL_ERROR "${_PAR_NAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
endif()
- if( ${PNAME}_PATH )
- message( FATAL_ERROR "${PNAME}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
+ if( ${pkgUPPER}_PATH )
+ message( FATAL_ERROR "${pkgUPPER}_PATH was provided by user but package ${_PAR_NAME} wasn't found" )
endif()
endif()
@@ -197,14 +205,14 @@ macro( ecbuild_find_package )
if( NOT ${_PAR_NAME}_FOUND )
if (NO_DEV_BUILD_DIRS)
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 3) search CMAKE_PREFIX_PATH and \$${PNAME}_PATH")
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 3) search CMAKE_PREFIX_PATH and \$${pkgUPPER}_PATH")
else()
- ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 3) search CMAKE_PREFIX_PATH and \$${PNAME}_PATH and package registry")
+ ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 3) search CMAKE_PREFIX_PATH and \$${pkgUPPER}_PATH and package registry")
endif()
- find_package( ${_PAR_NAME} ${_${PNAME}_version} QUIET NO_MODULE
+ find_package( ${_PAR_NAME} ${_${pkgUPPER}_version} ${_find_quiet} NO_MODULE
COMPONENTS ${_PAR_COMPONENTS}
- HINTS ENV ${PNAME}_PATH
+ HINTS ENV ${pkgUPPER}_PATH
${NO_DEV_BUILD_DIRS}
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
@@ -218,7 +226,7 @@ macro( ecbuild_find_package )
if( NOT ${_PAR_NAME}_FOUND )
ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 5) search system paths, for ${_PAR_NAME}-config.cmake")
- find_package( ${_PAR_NAME} ${_${PNAME}_version} QUIET NO_MODULE
+ find_package( ${_PAR_NAME} ${_${pkgUPPER}_version} ${_find_quiet} NO_MODULE
COMPONENTS ${_PAR_COMPONENTS}
${NO_DEV_BUILD_DIRS} )
@@ -229,7 +237,8 @@ macro( ecbuild_find_package )
if( NOT ${_PAR_NAME}_FOUND )
ecbuild_debug("ecbuild_find_package(${_PAR_NAME}): 6) search system paths, using Find${_PAR_NAME}.cmake if it exists")
- find_package( ${_PAR_NAME} ${_${PNAME}_version} QUIET MODULE COMPONENTS ${_PAR_COMPONENTS} )
+ find_package( ${_PAR_NAME} ${_${pkgUPPER}_version} ${_find_quiet} MODULE
+ COMPONENTS ${_PAR_COMPONENTS} )
endif()
@@ -266,12 +275,12 @@ macro( ecbuild_find_package )
if( ${_PAR_NAME}_FOUND )
if( _version_acceptable )
- set( ${PNAME}_FOUND ${${_PAR_NAME}_FOUND} )
+ set( ${pkgUPPER}_FOUND ${${_PAR_NAME}_FOUND} )
else()
if( NOT _PAR_QUIET )
message( WARNING "${PROJECT_NAME} found ${_PAR_NAME} but with unsuitable version" )
endif()
- set( ${PNAME}_FOUND 0 )
+ set( ${pkgUPPER}_FOUND 0 )
set( ${_PAR_NAME}_FOUND 0 )
endif()
@@ -283,21 +292,21 @@ macro( ecbuild_find_package )
"\n"
" ${PROJECT_NAME} FAILED to find package ${_PAR_NAME}\n"
"\n"
- " Provide location with \"-D${PNAME}_PATH=/...\" or \"-D${_PAR_NAME}_DIR=/...\" \n"
- " You may also export environment variables ${PNAME}_PATH or ${_PAR_NAME}_DIR\n"
+ " Provide location with \"-D${pkgUPPER}_PATH=/...\" or \"-D${_PAR_NAME}_DIR=/...\" \n"
+ " You may also export environment variables ${pkgUPPER}_PATH or ${_PAR_NAME}_DIR\n"
"\n"
" Values (note CAPITALISATION):\n"
- " ${PNAME}_PATH should contain the path to the install prefix (as in <install>/bin <install>/lib <install>/include)\n"
+ " ${pkgUPPER}_PATH should contain the path to the install prefix (as in <install>/bin <install>/lib <install>/include)\n"
" ${_PAR_NAME}_DIR should be a directory containing a <package>-config.cmake file (usually <install>/share/<package>/cmake)\n"
"\n"
)
- if( ${_PAR_NAME}_FOUND OR ${PNAME}_FOUND )
+ if( ${_PAR_NAME}_FOUND OR ${pkgUPPER}_FOUND )
if( NOT _PAR_QUIET )
message( STATUS "[${_PAR_NAME}] (${${_PAR_NAME}_VERSION})" )
foreach( var in ITEMS INCLUDE_DIR INCLUDE_DIRS DEFINITIONS LIBRARY LIBRARIES )
- if( ${PNAME}_${var} )
- message( STATUS " ${PNAME}_${var} : [${${PNAME}_${var}}]" )
+ if( ${pkgUPPER}_${var} )
+ message( STATUS " ${pkgUPPER}_${var} : [${${pkgUPPER}_${var}}]" )
elseif( ${_PAR_NAME}_${var} )
message( STATUS " ${_PAR_NAME}_${var} : [${${_PAR_NAME}_${var}}]" )
endif()
diff --git a/cmake/ecbuild_find_perl.cmake b/cmake/ecbuild_find_perl.cmake
index f4c933a..c615203 100644
--- a/cmake/ecbuild_find_perl.cmake
+++ b/cmake/ecbuild_find_perl.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_find_python.cmake b/cmake/ecbuild_find_python.cmake
index 3209826..c001a7b 100644
--- a/cmake/ecbuild_find_python.cmake
+++ b/cmake/ecbuild_find_python.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_generate_config_headers.cmake b/cmake/ecbuild_generate_config_headers.cmake
index 53be8f3..93cbb1f 100644
--- a/cmake/ecbuild_generate_config_headers.cmake
+++ b/cmake/ecbuild_generate_config_headers.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_generate_rpc.cmake b/cmake/ecbuild_generate_rpc.cmake
index 19fd3eb..45a00ba 100644
--- a/cmake/ecbuild_generate_rpc.cmake
+++ b/cmake/ecbuild_generate_rpc.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_generate_yy.cmake b/cmake/ecbuild_generate_yy.cmake
index 67ee422..5ef2dad 100644
--- a/cmake/ecbuild_generate_yy.cmake
+++ b/cmake/ecbuild_generate_yy.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -40,6 +40,7 @@
#
# DEPENDANT : required
# list of files which depend on the generated lex and yacc target files
+# At least one should be an existing source file (not generated itself).
#
# SOURCE_DIR : optional, defaults to CMAKE_CURRENT_SOURCE_DIR
# directory where yacc and lex source files are located
@@ -116,8 +117,6 @@ macro( ecbuild_generate_yy )
set( _PAR_BISON_FLAGS "-t" )
endif()
- #debug_var( BASE )
-
if( NOT _PAR_YACC_TARGET )
set ( _PAR_YACC_TARGET ${_PAR_YACC} )
endif()
diff --git a/cmake/ecbuild_get_date.cmake b/cmake/ecbuild_get_date.cmake
index 8c24623..ec308a3 100644
--- a/cmake/ecbuild_get_date.cmake
+++ b/cmake/ecbuild_get_date.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_get_resources.cmake b/cmake/ecbuild_get_resources.cmake
index bf48ecf..da824d9 100644
--- a/cmake/ecbuild_get_resources.cmake
+++ b/cmake/ecbuild_get_resources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_get_test_data.cmake b/cmake/ecbuild_get_test_data.cmake
index b1cc32d..8106c65 100644
--- a/cmake/ecbuild_get_test_data.cmake
+++ b/cmake/ecbuild_get_test_data.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -65,6 +65,7 @@ endfunction()
# [ TARGET <target> ]
# [ DIRNAME <dir> ]
# [ MD5 <hash> ]
+# [ EXTRACT ]
# [ NOCHECK ] )
#
# curl or wget is required (curl is preferred if available).
@@ -85,6 +86,9 @@ endfunction()
# md5 checksum of the data set to verify. If not given and NOCHECK is *not*
# set, download the md5 checksum and verify
#
+# EXTRACT : optional
+# extract the downloaded file (supported archives: tar, zip, tar.gz, tar.bz2)
+#
# NOCHECK : optional
# do not verify the md5 checksum of the data file
#
@@ -119,7 +123,7 @@ endfunction()
function( ecbuild_get_test_data )
- set( options NOCHECK )
+ set( options NOCHECK EXTRACT )
set( single_value_args TARGET URL NAME DIRNAME MD5 SHA1)
set( multi_value_args )
@@ -162,38 +166,38 @@ function( ecbuild_get_test_data )
if( NOT _p_NOCHECK )
- find_program( MD5SUM md5sum )
-
- if( MD5SUM AND NOT _p_MD5 AND NOT _p_SHA1) # use remote md5
+ if( NOT _p_MD5 AND NOT _p_SHA1) # use remote md5
# message( STATUS " --- getting MD5 sum " )
add_custom_command( OUTPUT ${_p_NAME}.localmd5
- COMMAND ${MD5SUM} -t ${_p_NAME} > ${_p_NAME}.localmd5
+ COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
DEPENDS ${_p_NAME} )
_download_test_data( ${_p_NAME}.md5 ${_p_DIRNAME} )
- add_custom_command( OUTPUT ${_p_NAME}.ok
- COMMAND diff ${_p_NAME}.md5 ${_p_NAME}.localmd5 && touch ${_p_NAME}.ok
+ add_custom_command( OUTPUT ${_p_NAME}.ok
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${_p_NAME}.md5 ${_p_NAME}.localmd5 &&
+ ${CMAKE_COMMAND} -E touch ${_p_NAME}.ok
DEPENDS ${_p_NAME}.localmd5 ${_p_NAME}.md5 )
list( APPEND _deps ${_p_NAME}.localmd5 ${_p_NAME}.ok )
endif()
- if( MD5SUM AND _p_MD5 )
+ if( _p_MD5 )
# message( STATUS " --- computing MD5 sum [${_p_MD5}]" )
add_custom_command( OUTPUT ${_p_NAME}.localmd5
- COMMAND ${MD5SUM} -t ${_p_NAME} > ${_p_NAME}.localmd5
+ COMMAND ${CMAKE_COMMAND} -E md5sum ${_p_NAME} > ${_p_NAME}.localmd5
DEPENDS ${_p_NAME} )
configure_file( "${ECBUILD_MACROS_DIR}/md5.in" ${_p_NAME}.md5 @ONLY )
add_custom_command( OUTPUT ${_p_NAME}.ok
- COMMAND diff ${_p_NAME}.md5 ${_p_NAME}.localmd5 && touch ${_p_NAME}.ok
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${_p_NAME}.md5 ${_p_NAME}.localmd5 &&
+ ${CMAKE_COMMAND} -E touch ${_p_NAME}.ok
DEPENDS ${_p_NAME}.localmd5 )
list( APPEND _deps ${_p_NAME}.localmd5 ${_p_NAME}.ok )
@@ -223,6 +227,12 @@ function( ecbuild_get_test_data )
add_custom_target( ${_p_TARGET} DEPENDS ${_deps} )
+ if( _p_EXTRACT )
+ ecbuild_debug("ecbuild_get_test_data: extracting ${_p_NAME} (post-build for target ${_p_TARGET}")
+ add_custom_command( TARGET ${_p_TARGET} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E tar xv ${_p_NAME} )
+ endif()
+
endfunction(ecbuild_get_test_data)
##############################################################################
@@ -236,6 +246,7 @@ endfunction(ecbuild_get_test_data)
# ecbuild_get_test_multidata( NAMES <name1> [ <name2> ... ]
# TARGET <target>
# [ DIRNAME <dir> ]
+# [ EXTRACT ]
# [ NOCHECK ] )
#
# curl or wget is required (curl is preferred if available).
@@ -252,6 +263,9 @@ endfunction(ecbuild_get_test_data)
# DIRNAME : optional, defaults to <project>/<relative path to current dir>
# directory in which the test data resides
#
+# EXTRACT : optional
+# extract downloaded files (supported archives: tar, zip, tar.gz, tar.bz2)
+#
# NOCHECK : optional
# do not verify the md5 checksum of the data file
#
@@ -292,7 +306,7 @@ endfunction(ecbuild_get_test_data)
function( ecbuild_get_test_multidata )
- set( options NOCHECK )
+ set( options EXTRACT NOCHECK )
set( single_value_args TARGET DIRNAME )
set( multi_value_args NAMES )
@@ -316,6 +330,10 @@ function( ecbuild_get_test_multidata )
# debug_var( _p_NAME )
# debug_var( _p_DIRNAME )
+ if( _p_EXTRACT )
+ set( _extract EXTRACT )
+ endif()
+
if( _p_NOCHECK )
set( _nocheck NOCHECK )
endif()
@@ -340,12 +358,11 @@ endfunction()\n\n" )
get_filename_component( _dir ${_f} PATH )
list( APPEND _path_comps ${_p_DIRNAME} ${_dir} )
-
join( _path_comps "/" _dirname )
-
if( _dirname )
set( _dirname DIRNAME ${_dirname} )
endif()
+ unset( _path_comps )
string( REPLACE "." "_" _name "${_file}" )
string( REGEX MATCH ":.*" _md5 "${_d}" )
@@ -363,12 +380,12 @@ endfunction()\n\n" )
ecbuild_get_test_data(
TARGET __get_data_${_p_TARGET}_${_name}
- NAME ${_file} ${_dirname} ${_md5} ${_nocheck} )
+ NAME ${_file} ${_dirname} ${_md5} ${_extract} ${_nocheck} )
# The option /fast disables dependency checking on a target, see
# https://cmake.org/Wiki/CMake_FAQ#Is_there_a_way_to_skip_checking_of_dependent_libraries_when_compiling.3F
file( APPEND ${_script}
- "exec_check( ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target __get_data_${_p_TARGET}_${_name}/fast )\n" )
+ "exec_check( \"${CMAKE_COMMAND}\" --build \"${CMAKE_BINARY_DIR}\" --target __get_data_${_p_TARGET}_${_name}/fast )\n" )
endforeach()
diff --git a/cmake/ecbuild_install_project.cmake b/cmake/ecbuild_install_project.cmake
index fa4d26d..d53f110 100644
--- a/cmake/ecbuild_install_project.cmake
+++ b/cmake/ecbuild_install_project.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -155,6 +155,25 @@ macro( ecbuild_install_project )
list( APPEND CPACK_SOURCE_IGNORE_FILES ${ECBUILD_DONT_PACK_FILES} )
+ # Find the ecbuild toolchain files and include in the source package if found
+ find_path( ECBUILD_TOOLCHAIN_DIR ecmwf-XC30-GNU.cmake
+ PATHS ${ECBUILD_MACROS_DIR}/../toolchains
+ ${ECBUILD_MACROS_DIR}/../share/ecbuild/toolchains )
+
+ if( ECBUILD_TOOLCHAIN_DIR )
+ list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_TOOLCHAIN_DIR}" "share/ecbuild/toolchains/" )
+ endif()
+
+ # Find the ecbuild bin directory and include in the source package if found
+ find_program( ECBUILD_SCRIPT ecbuild
+ PATHS ${ECBUILD_MACROS_DIR}/../bin
+ ${ECBUILD_MACROS_DIR}/../../../bin )
+
+ if( ECBUILD_SCRIPT )
+ get_filename_component( ECBUILD_BIN_DIR ${ECBUILD_SCRIPT} PATH )
+ list( APPEND CPACK_SOURCE_INSTALLED_DIRECTORIES "${ECBUILD_BIN_DIR}" "bin/" )
+ endif()
+
# cpack config file
# set(CPACK_INSTALL_CMAKE_PROJECTS "${${PROJECT_NAME}_BINARY_DIR}" "${PROJECT_NAME}" "${CPACK_COMPONENTS_ALL}" "*" )
diff --git a/cmake/ecbuild_links_target.cmake b/cmake/ecbuild_links_target.cmake
index 5dfacdc..c881c0d 100644
--- a/cmake/ecbuild_links_target.cmake
+++ b/cmake/ecbuild_links_target.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_list_extra_search_paths.cmake b/cmake/ecbuild_list_extra_search_paths.cmake
index 719b1e7..0768a48 100644
--- a/cmake/ecbuild_list_extra_search_paths.cmake
+++ b/cmake/ecbuild_list_extra_search_paths.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_list_macros.cmake b/cmake/ecbuild_list_macros.cmake
index fcfc815..a4152c7 100644
--- a/cmake/ecbuild_list_macros.cmake
+++ b/cmake/ecbuild_list_macros.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_pkgconfig.cmake b/cmake/ecbuild_pkgconfig.cmake
index 4f82e40..6db3726 100644
--- a/cmake/ecbuild_pkgconfig.cmake
+++ b/cmake/ecbuild_pkgconfig.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -120,6 +120,9 @@ function( ecbuild_pkgconfig_libs pkgconfig_libs libraries ignore_libs )
get_filename_component( _name ${_lib} NAME_WE )
get_filename_component( _dir ${_lib} PATH )
+ if( TARGET ${_lib} )
+ get_target_property( _name ${_lib} OUTPUT_NAME )
+ endif()
if( NOT _name )
set( _name ${_lib} )
endif()
@@ -179,14 +182,17 @@ function( ecbuild_pkgconfig_include INCLUDE INCLUDE_DIRS ignore_includes )
list( APPEND ignore_include_dirs
"/usr/include"
${${PNAME}_INCLUDE_DIRS} # These are build-directory includes
+ ${CMAKE_SOURCE_DIR} # Ignore private includes referencing source tree
+ ${CMAKE_BINARY_DIR} # Ignore private includes referencing build tree
${_ignore_includes}
)
foreach( _incdir ${${INCLUDE_DIRS}} )
foreach( _ignore ${ignore_include_dirs} )
- if( "${_incdir}" STREQUAL "${_ignore}" )
+ if( "${_incdir}" MATCHES "${_ignore}" )
unset( _incdir )
+ break()
endif()
endforeach()
diff --git a/cmake/ecbuild_print_summary.cmake b/cmake/ecbuild_print_summary.cmake
index b3cddf0..d4bffba 100644
--- a/cmake/ecbuild_print_summary.cmake
+++ b/cmake/ecbuild_print_summary.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_project_files.cmake b/cmake/ecbuild_project_files.cmake
index 162a625..fbf3015 100644
--- a/cmake/ecbuild_project_files.cmake
+++ b/cmake/ecbuild_project_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_requires_macro_version.cmake b/cmake/ecbuild_requires_macro_version.cmake
index 6c73fe7..ef13d64 100644
--- a/cmake/ecbuild_requires_macro_version.cmake
+++ b/cmake/ecbuild_requires_macro_version.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_separate_sources.cmake b/cmake/ecbuild_separate_sources.cmake
index 94aa182..55c6d8f 100644
--- a/cmake/ecbuild_separate_sources.cmake
+++ b/cmake/ecbuild_separate_sources.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_system.cmake b/cmake/ecbuild_system.cmake
index c9fe7f8..ca4f4fa 100644
--- a/cmake/ecbuild_system.cmake
+++ b/cmake/ecbuild_system.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -156,16 +156,10 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_log )
include( ecbuild_list_macros )
- include( ecbuild_check_c_source )
-
- if( CMAKE_CXX_COMPILER_LOADED )
- include( ecbuild_check_cxx_source )
+ include( ecbuild_check_c_source_return )
+ include( ecbuild_check_cxx_source_return )
include( ecbuild_check_cxx11 )
- endif()
-
- if( CMAKE_Fortran_COMPILER_LOADED )
- include( ecbuild_check_fortran_source )
- endif()
+ include( ecbuild_check_fortran_source_return )
include( ecbuild_requires_macro_version )
include( ecbuild_get_date )
@@ -181,8 +175,11 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_append_to_rpath )
include( ecbuild_download_resource )
include( ecbuild_get_test_data )
+ include( ecbuild_add_c_flags )
+ include( ecbuild_add_cxx_flags )
include( ecbuild_add_cxx11_flags )
include( ecbuild_get_cxx11_flags )
+ include( ecbuild_add_fortran_flags )
include( ecbuild_add_test )
include( ecbuild_add_resources )
include( ecbuild_get_resources )
@@ -205,9 +202,6 @@ if( PROJECT_NAME STREQUAL CMAKE_PROJECT_NAME )
include( ecbuild_find_fortranlibs )
include( ecbuild_git )
include( ecbuild_enable_fortran )
- include( ecbuild_check_c_source )
- include( ecbuild_check_cxx_source )
- include( ecbuild_check_fortran_source )
include( ecbuild_bundle )
include( ecbuild_pkgconfig )
include( ecbuild_cache )
diff --git a/cmake/ecbuild_use_package.cmake b/cmake/ecbuild_use_package.cmake
index 1746cd1..acbe495 100644
--- a/cmake/ecbuild_use_package.cmake
+++ b/cmake/ecbuild_use_package.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
@@ -100,35 +100,35 @@ macro( ecbuild_use_package )
# try to find the package as a subproject and build it
- string( TOUPPER ${_p_PROJECT} PNAME )
+ string( TOUPPER ${_p_PROJECT} pkgUPPER )
# user defined dir with subprojects
- if( NOT DEFINED ${PNAME}_SOURCE AND DEFINED SUBPROJECT_DIRS )
+ if( NOT DEFINED ${pkgUPPER}_SOURCE AND DEFINED SUBPROJECT_DIRS )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): scanning subproject directories ${SUBPROJECT_DIRS}")
foreach( dir ${SUBPROJECT_DIRS} )
if( EXISTS ${dir}/${_p_PROJECT} AND EXISTS ${dir}/${_p_PROJECT}/CMakeLists.txt )
- ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): setting ${PNAME}_SOURCE to ${dir}/${_p_PROJECT}")
- set( ${PNAME}_SOURCE "${dir}/${_p_PROJECT}" )
+ ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): setting ${pkgUPPER}_SOURCE to ${dir}/${_p_PROJECT}")
+ set( ${pkgUPPER}_SOURCE "${dir}/${_p_PROJECT}" )
endif()
endforeach()
endif()
# user defined path to subproject
- if( DEFINED ${PNAME}_SOURCE )
+ if( DEFINED ${pkgUPPER}_SOURCE )
- if( NOT EXISTS ${${PNAME}_SOURCE} OR NOT EXISTS ${${PNAME}_SOURCE}/CMakeLists.txt )
- message( FATAL_ERROR "User defined source directory '${${PNAME}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file." )
+ if( NOT EXISTS ${${pkgUPPER}_SOURCE} OR NOT EXISTS ${${pkgUPPER}_SOURCE}/CMakeLists.txt )
+ message( FATAL_ERROR "User defined source directory '${${pkgUPPER}_SOURCE}' for project '${_p_PROJECT}' does not exist or does not contain a CMakeLists.txt file." )
endif()
- set( ${PNAME}_subproj_dir_ "${${PNAME}_SOURCE}" )
+ set( ${pkgUPPER}_subproj_dir_ "${${pkgUPPER}_SOURCE}" )
else() # default is 'dropped in' subdirectory named as project
if( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT} AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}/CMakeLists.txt )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): found ${_p_PROJECT} in subdirectory ${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}")
- set( ${PNAME}_subproj_dir_ "${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}" )
+ set( ${pkgUPPER}_subproj_dir_ "${CMAKE_CURRENT_SOURCE_DIR}/${_p_PROJECT}" )
endif()
endif()
@@ -139,32 +139,32 @@ macro( ecbuild_use_package )
set( _do_version_check 0 )
set( _source_description "" )
- list( FIND ECBUILD_PROJECTS ${_p_PROJECT} _ecbuild_project_${PNAME} )
+ list( FIND ECBUILD_PROJECTS ${_p_PROJECT} _ecbuild_project_${pkgUPPER} )
- if( NOT _ecbuild_project_${PNAME} EQUAL "-1" )
+ if( NOT _ecbuild_project_${pkgUPPER} EQUAL "-1" )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} was previously added as a subproject")
- set( ${PNAME}_previous_subproj_ 1 )
+ set( ${pkgUPPER}_previous_subproj_ 1 )
else()
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} was not previously added as a subproject")
- set( ${PNAME}_previous_subproj_ 0 )
+ set( ${pkgUPPER}_previous_subproj_ 0 )
endif()
# solve capitalization issues
- if( ${_p_PROJECT}_FOUND AND NOT ${PNAME}_FOUND )
- set( ${PNAME}_FOUND 1 )
+ if( ${_p_PROJECT}_FOUND AND NOT ${pkgUPPER}_FOUND )
+ set( ${pkgUPPER}_FOUND 1 )
endif()
- if( ${PNAME}_FOUND AND NOT ${_p_PROJECT}_FOUND )
+ if( ${pkgUPPER}_FOUND AND NOT ${_p_PROJECT}_FOUND )
set( ${_p_PROJECT}_FOUND 1 )
endif()
# Case 1) project was NOT previously added as subproject and is NOT already FOUND
- if( NOT ${PNAME}_FOUND AND NOT ${PNAME}_previous_subproj_ )
+ if( NOT ${pkgUPPER}_FOUND AND NOT ${pkgUPPER}_previous_subproj_ )
# check if SUBPROJDIR is set
- if( DEFINED ${PNAME}_subproj_dir_ )
+ if( DEFINED ${pkgUPPER}_subproj_dir_ )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 1) project was NOT previously added as subproject and is NOT already FOUND")
@@ -175,17 +175,17 @@ macro( ecbuild_use_package )
# add as a subproject
- set( ${PNAME}_subproj_dir_ ${${PNAME}_subproj_dir_} CACHE PATH "Path to ${_p_PROJECT} source directory" )
+ set( ${pkgUPPER}_subproj_dir_ ${${pkgUPPER}_subproj_dir_} CACHE PATH "Path to ${_p_PROJECT} source directory" )
set( ECBUILD_PROJECTS ${ECBUILD_PROJECTS} ${_p_PROJECT} CACHE INTERNAL "" )
- ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} found in subdirectory ${${PNAME}_subproj_dir_}")
- add_subdirectory( ${${PNAME}_subproj_dir_} ${_p_PROJECT} )
+ ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): ${_p_PROJECT} found in subdirectory ${${pkgUPPER}_subproj_dir_}")
+ add_subdirectory( ${${pkgUPPER}_subproj_dir_} ${_p_PROJECT} )
set( ${_p_PROJECT}_BASE_DIR ${CMAKE_BINARY_DIR} )
- set( ${PNAME}_FOUND 1 )
- set( ${_p_PROJECT}_VERSION ${${PNAME}_VERSION} )
+ set( ${pkgUPPER}_FOUND 1 )
+ set( ${_p_PROJECT}_VERSION ${${pkgUPPER}_VERSION} )
endif()
@@ -193,12 +193,12 @@ macro( ecbuild_use_package )
# Case 2) project was already added as subproject, so is already FOUND -- BUT must check version acceptable
- if( ${PNAME}_previous_subproj_ )
+ if( ${pkgUPPER}_previous_subproj_ )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 2) project was already added as subproject, check version is acceptable")
- if( NOT ${PNAME}_FOUND )
- message( FATAL_ERROR "${_p_PROJECT} was already included as sub-project but ${PNAME}_FOUND isn't set -- this is likely a BUG in ecbuild" )
+ if( NOT ${pkgUPPER}_FOUND )
+ message( FATAL_ERROR "${_p_PROJECT} was already included as sub-project but ${pkgUPPER}_FOUND isn't set -- this is likely a BUG in ecbuild" )
endif()
# check version is acceptable
@@ -209,7 +209,7 @@ macro( ecbuild_use_package )
# Case 3) project was NOT added as subproject, but is FOUND -- so it was previously found as a binary ( either build or install tree )
- if( ${PNAME}_FOUND AND NOT ${PNAME}_previous_subproj_ AND NOT _just_added )
+ if( ${pkgUPPER}_FOUND AND NOT ${pkgUPPER}_previous_subproj_ AND NOT _just_added )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 3) project was NOT previously added as subproject, but is FOUND")
@@ -223,13 +223,13 @@ macro( ecbuild_use_package )
# debug_var( _p_PROJECT )
# debug_var( _p_VERSION )
- # debug_var( ${PNAME}_VERSION )
+ # debug_var( ${pkgUPPER}_VERSION )
# debug_var( ${_p_PROJECT}_VERSION )
# debug_var( _just_added )
# debug_var( _do_version_check )
# debug_var( _source_description )
- # debug_var( ${PNAME}_FOUND )
- # debug_var( ${PNAME}_previous_subproj_ )
+ # debug_var( ${pkgUPPER}_FOUND )
+ # debug_var( ${pkgUPPER}_previous_subproj_ )
if( _p_VERSION AND _do_version_check )
if( _p_EXACT )
@@ -248,7 +248,7 @@ macro( ecbuild_use_package )
# Case 4) is NOT FOUND so far, NOT as sub-project (now or before), and NOT as binary neither
# so try to find precompiled binaries or a build tree
- if( NOT ${PNAME}_FOUND )
+ if( NOT ${pkgUPPER}_FOUND )
ecbuild_debug("ecbuild_use_package(${_p_PROJECT}): 4) project has NOT been added as a subproject and is NOT already FOUND")
@@ -266,20 +266,20 @@ macro( ecbuild_use_package )
ecbuild_find_package( NAME ${_p_PROJECT} ${_opts} )
if( ${_p_PROJECT}_FOUND )
- set( ${PNAME}_FOUND ${${_p_PROJECT}_FOUND} )
+ set( ${pkgUPPER}_FOUND ${${_p_PROJECT}_FOUND} )
endif()
endif()
- if( ${PNAME}_FOUND )
+ if( ${pkgUPPER}_FOUND )
list( APPEND ${PROJECT_NAME_CAPS}_TPLS ${_p_PROJECT} )
list( REMOVE_DUPLICATES ${PROJECT_NAME_CAPS}_TPLS )
endif()
### for when we change this macro to a function()
- # set_parent_scope( ${PNAME}_FOUND )
+ # set_parent_scope( ${pkgUPPER}_FOUND )
# set_parent_scope( ${_p_PROJECT}_FOUND )
- # set_parent_scope( ${PNAME}_VERSION )
+ # set_parent_scope( ${pkgUPPER}_VERSION )
# set_parent_scope( ${_p_PROJECT}_VERSION )
# set_parent_scope( ${_p_PROJECT}_BINARY_DIR )
diff --git a/cmake/ecbuild_version.h.in b/cmake/ecbuild_version.h.in
index d274bf6..3ed96ce 100644
--- a/cmake/ecbuild_version.h.in
+++ b/cmake/ecbuild_version.h.in
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2014 ECMWF.
+ * (C) Copyright 1996-2015 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.
diff --git a/cmake/ecbuild_warn_unused_files.cmake b/cmake/ecbuild_warn_unused_files.cmake
index c33b213..084adb3 100644
--- a/cmake/ecbuild_warn_unused_files.cmake
+++ b/cmake/ecbuild_warn_unused_files.cmake
@@ -1,4 +1,4 @@
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/cmake/include/ecbuild/boost_test_framework.h b/cmake/include/ecbuild/boost_test_framework.h
index 09e61dd..8cbd8e9 100644
--- a/cmake/include/ecbuild/boost_test_framework.h
+++ b/cmake/include/ecbuild/boost_test_framework.h
@@ -1,5 +1,5 @@
/*
- * (C) Copyright 1996-2014 ECMWF.
+ * (C) Copyright 1996-2015 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.
diff --git a/cmake/sg.pl b/cmake/sg.pl
index 455161b..8a64bf4 100755
--- a/cmake/sg.pl
+++ b/cmake/sg.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl
#!/usr/local/share/perl56
-# (C) Copyright 1996-2014 ECMWF.
+# (C) Copyright 1996-2015 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.
diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
index 626f8d0..5cfccdd 100644
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@ -92,7 +92,7 @@ if(GRIB_API_PATH)
set(GRIB_API_LIB_DIR "${GRIB_API_PATH}/lib64")
endif()
- set(GRIB_API_LIBRARIES_STR "-L${GRIB_API_PATH}/lib -L${GRIB_API_PATH}/lib64 ${GRIB_API_LIBRARIES_STR}")
+ set(GRIB_API_LIBRARIES_STR "-L${GRIB_API_PATH}/lib -L${GRIB_API_PATH}/lib64 -Wl,-rpath,${GRIB_API_PATH}/lib:${GRIB_API_PATH}/lib64 ${GRIB_API_LIBRARIES_STR}")
endif()
@@ -158,22 +158,26 @@ endif()
ecbuild_get_date(TODAYS_DATE)
-# Add certain paths to LD_LIBRARY_PATH.
-# If the given path is not a standard system one, then add it to our list
-# of paths to add to LD_LIBRARY_PATH on Metview's startup. We want to
-# avoid adding system paths here because they can override non-default
-# paths (case in point: the wrong OpenGL library has been known to be
-# picked up - used by VAPOR).
-
-set(SYS_LIBDIRS "/usr/lib64" "/usr/lib64/" "/usr/lib" "/usr/lib/" "")
-set(METVIEW_LD_PATHS "")
-
-foreach(LIBPATH ${MAGICS_LIB_DIR} ${ODB_API_LIB_DIR} ${GRIB_API_LIB_DIR})
- list(FIND SYS_LIBDIRS ${LIBPATH} IND)
- if(IND EQUAL -1) # path not in the list of system paths
- set(METVIEW_LD_PATHS "${LIBPATH}:${METVIEW_LD_PATHS}")
- endif()
-endforeach()
+# # Add certain paths to LD_LIBRARY_PATH.
+# # If the given path is not a standard system one, then add it to our list
+# # of paths to add to LD_LIBRARY_PATH on Metview's startup. We want to
+# # avoid adding system paths here because they can override non-default
+# # paths (case in point: the wrong OpenGL library has been known to be
+# # picked up - used by VAPOR).
+#
+# NO - this is not really needed with the rpath, and it can lead, in the
+# case of a bundle, to the build directory (Magics) going into the
+# LD_LIBRARY_PATH even when installed (no harmful effect seen though).
+#
+# set(SYS_LIBDIRS "/usr/lib64" "/usr/lib64/" "/usr/lib" "/usr/lib/" "")
+# set(METVIEW_LD_PATHS "")
+#
+# foreach(LIBPATH ${MAGICS_LIB_DIR} ${ODB_API_LIB_DIR} ${GRIB_API_LIB_DIR})
+# list(FIND SYS_LIBDIRS ${LIBPATH} IND)
+# if(IND EQUAL -1) # path not in the list of system paths
+# set(METVIEW_LD_PATHS "${LIBPATH}:${METVIEW_LD_PATHS}")
+# endif()
+# endforeach()
# create the Metview startup script
diff --git a/scripts/metview_base.in b/scripts/metview_base.in
index cfe7c56..2fa09e6 100755
--- a/scripts/metview_base.in
+++ b/scripts/metview_base.in
@@ -41,7 +41,6 @@ MV_ODB1_VERSION=@MV_ODB1_VERSION@
##MV_ODB1_USE_SCRIPT=/usr/local/share/ecmwf/use/sh.odb
METVIEW_RELEASE=@METVIEW_VERSION_STR@
METVIEW_VERSION_TITLE="Metview @METVIEW_VERSION_STR@ @EXTRA_TITLE@ (@TODAYS_DATE@)"
-LD_LIBRARY_PATH="@METVIEW_LD_PATHS@:${LD_LIBRARY_PATH}"
METVIEW_GUI_BUILT=@METVIEW_GUI_BUILT@
@MV_FLEXTRA_PATH_SET@
MV_WEATHER_ROOM_BUILT=@MV_WEATHER_ROOM_BUILT@
@@ -836,7 +835,7 @@ then
MAIL=${MAIL:=/var/spool/mail/$LOGNAME}
fi
- resY=`xdpyinfo | grep "resolution" | awk '{print $2}' | cut -d "x" -f 2`
+ resY=`xdpyinfo | \grep "resolution" | awk '{print $2}' | cut -d "x" -f 2`
METVIEW_SCREEN_RESOLUTION=${METVIEW_SCREEN_RESOLUTION:=$resY}
fi
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
new file mode 100644
index 0000000..1e12d66
--- /dev/null
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Cray.cmake
@@ -0,0 +1,81 @@
+####################################################################
+# COMPILER
+####################################################################
+
+include(CMakeForceCompiler)
+
+CMAKE_FORCE_C_COMPILER ( cc Cray )
+CMAKE_FORCE_CXX_COMPILER ( CC Cray )
+CMAKE_FORCE_Fortran_COMPILER ( ftn Cray )
+
+link_libraries("$ENV{CC_X86_64}/lib/x86-64/libcray-c++-rts.so")
+link_libraries("-lmpichf90_cray")
+link_libraries("-lmpichcxx_cray")
+
+set( ECBUILD_FIND_MPI OFF )
+set( ECBUILD_TRUST_FLAGS ON )
+
+####################################################################
+# FLAGS COMMON TO ALL BUILD TYPES
+####################################################################
+
+set( OMP_C_FLAGS "-homp" )
+set( OMP_CXX_FLAGS "-homp" )
+set( OMP_Fortran_FLAGS "-homp" )
+
+set( OMPSTUBS_C_FLAGS "-hnoomp" )
+set( OMPSTUBS_CXX_FLAGS "-hnoomp" )
+set( OMPSTUBS_Fortran_FLAGS "-hnoomp" )
+
+set( CMAKE_C_FLAGS "" CACHE STRING "" FORCE )
+set( CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE )
+set( CMAKE_Fortran_FLAGS "-emf -rmoid" CACHE STRING "" FORCE ) # -emf activates .mods and uses lower case -rmoid produces a listing file
+
+####################################################################
+# RELEASE FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+set( ECBUILD_CXX_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+
+####################################################################
+# BIT REPRODUCIBLE FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
+set( ECBUILD_CXX_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
+set( ECBUILD_Fortran_FLAGS_BIT "-O1 -G2 -hflex_mp=conservative -hadd_paren -hfp1 -DNDEBUG" )
+
+####################################################################
+# RELWITHDEBINFO FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+
+####################################################################
+# DEBUG FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_DEBUG "-O0 -G0" )
+set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -G0" )
+set( ECBUILD_Fortran_FLAGS_DEBUG "-O0 -G0" )
+
+####################################################################
+# PRODUCTION FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+set( ECBUILD_CXX_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+set( ECBUILD_Fortran_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+
+####################################################################
+# LINK FLAGS
+####################################################################
+
+set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
+set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
+set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,loadmap -Wl,--as-needed -Ktrap=fp" )
+
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
new file mode 100644
index 0000000..3c890d5
--- /dev/null
+++ b/share/ecbuild/toolchains/ecmwf-XC30-GNU.cmake
@@ -0,0 +1,73 @@
+####################################################################
+# COMPILER
+####################################################################
+
+include(CMakeForceCompiler)
+
+CMAKE_FORCE_C_COMPILER ( cc GNU )
+CMAKE_FORCE_CXX_COMPILER ( CC GNU )
+CMAKE_FORCE_Fortran_COMPILER ( ftn GNU )
+
+set( ECBUILD_FIND_MPI OFF )
+set( ECBUILD_TRUST_FLAGS ON )
+
+####################################################################
+# FLAGS COMMON TO ALL BUILD TYPES
+####################################################################
+
+set( OMP_C_FLAGS "-fopenmp" )
+set( OMP_CXX_FLAGS "-fopenmp" )
+set( OMP_Fortran_FLAGS "-fopenmp" )
+
+set( CMAKE_C_FLAGS "" CACHE STRING "" FORCE )
+set( CMAKE_CXX_FLAGS "" CACHE STRING "" FORCE )
+set( CMAKE_Fortran_FLAGS "" CACHE STRING "" FORCE )
+
+####################################################################
+# RELEASE FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+#set( ECBUILD_CXX_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+#set( ECBUILD_Fortran_FLAGS_RELEASE "-O3 -hfp3 -hscalar3 -hvector3 -DNDEBUG" )
+
+####################################################################
+# BIT REPRODUCIBLE FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" )
+set( ECBUILD_CXX_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG" )
+set( ECBUILD_Fortran_FLAGS_BIT "-g -O2 -m64 -march=native -DNDEBUG -fno-range-check -ffree-line-length-300 -fconvert=big-endian" )
+
+####################################################################
+# RELWITHDEBINFO FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "-O2 -hfp1 -Gfast -DNDEBUG" )
+
+####################################################################
+# DEBUG FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_DEBUG "-O0 -G0" )
+#set( ECBUILD_CXX_FLAGS_DEBUG "-O0 -G0" )
+#set( ECBUILD_Fortran_FLAGS_DEBUG "-O0 -G0" )
+
+####################################################################
+# PRODUCTION FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+#set( ECBUILD_CXX_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+#set( ECBUILD_Fortran_FLAGS_PRODUCTION "-O2 -hfp1 -G2" )
+
+####################################################################
+# LINK FLAGS
+####################################################################
+
+set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+
diff --git a/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
new file mode 100644
index 0000000..485b122
--- /dev/null
+++ b/share/ecbuild/toolchains/ecmwf-XC30-Intel.cmake
@@ -0,0 +1,76 @@
+####################################################################
+# COMPILER
+####################################################################
+
+include(CMakeForceCompiler)
+
+CMAKE_FORCE_C_COMPILER ( cc Intel )
+CMAKE_FORCE_CXX_COMPILER ( CC Intel )
+CMAKE_FORCE_Fortran_COMPILER ( ftn Intel )
+
+set( ECBUILD_FIND_MPI OFF )
+set( ECBUILD_TRUST_FLAGS ON )
+
+####################################################################
+# FLAGS COMMON TO ALL BUILD TYPES
+####################################################################
+
+set( OMP_C_FLAGS "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
+set( OMP_CXX_FLAGS "-qopenmp -qopenmp-threadprivate=compat -qopenmp-report=2 -qopt-report-phase=vec,openmp" )
+set( OMP_Fortran_FLAGS " -openmp -openmp-threadprivate=compat -openmp-report=2 -opt-report-phase=vec,openmp" ) # -[q] is missing on purpose, ifort does not take -q as flag
+
+# for diagnostics:
+# -diag-enable=vec -diag-file -Winline
+
+set( CMAKE_C_FLAGS "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
+set( CMAKE_CXX_FLAGS "-fp-speculation=strict -fp-model precise -traceback" CACHE STRING "" FORCE )
+set( CMAKE_Fortran_FLAGS "-fp-speculation=strict -fp-model precise -convert big_endian -assume byterecl -traceback -fpe0" CACHE STRING "" FORCE )
+
+####################################################################
+# RELEASE FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_RELEASE "not implemented" )
+#set( ECBUILD_CXX_FLAGS_RELEASE "not implemented" )
+#set( ECBUILD_Fortran_FLAGS_RELEASE "not implemented" )
+
+####################################################################
+# BIT REPRODUCIBLE FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_BIT "-O2 -xAVX -finline-function -finline-limit=500" )
+set( ECBUILD_CXX_FLAGS_BIT "-O2 -xAVX -finline-function -finline-limit=500" )
+set( ECBUILD_Fortran_FLAGS_BIT "-O2 -xAVX -finline-function -finline-limit=500 -align array64byte" )
+
+####################################################################
+# RELWITHDEBINFO FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_RELWITHDEBINFO "not implemented" )
+#set( ECBUILD_CXX_FLAGS_RELWITHDEBINFO "not implemented" )
+#set( ECBUILD_Fortran_FLAGS_RELWITHDEBINFO "not implemented" )
+
+####################################################################
+# DEBUG FLAGS
+####################################################################
+
+set( ECBUILD_C_FLAGS_DEBUG "-g -O0" )
+set( ECBUILD_CXX_FLAGS_DEBUG "-g -O0" )
+set( ECBUILD_Fortran_FLAGS_DEBUG "-g -O0" ) # ??? -align array64byte
+
+####################################################################
+# PRODUCTION FLAGS
+####################################################################
+
+#set( ECBUILD_C_FLAGS_PRODUCTION "not implemented" )
+#set( ECBUILD_CXX_FLAGS_PRODUCTION "not implemented" )
+#set( ECBUILD_Fortran_FLAGS_PRODUCTION "not implemented" )
+
+####################################################################
+# LINK FLAGS
+####################################################################
+
+set( ECBUILD_C_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_CXX_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+set( ECBUILD_Fortran_LINK_FLAGS "-Wl,-Map,load.map -Wl,--as-needed" )
+
diff --git a/share/metview/app-defaults/CommonMacroFuncs/mvl_ml2hPa b/share/metview/app-defaults/CommonMacroFuncs/mvl_ml2hPa
index bfff470..1f337cd 100644
--- a/share/metview/app-defaults/CommonMacroFuncs/mvl_ml2hPa
+++ b/share/metview/app-defaults/CommonMacroFuncs/mvl_ml2hPa
@@ -130,11 +130,24 @@ function mvl_ml2hPa(lnsp:fieldset, mfld:fieldset, plist:list)
# -Interpolate, transform to pressure field, and add to fieldset list
fint= ( f1*(press-p2)+ f2*(p1-press) )/(p1-p2)
- if (press >= 1) then
- fpr = grib_set_long(fint,["levtype", 100, "level", press]) # in hPa
+# This code is GRIB edition dependent because it seems that gribAPI
+# has a problem to encode the key typeOfLevel = isobaricInhPa if data
+# is edition 2. GribAPI team is investigating this issue.
+# Also, it is not possible to use the key typeOfLevel = isobaricInPa
+# for all cases because GRIB edition 1 can not encode values greater
+# than 65535 (16 bits).
+# Update this code when gribAPI team finds a solution.
+ edition = grib_get_long(fint,"editionNumber")
+ if edition = 1 then
+ if (press >= 1) then
+ fpr = grib_set(fint, ["typeOfLevel", "isobaricInhPa", "level", press])
+ else
+ fpt = grib_set(fint, ["typeOfLevel", "isobaricInPa", "level", press*100])
+ end if
else
- fpr = grib_set_long(fint,["levtype", 210, "level", press*100]) # in Pa
+ fpr = grib_set(fint, ["typeOfLevel", "isobaricInPa", "level", press*100])
end if
+
pfld= pfld & fpr
end for
diff --git a/share/metview/etc/AnnotationViewDef b/share/metview/etc/AnnotationViewDef
index 6163b21..fd80dd9 100644
--- a/share/metview/etc/AnnotationViewDef
+++ b/share/metview/etc/AnnotationViewDef
@@ -1,5 +1,11 @@
ANNOTATIONVIEW ; uPlot Icon; Metview
{
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
*
diff --git a/share/metview/etc/CartesianViewDef b/share/metview/etc/CartesianViewDef
index 5cc245b..5dc0d69 100644
--- a/share/metview/etc/CartesianViewDef
+++ b/share/metview/etc/CartesianViewDef
@@ -173,6 +173,12 @@ CARTESIANVIEW; CartesianTransformation; MagicsPlusPlus Object
}
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/share/metview/etc/EPSOutputDef b/share/metview/etc/EPSOutputDef
index 4c7ee57..e065e3f 100644
--- a/share/metview/etc/EPSOutputDef
+++ b/share/metview/etc/EPSOutputDef
@@ -18,7 +18,7 @@ EPSOUTPUT; Magics; Automatically generated
{
@
} = MAGICS++ PLOT
- OUTPUT_RESOLUTION
+ OUTPUT_RESOLUTION [visible=false]
{
*
} = 300
diff --git a/share/metview/etc/GeoViewDef b/share/metview/etc/GeoViewDef
index c9dc0cf..24bc789 100644
--- a/share/metview/etc/GeoViewDef
+++ b/share/metview/etc/GeoViewDef
@@ -85,6 +85,12 @@ GEOVIEW; GEOVIEW; UPLOT
NEVER
}= ALWAYS_OVERLAY
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/share/metview/etc/MCONTDef b/share/metview/etc/MCONTDef
index adc4993..e767d67 100644
--- a/share/metview/etc/MCONTDef
+++ b/share/metview/etc/MCONTDef
@@ -309,12 +309,25 @@ MCONT; Magics; Automatically generated
/
} = ''
+ CONTOUR_SHADE_MARKER_TABLE_TYPE
+ {
+ INDEX
+ NAME
+ } = INDEX
+
CONTOUR_SHADE_MARKER_TABLE
{
*
/
} = ''
+ CONTOUR_SHADE_MARKER_NAME_TABLE
+ {
+ @
+ /
+ } = ''
+
+
CONTOUR_SHADE_MAX_LEVEL_COLOUR [ help = help_colour,interface = colour ]
{
&PARAMSHARE&COLOUR
@@ -637,6 +650,18 @@ MCONT; Magics; Automatically generated
OFF; OFF
} = OFF
+ GRIB_INTERPOLATION_METHOD
+ {
+ INTERPOLATE
+ NEAREST
+ NEAREST_VALID
+ } = INTERPOLATE
+
+ GRIB_INTERPOLATION_METHOD_MISSING_FILL_COUNT
+ {
+ *
+ } = 1
+
CONTOUR_SAMPLE_X_INTERVAL
{
*
diff --git a/share/metview/etc/MCONTRules b/share/metview/etc/MCONTRules
index e7b5f90..88716ff 100644
--- a/share/metview/etc/MCONTRules
+++ b/share/metview/etc/MCONTRules
@@ -145,6 +145,14 @@
%unset CONTOUR_SHADE_HEIGHT_TABLE
%unset CONTOUR_SHADE_COLOUR_TABLE
%unset CONTOUR_SHADE_MARKER_TABLE
+ %unset CONTOUR_SHADE_MARKER_TABLE_TYPE
+ %unset CONTOUR_SHADE_MARKER_NAME_TABLE
+
+%if CONTOUR_SHADE_MARKER_TABLE_TYPE <> INDEX %then
+ %unset CONTOUR_SHADE_MARKER_TABLE
+
+%if CONTOUR_SHADE_MARKER_TABLE_TYPE <> NAME %then
+ %unset CONTOUR_SHADE_MARKER_NAME_TABLE
%if CONTOUR_LEVEL_SELECTION_TYPE <> LEVEL_LIST %then
%unset CONTOUR_LEVEL_LIST
@@ -188,3 +196,6 @@
%if LEGEND <> ON %then
%unset CONTOUR_LEGEND_TEXT
+
+%if GRIB_INTERPOLATION_METHOD <> NEAREST_VALID %then
+ %unset GRIB_INTERPOLATION_METHOD_MISSING_FILL_COUNT
diff --git a/share/metview/etc/MWINDDef b/share/metview/etc/MWINDDef
index 67df8ae..d16df4d 100644
--- a/share/metview/etc/MWINDDef
+++ b/share/metview/etc/MWINDDef
@@ -18,38 +18,9 @@ MWIND; Magics; Automatically generated
{
FLAGS; FLAGS
ARROWS; ARROWS
- #STREAMLINES; STREAMLINES
+ STREAMLINES; STREAMLINES
} = ARROWS
- WIND_STREAMLINE_MIN_DENSITY
- [ visible = false ]
- {
- *
- } = 1
-
- WIND_STREAMLINE_MIN_SPEED
- [ visible = false ]
- {
- *
- } = 1
-
- WIND_STREAMLINE_THICKNESS
- [ visible = false ]
- {
- *
- } = 2
-
- WIND_STREAMLINE_COLOUR [ help = help_colour,interface = colour,visible = false ]
- {
- &PARAMSHARE&COLOUR
- } = BLUE
-
- WIND_STREAMLINE_STYLE
- [ visible = false ]
- {
- &PARAMSHARE&STYLE
- } = SOLID
-
WIND_THINNING_FACTOR
{
*
@@ -273,4 +244,38 @@ MWIND; Magics; Automatically generated
@
} = M/S
+ WIND_STREAMLINE_MIN_DENSITY
+ {
+ *
+ } = 1
+
+ WIND_STREAMLINE_MIN_SPEED
+ {
+ *
+ } = 1
+
+ WIND_STREAMLINE_THICKNESS
+ {
+ *
+ } = 2
+
+ WIND_STREAMLINE_COLOUR [ help = help_colour,interface = colour ]
+ {
+ &PARAMSHARE&COLOUR
+ } = BLUE
+
+ WIND_STREAMLINE_STYLE
+ {
+ &PARAMSHARE&STYLE
+ } = SOLID
+
+ WIND_STREAMLINE_HEAD_SHAPE
+ {
+ *
+ } = 0
+
+ WIND_STREAMLINE_HEAD_RATIO
+ {
+ *
+ } = 0.3
}
diff --git a/share/metview/etc/MWINDRules b/share/metview/etc/MWINDRules
index 89426a6..e209adc 100644
--- a/share/metview/etc/MWINDRules
+++ b/share/metview/etc/MWINDRules
@@ -52,6 +52,8 @@
%unset WIND_STREAMLINE_MIN_SPEED
%unset WIND_STREAMLINE_COLOUR
%unset WIND_STREAMLINE_THICKNESS
+ %unset WIND_STREAMLINE_HEAD_SHAPE
+ %unset WIND_STREAMLINE_HEAD_RATIO
%if LEGEND <> ON %or WIND_FIELD_TYPE <> ARROWS %then
%unset WIND_ARROW_LEGEND_TEXT
diff --git a/share/metview/etc/MarsRules b/share/metview/etc/MarsRules
index 32443da..c03f72a 100755
--- a/share/metview/etc/MarsRules
+++ b/share/metview/etc/MarsRules
@@ -504,7 +504,7 @@
CLASS=E2 %or
CLASS=EA %or
CLASS=NR %or
- CLASS=J5 %or
+ CLASS=EP %or
CLASS=RM %or
CLASS=UR %or
CLASS=ME %or
@@ -580,7 +580,7 @@
CLASS<>UR %and
CLASS<>MC %and
CLASS<>NR %and
- CLASS<>J5 %and
+ CLASS<>EP %and
CLASS<>CS)
%and (%not DATABASE) %then
%set DATABASE = marsrd
@@ -764,4 +764,8 @@
# _VERB = REMOVE) %and
# (DATABASE = marstest)) %then %set DATABASE = marstest/marsdev-core
+%if (GRID = N1280 %or (GRID=1280 %and GAUSSIAN=REDUCED)) %then
+ %error "Classic reduced gaussian 1280 not supported"
+ %fail
+
%include "rt_by_obsgroup.chk"
diff --git a/share/metview/etc/PDFOutputDef b/share/metview/etc/PDFOutputDef
index 798b0ac..e0e0d6e 100644
--- a/share/metview/etc/PDFOutputDef
+++ b/share/metview/etc/PDFOutputDef
@@ -22,7 +22,7 @@ PDFOUTPUT; Magics; Automatically generated
{
*
} = 800
- OUTPUT_RESOLUTION
+ OUTPUT_RESOLUTION [visible=false]
{
*
} = 300
diff --git a/share/metview/etc/PNGOutputDef b/share/metview/etc/PNGOutputDef
index 7eab30a..5f4b81b 100644
--- a/share/metview/etc/PNGOutputDef
+++ b/share/metview/etc/PNGOutputDef
@@ -22,7 +22,7 @@ PNGOUTPUT; Magics; Automatically generated
{
*
} = 800
- OUTPUT_RESOLUTION
+ OUTPUT_RESOLUTION [visible=false]
{
*
} = 300
diff --git a/share/metview/etc/PSOutputDef b/share/metview/etc/PSOutputDef
index 47b3d89..a5e29aa 100644
--- a/share/metview/etc/PSOutputDef
+++ b/share/metview/etc/PSOutputDef
@@ -18,7 +18,7 @@ PSOUTPUT; Magics; Automatically generated
{
@
} = MAGICS++ PLOT
- OUTPUT_RESOLUTION
+ OUTPUT_RESOLUTION [visible=false]
{
*
} = 300
diff --git a/share/metview/etc/ecmwf.def b/share/metview/etc/ecmwf.def
index b813f28..20a7c26 100755
--- a/share/metview/etc/ecmwf.def
+++ b/share/metview/etc/ecmwf.def
@@ -712,7 +712,7 @@ TOTAL AEROSOL OPTICAL DEPTH AT 1240NM ; AOD1240 ; 216.210
E20CM ; EM
E20C ; E2
ESAT ; ERA5 ; EA
- EPST ; EP
+ CERA20C ; EP
EURO4M ; RM
UERRA ; UR
@@ -1441,6 +1441,49 @@ CROSS-TRACK INFRARED SOUNDER ; CRIS ; 202
ALL
} = OFF
+ GRID {
+ ARCHIVED VALUE ; AV
+ N32
+ N48
+ N80
+ N128
+ N160
+ N200
+ N256
+ N320
+ N400
+ N512
+ N640
+ N1280
+ F32
+ F48
+ F80
+ F128
+ F160
+ F200
+ F256
+ F320
+ F400
+ F512
+ F640
+ F1280
+ O32
+ O48
+ O80
+ O128
+ O160
+ O200
+ O256
+ O320
+ O400
+ O512
+ O640
+ O1280
+ *
+ /
+ OFF ; OFF
+ } = OFF
+
PADDING
{
AUTOMATIC ; AUTO
@@ -1810,9 +1853,7 @@ ARCHIVE ; Archives data ; MARS
GRID
{
- *
- /
- OFF ; OFF; OFF
+ &_DUMMY&GRID
} = OFF
PASSWORD
@@ -2380,17 +2421,13 @@ LIST ; LIST FDF ENTRIES AND CFS FILES ; MARS
GRID
{
- ARCHIVED VALUE ; AV
- *
- /
- OFF ; OFF; OFF
+ &_DUMMY&GRID
} = OFF
GAUSSIAN
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF; OFF
} = OFF
@@ -2865,17 +2902,13 @@ STAGE ; STAGE FIELDS ; MARS
GRID
{
- ARCHIVED VALUE ; AV
- *
- /
- OFF ; OFF; OFF
+ &_DUMMY&GRID
} = OFF
GAUSSIAN
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF; OFF
} = OFF
@@ -3897,16 +3930,10 @@ RETRIEVE ; Retrieval of data ; MARS
marsdoc = pproc/field,
mars_interface = text,
check = false,
+ exact_match = true,
java_hidden = FALSE ]
{
- ARCHIVED VALUE ; AV
- 320
- 160
- 80
- 48
- *
- /
- OFF ; OFF
+ &_DUMMY&GRID
} = OFF
GAUSSIAN [ help = help_multiple_selection, # For Metview
@@ -3919,7 +3946,6 @@ RETRIEVE ; Retrieval of data ; MARS
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF
} = OFF
@@ -4394,16 +4420,14 @@ READ ; X; METVIEW
GRID
{
+ &_DUMMY&GRID
ANY ; ANY
- *
- /
} = ANY
GAUSSIAN
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF; OFF
} = OFF
@@ -4883,8 +4907,7 @@ FLUSH ; Flushes data ; MARS
GRID
{
- *
- /
+ &_DUMMY&GRID
OFF ; OFF; OFF
}
@@ -5831,10 +5854,7 @@ FETCH ; Fetch data ; MARS
GRID [ java_control = CHOICE_TEXT_2, java_section = DATA, java_hidden = FALSE ]
{
- ARCHIVED VALUE ; AV
- *
- /
- OFF ; OFF; OFF
+ &_DUMMY&GRID
} = OFF
DUPLICATES [ java_control = CHOICE, java_section = OTHER, java_hidden = FALSE ]
@@ -6289,17 +6309,13 @@ BROWSE ; LIST FDF ENTRIES AND CFS FILES ; MARS
GRID
{
- ARCHIVED VALUE ; AV
- *
- /
- OFF ; OFF; OFF
+ &_DUMMY&GRID
} = OFF
GAUSSIAN
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF; OFF
} = OFF
@@ -7099,21 +7115,13 @@ ERASE ; Erase data ; MARS
GRID
{
- ARCHIVED VALUE ; AV
- 320
- 160
- 80
- 48
- *
- /
- OFF ; OFF
+ &_DUMMY&GRID
} = OFF
GAUSSIAN
{
REDUCED
REGULAR
- OCTAHEDRAL
OFF ; OFF
} = OFF
diff --git a/share/metview/etc/macro_templates.txt b/share/metview/etc/macro_templates.txt
index 18ae344..b6fdb9d 100644
--- a/share/metview/etc/macro_templates.txt
+++ b/share/metview/etc/macro_templates.txt
@@ -203,6 +203,24 @@ case strMode of
end
end case
+
+{plot export}
+# depending on the run mode, write the plot to a PNG file
+# or else use the default action, which is to plot to the screen.
+# Other output formats are available, e.g. using ps_output()
+# or pdf_output().
+
+strMode = runmode()
+
+if strMode = 'execute' or strMode = 'batch' then
+ png = png_output (
+ output_name : 'my_plot',
+ output_resolution : 900
+ )
+ setoutput(png)
+end if
+
+
{SCM interactive plot}
# we supply an empty parameter definition for the function, which will mean that
# a user interface will be brought up using default values
diff --git a/share/metview/etc/mars.chk b/share/metview/etc/mars.chk
index 32443da..c03f72a 100755
--- a/share/metview/etc/mars.chk
+++ b/share/metview/etc/mars.chk
@@ -504,7 +504,7 @@
CLASS=E2 %or
CLASS=EA %or
CLASS=NR %or
- CLASS=J5 %or
+ CLASS=EP %or
CLASS=RM %or
CLASS=UR %or
CLASS=ME %or
@@ -580,7 +580,7 @@
CLASS<>UR %and
CLASS<>MC %and
CLASS<>NR %and
- CLASS<>J5 %and
+ CLASS<>EP %and
CLASS<>CS)
%and (%not DATABASE) %then
%set DATABASE = marsrd
@@ -764,4 +764,8 @@
# _VERB = REMOVE) %and
# (DATABASE = marstest)) %then %set DATABASE = marstest/marsdev-core
+%if (GRID = N1280 %or (GRID=1280 %and GAUSSIAN=REDUCED)) %then
+ %error "Classic reduced gaussian 1280 not supported"
+ %fail
+
%include "rt_by_obsgroup.chk"
diff --git a/share/metview/etc/obsgroups.def b/share/metview/etc/obsgroups.def
index 4a7004c..72f4c53 100755
--- a/share/metview/etc/obsgroups.def
+++ b/share/metview/etc/obsgroups.def
@@ -56,4 +56,5 @@
58 ; MWHS2 All-sky ; MWHS2_AS
59 ; SSMT2 ; SSMT2
60 ; SMAP ; SMAP
+61 ; TOVS MULTISENSOR ; TOVS_MS
99 ; TEST ; TEST
diff --git a/share/metview/etc/reportypes.def b/share/metview/etc/reportypes.def
index 4e85ccb..104c281 100755
--- a/share/metview/etc/reportypes.def
+++ b/share/metview/etc/reportypes.def
@@ -60,6 +60,7 @@ COMS-1 GEOS Radiances ; 4019
METEOSAT 4 GEOS Radiances ; 4020
METEOSAT 6 GEOS Radiances ; 4021
Himawari 8 GEOS radiances ; 4022
+METEOSAT 11 GEOS Allsky Radiances ; 4023
ERS 2 GOME O3 ; 5001
METEOSAT 8 SEVIRI O3 ; 5002
METEOSAT 9 SEVIRI O3 ; 5003
@@ -130,6 +131,8 @@ ENVISAT AATSR Aerosol ; 5067
NPP OMPS O3 ; 5068
TOMS ADEOS-I ; 5069
NIMBUS 4 BUV ; 5070
+METOP-A GOME-2 PMAP ; 5071
+METOP-B GOME-2 PMAP ; 5072
ENVISAT MERIS TCWV ; 6001
METOP-A GPSRO ; 7001
CHAMP GPSRO ; 7002
@@ -200,6 +203,8 @@ GOES 6 AMV subtype 82 ; 8051
GOES 6 AMV subtype 83 ; 8052
Himawari 8 AMV ; 8053
FY-2G AMVs ; 8054
+MISR AMV ; 8055
+METEOSAT 11 AMV ; 8056
Old ERS 1 Scatterometer ; 9001
New ERS 1 Scatterometer ; 9002
ERS 2 Scatterometer ; 9003
@@ -312,6 +317,7 @@ Upper air WISDOM ; 16081
WIGOS AMDAR ; 16082
BUFR MOORED BUOYS ; 16083
BUFR DRIFTING BUOYS ; 16084
+Ceilometer ground lidar ; 16085
SMOS ; 18001
CORIOLIS WINDSAT All-sky ; 19001
DMSP 8 SSMI ; 20001
@@ -458,6 +464,7 @@ DMSP 12 SSMT2 Radiances ; 58002
DMSP 14 SSMT2 Radiances ; 58003
DMSP 15 SSMT2 Radiances ; 58004
SMAP ; 59001
+UKMO TOVS ; 60001
TEST REPORTYPE 1 ; 98001
TEST REPORTYPE 2 ; 98002
TEST REPORTYPE 3 ; 98003
diff --git a/share/metview/etc/rt_by_obsgroup.chk b/share/metview/etc/rt_by_obsgroup.chk
index 42a6940..67974dd 100755
--- a/share/metview/etc/rt_by_obsgroup.chk
+++ b/share/metview/etc/rt_by_obsgroup.chk
@@ -11,10 +11,10 @@
%set REPORTYPE = 3001/3002/3003/3004
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = GEOS ) %and %not REPORTYPE %then
- %set REPORTYPE = 4002/4003/4004/4005/4006/4007/4008/4009/4010/4011/4012/4013/4014/4015/4016/4017/4018/4019/4020/4021/4022
+ %set REPORTYPE = 4002/4003/4004/4005/4006/4007/4008/4009/4010/4011/4012/4013/4014/4015/4016/4017/4018/4019/4020/4021/4022/4023
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = RESAT ) %and %not REPORTYPE %then
- %set REPORTYPE = 5001/5002/5003/5004/5005/5006/5007/5008/5009/5010/5011/5012/5013/5014/5015/5016/5017/5018/5019/5020/5021/5022/5023/5024/5025/5026/5027/5028/5029/5030/5031/5032/5033/5034/5035/5036/5037/5038/5039/5040/5041/5042/5043/5044/5045/5046/5047/5048/5049/5050/5051/5052/5053/5054/5055/5056/5057/5058/5059/5060/5061/5062/5063/5064/5065/5066/5067/5068/5069/5070
+ %set REPORTYPE = 5001/5002/5003/5004/5005/5006/5007/5008/5009/5010/5011/5012/5013/5014/5015/5016/5017/5018/5019/5020/5021/5022/5023/5024/5025/5026/5027/5028/5029/5030/5031/5032/5033/5034/5035/5036/5037/5038/5039/5040/5041/5042/5043/5044/5045/5046/5047/5048/5049/5050/5051/5052/5053/5054/5055/5056/5057/5058/5059/5060/5061/5062/5063/5064/5065/5066/5067/5068/5069/5070/5071/5072
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = MERIS ) %and %not REPORTYPE %then
%set REPORTYPE = 6001
@@ -23,7 +23,7 @@
%set REPORTYPE = 7001/7002/7003/7004/7005/7006/7007/7008/7009/7010/7011/7012/7013/7014/7015
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = SATOB ) %and %not REPORTYPE %then
- %set REPORTYPE = 8001/8002/8003/8004/8005/8006/8007/8008/8009/8010/8011/8012/8013/8014/8015/8016/8017/8018/8019/8020/8021/8022/8023/8024/8025/8026/8027/8028/8029/8030/8031/8032/8033/8034/8035/8036/8037/8038/8039/8040/8041/8042/8043/8044/8045/8046/8047/8048/8049/8050/8051/8052/8053/8054
+ %set REPORTYPE = 8001/8002/8003/8004/8005/8006/8007/8008/8009/8010/8011/8012/8013/8014/8015/8016/8017/8018/8019/8020/8021/8022/8023/8024/8025/8026/8027/8028/8029/8030/8031/8032/8033/8034/8035/8036/8037/8038/8039/8040/8041/8042/8043/8044/8045/8046/8047/8048/8049/8050/8051/8052/8053/8054/8055/8056
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = SCATT ) %and %not REPORTYPE %then
%set REPORTYPE = 9001/9002/9003/9004/9005/9006/9007/9008/9009
@@ -47,7 +47,7 @@
%set REPORTYPE = 15001
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = CONV ) %and %not REPORTYPE %then
- %set REPORTYPE = 16001/16002/16003/16004/16005/16006/16007/16008/16009/16010/16011/16012/16013/16014/16015/16016/16017/16018/16019/16020/16021/16022/16023/16024/16025/16026/16027/16028/16029/16030/16031/16032/16037/16038/16039/16040/16041/16042/16043/16044/16045/16046/16047/16048/16049/16050/16051/16052/16053/16054/16055/16056/16057/16058/16059/16060/16061/16062/16063/16064/16065/16066/16067/16068/16069/16070/16071/16072/16073/16074/16075/16076/16077/16078/16079/16080/16081/16082/16083/16084
+ %set REPORTYPE = 16001/16002/16003/16004/16005/16006/16007/16008/16009/16010/16011/16012/16013/16014/16015/16016/16017/16018/16019/16020/16021/16022/16023/16024/16025/16026/16027/16028/16029/16030/16031/16032/16037/16038/16039/16040/16041/16042/16043/16044/16045/16046/16047/16048/16049/16050/16051/16052/16053/16054/16055/16056/16057/16058/16059/16060/16061/16062/16063/16064/16065/16066/16067/16068/16069/16070/16071/16072/16073/16074/16075/16076/16077/16078/16079/16080/16081/16082/16083 [...]
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = SMOS ) %and %not REPORTYPE %then
%set REPORTYPE = 18001
@@ -169,6 +169,9 @@
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = SMAP ) %and %not REPORTYPE %then
%set REPORTYPE = 59001
+%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = TOVS_MS ) %and %not REPORTYPE %then
+ %set REPORTYPE = 60001
+
%if (TYPE = OFB %or TYPE = MFB %or TYPE = OAI) %and (OBSGROUP = TEST ) %and %not REPORTYPE %then
%set REPORTYPE = 98001/98002/98003/98004/98005/98006/98007/98008/98009/98010
diff --git a/share/metview/etc/uPlotTable b/share/metview/etc/uPlotTable
index c4397a7..6dd3c57 100644
--- a/share/metview/etc/uPlotTable
+++ b/share/metview/etc/uPlotTable
@@ -41,6 +41,12 @@ request,
view = GeoView
request,
+ class = RETRIEVE,
+ action = Create,
+ builder = DataBuilder,
+ view = GeoView
+
+request,
class = GEOPOINTS,
action = Create,
builder = DataBuilder,
diff --git a/src/Hovmoeller/MHovmoellerViewDef b/src/Hovmoeller/MHovmoellerViewDef
index 419a92f..babe2ae 100644
--- a/src/Hovmoeller/MHovmoellerViewDef
+++ b/src/Hovmoeller/MHovmoellerViewDef
@@ -122,6 +122,12 @@ MHOVMOELLERVIEW; uPlot Icon; Metview
LOG
} = LINEAR
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/src/Macro/bufr.cc b/src/Macro/bufr.cc
index a50fc79..2638a57 100644
--- a/src/Macro/bufr.cc
+++ b/src/Macro/bufr.cc
@@ -191,15 +191,20 @@ CGeopts::CGeopts( CGeopts* p, fieldset* v, int n, bool nearest) : InPool(tgeopt
gpts.format( p->gpts.format() );
field* g = get_field(v,n,expand_mem);
- MvField fld( g );
+
+ // It needs to be dynamically allocated because it needs to
+ // be destroyed before releasing the field (field* g). This is
+ // because the destructor of MvField will try to restore the
+ // previous memory status of the field, which is expand memory.
+ MvField* fld = new MvField( g );
//-- get date/time/level metadata from the GRIB field
- MvDate base( fld.yyyymmddFoh() ); //-- base (analysis) date
- double step = fld.stepFoh(); //-- forecast step
+ MvDate base( fld->yyyymmddFoh() ); //-- base (analysis) date
+ double step = fld->stepFoh(); //-- forecast step
MvDate valid = base + step; //-- valid date
long dat = valid.YyyyMmDd();
long tim = valid.Hour()*100 + valid.Minute();
- double level = fld.level();
+ double level = fld->level();
n = 0;
for( int i=0; i < p->gpts.count(); i++ )
@@ -207,11 +212,11 @@ CGeopts::CGeopts( CGeopts* p, fieldset* v, int n, bool nearest) : InPool(tgeopt
double x;
if( nearest )
{
- x = fld.nearestGridpoint( (*p)[i].lon_x(), (*p)[i].lat_y() );
+ x = fld->nearestGridpoint( (*p)[i].lon_x(), (*p)[i].lat_y() );
}
else
{
- x = fld.interpolateAt( (*p)[i].lon_x(), (*p)[i].lat_y() );
+ x = fld->interpolateAt( (*p)[i].lon_x(), (*p)[i].lat_y() );
}
MvGeoP1 pt = p->gpts[ i ];
@@ -234,6 +239,8 @@ CGeopts::CGeopts( CGeopts* p, fieldset* v, int n, bool nearest) : InPool(tgeopt
n++;
}
+ delete fld;
+ fld = 0;
release_field(g);
}
diff --git a/src/Macro/grib.cc b/src/Macro/grib.cc
index 731194a..1033a92 100644
--- a/src/Macro/grib.cc
+++ b/src/Macro/grib.cc
@@ -1325,6 +1325,115 @@ Value GribHeaderFunctionW::Execute(int, Value *arg)
return x;
}
+//=============================================================================
+
+/*******************************************************************************
+ *
+ * Function : GribHeaderFunctionWGeneric
+ *
+ * Description : Writes elements of any type to the GRIB header.
+ *
+ ******************************************************************************/
+
+class GribHeaderFunctionWGeneric : public Function {
+public:
+ GribHeaderFunctionWGeneric(const char *n) :
+ Function(n,2,tgrib,tlist)
+ { info = "Write GRIB headers using GRIB API keys"; }
+
+ virtual Value Execute(int arity,Value *arg);
+};
+
+
+Value GribHeaderFunctionWGeneric::Execute(int, Value *arg)
+{
+ fieldset *v;
+ CList *l;
+ int i;
+
+ arg[0].GetValue(v);
+ arg[1].GetValue(l);
+
+ if((l->Count() % 2) != 0)
+ return Error("grib_get: the list does not contain an even number of values");
+
+
+ int save = mars.computeflg;
+ mars.computeflg = 0;
+ int acc = mars.accuracy;
+
+
+ fieldset *z = copy_fieldset(v,v->count,true);
+
+
+ // for each field, apply the changes
+
+ for(i = 0; i < v->count ;i++)
+ {
+ field *h = GetIndexedFieldWithAtLeastPackedMem(z,i);
+ MvField mvfield (h);
+
+
+ // for each key/value pair, set them in the field
+
+ for(int j = 0; j < l->Count(); j +=2)
+ {
+ const char *key;
+ vtype valueType;
+
+ (*l)[j].GetValue(key);
+ valueType = (*l)[j+1].GetType();
+
+ switch (valueType)
+ {
+ case tstring:
+ {
+ const char *value;
+ (*l)[j+1].GetValue(value);
+ string valuestring = string(value);
+ mvfield.setGribKeyValueString (key, valuestring);
+ break;
+ }
+
+ case tnumber:
+ {
+ double value;
+ (*l)[j+1].GetValue(value);
+
+ // try to figure out if it's an integer (long) or double
+ double epsilon = 0.000000001; // a bit arbitrary
+ long numAsInt = (long) (value + epsilon);
+ if (fabs(numAsInt-value) < epsilon)
+ {
+ // close enough - set as integer
+ mvfield.setGribKeyValueLong (key, numAsInt);
+ }
+ else
+ {
+ // set as double
+ mvfield.setGribKeyValueDouble (key, value);
+ }
+ break;
+ }
+
+ default:
+ {
+ return Error("grib_set: bad value type - should be string or number", valueType);
+ }
+ }
+
+ }
+ }
+
+
+ Value x(z);
+
+ mars.computeflg = save;
+ mars.accuracy = acc;
+
+
+ return x;
+}
//=============================================================================
@@ -5641,6 +5750,7 @@ static void install(Context *c)
c->AddFunction(new GribHeaderFunctionW("grib_set_long", GRIB_LONG));
c->AddFunction(new GribHeaderFunctionW("grib_set_double", GRIB_DOUBLE));
c->AddFunction(new GribHeaderFunctionW("grib_set_string", GRIB_STRING));
+ c->AddFunction(new GribHeaderFunctionWGeneric("grib_set"));
}
diff --git a/src/Macro/include/cnetcdf.h b/src/Macro/include/cnetcdf.h
index 2594083..5edbf92 100644
--- a/src/Macro/include/cnetcdf.h
+++ b/src/Macro/include/cnetcdf.h
@@ -29,6 +29,7 @@ public:
MvRequest Attributes(bool global);
void Current(int xx) { current_ = xx; }
+ bool Current(const char *varName);
int Current() { return current_; }
MvNcVar *GetVar() { load(); return netCDF_->getVariable(current_ -1); }
diff --git a/src/Macro/netcdf.cc b/src/Macro/netcdf.cc
index ee8fbed..2fc0b7a 100644
--- a/src/Macro/netcdf.cc
+++ b/src/Macro/netcdf.cc
@@ -25,21 +25,16 @@ CNetCDF::CNetCDF(request *s) : InPool(tnetcdf,s), netCDF_(0),
CNetCDF::~CNetCDF()
{
- mars.debug = true;
- print_all_requests(r_);
- mars.debug = false;
-
- const char *t = get_value(r_,"TEMPORARY",0);
- const char *p = get_value(r_,"PATH",0);
-
- if(t && p)
- {
- if(atoi(t)) {
- unlink(p);
- }
- }
- free_all_requests(r_);
- unload();
+ const char *t = get_value(r_,"TEMPORARY",0);
+ const char *p = get_value(r_,"PATH",0);
+
+ if(t && p)
+ {
+ if(atoi(t))
+ unlink(p);
+ }
+ free_all_requests(r_);
+ unload();
}
const char *CNetCDF::GetFileName()
@@ -133,25 +128,73 @@ MvRequest CNetCDF::Attributes(bool global)
return req;
}
+
+// set the current netCDF variable by name
+bool CNetCDF::Current(const char *varName)
+{
+ load();
+
+ int count = netCDF_->getNumberOfVariables();
+
+ for ( int i = 0 ; i < count; i++)
+ {
+ const char *thisVarName = netCDF_->getVariable(i)->name();
+ if (!strcmp(thisVarName, varName)) // found it?
+ {
+ Current(i+1); // 1-based indexing
+ return true;
+ }
+ }
+ return false; // if we got to here then we did not find the variable
+}
+
+
class CDFCurrentFunction : public Function
{
public:
- CDFCurrentFunction(const char *n) : Function(n,2,tnetcdf,tnumber)
+ CDFCurrentFunction(const char *n) : Function(n,2,tnetcdf,tany)
{info = "Sets the variable number on which netcdf functions will operate.";};
virtual Value Execute(int arity,Value *arg);
+ virtual int ValidArguments(int arity,Value *arg);
};
+int CDFCurrentFunction::ValidArguments(int arity,Value *arg)
+{
+ if(arity != 2 ) return false;
+ if(arg[0].GetType() != tnetcdf) return false; // first arg must be a necdf
+ if(arg[1].GetType() != tnumber && arg[1].GetType() != tstring) return false; // second arg must be a number or string
+ return true;
+}
+
Value CDFCurrentFunction::Execute(int,Value *arg)
{
CNetCDF *cdf;
- int number;
arg[0].GetValue(cdf);
- arg[1].GetValue(number);
- cdf->Current(number);
+ if (arg[1].GetType() == tnumber)
+ {
+ int number;
+
+ arg[1].GetValue(number);
+
+ cdf->Current(number);
+
+ return Value(number);
+ }
+ else // must be string
+ {
+ const char *varName;
+
+ arg[1].GetValue(varName);
+
+ bool ok = cdf->Current(varName);
+ if (!ok)
+ return Error("Variable '%s' not found in netCDF.", varName);
+ else
+ return Value(varName);
+ }
- return Value(number);
}
/////////////////////////////// Function classes. //////////////////////
@@ -324,7 +367,6 @@ Value CDFValuesFunction::Execute(int,Value *arg)
for (long i = 0;i<positions->Count();i++) // extract the elements from the list of positions
{
long pos;
- long cnt;
if ((*positions)[i].GetType() == tstring) // passing a string?
{
@@ -505,7 +547,6 @@ Value CDFDimNamesFunction::Execute(int,Value *arg)
arg[0].GetValue(a);
MvNcVar *aVar = a->GetVar();
- long *edges = aVar->edges();
int nrDims = aVar->getNumberOfDimensions();
CList *l = new CList(nrDims);
diff --git a/src/MagML/CMakeLists.txt b/src/MagML/CMakeLists.txt
index 7c6468c..d5696f0 100644
--- a/src/MagML/CMakeLists.txt
+++ b/src/MagML/CMakeLists.txt
@@ -3,12 +3,8 @@ ecbuild_add_executable( TARGET MagML
SOURCES MagML.cc
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS} ${MAGICS_DEFINITIONS}
INCLUDES ${MAGICS_INCLUDE_DIRS} ${METVIEW_QT_INCLUDE_DIRS} ${METVIEW_STANDARD_INCLUDES} ${METVIEW_QT_INCLUDE_DIRS}
- LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${MAGICS_LIBRARIES}
+ LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper
)
-# add this dependency manually because CMake does not pick it up otherwise
-ADD_DEPENDENCIES(MagML MagPlusShared MagWrapper)
-
-
metview_module_files(ETC_FILES ObjectSpec.MagML
XPM_FILES MAGML.xpm)
diff --git a/src/MvApp/CMakeLists.txt b/src/MvApp/CMakeLists.txt
index f5538cb..1b76fd1 100644
--- a/src/MvApp/CMakeLists.txt
+++ b/src/MvApp/CMakeLists.txt
@@ -16,7 +16,7 @@ ecbuild_add_executable( TARGET Mars
SOURCES MarsG2.cc
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS}
INCLUDES ${METVIEW_STANDARD_INCLUDES} ${ODB_API_INCLUDE_DIRS} ${FDB_INCLUDE_DIRS}
- LIBS ${STANDARD_METVIEW_LIBS} ${FDB_LIBRARIES} ${ODB_API_LIBRARIES}
+ LIBS ${STANDARD_METVIEW_LIBS} ${FDB_LIBRARIES} ${METVIEW_ODB_API_LIBRARIES}
)
ecbuild_add_executable( TARGET togrib
diff --git a/src/Reprojection/CMakeLists.txt b/src/Reprojection/CMakeLists.txt
index b90a419..16b474c 100644
--- a/src/Reprojection/CMakeLists.txt
+++ b/src/Reprojection/CMakeLists.txt
@@ -4,13 +4,9 @@ include_directories(BEFORE ${MAGICS_INCLUDE_DIRS} ${METVIEW_QT_INCLUDE_DIRS} $
ecbuild_add_executable( TARGET Reprojection
SOURCES Reprojection.cc ReprojectService.cc
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS} ${MAGICS_DEFINITIONS}
- LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${MAGICS_LIBRARIES}
+ LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper
)
-# add this dependency manually because CMake does not pick it up otherwise
-ADD_DEPENDENCIES(Reprojection MagPlusShared MagWrapper)
-
-
metview_module_files(ETC_FILES ObjectSpec.Reprojection
ReprojectionDef
ReprojectionRules
diff --git a/src/StdAppManager/NetcdfPlusDef b/src/StdAppManager/NetcdfPlusDef
index aede4ee..6bc6570 100644
--- a/src/StdAppManager/NetcdfPlusDef
+++ b/src/StdAppManager/NetcdfPlusDef
@@ -76,7 +76,7 @@ NETCDF_VISUALISER; Netcdf Visualiser Application
} = ARRAY
NETCDF_MISSING_ATTRIBUTE
- { @ } = MISSING_VALUE
+ { @ } = _FillValue
NETCDF_X_AUXILIARY_VARIABLE [visible=false]
{ @ } = ''
diff --git a/src/XSection/MVProfileViewDef b/src/XSection/MVProfileViewDef
index 880db04..25458ae 100644
--- a/src/XSection/MVProfileViewDef
+++ b/src/XSection/MVProfileViewDef
@@ -82,6 +82,12 @@ MVPROFILEVIEW; PlotMod Icon; Metview
@
}
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/src/XSection/MXAverageViewDef b/src/XSection/MXAverageViewDef
index 1ac62ba..d8b34d5 100644
--- a/src/XSection/MXAverageViewDef
+++ b/src/XSection/MXAverageViewDef
@@ -72,6 +72,12 @@ MXAVERAGEVIEW; uPlot Icon; Metview
@
}
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/src/XSection/MXSectionViewDef b/src/XSection/MXSectionViewDef
index 1515339..0e6cb76 100644
--- a/src/XSection/MXSectionViewDef
+++ b/src/XSection/MXSectionViewDef
@@ -44,6 +44,12 @@ MXSECTIONVIEW; uPlot Icon; Metview
@
}
+ SUBPAGE_CLIPPING
+ {
+ ON
+ OFF
+ } = OFF
+
SUBPAGE_X_POSITION
{
@
diff --git a/src/libMars/CMakeLists.txt b/src/libMars/CMakeLists.txt
index b57a9d0..d6fb4f7 100644
--- a/src/libMars/CMakeLists.txt
+++ b/src/libMars/CMakeLists.txt
@@ -33,15 +33,18 @@ set(extra_files_for_tarball
${CMAKE_CURRENT_SOURCE_DIR}/macro_api_internals.h
${CMAKE_CURRENT_SOURCE_DIR}/macro_api_f90.f90
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
- ${MARS_SOURCE_PATH}/rpcmars.x
- ${MARS_SOURCE_PATH}/langy.y
- ${MARS_SOURCE_PATH}/langl.l
+ ${MARS_SOURCE}/rpcmars.x
+ ${MARS_SOURCE}/langy.y
+ ${MARS_SOURCE}/langl.l
+ ${MARS_SOURCE}/CMakeLists.txt # needed for bundle tarball
+ ${MARS_SOURCE}/mars_client_version.c.in # needed for bundle tarball
+ ${MARS_SOURCE}/mars_client_version.h.in # needed for bundle tarball
)
# add the path to where the source files are located
foreach( file ${_libMars_srcs} )
- list( APPEND libMars_srcs ${MARS_SOURCE_PATH}/${file} )
+ list( APPEND libMars_srcs ${MARS_SOURCE}/${file} )
endforeach()
# copy all the MARS source files to a subdirectory of the build directory; this is
@@ -85,28 +88,28 @@ find_package(CMath)
# If so, we may need to first check whether the file already exists.
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
- configure_file(${MARS_SOURCE_PATH}/rpcmars.x ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x)
+ configure_file(${MARS_SOURCE}/rpcmars.x ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x)
endif()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h
COMMAND rpcgen -h -o ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x
- DEPENDS ${MARS_SOURCE_PATH}/rpcmars.x)
+ DEPENDS ${MARS_SOURCE}/rpcmars.x)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.c
COMMAND rpcgen -c -o ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.c ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x
- DEPENDS ${MARS_SOURCE_PATH}/rpcmars.x)
+ DEPENDS ${MARS_SOURCE}/rpcmars.x)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/langl.c
- COMMAND lex -l ${MARS_SOURCE_PATH}/langl.l\; sed -e s/yy/yy_mars/g < lex.yy.c > ${CMAKE_CURRENT_BINARY_DIR}/langl.c
- DEPENDS ${MARS_SOURCE_PATH}/langl.l)
+ COMMAND lex -l ${MARS_SOURCE}/langl.l\; sed -e s/yy/yy_mars/g < lex.yy.c > ${CMAKE_CURRENT_BINARY_DIR}/langl.c
+ DEPENDS ${MARS_SOURCE}/langl.l)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/langy.c
- COMMAND yacc -t ${MARS_SOURCE_PATH}/langy.y\; sed -e s/yy/yy_mars/g < y.tab.c > ${CMAKE_CURRENT_BINARY_DIR}/langy.c
- DEPENDS ${MARS_SOURCE_PATH}/langy.y)
+ COMMAND yacc -t ${MARS_SOURCE}/langy.y\; sed -e s/yy/yy_mars/g < y.tab.c > ${CMAKE_CURRENT_BINARY_DIR}/langy.c
+ DEPENDS ${MARS_SOURCE}/langy.y)
ADD_CUSTOM_TARGET(mvmarsxdr DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.c)
ADD_CUSTOM_TARGET(mvmarslex DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/langy.c ${CMAKE_CURRENT_BINARY_DIR}/langl.c)
@@ -144,33 +147,36 @@ install( FILES ${CMAKE_BINARY_DIR}/include/macro_api.h
-# for the tarball, we want to include the MARS client source, but only the files that we actually
-# use in Metview. So we create a list of all files in the source, then subtract from it the list
-# of source files defined previously as libMars_srcs.
+if(NOT DEFINED METVIEW_BUNDLE)
-# first, list all the files in the MARS source directory - these are the files we will NOT pack
-file(GLOB mars_unwanted_src_files "${MARS_SOURCE_PATH}/*")
-file(GLOB mars_unwanted_tools_files "${MARS_SOURCE_PATH}/tools/*")
-list(APPEND mars_unwanted_src_files ${mars_unwanted_tools_files})
+ # for the tarball, we want to include the MARS client source, but only the files that we actually
+ # use in Metview. So we create a list of all files in the source, then subtract from it the list
+ # of source files defined previously as libMars_srcs.
-# remove each wanted source file from the list
-foreach( file ${libMars_srcs} ${extra_files_for_tarball})
- list(REMOVE_ITEM mars_unwanted_src_files ${file})
-endforeach()
+ # first, list all the files in the MARS source directory - these are the files we will NOT pack
+ file(GLOB mars_unwanted_src_files "${MARS_SOURCE}/*")
+ file(GLOB mars_unwanted_tools_files "${MARS_SOURCE}/tools/*")
+ list(APPEND mars_unwanted_src_files ${mars_unwanted_tools_files})
-# these filenames will be treated as regular expressions, so we need to be more
-# explicit and put a dollar sign at the end so that they don't match with too much
-set(mars_real_unwanted_src_files "")
-foreach( file ${mars_unwanted_src_files} )
- list(APPEND mars_real_unwanted_src_files "${file}\$")
-endforeach()
+ # remove each wanted source file from the list
+ foreach( file ${libMars_srcs} ${extra_files_for_tarball})
+ list(REMOVE_ITEM mars_unwanted_src_files ${file})
+ endforeach()
-# add our revised list to ECBUILD_DONT_PACK_FILES
-# - we don't use ecbuild_dont_pack() because it makes everything relative to the
-# source directory
-list( APPEND ECBUILD_DONT_PACK_FILES ${mars_real_unwanted_src_files})
-set( ECBUILD_DONT_PACK_FILES ${ECBUILD_DONT_PACK_FILES} CACHE INTERNAL "" )
+ # these filenames will be treated as regular expressions, so we need to be more
+ # explicit and put a dollar sign at the end so that they don't match with too much
+ set(mars_real_unwanted_src_files "")
+ foreach( file ${mars_unwanted_src_files} )
+ list(APPEND mars_real_unwanted_src_files "${file}\$")
+ endforeach()
+ # add our revised list to ECBUILD_DONT_PACK_FILES
+ # - we don't use ecbuild_dont_pack() because it makes everything relative to the
+ # source directory
+ list( APPEND ECBUILD_DONT_PACK_FILES ${mars_real_unwanted_src_files})
+ set( ECBUILD_DONT_PACK_FILES ${ECBUILD_DONT_PACK_FILES} CACHE INTERNAL "" )
+
+endif()
# soon to be redundant - remove unwanted files from libMars/MARS
diff --git a/src/libMarsClient/CMakeLists.txt b/src/libMarsClient/CMakeLists.txt
new file mode 100644
index 0000000..3f831a5
--- /dev/null
+++ b/src/libMarsClient/CMakeLists.txt
@@ -0,0 +1,168 @@
+### config headers
+
+configure_file( mars_client_version.h.in mars_client_version.h )
+configure_file( mars_client_version.c.in mars_client_version.c )
+
+# compile definitions
+
+add_definitions( -DR64 )
+
+if( ECMWF )
+ add_definitions( -DECMWF )
+endif()
+
+# ecbuild automatically test endiness and sets variable EC_BIG_ENDIAN or EC_LITTLE_ENDIAN
+if( EC_BIG_ENDIAN )
+ message( STATUS "System is big endian" )
+else()
+ message( STATUS "System is little endian" )
+ add_definitions(-DLITTLE_END)
+endif()
+
+if( NOT HAVE_FDB )
+ add_definitions(-DNOFDB)
+endif()
+
+if( NOT HAVE_ODB )
+ add_definitions(-DNOODB)
+else()
+ add_definitions(-DODB_SUPPORT )
+ include_directories( ${ODB_API_INCLUDE_DIRS} ${ECKIT_INCLUDE_DIRS} )
+endif()
+
+if( NOT HAVE_PPROC )
+ add_definitions(-DNOPPROC)
+endif()
+
+if( NOT CURL_FOUND )
+ add_definitions(-DNOCURL)
+endif()
+
+# sources
+
+list( APPEND mars_client_src_files
+account.c
+archive.c
+authenticate.c
+base.c
+bufr.c
+calc.c
+certify.c
+check.c
+control.c
+cos.c
+ecaccess.c
+eccert.c
+environ.c
+expand.c
+extargs.c
+externf.c
+feedtask.c
+field.c
+filebase.c
+files.c
+flatfilebase.c
+free.c
+gribbase.c
+grib.c
+guess.c
+handler.c
+hash.c
+hidden.c
+hypercube.c
+ibmblk.c
+index.c
+langy.c
+list.c
+lock.c
+logfile.c
+marsxdr.c
+mcs.c
+memory.c
+dhsbase.c
+metadata.c
+msbase.c
+multibase.c
+netbase.c
+nfdbbase.c
+nullbase.c
+odbbase.c
+options.c
+pproc.c
+queue.c
+rdb.c
+remove.c
+request.c
+restricted.c
+retrieve.c
+schedule.c
+server.c
+service.c
+sh2ll.c
+statistics.c
+stream.c
+target.c
+tcp.c
+time.c
+timer.c
+tools.c
+udp.c
+variable.c
+version.c
+json.c
+odb.cc
+api.c
+apibase.c
+wind.c)
+
+# targets
+
+configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/rpcmars.x ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x COPYONLY )
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h
+ COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h
+ COMMAND rpcgen -h -o ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x )
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/marsxdr.c
+ COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_CURRENT_BINARY_DIR}/marsxdr.c
+ COMMAND rpcgen -c -o ${CMAKE_CURRENT_BINARY_DIR}/marsxdr.c ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.x )
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/langl.c
+ COMMAND lex -l ${CMAKE_CURRENT_SOURCE_DIR}/langl.l\; sed -e s/yy/yy_mars/g < lex.yy.c > ${CMAKE_CURRENT_BINARY_DIR}/langl.c
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/langl.l)
+
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/langy.c
+ COMMAND yacc -t ${CMAKE_CURRENT_SOURCE_DIR}/langy.y\; sed -e s/yy/yy_mars/g < y.tab.c > ${CMAKE_CURRENT_BINARY_DIR}/langy.c
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/langy.y)
+
+add_custom_target(marsxdr DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/rpcmars.h ${CMAKE_CURRENT_BINARY_DIR}/marsxdr.c)
+add_custom_target(marslex DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/langy.c ${CMAKE_CURRENT_BINARY_DIR}/langl.c)
+
+ecbuild_add_library(
+ TARGET mars
+ TYPE STATIC
+ GENERATED mars_client_version.c
+ SOURCES ${mars_client_src_files} mars_client_version.c
+ DEPENDS marsxdr marslex
+ PUBLIC_INCLUDES
+ ${GRIB_API_INCLUDE_DIRS}
+ PRIVATE_INCLUDES
+ ${CURL_INCLUDE_DIRS}
+ DEFINITIONS ${GRIB_API_DEFINITIONS}
+ LIBS grib_api ${MARS_FEATURE_LIBRARIES} ${CURL_LIBRARIES} ${CMATH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} )
+
+set_directory_properties( ADDITIONAL_MAKE_CLEAN_FILES rpcmars.h marsxdr.c langl.c langy.c )
+
+ecbuild_add_executable(
+ TARGET mars.bin
+ SOURCES mars.c
+ LIBS mars
+)
+
+add_subdirectory( tools )
diff --git a/src/libMarsClient/apibase.c b/src/libMarsClient/apibase.c
index 07bdbb7..0ac1338 100644
--- a/src/libMarsClient/apibase.c
+++ b/src/libMarsClient/apibase.c
@@ -8,6 +8,9 @@
* does it submit to any jurisdiction.
*/
+#if (defined(__APPLE__) && defined(__MACH__))
+#include <ctype.h>
+#endif
#include "mars.h"
#include "api.h"
diff --git a/src/libMarsClient/archive.c b/src/libMarsClient/archive.c
index 4d16145..ac1bb2f 100644
--- a/src/libMarsClient/archive.c
+++ b/src/libMarsClient/archive.c
@@ -170,7 +170,7 @@ err handle_archive(request *r,void *data)
print_one_request(r);
}
- while( s = get_value(r,"DATABASE",i++) )
+ while( (s = get_value(r,"DATABASE",i++)) )
{
database *base;
const char *name = 0;
diff --git a/src/libMarsClient/authenticate.c b/src/libMarsClient/authenticate.c
index f00421d..b0d4093 100644
--- a/src/libMarsClient/authenticate.c
+++ b/src/libMarsClient/authenticate.c
@@ -54,7 +54,7 @@ static const char* alias2group(const char* alias)
strcpy(grname,grmain->gr_name);
setgrent();
- while (grmain = getgrent())
+ while ( (grmain = getgrent()) )
if(gid == grmain->gr_gid)
if(strlen(grname) > strlen(grmain->gr_name))
{
@@ -859,11 +859,11 @@ err local_validate_request(request *req, request *env)
int i = 0;
marslog(LOG_EROR,"Request validation failed:");
- while(p = get_value(reply,"info",i++))
+ while( (p = get_value(reply,"info",i++)) )
marslog(LOG_EROR,"%s",p);
i=0;
- while(p = get_value(reply,"url",i++))
+ while( (p = get_value(reply,"url",i++)) )
marslog(LOG_EROR,"%s",p);
marslog(LOG_EROR,"For any queries, please, contact User Support");
diff --git a/src/libMarsClient/bufr.c b/src/libMarsClient/bufr.c
index bbbdc8c..b5df7dd 100644
--- a/src/libMarsClient/bufr.c
+++ b/src/libMarsClient/bufr.c
@@ -741,16 +741,16 @@ void print_packed_key(char* buffer,packed_key* k)
printf("minute %d\n",KEY_MINUTE(k));
printf("second %d\n",KEY_SECOND(k));
printf("--------------------------------------------\n");
- printf("latitude1 %d\n",KEY_LATITUDE1(k));
- printf("longitude1 %d\n",KEY_LONGITUDE1(k));
+ printf("latitude1 %lu\n",KEY_LATITUDE1(k));
+ printf("longitude1 %lu\n",KEY_LONGITUDE1(k));
if (IS_SATTELITE(k))
{
- printf("latitude2 %d\n",KEY_LATITUDE2(k));
- printf("longitude2 %d\n",KEY_LONGITUDE2(k));
+ printf("latitude2 %lu\n",KEY_LATITUDE2(k));
+ printf("longitude2 %lu\n",KEY_LONGITUDE2(k));
}
printf("------------------------------------------------\n");
- printf("length %d\n",key_length(buffer,k));
- printf("number of subsets %d\n",KEY_NOBS(k));
+ printf("length %lu\n",key_length(buffer,k));
+ printf("number of subsets %lu\n",KEY_NOBS(k));
printf("------------------------------------------------\n");
if (IS_SATTELITE(k))
printf("ident %d\n", bufr_sat_id(buffer,k));
diff --git a/src/libMarsClient/calc.c b/src/libMarsClient/calc.c
index d7952c8..e4c7101 100644
--- a/src/libMarsClient/calc.c
+++ b/src/libMarsClient/calc.c
@@ -707,7 +707,7 @@ static err f_minmax(math *p,fop2 f)
variable *v = stack_top();
fs = v->scalar?0:v->fs;
- if(e = binop(p,f))
+ if( (e = binop(p,f)) )
return e;
if(m && n && fs)
@@ -2125,10 +2125,10 @@ static err compute(math *p,void *data)
err e = NOERR;
if(p)
{
- if(e = compute(p->left,data))
+ if( (e = compute(p->left,data)))
return e;
- if(e= compute(p->right,data))
+ if( (e = compute(p->right,data)) )
return e;
if(p->name)
diff --git a/src/libMarsClient/check.c b/src/libMarsClient/check.c
index 694d17e..e2427fe 100644
--- a/src/libMarsClient/check.c
+++ b/src/libMarsClient/check.c
@@ -84,14 +84,13 @@ static int compvalues(request *r,condition *t)
val = ((value*)(t2->left))->name;
- if(is_number(par) && is_number(val))
+ if(is_number(par) && is_number(val)){
if(EQ(name,"DATE"))
return date_to_julian(atol(par)) - date_to_julian(atol(val));
else
return atof(par) - atof(val);
-
+ }
return strcmp(par,val);
-
}
@@ -139,6 +138,7 @@ boolean call_func(request* c,char *f, char *a) {
/* For now, hardcoded ... */
if(strcmp(f,"old_expver") == 0) return old_expver_func(c,f,a);
marslog(LOG_EXIT,"Invalid function in chk [%s](%s)", f, a?a:"null");
+ return false;
}
boolean condition_check(request *c,condition *t)
diff --git a/src/libMarsClient/control.c b/src/libMarsClient/control.c
index 8a3b9f6..b432588 100644
--- a/src/libMarsClient/control.c
+++ b/src/libMarsClient/control.c
@@ -88,7 +88,7 @@ err handle_control(request *r,void *data)
code = controls[i].code;
i=0;
- while( s = get_value(r,"DATABASE",i++) )
+ while( (s = get_value(r,"DATABASE",i++)) )
{
request *b = findbase(s);
if(!b) return -2;
diff --git a/src/libMarsClient/dhsbase.c b/src/libMarsClient/dhsbase.c
index 0ff11da..bac6e4c 100644
--- a/src/libMarsClient/dhsbase.c
+++ b/src/libMarsClient/dhsbase.c
@@ -711,8 +711,8 @@ static err dhs_obs_check(dhsdata* dhs,request* original_req)
/* check the message is in archive period */
/*------------------------------------------------------*/
obs_date = key_2_datetime(keyptr);
- if (obs_date < archive_period.begin ||
- obs_date > archive_period.end && e == 0)
+ if ( ((obs_date < archive_period.begin) ||
+ (obs_date > archive_period.end) ) && (e == 0) )
{
char date[20];
char time[20];
@@ -969,7 +969,8 @@ static err previous_dhs_grib_check(dhsdata *dhs,request* original_req)
}
}
- if((e == NOERR) /*|| (e == BUF_TO_SMALL)*/)
+ /* if((e == NOERR) || (e == BUF_TO_SMALL)) */
+ if(e == NOERR)
{
found[n] = true;
cnt++;
@@ -2451,32 +2452,32 @@ static err dhs_open(void *data,request *r,request *e,int mode)
/* Images should be checked as other GRIB, from grib_api 1.10.0 */
else if (image(r))
{
- if(error = dhs_image_check(dhs))
+ if( (error = dhs_image_check(dhs)) )
return error;
}
else if (feedback(r))
{
- if(error = dhs_fb_check(dhs,r))
+ if( (error = dhs_fb_check(dhs,r)) )
return error;
}
else if (bias(r))
{
- if(error = dhs_bias_check(dhs,r))
+ if( (error = dhs_bias_check(dhs,r)) )
return error;
}
else if (track(r))
{
- if(error = dhs_track_check(dhs,r))
+ if( (error = dhs_track_check(dhs,r)) )
return error;
}
else if (is_odb(r))
{
- if(error = dhs_odb_check(dhs,r))
+ if( (error = dhs_odb_check(dhs,r)) )
return error;
}
else
{
- if(error = dhs_grib_check(dhs,r))
+ if( (error = dhs_grib_check(dhs,r)) )
return error;
}
diff --git a/src/libMarsClient/environ.c b/src/libMarsClient/environ.c
index d4be594..4f94882 100644
--- a/src/libMarsClient/environ.c
+++ b/src/libMarsClient/environ.c
@@ -363,7 +363,7 @@ request *get_environ(void)
#ifndef hpux
id = (unsigned long)gethostid();
- sprintf(buf,"%d.%d.%d.%d",
+ sprintf(buf,"%lu.%lu.%lu.%lu",
(id & 0xff000000) >> 24,
(id & 0x00ff0000) >> 16,
(id & 0x0000ff00) >> 8,
diff --git a/src/libMarsClient/expand.c b/src/libMarsClient/expand.c
index 0918c1e..7fe7421 100644
--- a/src/libMarsClient/expand.c
+++ b/src/libMarsClient/expand.c
@@ -231,11 +231,12 @@ static unsigned char charmap[] = {
};
-static int count_matches(const char *a,const char *b)
+static int count_matches(const char *a,const char *b, int exact)
{
int match = 0;
register char *cm = (char*)charmap;
+
if(b[1] == 0) /* Allow words starting with a @, *, ... */
switch(b[0])
{
@@ -270,6 +271,7 @@ static int count_matches(const char *a,const char *b)
case '/':
/* obsolete ... */
break;
+
}
/* match for DAY 1, WEEK 6, ... */
@@ -279,7 +281,7 @@ static int count_matches(const char *a,const char *b)
int value;
if(sscanf(a,"%s %d",buf,&value) == 2)
{
- if(count_matches(buf,b+1)) {
+ if(count_matches(buf,b+1, exact)) {
return PERFECT_MATCH;
}
}
@@ -299,6 +301,8 @@ static int count_matches(const char *a,const char *b)
if(*a == 0 && *b == 0) return PERFECT_MATCH;
+ if(exact) return 0;
+
return match;
}
@@ -355,7 +359,7 @@ void update_step_list(int p, int n, int by, value *v)
static err replace_value(value* v,long val)
{
char buf[80];
- sprintf(buf,"%d",val);
+ sprintf(buf,"%ld",val);
strfree(v->name);
v->name = strcache(buf);
return 0;
@@ -403,7 +407,7 @@ static err expand_steps_month(value* v,int val,request *r)
const char *date = get_value(r,"DATE",0);
long d1,d2,d0;
int i;
- int n = 0;
+ int n = 0;
int p = 0;
const char *time = get_value(r,"TIME",0);
@@ -422,7 +426,7 @@ static err expand_steps_month(value* v,int val,request *r)
p = d2-d1;
- printf("validate %d",julian_to_date(date_to_julian(atol(date)) + p,mars.y2k));
+ printf("validate %ld",julian_to_date(date_to_julian(atol(date)) + p,mars.y2k));
return replace_value(v,p*24);
@@ -538,55 +542,74 @@ void check_for_time(parameter *p,value *r)
}
}
-static void match_values(value *l,value *r,value **match1,value **match2,int *best_match)
+static void match_values(value *l,value *r,value **match1,value **match2,int *best_match, const parameter* p)
{
+ const char* exact_match = get_value(p->interface,"exact_match",0);
+ int exact = exact_match && exact_match[0] == 't';
+
+ /* if(exact) print_all_requests(p->interface); */
+
while(l)
{
value *o = l;
- if(l->ref) match_values(l->ref,r,match1,match2,best_match);
+ if(l->ref) match_values(l->ref,r,match1,match2,best_match, p);
else
while(o)
{
- int match = count_matches(r->name,o->name);
-
- if(match == *best_match)
- {
- /* only if it is not already this value */
- if(*match2 != l)
- {
- *match1 = *match2;
- *match2 = l;
- }
- }
+ int match = count_matches(r->name,o->name, exact);
+
+ if(exact) /* this will imply match of full string */
+ {
+ if(match == PERFECT_MATCH)
+ {
+ *best_match = match;
+ *match2 = l;
+ *match1 = NULL;
+ }
+ }
+ else
+ {
+ if(match == *best_match)
+ {
+ /* only if it is not already this value */
+ if(*match2 != l)
+ {
+ *match1 = *match2;
+ *match2 = l;
+ }
+ }
+
+ if(match > *best_match)
+ {
+ *best_match = match;
+ *match2 = l;
+ *match1 = NULL;
+ }
+ }
- if(match > *best_match)
- {
- *best_match = match;
- *match2 = l;
- *match1 = NULL;
- }
o = o->other_names;
}
l = l->next;
}
}
-static boolean expand_value(parameter *p,value *r,value *lang)
+static boolean expand_value(parameter *p,value *r,value *lang, parameter* plang)
{
value *match1 = NULL;
value *match2 = NULL;
int best_match = 0;
value *a,*b;
- match_values(lang,r,&match1,&match2,&best_match);
+ /* printf(" -----------> START MATCHING FOR %s %s\n", p->name, r->name); */
+
+ match_values(lang,r,&match1,&match2,&best_match, plang);
if(!best_match)
{
value *v = lang;
- marslog(LOG_EROR,"undefined value : %s for parameter %s",
- r->name,p->name);
+ marslog(LOG_EROR,"undefined value : %s for parameter %s", r->name, p->name);
if(mars.verbose)
{
@@ -673,8 +696,8 @@ static boolean expand_value(parameter *p,value *r,value *lang)
char buf[80];
long value;
- sscanf(r->name,"%s %d",buf,&value);
- sprintf(buf,"%s %d",match2->name+1,value);
+ sscanf(r->name,"%s %ld",buf,&value);
+ sprintf(buf,"%s %ld",match2->name+1,value);
strfree(r->name);
r->name = strcache(buf);
@@ -764,7 +787,7 @@ static parameter* match_parameter(parameter *r,parameter *lang,boolean verbose)
while(l)
{
- int match = count_matches(r->name,l->name);
+ int match = count_matches(r->name,l->name, 0);
if(match == best_match)
{
@@ -835,10 +858,18 @@ static void expand_parameter(parameter *r,parameter *lang)
strfree(r->name);
r->name = strcache(match->name);
+ parameter * plang = lang;
+ while(plang)
+ {
+ if(strcmp(plang->name,match->name)==0)
+ break;
+ plang = plang->next;
+ }
+
p = r->values;
while(p)
{
- if(expand_value(r,p,match->values))
+ if(expand_value(r,p,match->values, plang))
p = r->values;
else
p = p->next;
@@ -954,7 +985,7 @@ static boolean probe_parameters(parameter* p,parameter* lang)
if(*p->name != '_')
{
parameter* match;
- if(match = match_parameter(p,lang,mars.debug))
+ if( (match = match_parameter(p,lang,mars.debug)) )
{
value* v = p->values;
while(v)
@@ -963,7 +994,7 @@ static boolean probe_parameters(parameter* p,parameter* lang)
value *match2 = NULL;
int best_match = 0;
- match_values(match->values,v,&match1,&match2,&best_match);
+ match_values(match->values,v,&match1,&match2,&best_match, match);
/* Undefined value */
if(!best_match)
@@ -1005,7 +1036,7 @@ static request *match_verb(const request* r,request *lang)
while(l)
{
- int match = count_matches(r->name,l->name);
+ int match = count_matches(r->name,l->name, 0);
if(match == best_match)
{
@@ -1040,7 +1071,7 @@ static request *match_verb(const request* r,request *lang)
for(i = 0 ; i < top ; i++)
{
marslog(LOG_DBUG,"Probing %s (%s)",matches[i]->name,matches[i]->kind);
- if(ok[i] = probe_parameters(r->params,matches[i]->params))
+ if( (ok[i] = probe_parameters(r->params,matches[i]->params)) )
{
if(use < 0) use = i;
n++;
@@ -1083,7 +1114,10 @@ static request *expand_one_request(const request *r,request *lang)
while(p)
{
- if(*p->name != '_') expand_parameter(p,match->params);
+ if(*p->name != '_') {
+ /* printf("EXPAND PARAMETER %s\n", p->name); */
+ expand_parameter(p,match->params);
+ }
p = p->next;
}
@@ -1100,7 +1134,7 @@ static void chk_defaults(request *r)
value *v = p->default_values;
while(v)
{
- if(expand_value(p,v,p->values))
+ if(expand_value(p,v,p->values,p))
v = p->default_values;
else
v = v->next;
@@ -1243,7 +1277,7 @@ request *closest_verb(request *lang,const char *name)
while(l)
{
- int match = count_matches(name,l->name);
+ int match = count_matches(name,l->name, 0);
if(match > best) { r = l; best = match; };
l = l->next;
}
@@ -1259,7 +1293,7 @@ parameter *closest_parameter(request *lang,const char *name)
while(l)
{
- int match = count_matches(name,l->name);
+ int match = count_matches(name,l->name, 0);
if(match > best) { w = l; best = match; };
l = l->next;
}
diff --git a/src/libMarsClient/field.c b/src/libMarsClient/field.c
index fa3192f..5a9e87a 100644
--- a/src/libMarsClient/field.c
+++ b/src/libMarsClient/field.c
@@ -474,7 +474,7 @@ static err to_packed_mem(field *g)
}
accuracy = best_packing(accuracy);
- if(e = grib_set_long(g->handle,"bitsPerValue",accuracy))
+ if( (e = grib_set_long(g->handle,"bitsPerValue",accuracy)) )
{
marslog(LOG_EROR,"grib_api: cannot set accuracy to %ld (%s)",accuracy,grib_get_error_message(e));
return e;
@@ -500,7 +500,7 @@ static err to_packed_mem(field *g)
/* Compute flag */
if(mars.computeflg)
{
- if(e = grib_set_long(g->handle,"generatingProcessIdentifier",mars.computeflg))
+ if( (e = grib_set_long(g->handle,"generatingProcessIdentifier",mars.computeflg)) )
{
marslog(LOG_EROR,"grib_api: cannot set generating process to %ld (%s)",mars.computeflg,grib_get_error_message(e));
return e;
@@ -512,7 +512,7 @@ static err to_packed_mem(field *g)
char grid_type[80];
size_t size;
size = sizeof(grid_type);
- if(e = grib_get_string(g->handle,"typeOfGrid",grid_type,&size))
+ if( (e = grib_get_string(g->handle,"typeOfGrid",grid_type,&size)) )
{
marslog(LOG_EROR,"grib_api: cannot get typeOfGrid %s",grib_get_error_message(e));
return e;
diff --git a/src/libMarsClient/filebase.c b/src/libMarsClient/filebase.c
index a42b362..dc9329a 100644
--- a/src/libMarsClient/filebase.c
+++ b/src/libMarsClient/filebase.c
@@ -38,7 +38,7 @@ static option opts[] = {
".(NUMBER,%04d).(_EXPVER,%04X).(_REPRES,%02s)"
"/(_AREA_N,%.6f).(_AREA_W,%.6f).(_AREA_S,%.6f).(_AREA_E,%.6f)."
"(_ROTATION_LAT,%.6f).(_ROTATION_LON,%.6f)."
- "(_GRID_NS,%.6f).(_GRID_EW,%.6f).(_GAUSSIAN,%4d).(_TRUNCATION,%4d)/"
+ "(_GRID_NS,%.6f).(_GRID_EW,%.6f).(_GAUSSIAN,%4d).(_GRIDNAME,%s).(_TRUNCATION,%4d)/"
"(PARAM,%03d).(LEVELIST,%04d).(DATE,%06d).(TIME,%04d).(STEP,%04d)"
,
@@ -103,7 +103,7 @@ static err file_open(void *data,request *r,request *e,int mode)
names = NEW_ARRAY(char*,cnt);
p = file->order;
- while(q = strtok(p,","))
+ while( (q = strtok(p,",")) )
{
names[i++] = q;
p = NULL;
@@ -220,7 +220,7 @@ static err file_read(void *data,request *r,void *buffer,long *length)
if(r) reqcpy(r,file->w);
- if(ret = findpath(file,file->w,path))
+ if( (ret = findpath(file,file->w,path)) )
{
marslog(LOG_EROR,"Cannot parse %s",file->tmplate);
return ret;
@@ -260,7 +260,7 @@ static err file_write(void *data,request *r,void *buffer,long *length)
long len;
FILE *f;
- if(ret = findpath(file,r,path))
+ if( (ret = findpath(file,r,path)) )
{
marslog(LOG_EROR,"Cannot parse %s",file->tmplate);
return ret;
diff --git a/src/libMarsClient/flatfilebase.c b/src/libMarsClient/flatfilebase.c
index d846a10..f94c373 100644
--- a/src/libMarsClient/flatfilebase.c
+++ b/src/libMarsClient/flatfilebase.c
@@ -76,7 +76,7 @@ static err flatfile_open(void *data,request *r,request *e,int mode)
{
marslog(LOG_DBUG,"Trying to open flatfile %s",g->source);
- if(g->s = fopen(g->source,"r"))
+ if( (g->s = fopen(g->source,"r")) )
{
marslog(LOG_INFO,"Opening file '%s'",g->source);
/* Modify disk I/O buffer, if application buffer allows for that */
@@ -200,12 +200,12 @@ static err flatfile_read(void *data,request *r,void *buffer,long *length)
if(ret != 0 && ret != -3)
*length = 0;
- if(ret == 0 && r)
+ if(ret == 0 && r){
if(g->obs)
bufr_to_request(r,buffer,*length);
else
grib_to_request(r,buffer,*length);
-
+ }
return ret;
}
diff --git a/src/libMarsClient/gribbase.c b/src/libMarsClient/gribbase.c
index 243ae78..6651482 100644
--- a/src/libMarsClient/gribbase.c
+++ b/src/libMarsClient/gribbase.c
@@ -116,12 +116,14 @@ static err grib_read(void *data,request *r,void *buffer,long *length)
if(ret != 0 && ret != -3)
*length = 0;
- if(ret == 0 && r)
- if(g->obs)
+ if(ret == 0 && r){
+ if(g->obs) {
bufr_to_request(r,buffer,*length);
- else
+ }
+ else{
grib_to_request(r,buffer,*length);
-
+ }
+ }
return ret;
}
diff --git a/src/libMarsClient/handler.c b/src/libMarsClient/handler.c
index d6872f1..8edee05 100644
--- a/src/libMarsClient/handler.c
+++ b/src/libMarsClient/handler.c
@@ -66,9 +66,11 @@ err handle_request(request *r,void *data)
marslog(LOG_INFO,"Processing request %d",++n);
}
- add_hidden_parameters(r);
+ if( add_hidden_parameters(r) != NOERR ) {
+ marslog(LOG_EROR,"Error while processing hidden parameters");
+ return -2;
+ }
-
if(mars.marslite_mode)
{
if(!mars.keep_database)
diff --git a/src/libMarsClient/hash.c b/src/libMarsClient/hash.c
index 09cafe2..96d175a 100644
--- a/src/libMarsClient/hash.c
+++ b/src/libMarsClient/hash.c
@@ -50,7 +50,7 @@ void hash_stat()
printf("Table size is %d. ",SIZE);
for(i=0;i<SIZE;i++)
- if(h = table[i])
+ if( (h = table[i]) )
{
a++;
while(h) { b++; c += h->cnt; h = h->next; };
diff --git a/src/libMarsClient/hidden.c b/src/libMarsClient/hidden.c
index 656bb95..83e9958 100644
--- a/src/libMarsClient/hidden.c
+++ b/src/libMarsClient/hidden.c
@@ -125,11 +125,10 @@ request *un_first_guess(const request *r)
count_values(z,"TIME") *
count_values(z,"STEP");
- if(s = get_value(r,"TYPE",0))
+ if( (s = get_value(r,"TYPE",0)) )
if(EQ(s,"FG"))
{
-
- if(s = get_value(r,"STREAM",0))
+ if( (s = get_value(r,"STREAM",0)) )
if(EQ(s,"WAVE"))
return z;
@@ -326,13 +325,66 @@ void ensemble_to_number(request *r)
}
}
+static err request_to_gridname(request *r)
+{
+ const char* grid = get_value(r,"GRID",0);
+
+ const char *oldgauss = getenv("MARS_REGULAR_GRID");
+
+ if( grid && strlen(grid) )
+ {
+ if (isalpha(grid[0])) {
+
+ set_value(r,"_GRIDNAME","%s",grid);
+ set_value(r,"_GAUSSIAN","%s",grid+1);
+
+ } else if (isdigit(grid[0])) { /* first is digit so we need to look at GAUSSIAN */
+
+ if(grid[0] == '0') {
+ marslog(LOG_EROR,"GRID cannot start with leading digit 0");
+ return -2;
+ }
+
+ const char* gauss = get_value(r,"GAUSSIAN",0);
+
+ const char* k = "F"; /* default is regular gg */
+
+ if(gauss && strcmp(gauss,"REDUCED") == 0) {
+ k = "N";
+ }
+
+ if(oldgauss && atoi(oldgauss)) {
+ k = "F";
+ marslog(LOG_WARN,"The use of MARS_REGULAR_GRID is discontinued, please contact User Support");
+ }
+
+ set_value(r,"_GRIDNAME","%s%s",k,grid);
+ set_value(r,"_GAUSSIAN","%s",grid);
+ }
+ else
+ {
+ return -2;
+ }
+
+ set_value(r,"GRID","%s",get_value(r,"_GRIDNAME",0));
+ unset_value(r,"GAUSSIAN");
+
+ }
+ else
+ {
+ return -2;
+ }
+
+ return 0;
+}
+
err add_hidden_parameters(request *r)
{
const char *s;
- int i,n;
+ int i,n;
int j = 0;
- while(s = no_quotes(get_value(r,"EXPVER",j++)))
+ while( (s = no_quotes(get_value(r,"EXPVER",j++))) )
{
if(is_number(s))
{
@@ -353,9 +405,9 @@ err add_hidden_parameters(request *r)
valcpy(r,r,"EXPVER","TMPEXPVER");
unset_value(r,"TMPEXPVER");
- if(s = get_value(r,"RESOL",0))
+ if( (s = get_value(r,"RESOL",0)) )
{
- if(!EQ(s,"AV") && !EQ(s,"AUTO") && s[0] != 'N')
+ if(!EQ(s,"AV") && !EQ(s,"AUTO") && s[0] != 'N' && s[0] != 'O')
set_value(r,"_TRUNCATION",s);
}
@@ -397,7 +449,7 @@ mars.accuracy == -1 => same as input same as input
else
mars.accuracy = 0;
- if(i = count_values(r,"AREA"))
+ if( (i = count_values(r,"AREA")) )
{
int n,s;
@@ -442,16 +494,21 @@ mars.accuracy == -1 => same as input same as input
ensemble_to_number(r);
+ char* gridname;
+
switch(count_values(r,"GRID"))
{
case 0:
break;
- case 1:
+ case 1: /* It's Gaussian !! */
- /* It's Gaussian !! */
+ if( request_to_gridname(r) != NOERR )
+ {
+ marslog(LOG_EROR,"Cannot establish a valid gridname");
+ return -2;
+ }
- set_value(r,"_GAUSSIAN",get_value(r,"GRID",0));
break;
case 2:
diff --git a/src/libMarsClient/hypercube.c b/src/libMarsClient/hypercube.c
index e67ad6d..7dff531 100644
--- a/src/libMarsClient/hypercube.c
+++ b/src/libMarsClient/hypercube.c
@@ -610,7 +610,7 @@ hypercube *new_hypercube(const request *r)
those parameters found as axis */
h->iterator = empty_request(0);
for(n = 0; n < NUMBER(axis); ++n)
- if(val = get_value(h->r,axis[n].name,0))
+ if( (val = get_value(h->r,axis[n].name,0)) )
set_value(h->iterator,axis[n].name,val);
return h;
@@ -731,7 +731,7 @@ static void copy_cube(hypercube *a , const hypercube *b, int v)
request *r = NULL;
int from = 0, last = 0;
- while(r = next_cubelet((hypercube *)b,&from,&last))
+ while( (r = next_cubelet((hypercube *)b,&from,&last)) )
{
int new_index = cube_position(a,r);
set_index(a,new_index,v);
diff --git a/src/libMarsClient/ibmblk.c b/src/libMarsClient/ibmblk.c
index 48fba0c..9804ef7 100644
--- a/src/libMarsClient/ibmblk.c
+++ b/src/libMarsClient/ibmblk.c
@@ -8,6 +8,9 @@
* does it submit to any jurisdiction.
*/
+#if (defined(__APPLE__) && defined(__MACH__))
+#include <ctype.h>
+#endif
#include "mars.h"
#include "ibmblk.h"
@@ -198,7 +201,7 @@ char *buildblock(request *r,int actcls)
gethostname(buf,sizeof(buf));
FILL_CHR(prmhdr.recid,buf);
- if(s = getenv("QSUB_REQNAME"))
+ if( (s = getenv("QSUB_REQNAME")) )
{
strncpy(buf,s,9);
buf[9] = 0;
diff --git a/src/libMarsClient/index.c b/src/libMarsClient/index.c
index fd33ff3..6d2f589 100644
--- a/src/libMarsClient/index.c
+++ b/src/libMarsClient/index.c
@@ -130,7 +130,7 @@ void mars_grib_index_print( mars_grib_index* idx )
{
mars_grib_index* next = idx->next;
- printf( "offset = %lld length = %lld", idx->offset, idx->length );
+ printf( "offset = %lld length = %ld", idx->offset, idx->length );
print_map( idx->head );
printf("\n");
diff --git a/src/libMarsClient/logfile.c b/src/libMarsClient/logfile.c
index 6d589b1..ec90b9e 100644
--- a/src/libMarsClient/logfile.c
+++ b/src/libMarsClient/logfile.c
@@ -101,7 +101,7 @@ void mars_grib_api_log(const grib_context* c, int level, const char* msg)
}
-void marslog(int level,char *fmt,...)
+void marslog(int level,const char *fmt,...)
{
char buf[80];
va_list list;
diff --git a/src/libMarsClient/mars.h b/src/libMarsClient/mars.h
index 8c7b545..61ae0a8 100644
--- a/src/libMarsClient/mars.h
+++ b/src/libMarsClient/mars.h
@@ -336,6 +336,8 @@ typedef struct firewall_info firewall_info;
#else
typedef size_t marssocklen_t;
#endif
+#elif (defined(__APPLE__) && defined(__MACH__))
+ typedef socklen_t marssocklen_t;
#else
typedef int marssocklen_t;
#endif
diff --git a/src/libMarsClient/mars_client_version.c.in b/src/libMarsClient/mars_client_version.c.in
new file mode 100644
index 0000000..b901994
--- /dev/null
+++ b/src/libMarsClient/mars_client_version.c.in
@@ -0,0 +1,16 @@
+#include "mars_client_version.h"
+
+#define MARS_CLIENT_MAJOR_VERSION @MARS_CLIENT_MAJOR_VERSION@
+#define MARS_CLIENT_MINOR_VERSION @MARS_CLIENT_MINOR_VERSION@
+#define MARS_CLIENT_PATCH_VERSION @MARS_CLIENT_PATCH_VERSION@
+
+const char * mars_client_version() { return "@MARS_CLIENT_VERSION@"; }
+const char * mars_client_version_str() { return "@MARS_CLIENT_VERSION_STR@"; }
+const char * mars_client_buildstamp() { return "@EC_BUILD_TIMESTAMP@"; }
+
+unsigned int mars_client_version_int()
+{
+ return 10000*MARS_CLIENT_MAJOR_VERSION + 100*MARS_CLIENT_MINOR_VERSION + 1*MARS_CLIENT_PATCH_VERSION;
+}
+
+const char * mars_client_git_sha1() { return "@MARS_CLIENT_GIT_SHA1@"; }
\ No newline at end of file
diff --git a/src/libMarsClient/mars_client_version.h.in b/src/libMarsClient/mars_client_version.h.in
new file mode 100644
index 0000000..e95fc80
--- /dev/null
+++ b/src/libMarsClient/mars_client_version.h.in
@@ -0,0 +1,14 @@
+#ifndef mars_client_version_h
+#define mars_client_version_h
+
+const char * mars_client_version();
+
+unsigned int mars_client_version_int();
+
+const char * mars_client_version_str();
+
+const char * mars_client_buildstamp();
+
+const char * mars_client_git_sha1();
+
+#endif
diff --git a/src/libMarsClient/pproc.c b/src/libMarsClient/pproc.c
index 2991e29..3f27948 100644
--- a/src/libMarsClient/pproc.c
+++ b/src/libMarsClient/pproc.c
@@ -361,8 +361,7 @@ err pparea(request *r)
if( p = get_value(r,"_AREA_W",0)) w_ = w = atof(p);
if( p = get_value(r,"_GRID_EW",0))ew_ = ew = atof(p);
if( p = get_value(r,"_GRID_NS",0))ns_ = ns = atof(p);
- if( p = get_value(r,"_GAUSSIAN",0)) ew_ = ew = atof(p);
-
+ if( p = get_value(r,"_GAUSSIAN",0)) ew_ = ew = atof(p);
if(ew == 0 && ns == 0)
return 0;
@@ -376,7 +375,7 @@ err pparea(request *r)
}
- if(ew_ != 0 && ew_ != ew || ns_ != ns)
+ if( ((ew_ != 0) && (ew_ != ew)) || (ns_ != ns) )
{
if(ns == 0)
{
@@ -1405,7 +1404,7 @@ err ppinit(const request *r, postproc *proc)
ppdata.dup_count = 0;
#endif
- if(p = get_value(r,"GRIB",0))
+ if( (p = get_value(r,"GRIB",0)) )
{
ppdata.original_grib = EQ(p,"ORIGINAL");
}
@@ -1453,7 +1452,7 @@ err ppinit(const request *r, postproc *proc)
if(ppdata.idents) FREE(ppdata.idents);
- if(ppdata.ident_cnt = count_values(r,"IDENT"))
+ if( (ppdata.ident_cnt = count_values(r,"IDENT")) )
ppdata.idents = NEW_ARRAY(int,ppdata.ident_cnt);
for(i = 0;i<ppdata.ident_cnt;i++)
@@ -1484,7 +1483,7 @@ err ppinit(const request *r, postproc *proc)
if(ppdata.types) FREE(ppdata.types);
- if(ppdata.type_cnt = count_values(r,"OBSTYPE"))
+ if( (ppdata.type_cnt = count_values(r,"OBSTYPE")) )
{
int zero = 0;
ppdata.types = NEW_ARRAY(int,ppdata.type_cnt);
@@ -1556,7 +1555,7 @@ err ppinit(const request *r, postproc *proc)
if(ppdata.idents) FREE(ppdata.idents);
- if(ppdata.ident_cnt = count_values(r,"IDENT"))
+ if( (ppdata.ident_cnt = count_values(r,"IDENT")) )
ppdata.idents = NEW_ARRAY(int,ppdata.ident_cnt);
for(i = 0;i<ppdata.ident_cnt;i++)
@@ -1587,7 +1586,7 @@ err ppinit(const request *r, postproc *proc)
/* Instruments */
if(ppdata.instruments) FREE(ppdata.instruments);
- if(ppdata.instrument_cnt = count_values(r,"INSTRUMENT"))
+ if( (ppdata.instrument_cnt = count_values(r,"INSTRUMENT")) )
ppdata.instruments = NEW_ARRAY(fortint,ppdata.instrument_cnt);
for(i = 0;i<ppdata.instrument_cnt;i++)
@@ -1597,7 +1596,7 @@ err ppinit(const request *r, postproc *proc)
if(ppdata.types) FREE(ppdata.types);
- if(ppdata.type_cnt = count_values(r,"OBSTYPE"))
+ if( (ppdata.type_cnt = count_values(r,"OBSTYPE")) )
{
int zero = 0;
ppdata.types = NEW_ARRAY(int,ppdata.type_cnt);
@@ -1621,7 +1620,7 @@ err ppinit(const request *r, postproc *proc)
if(ppdata.blocks) FREE(ppdata.blocks);
- if(ppdata.block_cnt = count_values(r,"BLOCK"))
+ if( (ppdata.block_cnt = count_values(r,"BLOCK")) )
ppdata.blocks = NEW_ARRAY(int,ppdata.block_cnt);
for(i = 0;i<ppdata.block_cnt;i++)
@@ -1718,7 +1717,7 @@ err ppinit(const request *r, postproc *proc)
/* By default, copy edition from intput to output: edition=0*/
ppdata.edition = 0;
- if(p = get_value(r,"FORMAT",0))
+ if( (p = get_value(r,"FORMAT",0)) )
{
if(EQ(p,"GRIB1")) ppdata.edition = 1;
if(EQ(p,"GRIB2")) ppdata.edition = 2;
@@ -1735,7 +1734,21 @@ err ppinit(const request *r, postproc *proc)
}
- /* set grid */
+ /* gridname */
+
+ const char *gridname = get_value(r,"_GRIDNAME",0);
+ if(gridname)
+ {
+ ret = ppout("gridname",n,array,gridname);
+ if(ret) return ret;
+
+ n = atoi(get_value(r,"_GAUSSIAN",0));
+ long guess;
+ guess = (2*n) * (4*n+20); /* nb lats * nb points at equator for octahedral grid */
+ if( guess > ppdata.estimate ) ppdata.estimate = guess;
+ }
+
+ /* set LatLon grid */
if(get_value(r,"_GRID_EW",0))
{
@@ -1783,36 +1796,7 @@ err ppinit(const request *r, postproc *proc)
if(ret) return ret;
}
- /* gaussian */
-
- if(get_value(r,"_GAUSSIAN",0))
- {
- long guess;
- const char *gaussian = "GAUSSIAN";
- const char *g = get_value(r,"GAUSSIAN",0);
- const char *oldgauss = getenv("MARS_REGULAR_GRID");
-
- if(g != NULL)
- {
- gaussian = g;
- }
-
- n = atoi(get_value(r,"_GAUSSIAN",0));
-
- if(oldgauss && atoi(oldgauss))
- {
- gaussian = "REGULAR";
- marslog(LOG_WARN,"Please, specify new keyword ");
- marslog(LOG_WARN,"GAUSSIAN=REGULAR in your request");
- }
-
- ret = ppout((char *)lowcase(gaussian),n,array,0);
- if(ret) return ret;
- guess = n * n * 8;
- if( guess > ppdata.estimate ) ppdata.estimate = guess;
- }
-
- /* Interpolation */
+ /* Interpolation */
if(get_value(r,"INTERPOLATION",0))
{
@@ -1853,14 +1837,14 @@ err ppinit(const request *r, postproc *proc)
if(ret) marslog(LOG_EROR,"Auto Resolution error %d",ret);
}
}
- if(trunc[0] == 'N')
- {
- n = atoi(trunc+1);
- marslog(LOG_DBUG,"Using GG double interpolation to %d",n);
- ret = ppout("intermediate_gaussian",n,array,0);
- if(ret) marslog(LOG_EROR,"Double interpolation error %d",ret);
- }
- }
+ if(trunc[0] == 'N' || trunc[0] == 'O')
+ {
+ n = atoi(trunc+1);
+ marslog(LOG_DBUG,"Using GG double interpolation to %s", trunc);
+ ret = ppout("intermediate_gaussian",n,array,trunc);
+ if(ret) marslog(LOG_EROR,"Double interpolation error %d",ret);
+ }
+ }
}
@@ -2011,7 +1995,7 @@ fieldset *pp_fieldset(const char *file,request *filter)
postproc proc;
if(!v) return NULL;
- if(e = ppinit(filter,&proc)) {
+ if( (e = ppinit(filter,&proc)) ) {
marslog(LOG_EROR,"Interpolation initialisation failed (%d)",e);
ppdone();
return NULL;
diff --git a/src/libMarsClient/proto.h b/src/libMarsClient/proto.h
index 15ae047..4e6546f 100644
--- a/src/libMarsClient/proto.h
+++ b/src/libMarsClient/proto.h
@@ -50,7 +50,7 @@ long get_svc_ref(svcid *id);
const char *get_svc_target(svcid *id);
const char *get_svc_source(svcid *id);
const char *get_svc_msg(svcid *id, int n);
-void set_svc_msg(svcid *id, char *fmt, ...);
+void set_svc_msg(svcid *id, const char *fmt, ...);
err send_drop_info(svc *s, char *target, request *r, long ref);
err send_message(svc *s, request *r);
err send_progress(svcid *id, const char *msg, request *r);
@@ -420,7 +420,7 @@ int timed_readany(FILE *f, char *buffer, long *length, timer *t);
void marsdebug(boolean on);
FILE *marslogfile(FILE *f);
void mars_grib_api_log(const grib_context *c, int level, const char *msg);
-void marslog(int level, char *fmt, ...);
+void marslog(int level, const char *fmt, ...);
void log_errors(void);
void install_exit_proc(exitproc p, void *data);
void remove_exit_proc(exitproc p, void *data);
diff --git a/src/libMarsClient/restricted.c b/src/libMarsClient/restricted.c
index 9696816..59727cc 100644
--- a/src/libMarsClient/restricted.c
+++ b/src/libMarsClient/restricted.c
@@ -42,7 +42,7 @@ int restricted(void *p)
for(i=0;i<5;i++)
st.ident = st.ident*10 + (KEY_IDENT(k)[i]-'0');
- if(s = bsearch(&st,restrictions,NUMBER(restrictions),sizeof(station),compare))
+ if( (s = bsearch(&st,restrictions,NUMBER(restrictions),sizeof(station),compare)) )
{
if( (s->time_restricted & (1<<KEY_HOUR(k))) != 0)
{
diff --git a/src/libMarsClient/schedule.c b/src/libMarsClient/schedule.c
index 893786e..099ace2 100644
--- a/src/libMarsClient/schedule.c
+++ b/src/libMarsClient/schedule.c
@@ -134,7 +134,7 @@ boolean check_dissemination_schedule(request *user, request *env, boolean logsta
marslog(LOG_WARN,"Please, inform mars at ecmwf.int");
/* Allowed users will carry on*/
- if(allowed = user_category_allowed(allow,env))
+ if( (allowed = user_category_allowed(allow,env)) )
{
marslog(LOG_WARN,"MARS schedule ignored");
return 0;
diff --git a/src/libMarsClient/service.c b/src/libMarsClient/service.c
index 2507b8d..c5fdec5 100644
--- a/src/libMarsClient/service.c
+++ b/src/libMarsClient/service.c
@@ -260,7 +260,7 @@ const char *get_svc_msg(svcid *id,int n)
return get_value(id->r,q,n);
}
-void set_svc_msg(svcid *id,char *fmt,...)
+void set_svc_msg(svcid *id,const char *fmt,...)
{
va_list list;
char buf[1024];
@@ -458,7 +458,7 @@ err send_reply(svcid *id,request *r)
request *x = get_subrequest(r,s->name,0);
if(x == NULL)
{
- if(x = get_subrequest(id->r->next,s->name,0))
+ if( (x = get_subrequest(id->r->next,s->name,0)) )
set_subrequest(r,s->name,x);
else if(get_value(r,s->name,0) == NULL)
{
@@ -869,7 +869,7 @@ err process_service(svc *s)
id = new_id(s,r);
- if(serve = (strcmp(r->name,"SERVICE")==0)) p = s->serv;
+ if( (serve = (strcmp(r->name,"SERVICE")==0)) ) p = s->serv;
else if(strcmp(r->name,"REPLY")==0) {
p = s->repl;
s->replies--;
diff --git a/src/libMarsClient/sh2ll.c b/src/libMarsClient/sh2ll.c
index 904ce9f..f785ed4 100644
--- a/src/libMarsClient/sh2ll.c
+++ b/src/libMarsClient/sh2ll.c
@@ -33,7 +33,7 @@ err write_fieldset(fieldset *v,database *b)
const void *buffer = field_message(g,&length);
if(!buffer) return -1;
- if(e = database_write(b,NULL,(char*)buffer,&length))
+ if( (e = database_write(b,NULL,(char*)buffer,&length)) )
return e;
release_field(g);
diff --git a/src/libMarsClient/tools.c b/src/libMarsClient/tools.c
index 75f5bd7..4e301a3 100644
--- a/src/libMarsClient/tools.c
+++ b/src/libMarsClient/tools.c
@@ -755,7 +755,7 @@ int copylink(const char *from,const char *to)
buf[x] = 0;
- if(e = symlink(buf,to))
+ if( (e = symlink(buf,to)) )
{
marslog(LOG_EROR|LOG_PERR,"symlink(%s,%s)",buf,to);
return e;
@@ -828,7 +828,7 @@ int copydir(const char *from,const char *to)
marslog(LOG_EROR,"copy: %s exists",to);
return -1;
}
- if(e = mkdir(to,0777))
+ if( (e = mkdir(to,0777)) )
{
marslog(LOG_EROR|LOG_PERR,"mkdir %s",to);
return e;
@@ -865,7 +865,7 @@ int copyfile(const char *from,const char *to)
mode_t mask = umask(0);
umask(mask);
- if(e = lstat(from,&stf)) /* Don't follow link */
+ if( (e = lstat(from,&stf)) ) /* Don't follow link */
{
marslog(LOG_EROR|LOG_PERR,"Cannot stat %s",from);
return e;
@@ -873,7 +873,7 @@ int copyfile(const char *from,const char *to)
/* from is a directory */
dirf = (S_ISDIR(stf.st_mode) && !S_ISLNK(stf.st_mode));
- if(e = lstat(to,&stt)) /* Don't follow link */
+ if( (e = lstat(to,&stt)) ) /* Don't follow link */
{
if(errno != ENOENT) /* File not found */
{
@@ -910,7 +910,7 @@ int copyfile(const char *from,const char *to)
/* The target is a file */
else
{
- if(e = unlink(to))
+ if( (e = unlink(to)) )
{
marslog(LOG_EROR|LOG_PERR,"Cannot unlink %s",to);
return e;
@@ -922,7 +922,7 @@ int copyfile(const char *from,const char *to)
if(e == 0)
{
mode_t mode = 0777 & ~mask;
- if(e = chmod(to,mode))
+ if( (e = chmod(to,mode)) )
marslog(LOG_EROR|LOG_PERR,"chmod(%s,%o) failed",to,mode);
}
return e;
@@ -937,7 +937,7 @@ int copyfile(const char *from,const char *to)
if(e == 0)
{
mode_t mode = 0777 & ~mask;
- if(e = chmod(to,stf.st_mode&S_IAMB))
+ if( (e = chmod(to,stf.st_mode&S_IAMB)) )
marslog(LOG_EROR|LOG_PERR,"chmod(%s,%o) failed",to,mode);
}
return e;
@@ -1136,7 +1136,7 @@ FILE* mail_open(const char* to, char *fmt,...)
marslog(LOG_EROR|LOG_EXIT,"MARS internal error. Mail recipient not specified");
marslog(LOG_DBUG,"Seding email with command '%s'",buf);
- if(f = popen(buf,"w")) {
+ if( (f = popen(buf,"w")) ) {
char timestamp[80];
time_t now;
char host[1024];
@@ -1210,7 +1210,7 @@ FILE* mail_once(const char *mark, const char* to, char *fmt,...)
if(mars.mail_frequency > 0)
fprintf(f,"Its current value is: %s \n\n",timename(mars.mail_frequency));
else
- fprintf(f,"Its current value is: %d\n\n",mars.mail_frequency);
+ fprintf(f,"Its current value is: %ld\n\n",mars.mail_frequency);
touch(markfile);
}
@@ -1278,7 +1278,7 @@ const char *real_name(const char* fname)
last = 0;
- while(p=strtok(c,"/"))
+ while( (p=strtok(c,"/")) )
{
c = NULL;
@@ -1549,7 +1549,7 @@ long grib_length(const char *buffer, long length)
long len;
err e = NOERR;
grib_handle *h = grib_handle_new_from_message_copy(0,buffer,length);
- if( e = grib_get_long(h,"totalLength",&len))
+ if( (e = grib_get_long(h,"totalLength",&len)) )
{
marslog(LOG_WARN,"Cannot get totalLength for message");
}
@@ -1638,7 +1638,7 @@ time_t age(const char* path)
struct stat st;
err e = NOERR;
- if(e = stat(path,&st))
+ if( (e = stat(path,&st)) )
{
return e;
}
diff --git a/src/libMetview/MvRequest.cc b/src/libMetview/MvRequest.cc
index 64fcfad..1dab38a 100644
--- a/src/libMetview/MvRequest.cc
+++ b/src/libMetview/MvRequest.cc
@@ -188,10 +188,29 @@ void MvRequest::unsetParam(const char* pname)
unset_value(CurrentRequest, pname);
}
-void MvRequest::read(const char* file)
+void MvRequest::read(const char* fileNamePath, bool expand)
{
- free_all_requests(FirstRequest);
- CurrentRequest = FirstRequest = read_request_file(file);
+ // Read request using MARS library
+ // The problem here is that this function does not expand any
+ // subrequests. This expansion will be done manually, if second
+ // parameter is true.
+ free_all_requests(FirstRequest);
+ CurrentRequest = FirstRequest = read_request_file(fileNamePath);
+
+ if ( !expand )
+ return;
+
+ // Get object request. This will help to find out if a parameter
+ // is a subrequest, which in this case will need to be expanded.
+ request* obj = this->findRequestObject();
+ if ( obj == NULL )
+ return;
+
+ // Expand subrequests
+ string path = dirname(fileNamePath);
+ this->importSubObjects(path,obj);
+
+ return;
}
void MvRequest::save(const char* file) const
@@ -1124,3 +1143,73 @@ MvGrib::MvGrib(const char *s)
CurrentRequest = FirstRequest = empty_request("GRIB");
set_value(CurrentRequest,"PATH","%s",s);
}
+
+//----------------------------------------------
+
+
+void MvRequest::importSubObjects(string& path, request* obj)
+{
+ // Get the definition filename
+ const char* defFile = get_value(obj,"definition_file",0);
+ if ( !defFile )
+ return;
+
+ // Read the definition file
+ request* l = read_language_file(defFile);
+ if ( !l )
+ return;
+
+ // Skip auxiliary requests
+ while(l && (l->name != this->getVerb()))
+ l = l->next;
+
+ // Check each parameter to find out if it needs to be expanded
+ parameter* p = l->params;
+ MvRequest reqAux;
+ while (p)
+ {
+ // Search for parameters that have an icon interface
+ const char *cicon = get_value(p->interface,"interface",0);
+ if (cicon && (strcmp(cicon,"icon") == 0))
+ {
+ // Build all subrequests and add to this parameter
+ int i = 0;
+ const char *q;
+ while ( (q = get_value(CurrentRequest,p->name,i++)) )
+ {
+ // Build subrequest
+ string fullPath = path + "/" + q;;
+ reqAux.read(fullPath.c_str(),true);
+
+ // Add subrequest to this parameter
+ if ( i == 1 ) // clean parameter values once
+ this->unsetParam(p->name);
+
+ this->addValue(p->name,reqAux);
+ }
+ }
+
+ p = p->next;
+ }
+}
+
+request* MvRequest::findRequestObject()
+{
+ const char* className = this->getVerb();
+ if (!className)
+ return NULL;
+
+ const char *c;
+ request *u = mars.setup;
+ while (u)
+ {
+ if (strcmp(u->name,"object") == 0 &&
+ (c = get_value(u,"class",0)) &&
+ c == className )
+ return u;
+
+ u = u->next;
+ }
+
+ return NULL;
+}
diff --git a/src/libMetview/MvRequest.h b/src/libMetview/MvRequest.h
index 9b126bf..3f8d22d 100644
--- a/src/libMetview/MvRequest.h
+++ b/src/libMetview/MvRequest.h
@@ -178,10 +178,16 @@ protected:
int CurrentCount;
parameter *CurrentParam;
- // This function is similar to put_value (libMars), but it only
- // updates values that are common to both input and output requests
- void update_value(request *r,const char *param,const char *valname,boolean append);
- request *copyFromCurrentTo_Recursive(const request *r, const char *verb);
+ // This function is similar to put_value (libMars), but it only
+ // updates values that are common to both input and output requests
+ void update_value(request *r,const char *param,const char *valname,boolean append);
+ request *copyFromCurrentTo_Recursive(const request *r, const char *verb);
+
+ // Expand subrequests
+ void importSubObjects(string&, request*);
+
+ // Get the Object request given its name
+ request* findRequestObject();
public:
@@ -509,8 +515,11 @@ public:
*/
void print() const;
- //! Reads a request from file named 'file'
- void read(const char* file);
+ //! Reads a request from file named 'file'.
+ /*! if the second parameter is true then any request parameter,
+ * which is an icon (subrequest), will be expanded
+ */
+ void read(const char* file, bool expand = false);
//! Saves a request into file named 'file'
void save(const char* file) const;
diff --git a/src/libMvQtGui/MvQMainWindow.cc b/src/libMvQtGui/MvQMainWindow.cc
index f513a71..ad26f53 100644
--- a/src/libMvQtGui/MvQMainWindow.cc
+++ b/src/libMvQtGui/MvQMainWindow.cc
@@ -24,6 +24,9 @@ MvQMainWindow::MvQMainWindow(QWidget *parent) : QMainWindow(parent), movableTool
{
QApplication::setWindowIcon(
QIcon(QPixmap(QString::fromUtf8(":/window/metview_logo"))));
+
+// Uncomment this line if you want non-native menues on Mac OS X (i.e. menues are the same as under Linux)
+ menuBar()->setNativeMenuBar(false);
menuName_[FileMenu]="&File";
menuName_[ViewMenu]="&View";
@@ -45,7 +48,6 @@ MvQMainWindow::MvQMainWindow(QWidget *parent) : QMainWindow(parent), movableTool
ZoomMenu << SelectionMenu << ToolsMenu << SettingsMenu << HelpMenu;
//setIconSize(QSize(20,20));
-
}
void MvQMainWindow::setupMenus(MenuItemMap items,MenuOption option)
diff --git a/src/libMvQtUtil/MvQNetworkProxyFactory.cc b/src/libMvQtUtil/MvQNetworkProxyFactory.cc
index 8f9c9d3..5e495e6 100644
--- a/src/libMvQtUtil/MvQNetworkProxyFactory.cc
+++ b/src/libMvQtUtil/MvQNetworkProxyFactory.cc
@@ -31,8 +31,9 @@ void MvQNetworkProxyFactory::updateSettings()
const char* useProxy = myPref( "USE_NETWORK_PROXY" );
if((useProxy != NULL))
- useProxy_=(strcmp(useProxy, "Yes") == 0 || strcmp(useProxy, "YES") ==
- strcmp(useProxy, "yes") == 0)?true:false;
+ useProxy_=( strcmp(useProxy, "Yes") == 0 ||
+ strcmp(useProxy, "YES") == 0 ||
+ strcmp(useProxy, "yes") == 0 ) ?true:false;
if(useProxy_)
{
diff --git a/src/libUtil/MvAlmostObsoleteRequest.cc b/src/libUtil/MvAlmostObsoleteRequest.cc
index aee17a5..8093f14 100644
--- a/src/libUtil/MvAlmostObsoleteRequest.cc
+++ b/src/libUtil/MvAlmostObsoleteRequest.cc
@@ -162,7 +162,7 @@ MvDataVis :: MvDataVis (svcid *i,request* r)
reply = empty_request ("");
- if (tmp = get_value(req, "_DROP_ID", 0))
+ if( (tmp = get_value(req, "_DROP_ID", 0)) )
set_value(reply, "_DROP_ID", "%s",tmp);
delete tmpfile;
@@ -189,10 +189,10 @@ MvDataVis :: SendStatus (const char* st)
const char* tmp;
set_value (status, "STATUS", "%s", st);
- if (tmp = get_value (req, "_NAME", 0))
+ if ( (tmp = get_value (req, "_NAME", 0)) )
set_value (status, "NAME", "%s", tmp);
- if (tmp = get_value (req, "_ICON_CLASS", 0))
+ if ( (tmp = get_value (req, "_ICON_CLASS", 0)) )
set_value (status, "ICON_CLASS", "%s", tmp);
send_message (id->s, status);
diff --git a/src/uPlot/BufrDecoder.cc b/src/uPlot/BufrDecoder.cc
index 549f862..2bebcc4 100644
--- a/src/uPlot/BufrDecoder.cc
+++ b/src/uPlot/BufrDecoder.cc
@@ -86,7 +86,7 @@ BufrDecoder::~BufrDecoder()
bool BufrDecoder::ReadNextData ()
{
- if ( offset_++ < groupInfo_.size() )
+ if ( offset_++ < (signed int)groupInfo_.size() )
return true;
else
return false;
diff --git a/src/uPlot/CMakeLists.txt b/src/uPlot/CMakeLists.txt
index 3d9fb79..dce9046 100644
--- a/src/uPlot/CMakeLists.txt
+++ b/src/uPlot/CMakeLists.txt
@@ -147,13 +147,9 @@ ecbuild_add_executable( TARGET uPlot
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS} ${MAGICS_DEFINITIONS} ${WEATHER_ROOM_FLAGS}
# INCLUDES /a /b /c
INCLUDES /AAA ${MAGICS_INCLUDE_DIRS} /BBB ${METVIEW_QT_INCLUDE_DIRS} /CCC ${X11_INCLUDE_DIR} /DDD ${METVIEW_STANDARD_INCLUDES} /EEE
- LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${MAGICS_LIBRARIES} ${METVIEW_ODB_API_LIBRARIES} ${X11_LIBRARIES}
+ LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper ${METVIEW_ODB_API_LIBRARIES} ${X11_LIBRARIES}
)
-
-# add this dependency manually because CMake does not pick it up otherwise
-ADD_DEPENDENCIES(uPlot MagPlusShared MagWrapper)
-
MESSAGE( STATUS "UPLOT CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} )
###nodist_bin_uPlot_SOURCES = ${uPlot_COMMON_QT_SOURCES_nodist} ${uPlot_COMMON_UI_SOURCES_nodist} \
### uPlot.moc.cpp
@@ -201,13 +197,9 @@ ecbuild_add_executable( TARGET uPlotBatch
SOURCES ${uPlotBatch_srcs}
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS} ${MAGICS_DEFINITIONS} NOMETVIEW_QT
INCLUDES ${MAGICS_INCLUDE_DIRS} ${METVIEW_QT_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES}
- LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${MAGICS_LIBRARIES} ${METVIEW_ODB_API_LIBRARIES}
+ LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper ${METVIEW_ODB_API_LIBRARIES}
)
-# add this dependency manually because CMake does not pick it up otherwise
-ADD_DEPENDENCIES(uPlotBatch MagPlusShared MagWrapper)
-
-
#-------- GeoTool ---------------------------------------------------------------
if(ENABLE_UI)
@@ -243,13 +235,9 @@ ecbuild_add_executable( TARGET GeoTool
SOURCES ${uPlotGeoTool_srcs}
DEFINITIONS ${METVIEW_EXTRA_DEFINITIONS} ${MAGICS_DEFINITIONS}
INCLUDES ${MAGICS_INCLUDE_DIRS} ${METVIEW_QT_INCLUDE_DIRS} ${X11_INCLUDE_DIR} ${METVIEW_STANDARD_INCLUDES}
- LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} ${MAGICS_LIBRARIES} ${METVIEW_ODB_API_LIBRARIES} ${X11_LIBRARIES}
+ LIBS ${METVIEW_QT_LIBRARIES} ${STANDARD_METVIEW_LIBS} MagPlus MagWrapper ${METVIEW_ODB_API_LIBRARIES} ${X11_LIBRARIES}
)
-# add this dependency manually because CMake does not pick it up otherwise
-ADD_DEPENDENCIES(GeoTool MagPlusShared MagWrapper)
-
-
set(GeoToolManager_srcs
GeoToolManager.cc
)
diff --git a/src/uPlot/CommonXSectView.cc b/src/uPlot/CommonXSectView.cc
index 635205d..2cf1ee4 100644
--- a/src/uPlot/CommonXSectView.cc
+++ b/src/uPlot/CommonXSectView.cc
@@ -49,6 +49,14 @@ CommonXSectView::~CommonXSectView()
// Empty
}
+string CommonXSectView::Name()
+{
+ char tmp[32];
+ sprintf(tmp,"CommonXSectView%d",Owner().Id());
+
+ return string(tmp);
+}
+
// Synchronous call service. Calls a service and wait its return.
bool CommonXSectView::CallService(const MvRequest &dataReq, PmContext & context, MvRequest& replyReq)
{
diff --git a/src/uPlot/CommonXSectView.h b/src/uPlot/CommonXSectView.h
index 570decb..5a4da98 100644
--- a/src/uPlot/CommonXSectView.h
+++ b/src/uPlot/CommonXSectView.h
@@ -52,8 +52,7 @@ public:
~CommonXSectView();
// -- Methods overriden from PlotModView class
- virtual string Name()
- { return "CommonXSectView" + Owner().Id(); }
+ virtual string Name();
// Call a service and wait its return
bool CallService(const MvRequest&, PmContext&, MvRequest&);
diff --git a/src/uPlot/DataBuilder.cc b/src/uPlot/DataBuilder.cc
index 1b85ef4..75ffcd8 100644
--- a/src/uPlot/DataBuilder.cc
+++ b/src/uPlot/DataBuilder.cc
@@ -63,7 +63,7 @@ DataBuilder::Execute (PmContext& context)
if ( !viewRequest )
{
// Build a default
- viewRequest = ObjectList::CreateDefaultRequest( viewName,EXPAND_NO_DEFAULT );
+ viewRequest = ObjectList::UserDefaultRequest( viewName, true );
viewRequest("_ORIGIN") = "DataBuilder";
}
pageRequest("VIEW") = viewRequest;
diff --git a/src/uPlot/ExportDialog.cc b/src/uPlot/ExportDialog.cc
index aab8493..34e0c47 100644
--- a/src/uPlot/ExportDialog.cc
+++ b/src/uPlot/ExportDialog.cc
@@ -40,6 +40,9 @@ ExportDialog::ExportDialog(int currentFrame, int totalFrames, QWidget *parent) :
// Set widget mode behaviour to "Save As"
this->setAcceptMode(QFileDialog::AcceptSave);
+ // Setting for Mac OS X
+ setOption(QFileDialog::DontUseNativeDialog,true);
+
// Restore previous gui settings
QSettings settings("ECMWF","uPlotExportDialog");
settings.beginGroup("main");
@@ -131,6 +134,11 @@ ExportDialog::~ExportDialog()
// Callback from the SAVE button
void ExportDialog::accept()
{
+ // This function is also called if the user selected a filename
+ // from the treeView. If this is the case just continue.
+ if ( sender()->objectName() == "treeView" )
+ return;
+
// Get filename from the user interface
QStringList s = selectedFiles();
string filename = s.at(0).toStdString();
diff --git a/src/uPlot/GeopointsDecoder.cc b/src/uPlot/GeopointsDecoder.cc
index bf2519f..60f7138 100644
--- a/src/uPlot/GeopointsDecoder.cc
+++ b/src/uPlot/GeopointsDecoder.cc
@@ -71,40 +71,48 @@ GeopointsDecoder::ReadNextData ()
MatchingInfo
GeopointsDecoder::CreateMatchingInfo ()
{
- MvRequest matchingRequest ("MATCHING_INFO");
+ MvRequest matchingRequest ("MATCHING_INFO");
- matchingRequest( "DATA_TYPE" ) = "GEOPOINTS";
- SetTitle(matchingRequest);
+ matchingRequest( "DATA_TYPE" ) = "GEOPOINTS";
+ SetTitle(matchingRequest);
- //-- get date and time from the first geopoint
- MvGeoPoints gpts( (const char*)metadataRequest_("PATH"), 1 );
- MvGeoP1 gp1 = gpts[0];
- long myDate = gp1.date();
+ //-- get date and time from the first geopoint
+ MvGeoPoints gpts( (const char*)metadataRequest_("PATH"), 1 );
+ MvGeoP1 gp1 = gpts[0];
+ long myDate = gp1.date();
- if( myDate > 19010101 ) //-- a very simple date value check
- {
+ if( myDate > 19010101 ) //-- a very simple date value check
+ {
matchingRequest( "DATE" ) = myDate;
long myTime = gp1.time();
if( myTime < 24 && myTime != 0 ) //-- simple check for format HH
- {
- PlotMod::Instance().MetviewError(
- "Suspicuous geopoints time; HHMM needed for overlay matching!",
- "WARN");
- }
+ {
+ PlotMod::Instance().MetviewError(
+ "Suspicuous geopoints time; HHMM needed for overlay matching!","WARN");
+ }
//-- overlay matching checks strings, add leading zeros to make format 'HHMM'
ostringstream os;
os << setfill('0') << setw(4) << myTime;
matchingRequest( "TIME" ) = os.str().c_str();
- }
- else if( myDate != 0 ) //-- date 0 is probably format XYV
- {
+ }
+ else if( myDate != 0 ) //-- date 0 is probably format XYV
+ {
//-- not adding DATE/TIME will prevent overlay matching --//
PlotMod::Instance().MetviewError("Invalid geopoints date; no overlay matching!","WARN");
- }
-
- return MatchingInfo( matchingRequest );
+ }
+
+ // Save format info
+ if ( !(const char*)metadataRequest_("FORMAT") )
+ {
+ metadataRequest_("FORMAT") = (const char*)gpts.sFormat().c_str();
+ metadataRequest_("VECTOR_FORMAT") = gpts.hasVectors();
+ if ( gpts.hasVectors() )
+ metadataRequest_("_VISDEF") = "MWIND";
+ }
+
+ return MatchingInfo( matchingRequest );
}
// Add a proper datarequest with a geopoints record
diff --git a/src/uPlot/MacroConverter.cc b/src/uPlot/MacroConverter.cc
index 3610a40..7f82938 100644
--- a/src/uPlot/MacroConverter.cc
+++ b/src/uPlot/MacroConverter.cc
@@ -282,7 +282,7 @@ Cached CurveFamilyMacroConverter::Convert(MvRequest &req,ObjectInfo *oi )
oi->FormatLine("CURVES", nameList,"" );
}
- oi->PutNewLine(Cached("\t) ") );
+ oi->PutNewLine(Cached(" ) ") );
}
else
oi->ConvertRequestToMacro ( req, PUT_END, returnName,curveType);
@@ -309,8 +309,8 @@ Cached ComputeMacroConverter::Convert(MvRequest & req,ObjectInfo *oi )
if ( ! in ) // Fall back on the incomplete way
{
const char *formula = req("FORMULA");
- oi->PutNewLine("# Remember to import any icons used in formula.");
- oi->PutNewLine("#Just click in macro after this line, and drop the icons.");
+ oi->PutNewLine("# Remember to import any icons used in formula");
+ oi->PutNewLine("# Just click in macro after this line, and drop the icons");
oi->PutNewLine ( duName + Cached(" = ") + Cached(formula) );
}
else
@@ -341,25 +341,24 @@ Cached ComputeMacroConverter::Convert(MvRequest & req,ObjectInfo *oi )
Cached DataMacroConverter::Convert(MvRequest &req,ObjectInfo *oi)
{
- // Obtain the object name
- Cached duName = ObjectInfo::GenerateName(req);
-
- // Obtain the fully qualified path to the object
-// Cached fileName = req("PATH");
- const char* mvPath = req( "_NAME" );
- if ( mvPath )
- {
- // Get the full path and check if it can be opened
- Cached filename = MakeUserPath(mvPath);
- if ( !FileCanBeOpened(filename,"r") )
- filename = Cached("Please provide here an input filename");
-
- oi->PutNewLine ( Cached ( "# Importing ") + duName );
- oi->PutNewLine ( duName + Cached(" = read ( \"") + filename + Cached("\")") );
- oi->PutNewLine ( " " );
- }
- else
- duName = "";
-
- return duName;
+ // Obtain the object name
+ Cached duName = ObjectInfo::GenerateName(req);
+
+ // Obtain the fully qualified path to the object
+ const char* mvPath = req( "_NAME" );
+ if ( mvPath )
+ {
+ // Get the full path and check if it can be opened
+ Cached filename = MakeUserPath(mvPath);
+ if ( !FileCanBeOpened(filename,"r") )
+ filename = Cached("Please provide here an input filename");
+
+ oi->PutNewLine ( "" );
+ oi->PutNewLine ( Cached ( "# Importing ") + duName );
+ oi->PutNewLine ( duName + Cached(" = read ( \"") + filename + Cached("\")") );
+ }
+ else
+ duName = "";
+
+ return duName;
}
diff --git a/src/uPlot/MacroVisitor.cc b/src/uPlot/MacroVisitor.cc
index a6bb271..a881c6f 100644
--- a/src/uPlot/MacroVisitor.cc
+++ b/src/uPlot/MacroVisitor.cc
@@ -92,10 +92,10 @@ MacroVisitor::WriteProlog()
fprintf ( filePtr_, "# For: %s (%s)\n",who->pw_name, who->pw_gecos );
fprintf ( filePtr_, "# \n" );
fprintf ( filePtr_, "# Disclaimer:\n" );
- fprintf ( filePtr_, "# This macro is to be used primarily as a framework. \n" );
- fprintf ( filePtr_, "# Some macros generated in this manner may not work \n" );
- fprintf ( filePtr_, "# as expected and in such cases you may need to \n" );
- fprintf ( filePtr_, "# fine-tune the macro manually! \n" );
+ fprintf ( filePtr_, "# This macro is to be used primarily as a framework.\n" );
+ fprintf ( filePtr_, "# Some macros generated in this manner may not work\n" );
+ fprintf ( filePtr_, "# as expected and in such cases you may need to\n" );
+ fprintf ( filePtr_, "# fine-tune the macro manually!\n" );
}
// -- METHOD: WriteTrailer
@@ -105,40 +105,41 @@ MacroVisitor::WriteProlog()
void
MacroVisitor::WriteTrailer()
{
- // Set the device Information
- deviceInfo_.WriteDescription ( filePtr_ );
+ // Set the device Information
+ deviceInfo_.WriteDescription( filePtr_ );
- // Set build layout function
- fprintf(filePtr_,"# Call function to build layout (defined at end of macro)\n");
- fprintf(filePtr_,"display_window = build_layout()\n");
+ fprintf(filePtr_,"\n# Drops to SuperPage\n");
+ superpageDrops_.WriteDescription ( filePtr_ );
- fprintf(filePtr_,"\n# Drops to SuperPage.\n");
- superpageDrops_.WriteDescription ( filePtr_ );
+ fprintf(filePtr_,"\n# Drops to Page\n");
+ pageDrops_.WriteDescription ( filePtr_ );
- fprintf(filePtr_,"\n# Drops to Page.\n");
- pageDrops_.WriteDescription ( filePtr_ );
+ // If there are no drops associated to the pages,
+ // we still need to plot something
+ if ( pageDrops_.HasAction() == false && superpageDrops_.HasAction() == false )
+ {
+ // Set build layout function
+ fprintf (filePtr_,"# Call function to build layout (defined at end of macro)");
+ fprintf (filePtr_,"dw = build_layout()\n");
- // If there are no drops associated to the pages,
- // we still need to plot something
- if ( pageDrops_.HasAction() == false &&
- superpageDrops_.HasAction() == false )
- fprintf ( filePtr_, "plot ( display_window ) \n");
+ // Write the plot command
+ fprintf (filePtr_, "plot ( dw )\n");
+ }
- fprintf ( filePtr_, "\n# End of main program\n" );
+ fprintf ( filePtr_, "\n# End of main program\n" );
- // Output the page Drops and Contents
- fprintf(filePtr_,"\n# Function to build the layout.\n");
- fprintf(filePtr_,"function build_layout()\n\n");
+ // Output the page Drops and Contents
+ fprintf(filePtr_,"\n# Function to build the layout\n");
+ fprintf(filePtr_,"function build_layout()\n\n");
- // Add some indentation since this is now in a function
- pageInfo_.LinePrefix(" ");
- superpageInfo_.LinePrefix(" ");
+ // Add some indentation since this is now in a function
+ pageInfo_.LinePrefix(" ");
+ superpageInfo_.LinePrefix(" ");
- pageInfo_.WriteDescription( filePtr_ );
-
- superpageInfo_.WriteDescription( filePtr_ );
- fprintf(filePtr_,"\nend build_layout\n");
+ pageInfo_.WriteDescription( filePtr_ );
+ superpageInfo_.WriteDescription( filePtr_ );
+ fprintf(filePtr_,"\nend build_layout\n");
}
// -- METHOD: Visit ( SuperPage& )
@@ -150,13 +151,13 @@ MacroVisitor::WriteTrailer()
void
MacroVisitor::Visit ( SuperPage& superpage )
{
- macroName_ = superpage.MacroName();
+ macroName_ = superpage.MacroName();
- superpage.DescribeDevice ( deviceInfo_ );
+ superpage.DescribeDevice ( deviceInfo_ );
- superpage.DescribeYourself ( superpageInfo_ );
+ superpage.DescribeYourself ( superpageInfo_ );
- superpage.DescribeDrops ( superpageDrops_,vdMap_ );
+ superpage.DescribeDrops ( superpageDrops_,vdMap_ );
}
// -- METHOD: Visit ( Page& )
@@ -167,14 +168,15 @@ MacroVisitor::Visit ( SuperPage& superpage )
void
MacroVisitor::Visit ( Page& page)
{
- // Print the contents of the page
- page.DescribeYourself ( pageInfo_ );
+ // Print the contents of the page
+ page.DescribeYourself ( pageInfo_ );
- // PrintData Units and VisDefs
- page.DescribeDrops ( pageDrops_, vdMap_ );
+ // PrintData Units and VisDefs
+ page.DescribeDrops ( pageDrops_, vdMap_ );
}
+
void
MacroVisitor::Visit ( SubPage& )
{
- // Empty
+ // Empty
}
diff --git a/src/uPlot/MagPlusService.cc b/src/uPlot/MagPlusService.cc
index 96f9fae..8ccd80c 100644
--- a/src/uPlot/MagPlusService.cc
+++ b/src/uPlot/MagPlusService.cc
@@ -72,6 +72,22 @@ MagPlusService::endOfTask ( MvTask* task )
cout << "MAGPLUSSERVICE::endOfTask" << endl;
}
+void
+MagPlusService::decode( MvRequest& req, const string& sjson )
+{
+ // Structure MvMagRequest requires that the input MvRequest has a Verb
+ if ( !req.getVerb() )
+ req.setVerb("GCoord");
+
+ MvMagRequest magReq(req);
+
+ // Translate json string to a MagRequest
+ magplus_->decode(magReq,sjson);
+
+ // Get the equivalent MvRequest
+ req = magReq.getRequest();
+}
+
#if 0
void
MagPlusService::RegisterObserver(MagicsObserver* observer)
diff --git a/src/uPlot/MagPlusService.h b/src/uPlot/MagPlusService.h
index 0a71094..4c557f0 100644
--- a/src/uPlot/MagPlusService.h
+++ b/src/uPlot/MagPlusService.h
@@ -118,6 +118,9 @@ public:
void read(const string& file) { request_.read(file.c_str()); }
MagRequest& justOneRequest() { MvRequest sub = request_.justOneRequest();
return *(new MvMagRequest(sub)); }
+
+ MvRequest& getRequest() { return request_; }
+
protected:
mutable MvRequest request_;
mutable map<string, MvMagParam> parameters_;
@@ -152,6 +155,9 @@ public:
void SetRequest ( const MvRequest& );
// void SetRequest ( const MvRequest& ){}
+ // Decode the geographical coordinates in json string to a MvRequest class
+ void decode( MvRequest&, const string& );
+
// Register to magics observer
// void RegisterObserver(MagicsObserver* observer);
// void RegisterObserver(MagicsObserver* observer){}
diff --git a/src/uPlot/MagicsTranslator.cc b/src/uPlot/MagicsTranslator.cc
index 1b2bb8d..a54640f 100644
--- a/src/uPlot/MagicsTranslator.cc
+++ b/src/uPlot/MagicsTranslator.cc
@@ -383,6 +383,7 @@ PageTranslator::Execute ( const MvRequest& viewRequest )
CopySomeParameters(metviewRequest, magicsRequest, "PAGE_FRAME");
CopySomeParameters(metviewRequest, magicsRequest, "SUBPAGE_FRAME");
CopySomeParameters(metviewRequest, magicsRequest, "SUBPAGE_METADATA");
+ CopySomeParameters(metviewRequest, magicsRequest, "SUBPAGE_CLIPPING");
if ( (const char*)metviewRequest( "SUBPAGE_VERTICAL_AXIS_WIDTH" ) )
magicsRequest( "SUBPAGE_VERTICAL_AXIS_WIDTH" ) = (double)metviewRequest( "SUBPAGE_VERTICAL_AXIS_WIDTH" );
diff --git a/src/uPlot/MapView.cc b/src/uPlot/MapView.cc
index 96d2937..52e03c8 100644
--- a/src/uPlot/MapView.cc
+++ b/src/uPlot/MapView.cc
@@ -22,6 +22,7 @@
#include "GraphicsEngine.h"
#include "Page.h"
#include "PmContext.h"
+#include "MagPlusService.h"
#include "MvDecoder.h"
#include "PlotMod.h"
#include "PlotModTask.h"
@@ -635,19 +636,36 @@ MapView::DrawForeground ( )
void
MapView::DescribeYourself ( ObjectInfo& description )
{
- // Translate MAPVIEW to GEOVIEW. Add GEOVIEW parameters, temporarily.
- if ( (const char*)viewRequest_("AREA") )
- viewRequest_("MAP_AREA_DEFINITION") = "CORNERS";
+ // Translate MAPVIEW to GEOVIEW by adding GEOVIEW parameters
+ MvRequest tmpRequest = viewRequest_;
+ if ( (const char*)tmpRequest("AREA") )
+ tmpRequest("MAP_AREA_DEFINITION") = "CORNERS";
+
+ // Translate json zoom definition to a Magics request
+ if ( (const char*)tmpRequest("_ZOOM_DEFINITION") )
+ {
+ MvRequest req;
+ string sjson = (const char*)tmpRequest("_ZOOM_DEFINITION");
+ MagPlusService::Instance().decode(req, sjson );
+
+ // Translate Magics request to a Metview request
+ if ( (const char*)req("subpage_map_projection") )
+ tmpRequest("MAP_PROJECTION") = (const char*)req("subpage_map_projection");
+
+ if ( (const char*)req("subpage_map_area_definition") )
+ tmpRequest("MAP_AREA_DEFINITION") = (const char*)req("subpage_map_area_definition");
+
+ tmpRequest("AREA") = req("subpage_lower_left_latitude");
+ tmpRequest("AREA") +=req("subpage_lower_left_longitude");
+ tmpRequest("AREA") +=req("subpage_upper_right_latitude");
+ tmpRequest("AREA") +=req("subpage_upper_right_longitude");
+ }
// Convert my request to macro
string defView = DEFAULTVIEW;
std::transform(defView.begin(), defView.end(), defView.begin(), ::tolower);
set<Cached> skipSet;
- description.ConvertRequestToMacro ( viewRequest_, PUT_END, MacroName().c_str(),defView.c_str(),skipSet);
-
- // Remove temporary GEOVIEW parameters
- if ( (const char*)viewRequest_("AREA") )
- viewRequest_.unsetParam("MAP_AREA_DEFINITION");
+ description.ConvertRequestToMacro ( tmpRequest, PUT_END, MacroName().c_str(),defView.c_str(),skipSet);
}
bool MapView::CallService(const MvRequest &req, PmContext &context)
diff --git a/src/uPlot/ObjectInfo.cc b/src/uPlot/ObjectInfo.cc
index c163131..73e8caf 100644
--- a/src/uPlot/ObjectInfo.cc
+++ b/src/uPlot/ObjectInfo.cc
@@ -33,9 +33,9 @@ NamesMap ObjectInfo::namesMap_;
//
// -- OUTPUT :
void
-ObjectInfo::PutNewLine ( const Cached& newLine )
+ObjectInfo::PutNewLine ( const Cached& newLine )
{
- description_.push_back( newLine );
+ description_.push_back( newLine );
}
void
@@ -159,7 +159,7 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
for (i = 0; i < (int)strlen(macrolower); i++ )
macrolower[i] = tolower(macrolower[i]);
- PutNewLine( ObjectInfo::SpaceToUnderscore(varName) + Cached(" = ") + Cached(macrolower) + Cached("( ") );
+ PutNewLine( ObjectInfo::SpaceToUnderscore(varName) + Cached(" = ") + Cached(macrolower) + Cached("(") );
delete [] macrolower;
@@ -221,9 +221,9 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
FormatLine((*ii).first,(*ii).second,comma,size);
}
- if ( lastComma == PUT_END )
- this->PutNewLine ( Cached("\t)") );
- }
+ if ( lastComma == PUT_END )
+ this->PutNewLine ( " )" );
+ }
}
// -- METHOD :
@@ -237,28 +237,28 @@ ObjectInfo::ConvertRequestToMacro( MvRequest& inRequest,
Cached
ObjectInfo::ConvertDataUnitToMacro ( MvIcon& dataUnit )
{
- // Retrieve the request associated to the dataUnit
- MvRequest duRequest = dataUnit.Request();
- Cached objectName;
+ // Retrieve the request associated to the dataUnit
+ MvRequest duRequest = dataUnit.Request();
+ Cached objectName;
- if ( isPrint_ )
- {
+ if ( isPrint_ )
+ {
Cached fileName;
MvRequest svcRequest = dataUnit.SvcRequest ();
if ( svcRequest.getVerb() == NETCDF )
- fileName = svcRequest ( "PATH" );
+ fileName = svcRequest ( "PATH" );
else if ( duRequest.getVerb() == GRIB )
- fileName = duRequest ( "PATH" );
-
- if ( FileCanBeOpened ( fileName, "r" ) )
- {
- Cached objectName = Cached ("DataUnit") + dataUnit.Id();
- this->PutNewLine ( Cached ( "# Importing ") + objectName );
- this->PutNewLine ( objectName + Cached(" = read ( \"") + fileName + Cached("\")") );
- return objectName;
- }
- }
+ fileName = duRequest ( "PATH" );
+
+ if ( FileCanBeOpened ( fileName, "r" ) )
+ {
+ Cached objectName = Cached ("DataUnit") + dataUnit.Id();
+ this->PutNewLine ( Cached ( "# Importing ") + objectName );
+ this->PutNewLine ( objectName + Cached(" = read(\"") + fileName + Cached("\")") );
+ return objectName;
+ }
+ }
int use_mode = duRequest("_USE_MODE");
@@ -269,19 +269,18 @@ ObjectInfo::ConvertDataUnitToMacro ( MvIcon& dataUnit )
{
MvRequest modeRequest = duRequest.getSubrequest("_MODE");
if ( (const char *) duRequest("_NAME") )
- modeRequest("_NAME") = duRequest("_NAME");
+ modeRequest("_NAME") = duRequest("_NAME");
if ( (const char *) duRequest("_CLASS") )
- modeRequest("_CLASS") = duRequest("_CLASS");
+ modeRequest("_CLASS") = duRequest("_CLASS");
if ( (const char *) duRequest("_APPL") )
- modeRequest("_APPL") = duRequest("_APPL");
+ modeRequest("_APPL") = duRequest("_APPL");
- modeRequest.print();
MvIcon tmpIcon(modeRequest);
// Call itself with the mode request.
objectName = ConvertDataUnitToMacro(tmpIcon);
}
- return objectName;
+ return objectName;
}
Cached
@@ -341,7 +340,7 @@ ObjectInfo::WriteDescription ( FILE* filePtr )
while ( line != description_.end() )
{
Cached newLine = (*line);
- fprintf ( filePtr, "%s%s \n", linePrefix_.c_str(), (const char*) newLine );
+ fprintf ( filePtr, "%s%s\n", linePrefix_.c_str(), (const char*)newLine );
++line;
}
@@ -701,77 +700,77 @@ ObjectInfo::Convert(MvRequest &req)
void ObjectInfo::FormatLine(const Cached ¶m, const Cached &val, const Cached &comma, int width)
{
- ostrstream str;
- str.setf(ios::left);
- str << "\t\t";str.width(width);
- str << param;
- str << ": " << val << comma << ends;
+ ostrstream str;
+ str.setf(ios::left);
+ str << " ";str.width(width);
+ str << param;
+ str << ": " << val << comma << ends;
- const char *cStr = str.str();
+ const char *cStr = str.str();
- PutNewLine(cStr);
- delete [] cStr;
+ PutNewLine(cStr);
+ delete [] cStr;
}
-Cached ObjectInfo::FormatValue(const char *val, const char *param,
- const Cached ¯oName)
+Cached ObjectInfo::FormatValue(const char *val, const char *param, const Cached ¯oName)
{
- string sval;
- bool addQuotes = false;
-
- // Multiple lines
- if(strstr(val,"\n") != 0)
- {
- char *pch;
- int len = strlen(val);
- if(len > 0)
- {
- char *buff=(char*) calloc(len+1,sizeof(char));
- sprintf(buff,"%s",val);
- pch = strtok (buff,"\n");
- //fprintf(f,"\"%s \"",pch);
- sval = sval + "\"" + pch + " \"";
-
- while (pch != NULL)
- {
- pch = strtok (NULL, "\n");
- if(pch != NULL)
- {
- //fprintf(f," &\n",pch);
- //fprintf(f,"%s%s%s%s%s\"%s \"",tab,tab,tab,tab,tab,pch);
- sval += " &\n";
- sval = sval + "\t\t\t\t\"" + pch + " \"";
- }
- }
+ string sval;
+ bool addQuotes = false;
- free(buff);
- }
+ // Multiple lines
+ if(strstr(val,"\n") != 0)
+ {
+ char *pch;
+ int len = strlen(val);
+ if(len > 0)
+ {
+ char *buff = (char*) calloc(len+1,sizeof(char));
+ sprintf(buff,"%s",val);
+ pch = strtok (buff,"\n");
+ sval = sval + "\"" + pch + " \"";
+
+ while (pch != NULL)
+ {
+ pch = strtok (NULL, "\n");
+ if(pch != NULL)
+ {
+ sval += " &\n";
+ sval = sval + " \"" + pch + " \"";
+ }
+ }
+
+ free(buff);
+ }
+
+ return Cached(sval.c_str());
+ }
- return Cached(sval.c_str());
- }
+ // Single line
+ // Put all names under '' symbols
+ if ( ( ObjectInfo::IsAName ( val ) ) || ( strcmp(val,"") == 0 ) ||
+ ( ( strcmp(param, "TIME" ) == 0 ) && ( macroName == Cached ("retrieve") ) ) )
+ addQuotes = true;
- // Single line
- // Put all names under '' symbols
- if ( ( ObjectInfo::IsAName ( val ) ) || ( strcmp(val,"") == 0 ) ||
- ( ( strcmp(param, "TIME" ) == 0 ) && ( macroName == Cached ("retrieve") ) ) )
- addQuotes = true;
+ if ( addQuotes )
+ sval = "\"";
- if ( addQuotes ) sval = "\"";
- while ( *val )
- {
- if ( *val == '\\' ) sval += '\\';
+ while ( *val )
+ {
+ if ( *val == '\\' )
+ sval += '\\';
- // If dot is first character and it's a number, add a 0 at the beginning.
- if ( *val == '.' && sval.length() == 0 && is_number(val) )
- sval += "0";
+ // If dot is first character and it's a number, add a 0 at the beginning.
+ if ( *val == '.' && sval.length() == 0 && is_number(val) )
+ sval += "0";
- sval += *val;
- val++;
- }
+ sval += *val;
+ val++;
+ }
- if ( addQuotes ) sval += "\"";
+ if ( addQuotes )
+ sval += "\"";
- return Cached(sval.c_str());
+ return Cached(sval.c_str());
}
int ObjectInfo::MaximumParameterNameLength( MvRequest& inRequest)
diff --git a/src/uPlot/ObjectList.cc b/src/uPlot/ObjectList.cc
index 86aa998..fe6baee 100644
--- a/src/uPlot/ObjectList.cc
+++ b/src/uPlot/ObjectList.cc
@@ -446,14 +446,18 @@ ObjectList::UserPreferencesRequest(const char* name)
// -- METHOD : UserDefaultRequest
//
// -- PURPOSE: For each type of object, read a request
-// based on the user's default
+// based on the user's default.
+// Parameter EXPAND equals true means that if the output request
+// contains any parameter, which is an icon (subrequest), then it
+// will be expanded
//
// -- INPUT : request name
+// flag indicating to expand all subrequests
//
// -- OUTPUT : request
//
MvRequest
-ObjectList::UserDefaultRequest(const char* requestName)
+ObjectList::UserDefaultRequest(const char* requestName, bool expand)
{
require ( requestName != 0 );
@@ -471,7 +475,7 @@ ObjectList::UserDefaultRequest(const char* requestName)
MvRequest defaultRequest;
if ( FileCanBeOpened ( fullName.c_str(), "r" ) == true )
{
- defaultRequest.read (fullName.c_str());
+ defaultRequest.read (fullName.c_str(),expand);
if ( defaultRequest.countParameters() == 0 )
defaultRequest = ObjectList::CreateDefaultRequest(requestName,0,path.c_str());
diff --git a/src/uPlot/ObjectList.h b/src/uPlot/ObjectList.h
index 924e7fc..3029f15 100644
--- a/src/uPlot/ObjectList.h
+++ b/src/uPlot/ObjectList.h
@@ -74,17 +74,16 @@ public:
static Cached DefaultVisDefClass ( const char* dataUnitVerb );
- static bool CheckValidVisDef ( const char*, const char*, const char* );
- static bool CheckValidVisDef ( const char*, const char*, int = 0);
- static bool CheckValidVisDefList ( const char*, MvIconList&, const char* = 0 );
- //static bool CheckValidVisDef ( const char* dataunitClass, const MvRequest& reqst );
+ static bool CheckValidVisDef ( const char*, const char*, const char* );
+ static bool CheckValidVisDef ( const char*, const char*, int = 0);
+ static bool CheckValidVisDefList ( const char*, MvIconList&, const char* = 0 );
- static void VisDefNDimFlags ( int, vector<string>& );
+ static void VisDefNDimFlags ( int, vector<string>& );
- static MvRequest UserPreferencesRequest ( const char* verb );
- static MvRequest UserDefaultRequest ( const char* requestName );
+ static MvRequest UserPreferencesRequest ( const char* );
+ static MvRequest UserDefaultRequest ( const char*, bool expand = false );
- static MvRequest ExpandRequest ( const MvRequest&, long );
+ static MvRequest ExpandRequest ( const MvRequest&, long );
// Create a request in case there isn't one.
// expandFlag = 0 means use the expand flag value from the ObjectList.
diff --git a/src/uPlot/Page.cc b/src/uPlot/Page.cc
index 4baa35b..129aff1 100644
--- a/src/uPlot/Page.cc
+++ b/src/uPlot/Page.cc
@@ -873,22 +873,31 @@ Page::ReplaceArea ( const Location& zoomCoord, int izoom )
void
Page::DescribeYourself ( ObjectInfo& description )
{
- description.PutNewLine ("#PageDescription ");
-
- // Ask the view to describe itself
- myView_->DescribeYourself ( description );
-
- // Convert the page description to the macro syntax
- set<Cached> skipSet;
- skipSet.insert("VIEW");
- description.ConvertRequestToMacro ( myRequest_, PUT_LAST_COMMA, MacroName().c_str(), "plot_page", skipSet);
-
- // Include the view information
- string viewName = myView_->MacroName();
- description.FormatLine ("VIEW",viewName.c_str(),"" );
-
- // Close the page description
- description.PutNewLine ("\t) " );
+ description.PutNewLine ("#PageDescription");
+
+ // Ask the view to describe itself
+ myView_->DescribeYourself ( description );
+
+ // Remove extra parameters that have not been used in the current
+ // implementation of the PLOT_PAGE icon (FAMI, Oct-2015, METV-4.5.7)
+ MvRequest myRequest = myRequest_;
+ myRequest.unsetParam("ROWS");
+ myRequest.unsetParam("COLUMNS");
+ myRequest.unsetParam("PAGE_X_GAP");
+ myRequest.unsetParam("PAGE_Y_GAP");
+
+ // Convert the page description to the macro syntax
+ set<Cached> skipSet;
+ skipSet.insert("VIEW");
+ description.ConvertRequestToMacro ( myRequest, PUT_LAST_COMMA, MacroName().c_str(), "plot_page", skipSet);
+
+ // Include the view information
+ int size = description.MaximumParameterNameLength(myRequest);
+ string viewName = myView_->MacroName();
+ description.FormatLine ("VIEW",viewName.c_str(),"",size );
+
+ // Close the page description
+ description.PutNewLine (")" );
}
void
diff --git a/src/uPlot/Presentable.cc b/src/uPlot/Presentable.cc
index 7a4fec3..1e8e105 100644
--- a/src/uPlot/Presentable.cc
+++ b/src/uPlot/Presentable.cc
@@ -232,41 +232,6 @@ Presentable::~Presentable()
(*j)->Dead(this);
}
-#if 0
-Cached
-Presentable::Class()
-{
- // Cached name = ObjectInfo::ObjectName ( myRequest_ );
- //Cached path = ObjectInfo::ObjectPath ( myRequest_ );
-
- return ObjectInfo::IconClass (myRequest_);
-}
-
-// -- METHOD : SuperPageName
-//
-// -- PURPOSE: Provide the name of the superpage associated
-// to a presentable ( the main branch of the tree)
-// -- INPUT : (none)
-//
-// -- OUTPUT : The name of the superpage (with spaces)
-Cached
-Presentable::SuperPageName()
-{
- return myParent_->SuperPageName();
-}
-
-
-// -- METHOD: Close
-//
-// -- PURPOSE: Delete the superpage and its contents
-//
-void
-Presentable::Close()
-{
- myParent_->Close();
-}
-#endif
-
string
Presentable::Name()
{
@@ -744,43 +709,43 @@ Presentable::SetDrawingArea ( Location loc )
bool
Presentable::DefaultVisDefList ( const char* className, MvIconList& visdefList, int type)
{
- require (className != 0);
+ require (className != 0);
- bool usingDefault = false;
- bool found = false;
+ bool usingDefault = false;
+ bool found = false;
- // Retrieve the Icon Data Base
- MvIconDataBase& iconDataBase = this->IconDataBase();
+ // Retrieve the Icon Data Base
+ MvIconDataBase& iconDataBase = this->IconDataBase();
- // Try to find a visdef associated to the presentable
- visdefList.clear(); //initialise list
- if ( type == GETBYVISDEF )
- {
- MvIconList tmpList;
- //iconDataBase.VisDefListByPresentableId(presentableId_,tmpList);
- iconDataBase.RetrieveIcon(PRES_VISDEF_REL,presentableId_,tmpList);
- MvListCursor ii;
- MvIcon currentVisDef;
- for ( ii = tmpList.begin(); ii != tmpList.end(); ii++ )
- {
- currentVisDef = *ii;
- if ( currentVisDef.Request().getVerb() == Cached(className) )
- visdefList.push_back(currentVisDef);
- }
- found = visdefList.size() > 0;
- }
- else
- found = iconDataBase.VisDefListByDataUnitAndPresentableId( presentableId_, className, visdefList );
-
- // If not found, try to find Visdefs up in the tree
- if ( !found )
- usingDefault = myParent_->DefaultVisDefList(className, visdefList,type);
- else //If Visdef(s) are found, check if there is at least one valid.
- { //Be careful, only make this check if type is GETBYDATAUNIT
- if ( type != GETBYVISDEF && !ObjectList::CheckValidVisDefList ( className, visdefList ) )
- usingDefault = myParent_->DefaultVisDefList(className, visdefList,type);
- }
- ensure(visdefList.size() > 0);
+ // Try to find a visdef associated to the presentable
+ visdefList.clear(); //initialise list
+ if ( type == GETBYVISDEF )
+ {
+ MvIconList tmpList;
+ iconDataBase.RetrieveIcon(PRES_VISDEF_REL,presentableId_,tmpList);
+ MvListCursor ii;
+ MvIcon currentVisDef;
+ for ( ii = tmpList.begin(); ii != tmpList.end(); ii++ )
+ {
+ currentVisDef = *ii;
+ if ( currentVisDef.Request().getVerb() == className )
+ visdefList.push_back(currentVisDef);
+ }
+ found = visdefList.size() > 0;
+ }
+ else
+ found = iconDataBase.VisDefListByDataUnitAndPresentableId( presentableId_, className, visdefList );
+
+ // If not found, try to find Visdefs up in the tree
+ if ( !found )
+ usingDefault = myParent_->DefaultVisDefList(className, visdefList,type);
+ else //If Visdef(s) are found, check if there is at least one valid.
+ { //Be careful, only make this check if type is GETBYDATAUNIT
+ if ( type != GETBYVISDEF && !ObjectList::CheckValidVisDefList ( className, visdefList ) )
+ usingDefault = myParent_->DefaultVisDefList(className, visdefList,type);
+ }
+
+ ensure(visdefList.size() > 0);
// FAMI022012 Remove this code temporarily. In the new visualisation scheme
// the DataObject::DrawDataVisDef() function is in charge to insert Visdefs
@@ -1088,108 +1053,136 @@ Presentable::Reset()
void
Presentable::DescribeDrops ( ObjectInfo& myDescription, MacroVisDefMap& vdMap )
{
- // Retrieve the Icon Data Base
- MvIconDataBase& dataBase = this->IconDataBase();
-
- // Find any ptexts associated with the presentable.
- MvIconList ptextList;
- //dataBase.TextListByPresentableId ( Id(), ptextList );
- dataBase.RetrieveIcon ( PRES_TEXT_REL, Id(), ptextList );
+ // Retrieve the Icon Data Base
+ MvIconDataBase& dataBase = this->IconDataBase();
- // Find the list of Visdefs associated to the presentable
- MvIconList visdefList;
- //dataBase.VisDefListByPresentableId ( Id(), visdefList );
- dataBase.RetrieveIcon(PRES_VISDEF_REL, Id(), visdefList );
+ // Get an indexed name for the page. Need to be called even if
+ // there are no drops, beacuse it updates the index.
+ string macroIndexName = this->MacroPlotIndexName();
- // Find the list of data units associated to the presentable
- MvIconList dataUnitList;
- //dataBase.DataUnitListByPresentableId ( Id(), dataUnitList );
- dataBase.RetrieveIcon ( PRES_DATAUNIT_REL, Id(), dataUnitList );
+ // Find any texts associated with the presentable
+ MvIconList ptextList;
+ dataBase.RetrieveIcon ( PRES_TEXT_REL, Id(), ptextList );
- // Get an indexed name for the page. Need to be called even if
- // there are no drops, beacuse it updates the index.
- string macroIndexName = this->MacroPlotIndexName();
+ // Describe texts
+ bool first = true;
+ string ptextDrops;
+ MvListCursor lCursor;
+ for ( lCursor = ptextList.begin(); lCursor != ptextList.end(); ++lCursor)
+ {
+ MvIcon icon = *lCursor;
+ MvRequest iconRequest = icon.Request();
+ if ( (const char*)iconRequest("_SKIP_MACRO") || (const char*)iconRequest("_DEFAULT") )
+ continue;
- // If nothing attached, just return.
- //if ( dataUnitList.size() == 0 && visdefList.size() == 0 && ptextList.size() == 0 )
- //return;
+ if ( first )
+ {
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# Title and annotations descriptions" );
+ first = false;
+ }
+ string sdesc = (const char*)myDescription.Convert(iconRequest);
+ ptextDrops = ptextDrops + ", " + sdesc;
+ }
- Cached listDrops, ptextDrops;
- myDescription.PutNewLine ( " " );
- myDescription.PutNewLine ( "# Data and Visualisation parameters" );
- myDescription.PutNewLine ( " " );
+ // Find legend associated with the presentable
+ MvIconList mlegList;
+ dataBase.RetrieveIcon ( PRES_LEGEND_REL, Id(), mlegList );
- MvListCursor ptCursor;
- for ( ptCursor = ptextList.begin(); ptCursor != ptextList.end(); ++ptCursor)
- {
- MvIcon currentpt = *ptCursor;
- MvRequest currentptRequest = currentpt.Request();
- if ( (const char*)currentptRequest("_SKIP_MACRO") || (const char*)currentptRequest("_DEFAULT") )
- continue;
+ // Describe legend
+ first = true;
+ string mlegDrops;
+ for ( lCursor = mlegList.begin(); lCursor != mlegList.end(); ++lCursor)
+ {
+ MvIcon icon = *lCursor;
+ MvRequest iconRequest = icon.Request();
+ if ( (const char*)iconRequest("_SKIP_MACRO") || (const char*)iconRequest("_DEFAULT") )
+ continue;
- Cached ptextName = myDescription.Convert( currentptRequest);
- ptextDrops = ptextDrops + Cached (", " ) + ptextName;
- }
+ if ( first )
+ {
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# Legend description" );
+ first = false;
+ }
+ string sdesc = (const char*)myDescription.Convert(iconRequest);
+ mlegDrops = mlegDrops + ", " + sdesc;
+ }
- MvIcon dummy;
- DescribeVisDefList(myDescription,visdefList,dummy,listDrops,true,vdMap);
+ // Find the list of Visdefs associated to the presentable
+ MvIconList visdefList;
+ dataBase.RetrieveIcon ( PRES_VISDEF_REL, Id(), visdefList );
- MvListCursor du = dataUnitList.begin();
- while ( du != dataUnitList.end() )
- {
- MvIcon currentDataUnit = *du;
- if ( (int)currentDataUnit.Request()("_SKIP_MACRO") )
- {
- ++du;
- continue;
- }
+ // Describe isolated visdefs (not connected to the data)
+ string listDrops;
+ MvIcon dummy;
+ DescribeVisDefList(myDescription,visdefList,dummy,listDrops,true,vdMap);
- int use_mode = currentDataUnit.Request()("_USE_MODE");
+ // Find the list of data units associated to the presentable
+ MvIconList dataUnitList;
+ dataBase.RetrieveIcon ( PRES_DATAUNIT_REL, Id(), dataUnitList );
- // Convert the data unit to macro
- Cached dataUnitName = myDescription.ConvertDataUnitToMacro ( currentDataUnit );
- if ( ! strcmp("",dataUnitName) )
- {
- ++du;
- continue;
- }
+ // Describe dataunits and associated visdefs
+ MvListCursor du = dataUnitList.begin();
+ while ( du != dataUnitList.end() )
+ {
+ MvIcon currentDataUnit = *du;
+ if ( (int)currentDataUnit.Request()("_SKIP_MACRO") )
+ {
+ ++du;
+ continue;
+ }
- listDrops = listDrops + Cached (", " ) + dataUnitName;
+ int use_mode = currentDataUnit.Request()("_USE_MODE");
- if ( use_mode )
- {
- ++du;
- continue;
- }
+ // Convert the data unit to macro
+ string dataUnitName = (const char*)myDescription.ConvertDataUnitToMacro ( currentDataUnit );
+ if ( dataUnitName.empty() )
+ {
+ ++du;
+ continue;
+ }
- // Find all visdefs associated to the data unit
- visdefList.erase(visdefList.begin(),visdefList.end() );
- dataBase.RetrieveVisDefList ( (*du) , visdefList );
+ listDrops = listDrops + string(", ") + dataUnitName;
- DescribeVisDefList(myDescription,visdefList,*du,listDrops,true,vdMap );
- ++du;
- }
+ if ( use_mode )
+ {
+ ++du;
+ continue;
+ }
+ // Find all visdefs associated to the data unit
+ visdefList.erase(visdefList.begin(),visdefList.end() );
+ dataBase.RetrieveVisDefList ( (*du) , visdefList );
+ DescribeVisDefList(myDescription,visdefList,*du,listDrops,true,vdMap );
+ ++du;
+ }
- if ( this->FindSuperPage () != this ) // Not a SuperPage
- {
- // Describe priority
- DrawingPriority& pageDrawPriority = this->GetDrawPriority ();
- string priorName = pageDrawPriority.DescribeYourself ( myDescription, MacroName() );
+ if ( this->FindSuperPage () != this ) // Not a SuperPage
+ {
+ // Describe priority
+ DrawingPriority& pageDrawPriority = this->GetDrawPriority ();
+ string priorName = pageDrawPriority.DescribeYourself ( myDescription, MacroName() );
- if ( strcmp(priorName.c_str(),"") != 0 )
- listDrops = ptextDrops + listDrops + Cached (", " ) + priorName.c_str();
- }
+ if ( !priorName.empty() )
+ listDrops = ptextDrops + mlegDrops + listDrops + "," + priorName;
+ }
- // Skip superpage, but should produce the plot command for a map without data
-// if ( listDrops || ptextDrops )
- if ( this->FindSuperPage () != this )
- {
- myDescription.SetPlotAction();
- myDescription.PutNewLine ( " " );
- myDescription.PutNewLine ( "# Plot command " );
- myDescription.PutNewLine ( Cached ("plot ( ") + macroIndexName.c_str() + ptextDrops + listDrops + Cached ( " )" ) );
- }
+ // Skip superpage, but should produce the plot command for a map without data
+ if ( this->FindSuperPage () != this )
+ {
+ // Set build layout function
+ myDescription.PutNewLine("");
+ myDescription.PutNewLine("# Call function to build layout (defined at end of macro)");
+ myDescription.PutNewLine("dw = build_layout()");
+
+ // Set plot command
+ myDescription.SetPlotAction();
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# Plot command" );
+ string str = "plot ( " + macroIndexName + ptextDrops + mlegDrops + listDrops + " )";
+ myDescription.PutNewLine ( str.c_str() );
+ }
}
int
@@ -1224,43 +1217,44 @@ Presentable::EraseDefaultDraw ()
}
bool Presentable::DescribeVisDefList( ObjectInfo &myDescription,
- MvIconList& visdefList,MvIcon &dataUnit,
- Cached &listDrops, bool addToDrops,
- MacroVisDefMap &vdMap )
+ MvIconList& visdefList, MvIcon &dataUnit,
+ string &listDrops, bool addToDrops,
+ MacroVisDefMap &vdMap )
{
- bool found = false;
- MvListCursor vd = visdefList.begin();
- while ( vd != visdefList.end() )
- {
- MvIcon currentvd = *vd;
- MvRequest currentvdRequest = currentvd.Request();
- if ( (const char*)currentvdRequest("_SKIP_MACRO") || (const char*)currentvdRequest("_DEFAULT") )
- {
- ++vd;
- continue;
- }
+ bool found = false;
+ MvListCursor vd = visdefList.begin();
+ while ( vd != visdefList.end() )
+ {
+ MvIcon currentvd = *vd;
+ MvRequest currentvdRequest = currentvd.Request();
+ if ( (const char*)currentvdRequest("_SKIP_MACRO") || (const char*)currentvdRequest("_DEFAULT") )
+ {
+ ++vd;
+ continue;
+ }
- // Only generate the definition if it hasn't been done before
- MacroVisDefMap::iterator ii = vdMap.find(currentvd.Id());
- Cached visDefName;
- if ( ii == vdMap.end() )
- {
- visDefName = myDescription.Convert(currentvdRequest);
- vdMap[currentvd.Id()] = visDefName;
- }
- else
- visDefName = (*ii).second.c_str();
+ // Only generate the definition if it hasn't been done before
+ MacroVisDefMap::iterator ii = vdMap.find(currentvd.Id());
+ string visDefName;
+ if ( ii == vdMap.end() )
+ {
+ myDescription.PutNewLine ( "" );
+ visDefName = myDescription.Convert(currentvdRequest);
+ vdMap[currentvd.Id()] = visDefName;
+ }
+ else
+ visDefName = (*ii).second.c_str();
- currentvdRequest.rewind();
- if ( ( dataUnit.Id() == 0 || CheckValidVisDef ( dataUnit, currentvdRequest ) ) && addToDrops )
- {
- found = true;
- listDrops = listDrops + Cached (", " ) + visDefName;
- }
- ++vd;
- }
+ currentvdRequest.rewind();
+ if ( ( dataUnit.Id() == 0 || CheckValidVisDef ( dataUnit, currentvdRequest ) ) && addToDrops )
+ {
+ found = true;
+ listDrops = listDrops + string(", ") + visDefName;
+ }
+ ++vd;
+ }
- return found;
+ return found;
}
// Process the dropping of common icons
diff --git a/src/uPlot/Presentable.h b/src/uPlot/Presentable.h
index 37c7753..0f209b6 100644
--- a/src/uPlot/Presentable.h
+++ b/src/uPlot/Presentable.h
@@ -398,7 +398,7 @@ public:
protected:
- bool DescribeVisDefList( ObjectInfo&, MvIconList&, MvIcon&, Cached&, bool, MacroVisDefMap&);
+ bool DescribeVisDefList( ObjectInfo&, MvIconList&, MvIcon&, string&, bool, MacroVisDefMap&);
// Members
static int treeNodeCounter_; // used to obtain unique Id
diff --git a/src/uPlot/SuperPage.cc b/src/uPlot/SuperPage.cc
index 20c610c..7d6add0 100644
--- a/src/uPlot/SuperPage.cc
+++ b/src/uPlot/SuperPage.cc
@@ -45,7 +45,6 @@ SuperPage::SuperPage ( const MvRequest& superpageRequest ):
{
// bool calledFromMacro = ObjectInfo::CalledFromMacro(superpageRequest);
-
// Retrieve the subrequest describing the Pages
MvRequest pagesRequest = superpageRequest.getSubrequest ( PAGES );
@@ -843,7 +842,7 @@ SuperPage::MacroPlotIndexName(bool useIndex)
index = childList_.size() + 1;
ostringstream ostr;
- ostr << "display_window[" << index << "]";
+ ostr << "dw[" << index << "]";
return ostr.str();
}
@@ -858,51 +857,23 @@ SuperPage::MacroPlotIndexName(bool useIndex)
void
SuperPage::DescribeDevice ( ObjectInfo& myDescription )
{
- myDescription.PutNewLine ( " " );
- myDescription.PutNewLine ( "# Device Description" );
-
- // Obtains the preferred printer request
-// MvRequest printerRequest = Preferences::PrinterRequest();
-
-/*
- // Creates for device descriptions (printer, file, preview, screen)
- myDescription.PutNewLine ( "# Define output device.");
- if ( macroType_ == SCREEN_MACRO )
- {
- myDescription.PutNewLine ( "# Screen is default output device.");
-
- // Generate description for screen
- myDescription.PutNewLine ( "Screen = output ( " );
- myDescription.FormatLine ( "FORMAT","'SCREEN'","" );
- myDescription.PutNewLine ( "\t) ");
- myDescription.PutNewLine ( " " );
- }
- else
- myDescription.PutNewLine ( "# Can be printer, file or preview");
-
- // Generate description for printer
- printerRequest ( "DESTINATION" ) = "PRINTER";
- myDescription.ConvertRequestToMacro ( printerRequest,PUT_END,
- "Printer","output" );
- myDescription.PutNewLine ( " " );
-*/
-
- // Generate description for file
-// MvRequest reqDev = ObjectList::CreateDefaultRequest ( "PSDriver" );
- MvRequest reqDev( "PSOUTPUT" );
- string filename = (const char*)ObjectInfo::ObjectPath ( myRequest_ );
- filename += "/ps";
- reqDev("OUTPUT_NAME") = filename.c_str();
- myDescription.ConvertRequestToMacro ( reqDev,PUT_END,"File","ps_output" );
-
- // Check running mode
- myDescription.PutNewLine ( " " );
- myDescription.PutNewLine ( "# Checks running mode " );
- myDescription.PutNewLine ( "mode = runmode() " );
- myDescription.PutNewLine ( "if mode = 'batch' or mode = 'execute' then " );
- myDescription.PutNewLine ( " setoutput(File) " );
- myDescription.PutNewLine ( "end if " );
- myDescription.PutNewLine ( " " );
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# Device description" );
+
+ // Generate description for file
+ MvRequest reqDev( "PSOUTPUT" );
+ string filename = (const char*)ObjectInfo::ObjectPath ( myRequest_ );
+ filename += "/ps";
+ reqDev("OUTPUT_NAME") = filename.c_str();
+ myDescription.ConvertRequestToMacro ( reqDev,PUT_END,"File","ps_output" );
+
+ // Check running mode
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# Checks running mode" );
+ myDescription.PutNewLine ( "mode = runmode()" );
+ myDescription.PutNewLine ( "if mode = 'batch' or mode = 'execute' then" );
+ myDescription.PutNewLine ( " setoutput(File)" );
+ myDescription.PutNewLine ( "end if" );
}
// -- METHOD : Describe Yourself
@@ -916,27 +887,26 @@ SuperPage::DescribeDevice ( ObjectInfo& myDescription )
void
SuperPage::DescribeYourself ( ObjectInfo& myDescription )
{
- myDescription.PutNewLine ( " " );
- myDescription.PutNewLine ( "# SuperPageDescription" );
-
- set<Cached> skipSet;
- skipSet.insert("PAGES");
- myDescription.ConvertRequestToMacro ( myRequest_, PUT_LAST_COMMA,
- MacroName().c_str(),"plot_superpage",
- skipSet);
-
- // Print the page list
- string pageList = ListMyPages();
- myDescription.FormatLine ("PAGES",pageList.c_str(),"" );
-
- // Close superpage request
- myDescription.PutNewLine ( "\t)" );
- myDescription.PutNewLine ( "# plot_superpage returns a list of drop identifiers." );
- myDescription.PutNewLine ( "# Index 1 is for first page, and so on." );
- myDescription.PutNewLine ( "# end of superpage definition " );
- myDescription.PutNewLine ( " " );
- string ret = "return " + MacroName();
- myDescription.PutNewLine( ret.c_str() );
+ myDescription.PutNewLine ( "" );
+ myDescription.PutNewLine ( "# SuperPage description" );
+
+ set<Cached> skipSet;
+ skipSet.insert("PAGES");
+ myDescription.ConvertRequestToMacro ( myRequest_, PUT_LAST_COMMA,
+ MacroName().c_str(),"plot_superpage",
+ skipSet);
+
+ // Print the page list
+ int size = myDescription.MaximumParameterNameLength(myRequest_);
+ string pageList = ListMyPages();
+ myDescription.FormatLine ("PAGES",pageList.c_str(),"",size);
+
+ // Close superpage request
+ myDescription.PutNewLine ( ")" );
+ myDescription.PutNewLine ( "# plot_superpage returns a list of drop identifiers." );
+ myDescription.PutNewLine ( "# Index 1 is for first page, and so on.\n" );
+ string ret = "return " + MacroName();
+ myDescription.PutNewLine( ret.c_str() );
}
// -- METHOD : ListMyPages
@@ -1365,33 +1335,36 @@ SuperPage::ExportPlot ( MvRequest* req, bool sync )
void
SuperPage::PrintFile ( MvRequest& req )
{
- // Create output format request
- MvRequest driverReq("PSOUTPUT");
- string fileName = tempnam(getenv("METVIEW_TMPDIR"),"plot");
- fileName += ".ps";
- driverReq("OUTPUT_FULLNAME") = fileName.c_str();
- if ( (const char*)req("_OUTPUT_FRAME_LIST") )
- {
- for ( int i = 0; i < req.countValues("_OUTPUT_FRAME_LIST"); i++ )
- driverReq.addValue("OUTPUT_FRAME_LIST",(int)req("_OUTPUT_FRAME_LIST",i));
- req.unsetParam(("_OUTPUT_FRAME_LIST"));
- }
+ // Create output format request
+ MvRequest driverReq("PSOUTPUT");
+ string fileName = tempnam(getenv("METVIEW_TMPDIR"),"plot");
+ fileName += ".ps";
+ driverReq("OUTPUT_FULLNAME") = fileName.c_str();
+ if ( (const char*)req("_OUTPUT_FRAME_LIST") )
+ {
+ for ( int i = 0; i < req.countValues("_OUTPUT_FRAME_LIST"); i++ )
+ driverReq.addValue("OUTPUT_FRAME_LIST",(int)req("_OUTPUT_FRAME_LIST",i));
+ req.unsetParam(("_OUTPUT_FRAME_LIST"));
+ }
- // Create printer request
- MvRequest printerReq = req;
- printerReq("OUTPUT_DEVICES") = driverReq;
+ // To avoid the printer to clip the bottom and left sides of the plot
+ driverReq("OUTPUT_PS_SCALE") = 0.96;
- // Retrieve current plot requests
- MvRequest fullReq;
- GetAllRequests( fullReq );
+ // Create printer request
+ MvRequest printerReq = req;
+ printerReq("OUTPUT_DEVICES") = driverReq;
+
+ // Retrieve current plot requests
+ MvRequest fullReq;
+ GetAllRequests( fullReq );
- // Create the full request: printer request + plot requests
- MvRequest newReq = printerReq + fullReq;
+ // Create the full request: printer request + plot requests
+ MvRequest newReq = printerReq + fullReq;
- // Call uPlotBatch to do the job
- MvApplication::callService ( "uPlotBatch", newReq, 0 );
+ // Call uPlotBatch to do the job
+ MvApplication::callService ( "uPlotBatch", newReq, 0 );
- return;
+ return;
}
Page*
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/metview.git
More information about the debian-science-commits
mailing list