Skip to content

Commit

Permalink
use a unique fortran module directory for each example
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Jun 17, 2024
1 parent 717798f commit c1573be
Show file tree
Hide file tree
Showing 21 changed files with 30 additions and 24 deletions.
14 changes: 10 additions & 4 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
# We need this to ensure the installed templates have MPI when ENABLE_MPI=TRUE,
# at least until we convert all of the templates to use the SUNDIALS CMake target.

# ===============================================================
# ===================================================================
# Configure compilers for installed examples
# ===============================================================
# ===================================================================

foreach(lang ${_SUNDIALS_ENABLED_LANGS})
if(ENABLE_MPI)
Expand All @@ -37,7 +37,13 @@ if(ENABLE_ALL_WARNINGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
endif()

# Initialize CMAKE_Fortran_MODULE_DIRECTORY for examples
set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})

# ===================================================================
# Set variables used in generating CMake and Makefiles for examples
# ===================================================================

if(EXAMPLES_INSTALL)

set(SHELL "sh")
Expand Down Expand Up @@ -95,9 +101,9 @@ if(EXAMPLES_INSTALL)

endif()

#----------------------------------------
# ===================================================================
# Add specific examples
#----------------------------------------
# ===================================================================

# Add ARKode examples
if(BUILD_ARKODE)
Expand Down
2 changes: 1 addition & 1 deletion examples/arkode/F2003_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ if(BUILD_SUNLINSOL_KLU)
add_executable(${example} ${example}.f90)

set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# add example to regression tests
sundials_add_test(${example} ${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/C_openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ foreach(example_tuple ${nvector_openmp_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/manyvector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ foreach(example_tuple ${nvector_manyvector_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/mpimanyvector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ foreach(example_tuple ${nvector_mpimanyvector_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/mpiplusx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ foreach(example_tuple ${nvector_mpiplusx_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/parallel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ foreach(example_tuple ${nvector_parallel_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/pthreads/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ foreach(example_tuple ${nvector_pthreads_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS} ${CMAKE_THREAD_LIBS_INIT})
Expand Down
2 changes: 1 addition & 1 deletion examples/nvector/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ foreach(example_tuple ${nvector_serial_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# folder where fortran .mod files are
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example} ${SUNDIALS_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/band/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ foreach(example_tuple ${sunlinsol_band_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/dense/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ foreach(example_tuple ${sunlinsol_dense_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/klu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ foreach(example_tuple ${sunlinsol_klu_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/lapackdense/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ foreach(example_tuple ${sunlinsol_lapackdense_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/pcg/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ foreach(example_tuple ${sunlinsol_pcg_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/spbcgs/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ foreach(example_tuple ${sunlinsol_spbcgs_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/spfgmr/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ foreach(example_tuple ${sunlinsol_spfgmr_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/spgmr/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ foreach(example_tuple ${sunlinsol_spgmr_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunlinsol/sptfqmr/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ foreach(example_tuple ${sunlinsol_sptfqmr_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/band/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ foreach(example_tuple ${sunmatrix_band_fortran_examples})
set_target_properties(${example} PROPERTIES FOLDER "Examples")

# set fortran module directory to avoid name collisions
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/dense/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ foreach(example_tuple ${sunmatrix_dense_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down
2 changes: 1 addition & 1 deletion examples/sunmatrix/sparse/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ foreach(example_tuple ${sunmatrix_sparse_fortran_examples})

# folder to organize targets in an IDE
set_target_properties(${example} PROPERTIES FOLDER "Examples")
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${example} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${example}.dir)

# libraries to link against
target_link_libraries(${example}
Expand Down

0 comments on commit c1573be

Please sign in to comment.