Skip to content

Commit

Permalink
moved cmake build of ncint into src/clib dir, now test works!
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Aug 19, 2020
1 parent 9f57a5c commit 6bd5fa4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 45 deletions.
11 changes: 6 additions & 5 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ project (PIOC C)
# DEFINE THE TARGET
#==============================================================================

add_library (pioc topology.c pio_file.c pioc_support.c pio_lists.c
set (src topology.c pio_file.c pioc_support.c pio_lists.c
pioc.c pioc_sc.c pio_spmd.c pio_rearrange.c pio_nc4.c bget.c
pio_nc.c pio_put_nc.c pio_get_nc.c pio_getput_int.c pio_msg.c
pio_darray.c pio_darray_int.c pio_get_vard.c pio_put_vard.c pio_error.c)
if (NETCDF_INTEGRATION)
set (src ${src} ../ncint/nc_get_vard.c ../ncint/ncintdispatch.c ../ncint/ncint_pio.c ../ncint/nc_put_vard.c)
endif ()

add_library (pioc ${src})

# set up include-directories
include_directories(
Expand Down Expand Up @@ -42,10 +47,6 @@ elseif ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
string(APPEND CMAKE_C_FLAGS " -std=c99 ")
endif()

if (NETCDF_INTEGRATION)
target_link_libraries(pioc PUBLIC ncint)
endif ()

#==============================================================================
# DEFINE THE INSTALL
#==============================================================================
Expand Down
80 changes: 40 additions & 40 deletions src/ncint/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
cmake_minimum_required (VERSION 2.8.12)

add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c)

# set up include-directories
include_directories(
"${CMAKE_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}" # to find foo/foo.h
"${PROJECT_BINARY_DIR}") # to find foo/config.h

# Include the clib source directory
target_include_directories (ncint
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# Include the ncint source directory
target_include_directories (ncint
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib)

#===== NetCDF-C =====
find_package (NetCDF "4.3.3" COMPONENTS C)
if (NetCDF_C_FOUND)
target_include_directories (ncint
PUBLIC ${NetCDF_C_INCLUDE_DIRS})
target_compile_definitions (ncint
PUBLIC _NETCDF)
target_link_libraries (ncint
PUBLIC ${NetCDF_C_LIBRARIES})
if (${NetCDF_C_HAS_PARALLEL})
target_compile_definitions (ncint
PUBLIC _NETCDF4)
endif ()
if (${NetCDF_C_LOGGING_ENABLED})
target_compile_definitions (ncint
PUBLIC NETCDF_C_LOGGING_ENABLED)
# netcdf.h needs this to be defined to use netCDF logging.
target_compile_definitions (ncint
PUBLIC LOGGING)
endif()
else ()
target_compile_definitions (ncint
PUBLIC _NONETCDF)
endif ()
# add_library(ncint nc_get_vard.c ncintdispatch.c ncint_pio.c nc_put_vard.c)

# # set up include-directories
# include_directories(
# "${CMAKE_BINARY_DIR}"
# "${PROJECT_SOURCE_DIR}" # to find foo/foo.h
# "${PROJECT_BINARY_DIR}") # to find foo/config.h

# # Include the clib source directory
# target_include_directories (ncint
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../clib)

# # Include the ncint source directory
# target_include_directories (ncint
# PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

# #===== NetCDF-C =====
# find_package (NetCDF "4.3.3" COMPONENTS C)
# if (NetCDF_C_FOUND)
# target_include_directories (ncint
# PUBLIC ${NetCDF_C_INCLUDE_DIRS})
# target_compile_definitions (ncint
# PUBLIC _NETCDF)
# target_link_libraries (ncint
# PUBLIC ${NetCDF_C_LIBRARIES})
# if (${NetCDF_C_HAS_PARALLEL})
# target_compile_definitions (ncint
# PUBLIC _NETCDF4)
# endif ()
# if (${NetCDF_C_LOGGING_ENABLED})
# target_compile_definitions (ncint
# PUBLIC NETCDF_C_LOGGING_ENABLED)
# # netcdf.h needs this to be defined to use netCDF logging.
# target_compile_definitions (ncint
# PUBLIC LOGGING)
# endif()
# else ()
# target_compile_definitions (ncint
# PUBLIC _NONETCDF)
# endif ()



4 changes: 4 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ if (PIO_ENABLE_FORTRAN)
message (STATUS "Cannot build performance test without gptl timing library")
endif ()
endif()

if (NETCDF_INTEGRATION)
add_subdirectory(ncint)
endif ()

0 comments on commit 6bd5fa4

Please sign in to comment.