Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
libcdi
Compare revisions
b5750d2ab634a2785931ee452aed104556ea215c to 29485a63f474d1a12adaebcb1cf7952ba9832f32
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
mpim-sw/libcdi
Select target project
No results found
29485a63f474d1a12adaebcb1cf7952ba9832f32
Select Git revision
Swap
Target
mpim-sw/libcdi
Select target project
b383306/libcdi
mpim-sw/libcdi
m214007/libcdi
3 results
b5750d2ab634a2785931ee452aed104556ea215c
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
if eccodes option enables: make eccodes required, removed not reachable else statements
· 72c71a78
Oliver Heidmann
authored
1 month ago
72c71a78
CMake: fixed typo, moved library declaration to main CMake file, added compile commands
· 4c2a5cd9
Oliver Heidmann
authored
1 month ago
4c2a5cd9
removed usage of lists and replaced it by target specific cmake routines
· 0e8861e0
Oliver Heidmann
authored
1 month ago
0e8861e0
moved install logic into main file
· 29485a63
Oliver Heidmann
authored
1 month ago
29485a63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+48
-18
48 additions, 18 deletions
CMakeLists.txt
src/CMakeLists.txt
+62
-77
62 additions, 77 deletions
src/CMakeLists.txt
with
110 additions
and
95 deletions
CMakeLists.txt
View file @
29485a63
cmake_minimum_required
(
VERSION 3.27 FATAL_ERROR
)
cmake_minimum_required
(
VERSION 3.27 FATAL_ERROR
)
message
(
VERBOSE
"Entering
lib
cdi"
)
message
(
VERBOSE
"Entering cdi
lib
"
)
project
(
cdilib VERSION 2.5.1 LANGUAGES C
)
project
(
cdilib VERSION 2.5.1 LANGUAGES C
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_EXPORT_COMPILE_COMMANDS YES
)
add_library
(
cdilib
)
add_library
(
cdilib::cdilib ALIAS cdilib
)
include
(
CTest
)
include
(
CTest
)
include
(
CheckIncludeFile
)
include
(
CheckIncludeFile
)
...
@@ -15,46 +19,44 @@ if(${CDI_PTHREAD})
...
@@ -15,46 +19,44 @@ if(${CDI_PTHREAD})
include
(
FindThreads
)
include
(
FindThreads
)
find_package
(
Threads REQUIRED
)
find_package
(
Threads REQUIRED
)
set_target_properties
(
Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE
)
set_target_properties
(
Threads::Threads PROPERTIES THREADS_PREFER_PTHREAD_FLAG TRUE
)
list
(
APPEND cdi_compile_defs
HAVE_PTHREAD=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_PTHREAD=1
)
list
(
APPEND cdi
_link
ed
_lib
s
pthread
)
target
_link_lib
raries
(
cdilib
pthread
)
endif
()
endif
()
# enable default internal libs
# enable default internal libs
option
(
CDI_LIBGRIB
"GRIB support [default=ON]"
ON
)
option
(
CDI_LIBGRIB
"GRIB support [default=ON]"
ON
)
if
(
${
CDI_LIBGRIB
}
)
if
(
${
CDI_LIBGRIB
}
)
list
(
APPEND cdi_compile_defs
target_compile_definitions
(
cdilib PRIVATE HAVE_LIBGRIB=1 HAVE_LIBGRIB_API=1
)
HAVE_LIBGRIB=1
HAVE_LIBGRIB_API=1
)
endif
()
endif
()
option
(
CDI_LIBGRIBEX
"Use the CGRIBEX library [default=ON]"
ON
)
option
(
CDI_LIBGRIBEX
"Use the CGRIBEX library [default=ON]"
ON
)
if
(
${
CDI_LIBGRIBEX
}
)
if
(
${
CDI_LIBGRIBEX
}
)
list
(
APPEND cdi_compile_defs
LIBCGRIBEX=1
)
target_compile_definitions
(
cdilib PRIVATE
LIBCGRIBEX=1
)
endif
()
endif
()
option
(
CDI_EXTRA
"Use the extra library [default=ON]"
ON
)
option
(
CDI_EXTRA
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_EXTRA
}
)
if
(
${
CDI_EXTRA
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBEXTRA=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBEXTRA=1
)
endif
()
endif
()
option
(
CDI_IEG
"Use the extra library [default=ON]"
ON
)
option
(
CDI_IEG
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_IEG
}
)
if
(
${
CDI_IEG
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBIEG=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBIEG=1
)
endif
()
endif
()
option
(
CDI_SERVICE
"Use the extra library [default=ON]"
ON
)
option
(
CDI_SERVICE
"Use the extra library [default=ON]"
ON
)
if
(
${
CDI_SERVICE
}
)
if
(
${
CDI_SERVICE
}
)
list
(
APPEND cdi_compile_defs
HAVE_LIBSERVICE=1
)
target_compile_definitions
(
cdilib PRIVATE
HAVE_LIBSERVICE=1
)
endif
()
endif
()
# ecCodes
# ecCodes
option
(
CDI_ECCODES
"Use the eccodes library [default=ON]"
ON
)
option
(
CDI_ECCODES
"Use the eccodes library [default=ON]"
ON
)
if
(
${
CDI_ECCODES
}
OR eccodes_ROOT
)
if
(
${
CDI_ECCODES
}
OR eccodes_ROOT
)
find_package
(
eccodes
)
find_package
(
eccodes
REQUIRED
)
if
(
${
eccodes_FOUND
}
)
if
(
${
eccodes_FOUND
}
)
list
(
APPEND cdi_linked_libs eccodes
)
target_compile_definitions
(
cdilib PRIVATE HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
)
else
(
)
message
(
VERBOSE
"added compile definition HAVE_LIBGRIB_API=
${
eccodes_FOUND
}
"
)
message
(
WARNING
"eccodes not found, compiling without
eccodes
"
)
target_link_libraries
(
cdilib
eccodes
)
endif
()
endif
()
endif
()
endif
()
...
@@ -68,9 +70,7 @@ if(${CDI_NETCDF} OR netCDF_ROOT )
...
@@ -68,9 +70,7 @@ if(${CDI_NETCDF} OR netCDF_ROOT )
HAVE_LIBNC_DAP=
${
netCDF_FOUND
}
HAVE_LIBNC_DAP=
${
netCDF_FOUND
}
HAVE_NETCDF4=
${
netCDF_FOUND
}
HAVE_NETCDF4=
${
netCDF_FOUND
}
)
)
list
(
APPEND cdi_linked_libs netCDF::netcdf
)
target_link_libraries
(
cdilib netCDF::netcdf
)
else
()
message
(
WARNING
"netcdf target not found, compiling without netcdf"
)
endif
()
endif
()
endif
()
endif
()
...
@@ -78,7 +78,7 @@ message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src")
...
@@ -78,7 +78,7 @@ message(VERBOSE "looking for config.h in: ${PROJECT_BINARY_DIR}/src")
#adding subdirectories
#adding subdirectories
## lib and general files
## lib and general files
list
(
APPEND cdi_compile_defs
CDI=1 CDI_SIZE_TYPE=size_t PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
)
target_compile_definitions
(
cdilib PRIVATE
CDI=1 CDI_SIZE_TYPE=size_t PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
)
add_subdirectory
(
src
)
add_subdirectory
(
src
)
#app
#app
...
@@ -91,3 +91,33 @@ endif ()
...
@@ -91,3 +91,33 @@ endif ()
if
(
BUILD_TESTING
)
if
(
BUILD_TESTING
)
add_subdirectory
(
tests
)
add_subdirectory
(
tests
)
endif
()
endif
()
# --- Installation
# packages required for installation
include
(
GNUInstallDirs
)
include
(
CMakePackageConfigHelpers
)
install
(
TARGETS cdilib
ARCHIVE DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
RUNTIME DESTINATION
"
${
CMAKE_INSTALL_BINDIR
}
"
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
)
get_target_property
(
cdi_install_files cdilib CDI_INSTALL_HEADERS
)
install
(
FILES
${
cdi_install_files
}
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
# -- create configuration files
configure_package_config_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src/cmake/cdi/cdi-config.cmake.in"
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config.cmake"
INSTALL_DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/cdi"
)
write_basic_package_version_file
(
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config-version.cmake"
VERSION
"
${
PACKAGE_VERSION
}
"
COMPATIBILITY SameMajorVersion
)
#Install CMake configuration files to
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config.cmake"
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config-version.cmake"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/cdi"
)
This diff is collapsed.
Click to expand it.
src/CMakeLists.txt
View file @
29485a63
list
(
APPEND cdi_src_files
target_sources
(
cdilib PRIVATE
async_worker.c
async_worker.c
async_worker.h
async_worker.h
basetime.c
basetime.c
...
@@ -139,95 +140,79 @@ list( APPEND cdi_src_files
...
@@ -139,95 +140,79 @@ list( APPEND cdi_src_files
zaxis.c
zaxis.c
zaxis.h
zaxis.h
)
)
list
(
APPEND cdi_pio_files
cdipio.h
pio.c
pio.h
pio_cdf_int.c
pio_cdf_int.h
pio_client.c
pio_client.h
pio_comm.c
pio_comm.h
pio_conf.c
pio_conf.h
pio_dbuffer.c
pio_dbuffer.h
pio_dist_grid.c
pio_dist_grid.h
pio_id_set.h
pio_idxlist_cache.c
pio_idxlist_cache.h
pio_impl.h
pio_interface.c
pio_interface.h
pio_mpi_fw_at_all.c
pio_mpi_fw_at_reblock.c
pio_mpi_fw_ordered.c
pio_mpinonb.c
pio_posixasynch.c
pio_posixfpguardsendrecv.c
pio_posixnonb.c
pio_record_send.c
pio_roles.c
pio_rpc.c
pio_rpc.h
pio_serialize.c
pio_serialize.h
pio_server.c
pio_server.h
pio_util.c
pio_util.h
pio_xmap_cache.c
pio_xmap_cache.h
)
list
(
APPEND cdi_unknown
option
(
CDI_BUILD_PIO
"Build unknown sources in libcdi"
OFF
)
cfortran.h
mark_as_advanced
(
CDI_BUILD_PIO
)
getline.c
if
(
CDI_BUILD_PIO
)
make_fint.c
target_sources
(
cdilib PRIVATE
resource_unpack.c
cdipio.h
resource_unpack.h
pio.c
)
pio.h
pio_cdf_int.c
pio_cdf_int.h
pio_client.c
pio_client.h
pio_comm.c
pio_comm.h
pio_conf.c
pio_conf.h
pio_dbuffer.c
pio_dbuffer.h
pio_dist_grid.c
pio_dist_grid.h
pio_id_set.h
pio_idxlist_cache.c
pio_idxlist_cache.h
pio_impl.h
pio_interface.c
pio_interface.h
pio_mpi_fw_at_all.c
pio_mpi_fw_at_reblock.c
pio_mpi_fw_ordered.c
pio_mpinonb.c
pio_posixasynch.c
pio_posixfpguardsendrecv.c
pio_posixnonb.c
pio_record_send.c
pio_roles.c
pio_rpc.c
pio_rpc.h
pio_serialize.c
pio_serialize.h
pio_server.c
pio_server.h
pio_util.c
pio_util.h
pio_xmap_cache.c
pio_xmap_cache.h
)
endif
()
option
(
CDI_BUILD_UNKNOWN
"Build unknown sources in libcdi"
ON
)
option
(
CDI_BUILD_UNKNOWN
"Build unknown sources in libcdi"
ON
)
mark_as_advanced
(
CDI_BUILD_UNKNOWN
)
mark_as_advanced
(
CDI_BUILD_UNKNOWN
)
if
(
CDI_BUILD_UNKNOWN
)
if
(
CDI_BUILD_UNKNOWN
)
list
(
APPEND cdi_src_files
${
cdi_unknown
}
)
target_sources
(
cdilib PRIVATE
cfortran.h
getline.c
make_fint.c
resource_unpack.c
resource_unpack.h
)
endif
()
endif
()
# Support exporting all symbol
d
s on Windows
# Support exporting all symbols on Windows
set
(
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON
)
set
(
CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON
)
add_library
(
cdilib
set_property
(
TARGET cdilib PROPERTY CDI_INSTALL_HEADERS
${
cdi_src_files
}
${
CMAKE_CURRENT_SOURCE_DIR
}
/cdi.h
# INSTALL_HEADERS_LIST cdi.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/calendar.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/cdi_datetime.h
${
CMAKE_CURRENT_SOURCE_DIR
}
/julian_date.h
)
)
target_include_directories
(
cdilib PRIVATE
"
${
PROJECT_BINARY_DIR
}
/src/config.h"
)
target_include_directories
(
cdilib PRIVATE
"
${
PROJECT_BINARY_DIR
}
/src/config.h"
)
target_link_libraries
(
cdilib
${
cdi_linked_libs
}
)
target_link_libraries
(
cdilib
${
cdi_linked_libs
}
)
target_compile_definitions
(
cdilib PRIVATE PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
${
cdi_compile_defs
}
)
target_compile_definitions
(
cdilib PRIVATE PACKAGE_NAME=
"
${
PROJECT_NAME
}
"
VERSION=
"
${
CMAKE_PROJECT_VERSION
}
"
${
cdi_compile_defs
}
)
add_library
(
cdilib::cdilib ALIAS cdilib
)
include
(
GNUInstallDirs
)
install
(
FILES cdi.h calendar.h cdi_datetime.h julian_date.h DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
"
)
install
(
TARGETS cdilib
ARCHIVE DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
RUNTIME DESTINATION
"
${
CMAKE_INSTALL_BINDIR
}
"
LIBRARY DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
"
)
include
(
CMakePackageConfigHelpers
)
configure_package_config_file
(
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/cmake/cdi/cdi-config.cmake.in"
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config.cmake"
INSTALL_DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/cdi"
)
write_basic_package_version_file
(
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config-version.cmake"
VERSION
"
${
PACKAGE_VERSION
}
"
COMPATIBILITY SameMajorVersion
)
install
(
FILES
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config.cmake"
"
${
CMAKE_BINARY_DIR
}
/cmake/cdi-config-version.cmake"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/cdi"
)
This diff is collapsed.
Click to expand it.