Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
cdo
Commits
1f03d8ad
Commit
1f03d8ad
authored
1 month ago
by
Oliver Heidmann
Browse files
Options
Downloads
Patches
Plain Diff
fixed use of wrong HAVE_ for memory streams, improved error handling
parent
566c28a5
No related branches found
Branches containing commit
No related tags found
1 merge request
!312
CMake Improvements and fixes
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+10
-3
10 additions, 3 deletions
CMakeLists.txt
src/process.cc
+8
-4
8 additions, 4 deletions
src/process.cc
with
18 additions
and
7 deletions
CMakeLists.txt
+
10
−
3
View file @
1f03d8ad
...
...
@@ -8,6 +8,10 @@ include(CheckIncludeFileCXX)
include
(
CheckIncludeFiles
)
include
(
CMakePrintHelpers
)
add_library
(
cdolib
)
add_library
(
operators
)
add_executable
(
cdo
)
# --- Language Standards
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_CXX_STANDARD 20
)
...
...
@@ -21,9 +25,9 @@ configure_file (
"
${
PROJECT_SOURCE_DIR
}
/cmake/cdo_config_features.h.in"
"
${
PROJECT_BINARY_DIR
}
/src/cdo_config_features.h"
)
# --- Other compile definitions currently required TEMP
list
(
APPEND cdo_compile_definitions
restrict=
# --- Other compile definitions currently required TEMP
list
(
APPEND cdo_compile_definitions
restrict=
CDI_SIZE_TYPE=size_t
#size type for cdi, in cdo its size_t
YAC_FOR_CDO
HAVE_CONFIG_H=1
...
...
@@ -83,6 +87,8 @@ find_package(netCDF 4.0 REQUIRED)
if
(
TARGET netCDF::netcdf
)
message
(
DEBUG
"Checking for netCDF_HAS_NC4 flag equal 'yes' : flag is:
${
netCDF_HAS_NC4
}
"
)
list
(
APPEND cdo_compile_definitions HAVE_NETCDF=
${
netCDF_FOUND
}
)
list
(
APPEND cdo_compile_definitions HAVE_LIBNETCDF=
${
netCDF_FOUND
}
)
list
(
APPEND cdo_compile_definitions HAVE_NETCDF4=
${
netCDF_FOUND
}
)
else
()
message
(
WARNING
"Netcdf not found, compiling without netcdf"
)
endif
()
...
...
@@ -98,6 +104,7 @@ if(CMOR_ROOT)
find_package
(
CMOR
)
if
(
TARGET CMOR::CMOR
)
list
(
APPEND cdo_compile_definitions
"HAVE_LIBCMOR=1"
)
target_link_libraries
(
operators PUBLIC CMOR::CMOR Uuid::uuid json-c Udunits
)
endif
()
endif
()
# ----------------------------------------------------------------------
...
...
This diff is collapsed.
Click to expand it.
src/process.cc
+
8
−
4
View file @
1f03d8ad
...
...
@@ -14,7 +14,7 @@
#include
<pthread.h>
#endif
#ifdef HAVE_
LIB
NETCDF
#ifdef HAVE_NETCDF
#include
<netcdf.h>
#include
<netcdf_mem.h>
#endif
...
...
@@ -306,7 +306,7 @@ Process::create_output()
{
int
ncid
=
-
1
;
#ifdef HAVE_
LIB
NETCDF
#ifdef HAVE_NETCDF
if
(
auto
retVal
=
nc_create_mem
(
"test_name"
,
0
,
4096
,
&
ncid
))
{
printf
(
"Error: %s
\n
"
,
nc_strerror
(
retVal
));
...
...
@@ -316,10 +316,14 @@ Process::create_output()
int
streamID
=
streamOpenWriteNCMem
(
ncid
);
#else
int
streamID
=
-
1
;
int
streamID
=
-
1
00103
;
#endif
if
(
streamID
<
0
)
{
throw
std
::
runtime_error
(
"ERROR: could not open stream from memory"
);
}
std
::
stringstream
ss
=
std
::
stringstream
();
ss
<<
"ERROR: could not open output stream to memory: errcode: "
;
ss
<<
std
::
to_string
(
streamID
);
if
(
streamID
<
0
)
{
throw
std
::
runtime_error
(
ss
.
str
());}
return
{
ncid
,
streamID
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment