From b5af7da2c64df06c6bab3e45d8054ab95da495d9 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 5 May 2020 07:10:42 -0600 Subject: [PATCH 1/5] cmake: enable Fortran before checking for the compiler --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 4d107f9da6..0ee0ef3772 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -553,8 +553,8 @@ if(BUILD_TOOLS) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) include(CheckGeneratorSupport) + enable_language(Fortran) if(CMAKE_GENERATOR_SUPPORT_FORTRAN AND CMAKE_Fortran_COMPILER) - enable_language(Fortran) add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) From bcd50646b4f66f055adfcee459ba5c4e6723c21f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 5 May 2020 10:23:04 -0400 Subject: [PATCH 2/5] don't enable fortran if the generator does not support it. --- cmake/CMakeLists.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0ee0ef3772..ac28e58f3e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -553,11 +553,15 @@ if(BUILD_TOOLS) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) include(CheckGeneratorSupport) - enable_language(Fortran) - if(CMAKE_GENERATOR_SUPPORT_FORTRAN AND CMAKE_Fortran_COMPILER) - add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) - target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) - install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) + if(CMAKE_GENERATOR_SUPPORT_FORTRAN) + enable_language(Fortran) + if(CMAKE_Fortran_COMPILER) + add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) + target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) + install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) + else() + message(WARNING "No suitable Fortran compiler found, skipping building 'chain.x'") + endif() else() message(WARNING "CMake build doesn't support fortran, skipping building 'chain.x'") endif() From 9708b589396c8b517c386b57cb05ed6c4af4c3d2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 5 May 2020 10:41:18 -0400 Subject: [PATCH 3/5] check for fortran instead of directly enabling it --- cmake/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ac28e58f3e..ff56b4b6d1 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -553,9 +553,11 @@ if(BUILD_TOOLS) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) include(CheckGeneratorSupport) + include(CheckLanguage) if(CMAKE_GENERATOR_SUPPORT_FORTRAN) - enable_language(Fortran) + check_language(Fortran) if(CMAKE_Fortran_COMPILER) + enable_language(Fortran) add_executable(chain.x ${LAMMPS_TOOLS_DIR}/chain.f) target_link_libraries(chain.x PRIVATE ${CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES}) install(TARGETS chain.x DESTINATION ${CMAKE_INSTALL_BINDIR}) From 8a114fca970f46c93d9c510302583d12a6bc3ce6 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Tue, 5 May 2020 08:53:49 -0600 Subject: [PATCH 4/5] cmake: include where it is used --- cmake/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index ff56b4b6d1..c1b3927b0f 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -553,8 +553,8 @@ if(BUILD_TOOLS) install(TARGETS binary2txt DESTINATION ${CMAKE_INSTALL_BINDIR}) include(CheckGeneratorSupport) - include(CheckLanguage) if(CMAKE_GENERATOR_SUPPORT_FORTRAN) + include(CheckLanguage) check_language(Fortran) if(CMAKE_Fortran_COMPILER) enable_language(Fortran) From b933538dfa94e3a25f21d702c62eb64185a2733c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 5 May 2020 11:27:19 -0400 Subject: [PATCH 5/5] tweak tbbmalloc search path for intel 19.1 compiler --- cmake/Modules/FindTBB_MALLOC.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindTBB_MALLOC.cmake b/cmake/Modules/FindTBB_MALLOC.cmake index 896db649af..776c2c4749 100644 --- a/cmake/Modules/FindTBB_MALLOC.cmake +++ b/cmake/Modules/FindTBB_MALLOC.cmake @@ -11,7 +11,8 @@ # TBB Malloc find_path(TBB_MALLOC_INCLUDE_DIR NAMES tbb/tbb.h PATHS $ENV{TBBROOT}/include) -find_library(TBB_MALLOC_LIBRARY NAMES tbbmalloc PATHS $ENV{TBBROOT}/lib/intel64/gcc4.7 +find_library(TBB_MALLOC_LIBRARY NAMES tbbmalloc PATHS $ENV{TBBROOT}/lib/intel64/gcc4.8 + $ENV{TBBROOT}/lib/intel64/gcc4.7 $ENV{TBBROOT}/lib/intel64/gcc4.4 $ENV{TBBROOT}/lib/intel64/gcc4.1)