<commit_before>project(aether Fortran C)

# The list of all source files that are required to build the library
set(LIB_SRCS
  arrays.f90
  capillaryflow.f90
  diagnostics.f90
  exports.f90
  filenames.f90
  field_utilities.f90
  gas_exchange.f90
  gasmix.f90
  geometry.f90
  growtree.f90
  indices.f90
  imports.f90
  math_utilities.f90
  mesh_utilities.f90
  other_consts.f90
  pressure_resistance_flow.f90
  solve.f90
  species_transport.f90
  ventilation.f90
  wave_transmission.f90
)

set(AETHER_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Modules")

# Create an object library so we can use the objects in two different libraries
add_library(aether_obj OBJECT ${LIB_SRCS})
set_target_properties(aether_obj PROPERTIES
  Fortran_MODULE_DIRECTORY "${AETHER_MODULE_DIRECTORY}"
  POSITION_INDEPENDENT_CODE TRUE)

if (MSVC)
  target_compile_options(aether_obj PRIVATE /heap-arrays0)
  # Visual Studio requires a dummy file as it will not build a library from only objects.
  set(dummy_file "${CMAKE_CURRENT_BINARY_DIR}/dummy.f90")
  file(WRITE ${dummy_file} "module dummy
implicit none
contains
end module dummy\n")
endif ()

# Create the aether fortran library
add_library(aether $<TARGET_OBJECTS:aether_obj> ${dummy_file})

set_target_properties(aether PROPERTIES
  Fortran_VISIBILITY_PRESET hidden
  C_VISIBILITY_PRESET hidden
  VISIBILITY_INLINES_HIDDEN 1)

target_include_directories(aether PUBLIC "${AETHER_MODULE_DIRECTORY}")

install(TARGETS aether
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib)

# Our version for FindSuperLU creates an imported target for us to use.
find_package(SuperLU)


set(SUPERLU_FORTRAN_SRCS
  c_fortran_dgssv.c
  #c_fortran_cgssv.c
)

# Create an object library for the SuperLU C Fortran cgssv file.
add_library(aether_superlu_obj OBJECT ${SUPERLU_FORTRAN_SRCS})

target_link_libraries(aether_superlu_obj PRIVATE superlu)

set_property(TARGET aether_superlu_obj PROPERTY POSITION_INDEPENDENT_CODE ON)

# Create the aether library from the object libraries.
#add_library(aether $<TARGET_OBJECTS:aether_obj> $<TARGET_OBJECTS:aether_superlu_obj> ${dummy_file})

target_link_libraries(aether PUBLIC superlu)
<commit_msg>trying to fix for earlier cmake<commit_after>project(aether Fortran C)

# The list of all source files that are required to build the library
set(LIB_SRCS
  arrays.f90
  capillaryflow.f90
  diagnostics.f90
  exports.f90
  filenames.f90
  field_utilities.f90
  gas_exchange.f90
  gasmix.f90
  geometry.f90
  growtree.f90
  indices.f90
  imports.f90
  math_utilities.f90
  mesh_utilities.f90
  other_consts.f90
  pressure_resistance_flow.f90
  solve.f90
  species_transport.f90
  ventilation.f90
  wave_transmission.f90
)

set(AETHER_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Modules")

# Create an object library so we can use the objects in two different libraries
add_library(aether_obj OBJECT ${LIB_SRCS})
set_target_properties(aether_obj PROPERTIES
  Fortran_MODULE_DIRECTORY "${AETHER_MODULE_DIRECTORY}"
  POSITION_INDEPENDENT_CODE TRUE)

if (MSVC)
  target_compile_options(aether_obj PRIVATE /heap-arrays0)
  # Visual Studio requires a dummy file as it will not build a library from only objects.
  set(dummy_file "${CMAKE_CURRENT_BINARY_DIR}/dummy.f90")
  file(WRITE ${dummy_file} "module dummy
implicit none
contains
end module dummy\n")
endif ()

# Create the aether fortran library
add_library(aether $<TARGET_OBJECTS:aether_obj> ${dummy_file})

set_target_properties(aether PROPERTIES
  Fortran_VISIBILITY_PRESET hidden
  C_VISIBILITY_PRESET hidden
  VISIBILITY_INLINES_HIDDEN 1)

target_include_directories(aether PUBLIC "${AETHER_MODULE_DIRECTORY}")

install(TARGETS aether
  RUNTIME DESTINATION bin
  LIBRARY DESTINATION lib
  ARCHIVE DESTINATION lib)

# Our version for FindSuperLU creates an imported target for us to use.
find_package(SuperLU)


set(SUPERLU_FORTRAN_SRCS
  c_fortran_dgssv.c
  #c_fortran_cgssv.c
)

# Create an object library for the SuperLU C Fortran cgssv file.
add_library(aether_superlu_obj OBJECT c_fortran_dgssv.c)# ${SUPERLU_FORTRAN_SRCS})

target_link_libraries(aether_superlu_obj PRIVATE superlu)

set_property(TARGET aether_superlu_obj PROPERTY POSITION_INDEPENDENT_CODE ON)

# Create the aether library from the object libraries.
#add_library(aether $<TARGET_OBJECTS:aether_obj> $<TARGET_OBJECTS:aether_superlu_obj> ${dummy_file})

target_link_libraries(aether PUBLIC superlu)

{'fraction_non_alphanumeric': 0.06190476190476191, 'fraction_numerical': 0.019954648526077097, 'mean_word_length': 6.1375404530744335, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1513746', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1553, 'n_words': 364}