Skip to content
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

Place fortran modules in unique directory, copy dir on install into c… #320

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,6 @@ foreach(_header ${EOS_HEADERS})
list(APPEND _headers singularity-eos/${_header})
endforeach()

foreach(_mod ${EOS_MODS})
list(APPEND _install_mods ${CMAKE_CURRENT_BINARY_DIR}/${_mod})
endforeach()

foreach(_src ${EOS_SRCS})
list(APPEND _srcs singularity-eos/${_src})
endforeach()
Expand All @@ -389,9 +385,9 @@ target_sources(singularity-eos PRIVATE ${_srcs} ${_headers})
# make sure .mods are placed in build path, and installed along with includes
if(SINGULARITY_USE_FORTRAN)
set_target_properties(singularity-eos PROPERTIES Fortran_MODULE_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR})
${CMAKE_CURRENT_BINARY_DIR}/fortran)
target_include_directories(
singularity-eos INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
singularity-eos INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/fortran>
$<INSTALL_INTERFACE:include/singularity-eos/eos>)
set_target_properties(singularity-eos PROPERTIES Fortran_PREPROCESS ON)
endif() # SINGULARITY_USE_FORTRAN
Expand Down
7 changes: 4 additions & 3 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ foreach(file ${_install_headers})
endforeach() # file

# install the fortran modules NB: cmake doesn't provide a clean way to handle
# mods
install(FILES ${_install_mods}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/singularity-eos/eos)
if(SINGULARITY_USE_FORTRAN)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/fortran/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/singularity-eos/eos)
endif()

# ----------------------------------------------------------------------------#
# local export
Expand Down
3 changes: 0 additions & 3 deletions singularity-eos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,8 @@ if (SINGULARITY_USE_FORTRAN)
list(APPEND EOS_SRCS eos/singularity_eos.f90)
list(APPEND EOS_SRCS eos/singularity_eos.cpp)
list(APPEND EOS_HEADERS eos/singularity_eos.hpp)
# would rather handle this more robustly, being sloppy for now
list(APPEND EOS_MODS singularity_eos.mod singularity_eos_types.mod)
endif()

# export to parent scope
set(EOS_HEADERS ${EOS_HEADERS} PARENT_SCOPE)
set(EOS_SRCS ${EOS_SRCS} PARENT_SCOPE)
set(EOS_MODS ${EOS_MODS} PARENT_SCOPE)
Loading