-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow using the SMIOL I/O library when building with cmake. #1254
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
find_package(MPI REQUIRED COMPONENTS C Fortran) | ||
find_package(NetCDF REQUIRED COMPONENTS Fortran C) | ||
find_package(PnetCDF REQUIRED COMPONENTS Fortran C) | ||
|
||
# Specify the library source files | ||
set(SMIOL_C_SOURCES smiol.c smiol_utils.c) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you mean change There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that would also work, but in keeping with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to leave the explicit C naame, esp as c sources are rare. |
||
set(SMIOL_F_SOURCES smiolf.F90) | ||
|
||
# Create the C library | ||
add_library(smiol ${SMIOL_C_SOURCES}) | ||
add_library(${PROJECT_NAME}::external::smiol ALIAS smiol) | ||
target_compile_definitions(smiol PRIVATE SMIOL_PNETCDF SINGLE_PRECISION) | ||
target_include_directories(smiol PRIVATE ${MPI_INCLUDE_PATH}) | ||
|
||
# Create the Fortran library | ||
add_library(smiolf ${SMIOL_F_SOURCES}) | ||
enable_language(Fortran) | ||
mpas_fortran_target(smiolf) | ||
add_library(${PROJECT_NAME}::external::smiolf ALIAS smiolf) | ||
target_compile_definitions(smiolf PRIVATE SMIOL_PNETCDF ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When compiling this branch on my local machine, the build fails because the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for testing and finding this. |
||
# fortran lib requires the c lib | ||
target_link_libraries(smiolf PUBLIC smiol) | ||
target_include_directories(smiol PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) | ||
|
||
install(TARGETS smiol EXPORT ${PROJECT_NAME}ExportsExternal | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(TARGETS smiolf EXPORT ${PROJECT_NAME}ExportsExternal | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to work. When I build with
-DMPAS_USE_SMIOL=1
the cmake output still has:as well as