Skip to content

Commit

Permalink
Merge pull request #4601 from ye-luo/fix-cray
Browse files Browse the repository at this point in the history
Introduce ENABLE_PPCONVERT option and skip ppconvert compilation when cross compiling.
  • Loading branch information
ye-luo authored May 16, 2023
2 parents f1345f8 + 57da4db commit 98619fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ the path to the source directory.
saving default use of symbolic links for test files. Useful
if the build is on a separate filesystem from the source, as
required on some HPC systems.
ENABLE_PPCONVERT ON/OFF. Enable the ppconvert tool. If requirements are met, it is ON by default.

- BLAS/LAPACK related

Expand Down
23 changes: 15 additions & 8 deletions src/QMCTools/ppconvert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ endif()

string(REPLACE "-ffast-math" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

# check if std::isnan works or not
# this check may fail when cross-compiling even if std::isnan actually functions properly.
include(CheckCXXSourceRuns)
check_cxx_source_runs(
if(CMAKE_CROSSCOMPILING)
message(STATUS "Cannot run std::isnan tests when cross compiling. Setting ISNAN_WORKS to FALSE.")
set(ISNAN_WORKS FALSE)
else()
# check if std::isnan works or not
# this check may fail when cross-compiling even if std::isnan actually functions properly.
include(CheckCXXSourceRuns)
check_cxx_source_runs(
"
#include <cmath>
int main()
Expand All @@ -24,13 +28,16 @@ int main()
return 1;
}
"
ISNAN_WORKS)
ISNAN_WORKS)
endif()

option(ENABLE_PPCONVERT "Enable ppconvert" ${ISNAN_WORKS})

# ppconvert only works when std::isnan works.
if(ISNAN_WORKS)
message(STATUS "ppconvert enabled. std:isnan support check passed.")
if(ENABLE_PPCONVERT)
message(STATUS "ppconvert enabled.")
add_subdirectory(src)
add_subdirectory(test)
else()
message(STATUS "ppconvert disabled. std:isnan support check failed.")
message(STATUS "ppconvert disabled.")
endif()

0 comments on commit 98619fe

Please sign in to comment.