Skip to content

Commit

Permalink
Rework fortran executables to explicitly specify linker language
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck Atkins committed May 18, 2018
1 parent b430c33 commit 58e7137
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 118 deletions.
17 changes: 6 additions & 11 deletions examples/hello/bpFWriteCRead/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,18 @@

if(ADIOS2_HAVE_MPI)
add_executable(CppWriter CppWriter.cpp)
target_include_directories(CppWriter PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(CppWriter ${MPI_C_LIBRARIES} adios2)
target_link_libraries(CppWriter adios2 MPI::MPI_C)

add_executable(CppReader CppReader.cpp)
target_include_directories(CppReader PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(CppReader ${MPI_C_LIBRARIES} adios2)
target_link_libraries(CppReader adios2 MPI::MPI_C)

if(ADIOS2_HAVE_Fortran)
add_executable(FWriter FWriter.f90)
target_link_libraries(FWriter MPI::MPI_Fortran)
target_link_libraries(FWriter adios2_f)
target_link_libraries(FWriter adios2_f MPI::MPI_Fortran)
set_property(TARGET FWriter PROPERTY LINKER_LANGUAGE Fortran)

add_executable(FReader FReader.f90)
target_link_libraries(FReader MPI::MPI_Fortran)
target_link_libraries(FReader adios2_f)
target_link_libraries(FReader adios2_f MPI::MPI_Fortran)
set_property(TARGET FReader PROPERTY LINKER_LANGUAGE Fortran)
endif()

else()

endif()
38 changes: 8 additions & 30 deletions examples/hello/bpReader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,23 @@

if(ADIOS2_HAVE_MPI)
add_executable(hello_bpReader helloBPReader.cpp)
target_include_directories(hello_bpReader PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpReader ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpReader adios2 MPI::MPI_C)

add_executable(hello_bpReaderHeatMap2D helloBPReaderHeatMap2D.cpp)
target_include_directories(hello_bpReaderHeatMap2D PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpReaderHeatMap2D ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpReaderHeatMap2D adios2)
target_link_libraries(hello_bpReaderHeatMap2D adios2 MPI::MPI_C)

add_executable(hello_bpReaderHeatMap3D helloBPReaderHeatMap3D.cpp)
target_include_directories(hello_bpReaderHeatMap3D PRIVATE ${MPI_C_INCLUDE_PATH})
target_link_libraries(hello_bpReaderHeatMap3D ${MPI_C_LIBRARIES})
target_link_libraries(hello_bpReaderHeatMap3D adios2)
target_link_libraries(hello_bpReaderHeatMap3D adios2 MPI::MPI_C)

if(ADIOS2_HAVE_Fortran)
add_executable(hello_bpReaderHeatMap3D_f helloBPReaderHeatMap3D.f90)
target_link_libraries(hello_bpReaderHeatMap3D_f MPI::MPI_Fortran)
target_link_libraries(hello_bpReaderHeatMap3D_f adios2_f)
target_link_libraries(hello_bpReaderHeatMap3D_f adios2_f MPI::MPI_Fortran)
set_property(TARGET hello_bpReaderHeatMap3D_f
PROPERTY LINKER_LANGUAGE Fortran
)
endif()


# add_executable(hello_bpReader_c helloBPReader.c)
# target_include_directories(hello_bpReader_c PRIVATE ${MPI_C_INCLUDE_PATH})
# target_link_libraries(hello_bpReader_c ${MPI_C_LIBRARIES})


else()
add_executable(hello_bpReader helloBPReader_nompi.cpp)
# add_executable(hello_bpReader_c helloBPReader_nompi.c)
#
# if(ADIOS2_HAVE_Fortran)
# add_executable(hello_bpReader_f helloBPReader_nompi.f90)
# endif()

target_link_libraries(hello_bpReader adios2)
endif()

target_link_libraries(hello_bpReader adios2)

#target_link_libraries(hello_bpReader_c adios2)

#if(ADIOS2_HAVE_Fortran)
# target_link_libraries(hello_bpReader_f PRIVATE adios2_f)
#endif()
26 changes: 11 additions & 15 deletions examples/hello/bpWriter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,35 @@

if(ADIOS2_HAVE_MPI)
add_executable(hello_bpWriter helloBPWriter.cpp)
target_link_libraries(hello_bpWriter MPI::MPI_C)
target_link_libraries(hello_bpWriter adios2 MPI::MPI_C)

add_executable(hello_bpWriter_c helloBPWriter.c)
target_link_libraries(hello_bpWriter_c MPI::MPI_C)
target_link_libraries(hello_bpWriter_c adios2 MPI::MPI_C)

if(ADIOS2_HAVE_Fortran)
add_executable(hello_bpWriter_f helloBPWriter.f90)
target_link_libraries(hello_bpWriter_f MPI::MPI_Fortran)
target_link_libraries(hello_bpWriter_f adios2_f MPI::MPI_Fortran)
set_property(TARGET hello_bpWriter_f PROPERTY LINKER_LANGUAGE Fortran)
endif()

add_executable(hello_bpPutDeferred helloBPPutDeferred.cpp)
target_link_libraries(hello_bpPutDeferred MPI::MPI_C)
target_link_libraries(hello_bpPutDeferred adios2 MPI::MPI_C)

add_executable(hello_bpSubStreams helloBPSubStreams.cpp)
target_link_libraries(hello_bpSubStreams MPI::MPI_C adios2)
target_link_libraries(hello_bpSubStreams adios2 MPI::MPI_C adios2)

else()
add_executable(hello_bpWriter helloBPWriter_nompi.cpp)
target_link_libraries(hello_bpWriter adios2)

add_executable(hello_bpWriter_c helloBPWriter_nompi.c)
target_link_libraries(hello_bpWriter_c adios2)

if(ADIOS2_HAVE_Fortran)
add_executable(hello_bpWriter_f helloBPWriter_nompi.f90)
target_link_libraries(hello_bpWriter_f adios2_f)
endif()

add_executable(hello_bpPutDeferred helloBPPutDeferred_nompi.cpp)

endif()

target_link_libraries(hello_bpWriter adios2)
target_link_libraries(hello_bpWriter_c adios2)

if(ADIOS2_HAVE_Fortran)
target_link_libraries(hello_bpWriter_f adios2_f)
target_link_libraries(hello_bpPutDeferred adios2)
endif()

target_link_libraries(hello_bpPutDeferred adios2)
8 changes: 6 additions & 2 deletions examples/hello/insituMPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ if(ADIOS2_HAVE_Fortran)
add_library(helloInsituArgs OBJECT helloInsituArgs.F90)

add_executable(hello_insituMPIWriter_f
helloInsituMPIWriter.f90 $<TARGET_OBJECTS:helloInsituArgs>
helloInsituMPIWriter.f90
$<TARGET_OBJECTS:helloInsituArgs>
)
target_link_libraries(hello_insituMPIWriter_f MPI::MPI_Fortran adios2_f)
set_property(TARGET hello_insituMPIWriter_f PROPERTY LINKER_LANGUAGE Fortran)

add_executable(hello_insituMPIReader_f
helloInsituMPIReader.f90 $<TARGET_OBJECTS:helloInsituArgs>
helloInsituMPIReader.f90
$<TARGET_OBJECTS:helloInsituArgs>
)
target_link_libraries(hello_insituMPIReader_f MPI::MPI_Fortran adios2_f)
set_property(TARGET hello_insituMPIReader_f PROPERTY LINKER_LANGUAGE Fortran)
endif()

add_executable(hello_insituMPIReader
Expand Down
89 changes: 29 additions & 60 deletions testing/adios2/bindings/fortran/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,87 +5,56 @@

add_library(SmallTestData_f OBJECT SmallTestData_mod.f90)

add_executable(TestBPWriteReadTypes_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestBPWriteReadTypes_f adios2_f)

add_executable(TestBPWriteReadTypesHighLevelAPI_f
$<TARGET_OBJECTS:SmallTestData_f>
)
target_link_libraries(TestBPWriteReadTypesHighLevelAPI_f adios2_f)

add_executable(TestRemove_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestRemove_f adios2_f)

if(ADIOS2_HAVE_MPI)
target_sources(TestBPWriteReadTypes_f PRIVATE TestBPWriteTypes.f90)
set(fortran_tests
BPWriteReadTypes BPWriteReadTypesHighLevelAPI Remove
BPWriteAttributes BPWriteTypesByName BPWriteStep BPWriteLocal
)

add_executable(TestBPWriteReadTypes_f TestBPWriteTypes.f90)
target_link_libraries(TestBPWriteReadTypes_f MPI::MPI_Fortran)

target_sources(TestBPWriteReadTypesHighLevelAPI_f
PRIVATE TestBPWriteTypesHighLevelAPI.f90)
add_executable(TestBPWriteReadTypesHighLevelAPI_f
TestBPWriteTypesHighLevelAPI.f90
)
target_link_libraries(TestBPWriteReadTypesHighLevelAPI_f MPI::MPI_Fortran)

target_sources(TestRemove_f PRIVATE TestRemove.f90)
add_executable(TestRemove_f TestRemove.f90)
target_link_libraries(TestRemove_f MPI::MPI_Fortran)

add_executable(TestBPWriteAttributes_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestBPWriteAttributes_f adios2_f)
target_sources(TestBPWriteAttributes_f PRIVATE TestBPWriteAttributes.f90)
add_executable(TestBPWriteAttributes_f TestBPWriteAttributes.f90)
target_link_libraries(TestBPWriteAttributes_f MPI::MPI_Fortran)

add_executable(TestBPWriteTypesByName_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestBPWriteTypesByName_f adios2_f)
target_sources(TestBPWriteTypesByName_f PRIVATE TestBPWriteTypesByName.f90)
add_executable(TestBPWriteTypesByName_f TestBPWriteTypesByName.f90)
target_link_libraries(TestBPWriteTypesByName_f MPI::MPI_Fortran)

add_executable(TestBPWriteStep_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestBPWriteStep_f adios2_f)
target_sources(TestBPWriteStep_f PRIVATE TestBPWriteStep.f90)
add_executable(TestBPWriteStep_f TestBPWriteStep.f90)
target_link_libraries(TestBPWriteStep_f MPI::MPI_Fortran)

add_executable(TestBPWriteLocal_f $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(TestBPWriteLocal_f adios2_f)
target_sources(TestBPWriteLocal_f PRIVATE TestBPWriteTypesLocal.f90)
add_executable(TestBPWriteLocal_f TestBPWriteTypesLocal.f90)
target_link_libraries(TestBPWriteLocal_f MPI::MPI_Fortran)

set(test_parameters
${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS}
)

add_test(NAME BPWriteAttributes_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteAttributes_f>
)

add_test(NAME BPWriteReadTypesByName_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteTypesByName_f>
)

add_test(NAME BPWriteStep_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteStep_f>
)

add_test(NAME BPWriteLocal_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteLocal_f>
)

else()

target_sources(TestBPWriteReadTypes_f PRIVATE TestBPWriteTypes_nompi.f90)

target_sources(TestBPWriteReadTypesHighLevelAPI_f
PRIVATE TestBPWriteTypesHighLevelAPI_nompi.f90)

target_sources(TestRemove_f PRIVATE TestRemove_nompi.f90)
set(fortran_tests BPWriteReadTypes BPWriteReadTypesHighLevelAPI Remove)

add_executable(TestBPWriteReadTypes_f TestBPWriteTypes_nompi.f90)
add_executable(TestBPWriteReadTypesHighLevelAPI_f
TestBPWriteTypesHighLevelAPI_nompi.f90
)
add_executable(TestRemove_f TestRemove_nompi.f90)
endif()

add_test(NAME BPWriteReadTypes_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteReadTypes_f>
)
foreach(test IN LISTS fortran_tests)
target_sources(Test${test}_f PRIVATE $<TARGET_OBJECTS:SmallTestData_f>)
target_link_libraries(Test${test}_f adios2_f)
set_property(TARGET Test${test}_f PROPERTY LINKER_LANGUAGE Fortran)

add_test(NAME BPWriteReadTypesHighLevelAPI_f
COMMAND ${test_parameters} $<TARGET_FILE:TestBPWriteReadTypesHighLevelAPI_f>
)

add_test(NAME Remove_f
COMMAND ${test_parameters} $<TARGET_FILE:TestRemove_f>
)
add_test(
NAME ${test}_f
COMMAND ${test_parameters} $<TARGET_FILE:Test${test}_f>
)
endforeach()

0 comments on commit 58e7137

Please sign in to comment.