Skip to content

Commit

Permalink
Merge pull request #1191 from chuckatkins/fix-install-without-fortran
Browse files Browse the repository at this point in the history
Make generation of adios2-config work without Fortran enabled
  • Loading branch information
Chuck Atkins authored Feb 15, 2019
2 parents dfa36cd + 92e04d7 commit cf6ce71
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 29 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,12 @@ endif()
#------------------------------------------------------------------------------#
GenerateADIOSPackageConfig()

# It's certainly a little awkward to have this lass add_subdirectory but it's
# It's certainly a little awkward to have this last add_subdirectory but it's
# currently the only way to guarantee installation order for the static config
# generation script
add_subdirectory(cmake/install)
if(UNIX)
add_subdirectory(cmake/install)
endif()

#------------------------------------------------------------------------------#
# Configuration summary
Expand Down
5 changes: 5 additions & 0 deletions cmake/install/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
if(ADIOS2_HAVE_Fortran)
set(ADIOS2_CONFIG_FORTRAN 1)
else()
set(ADIOS2_CONFIG_FORTRAN 0)
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/generate-adios2-config.sh.in
${CMAKE_CURRENT_BINARY_DIR}/generate-adios2-config.sh
Expand Down
72 changes: 45 additions & 27 deletions cmake/install/generate-adios2-config.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,49 +53,67 @@ BUILD_DIR=$(mktemp -d)
pushd ${BUILD_DIR}

echo "Configuring adios2-config dummy CMake project"
if ! ${CMAKE} -G "Unix Makefiles" ${SOURCE_DIR}
if ! ${CMAKE} -G "Unix Makefiles" ${SOURCE_DIR} ${EXTRA_CMAKE_ARGS}
then
echo "Failed"
exit 1
fi

echo "Extacting build flags with and without ADIOS"
make_target_flags without_C
make_target_flags without_CXX
make_target_flags without_Fortran
make_target_flags with_C
make_target_flags with_CXX
make_target_flags with_Fortran
rm -f adios2.flags

echo "Extacting ADIOS flags for C bindings"
echo " Without ADIOS"
make_target_flags without_C
without_C_CFLAGS=$(head -1 without_C.flags)
without_C_LDFLAGS=$(tail -1 without_C.flags)
without_CXX_CXXFLAGS=$(head -1 without_CXX.flags)
without_CXX_LDFLAGS=$(tail -1 without_CXX.flags)
without_Fortran_FFLAGS=$(head -1 without_Fortran.flags)
without_Fortran_LDFLAGS=$(tail -1 without_Fortran.flags)

echo " With ADIOS"
make_target_flags with_C
with_C_CFLAGS=$(head -1 with_C.flags)
with_C_LDFLAGS=$(tail -1 with_C.flags)
with_CXX_CXXFLAGS=$(head -1 with_CXX.flags)
with_CXX_LDFLAGS=$(tail -1 with_CXX.flags)
with_Fortran_FFLAGS=$(head -1 with_Fortran.flags)
with_Fortran_LDFLAGS=$(tail -1 with_Fortran.flags)

echo "Computing diff"
echo " Extracting diff"
ADIOS2_C_CFLAGS="$(prefixify $(flag_diff "${without_C_CFLAGS}" "${with_C_CFLAGS}"))"
ADIOS2_C_LDFLAGS="$(prefixify $(flag_diff "${without_C_LDFLAGS}" "${with_C_LDFLAGS}"))"
ADIOS2_CXX_CXXFLAGS="$(prefixify $(flag_diff "${without_CXX_CXXFLAGS}" "${with_CXX_CXXFLAGS}"))"
ADIOS2_CXX_LDFLAGS="$(prefixify $(flag_diff "${without_CXX_LDFLAGS}" "${with_CXX_LDFLAGS}"))"
ADIOS2_Fortran_FFLAGS="$(prefixify $(flag_diff "${without_Fortran_FFLAGS}" "${with_Fortran_FFLAGS}"))"
ADIOS2_Fortran_LDFLAGS="$(prefixify $(flag_diff "${without_Fortran_LDFLAGS}" "${with_Fortran_LDFLAGS}"))"

rm -f adios2.flags
echo " Exporting"
echo ADIOS2_C_CFLAGS=\"${ADIOS2_C_CFLAGS}\" >> adios2.flags
echo ADIOS2_C_LDFLAGS=\"${ADIOS2_C_LDFLAGS}\" >> adios2.flags

echo "Extacting ADIOS flags for C++ bindings"
echo " Without ADIOS"
make_target_flags without_CXX
without_CXX_CXXFLAGS=$(head -1 without_CXX.flags)
without_CXX_LDFLAGS=$(tail -1 without_CXX.flags)
echo " With ADIOS"
make_target_flags with_CXX
with_CXX_CXXFLAGS=$(head -1 with_CXX.flags)
with_CXX_LDFLAGS=$(tail -1 with_CXX.flags)
echo " Extracting diff"
ADIOS2_CXX_CXXFLAGS="$(prefixify $(flag_diff "${without_CXX_CXXFLAGS}" "${with_CXX_CXXFLAGS}"))"
ADIOS2_CXX_LDFLAGS="$(prefixify $(flag_diff "${without_CXX_LDFLAGS}" "${with_CXX_LDFLAGS}"))"
echo " Exporting"
echo ADIOS2_CXX_CXXFLAGS=\"${ADIOS2_CXX_CXXFLAGS}\" >> adios2.flags
echo ADIOS2_CXX_LDFLAGS=\"${ADIOS2_CXX_LDFLAGS}\" >> adios2.flags
echo ADIOS2_Fortran_FFLAGS=\"${ADIOS2_Fortran_FFLAGS}\" >> adios2.flags
echo ADIOS2_Fortran_LDFLAGS=\"${ADIOS2_Fortran_LDFLAGS}\" >> adios2.flags

if [ @ADIOS2_CONFIG_FORTRAN@ -eq 1 ]
then
echo "Extacting ADIOS flags for Fortran bindings"
echo " Without ADIOS"
make_target_flags without_Fortran
without_Fortran_FFLAGS=$(head -1 without_Fortran.flags)
without_Fortran_LDFLAGS=$(tail -1 without_Fortran.flags)
echo " With ADIOS"
make_target_flags with_Fortran
with_Fortran_FFLAGS=$(head -1 with_Fortran.flags)
with_Fortran_LDFLAGS=$(tail -1 with_Fortran.flags)
echo " Extracting diff"
ADIOS2_Fortran_FFLAGS="$(prefixify $(flag_diff "${without_Fortran_FFLAGS}" "${with_Fortran_FFLAGS}"))"
ADIOS2_Fortran_LDFLAGS="$(prefixify $(flag_diff "${without_Fortran_LDFLAGS}" "${with_Fortran_LDFLAGS}"))"
echo " Exporting"
echo ADIOS2_Fortran_FFLAGS=\"${ADIOS2_Fortran_FFLAGS}\" >> adios2.flags
echo ADIOS2_Fortran_LDFLAGS=\"${ADIOS2_Fortran_LDFLAGS}\" >> adios2.flags
else
echo ADIOS2_Fortran_FFLAGS="" >> adios2.flags
echo ADIOS2_Fortran_LDFLAGS="" >> adios2.flags
fi

echo "Writing @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/adios2-config"
cat \
Expand Down

0 comments on commit cf6ce71

Please sign in to comment.