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

Build and link to Cloud-J in MUSICA Fortran Library #229

Open
lizziel opened this issue Oct 2, 2024 · 1 comment
Open

Build and link to Cloud-J in MUSICA Fortran Library #229

lizziel opened this issue Oct 2, 2024 · 1 comment

Comments

@lizziel
Copy link
Collaborator

lizziel commented Oct 2, 2024

I am seeking guidance on modifying the build of MUSICA Fortran Library to build and link to Cloud-J photolysis.

Acceptance Criteria
Build and link to Cloud-J library when building MUSICA Fortran Library

Ideas
Cloud-J repo will require work to not require unlimited stack frame size, as documented in geoschem/Cloud-J#20.

@K20shores
Copy link
Collaborator

One weird thing we do is to link TUVx directly with our non fortran target. I forget why, honestly, but I know it was necessary.

However, all of our libraries are compiled into a single static or shared library. To do this, all of our downstream projects define an object library which contains all of their sources. This allows us to directly compile the sources so we end up with a single file. Sadly, cmake doesn't offer any other way (that I'm aware of) to combine multiple libraries into one.

musica/src/CMakeLists.txt

Lines 76 to 100 in e1d6f9d

####################
# TUVX
if(MUSICA_ENABLE_TUVX)
enable_language(Fortran)
# include the sources directly into musica
target_sources(musica
PRIVATE
$<TARGET_OBJECTS:tuvx_object>
)
# but grab the include directories needed for tuvx
target_link_libraries(musica
PUBLIC
tuvx_object
)
target_include_directories(tuvx
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${MUSICA_INSTALL_INCLUDE_DIR}>
)
add_subdirectory(tuvx)
endif()

We only did this to have a single musica.a library, but it isn't necessary. All you have to do is ensure that musica publicly links to cloud-j and then add it as an install target alongside musica in our packaging instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants