From 341c3c2c50fffaf2d7269de64deb5588c81dbf54 Mon Sep 17 00:00:00 2001 From: Berenger Bramas Date: Fri, 30 Jan 2015 12:07:17 +0100 Subject: [PATCH] Add a generic way to test if a FUSE is inside a file --- Addons/CKernelApi/CMakeLists.txt | 30 +++++++++--------------- Addons/FmmApi/CMakeLists.txt | 30 +++++++++--------------- CMakeLists.txt | 14 ++++++++++++ Examples/CMakeLists.txt | 39 +++++++++----------------------- Tests/CMakeLists.txt | 39 +++++++++----------------------- UTests/CMakeLists.txt | 39 +++++++++----------------------- Utils/CMakeLists.txt | 39 +++++++++----------------------- 7 files changed, 80 insertions(+), 150 deletions(-) diff --git a/Addons/CKernelApi/CMakeLists.txt b/Addons/CKernelApi/CMakeLists.txt index 39a76de5..13e8e172 100755 --- a/Addons/CKernelApi/CMakeLists.txt +++ b/Addons/CKernelApi/CMakeLists.txt @@ -55,25 +55,17 @@ if(SCALFMM_ADDON_CKERNELAPI) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT SCALFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT SCALFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) diff --git a/Addons/FmmApi/CMakeLists.txt b/Addons/FmmApi/CMakeLists.txt index 641564b5..edcf2a4d 100755 --- a/Addons/FmmApi/CMakeLists.txt +++ b/Addons/FmmApi/CMakeLists.txt @@ -55,25 +55,17 @@ if(SCALFMM_ADDON_FMMAPI) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT SCALFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT SCALFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8487f324..d67b7068 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,14 @@ ELSE(APPLE) SET(SSE_FLAGS "-mtune=native -march=native") # -mtune=native -march=native ENDIF(APPLE) endif() + +############################################################################## +# FUSE list # +############################################################################## +set(FUSE_LIST "") +# then do list(APPEND FUSE_LIST "BLAS") to protect from FUSE_BLAS +list(APPEND FUSE_LIST "MPI") + ############################################################################## # Debug flags # ############################################################################## @@ -212,6 +220,7 @@ if( ScalFMM_USE_BLAS ) SET(SCALFMM_LIBRARIES "${SCALFMM_LIBRARIES};${BLASLAPACK_LIBRARIES}") MESSAGE(STATUS "SCALFMM_LIBRARIES = ${SCALFMM_LIBRARIES}") endif(ScalFMM_USE_BLAS) +list(APPEND FUSE_LIST "BLAS") # # FFT option # @@ -239,6 +248,7 @@ if( ScalFMM_USE_FFT ) MESSAGE(STATUS " SCALFMM_LIBRARIES = ${SCALFMM_LIBRARIES}") MESSAGE(STATUS " SCALFMM_INCLUDES = ${SCALFMM_INCLUDES}") endif(ScalFMM_USE_FFT) +list(APPEND FUSE_LIST "FFT") # Compile option #ADD_DEFINITIONS(-Wall -Wshadow -Wpointer-arith -Wcast-qual -Wconversion -fpic ) @@ -278,6 +288,7 @@ if( ScalFMM_USE_STARPU ) # SET(SCALFMM_INCLUDES "${SCALFMM_INCLUDES}; ${STARPU_INCLUDES}") include_directories(${STARPU_INCLUDES}) endif(ScalFMM_USE_STARPU) +list(APPEND FUSE_LIST "STARPU") # ################################################################## # Use SSE # @@ -304,6 +315,7 @@ if( ScalFMM_USE_SSE ) MESSAGE(FATAL_ERROR "SSE NOT SUPPORTED ; Set ScalFMM_USE_SSE to OFF \n Output from test is : ${COMPILE_SSE_OUTPUT}") ENDIF(${COMPILE_SSE}) endif() +list(APPEND FUSE_LIST "SSE") ################################################################## # Use AVX # ################################################################## @@ -329,6 +341,7 @@ ELSE(${COMPILE_AVX}) MESSAGE(FATAL_ERROR "AVX NOT SUPPORTED ; Set ScalFMM_USE_AVX to OFF \n Output from test is : ${COMPILE_AVX_OUTPUT} ") ENDIF(${COMPILE_AVX}) endif(ScalFMM_USE_AVX) +list(APPEND FUSE_LIST "AVX") # # Error if both ScalFMM_USE_AVX AND ScalFMM_USE_SSE are set # @@ -348,6 +361,7 @@ if( ScalFMM_USE_MIC_NATIVE ) else() # SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xhost") ENDIF() +list(APPEND FUSE_LIST "MIC") ################################################################## # ################################################################## diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 5cc90348..9fc05095 100755 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -31,34 +31,17 @@ foreach(exec ${source_tests_files}) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT ScalFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test FFT dependency - file(STRINGS "${exec}" lines_fft REGEX "@FUSE_FFT") - if(lines_fft) - if( NOT ScalFMM_USE_FFT ) - MESSAGE( STATUS "This needs FFT = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT ScalFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 6c4fb861..108d3d72 100755 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -30,34 +30,17 @@ foreach(exec ${source_tests_files}) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT ScalFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test FFT dependency - file(STRINGS "${exec}" lines_fft REGEX "@FUSE_FFT") - if(lines_fft) - if( NOT ScalFMM_USE_FFT ) - MESSAGE( STATUS "This needs FFT = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT ScalFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) diff --git a/UTests/CMakeLists.txt b/UTests/CMakeLists.txt index b035a60b..cdd450a7 100755 --- a/UTests/CMakeLists.txt +++ b/UTests/CMakeLists.txt @@ -69,34 +69,17 @@ foreach(exec ${source_tests_files}) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT ScalFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test FFT dependency - file(STRINGS "${exec}" lines_fft REGEX "@FUSE_FFT") - if(lines_fft) - if( NOT ScalFMM_USE_FFT ) - MESSAGE( STATUS "This needs FFT = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT ScalFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt index 9e1f45ee..832aa904 100755 --- a/Utils/CMakeLists.txt +++ b/Utils/CMakeLists.txt @@ -30,34 +30,17 @@ foreach(exec ${source_tests_files}) NAME_WE ) - set(compile_exec "TRUE") - - # Test Blas dependency - file(STRINGS "${exec}" lines_blas REGEX "@FUSE_BLAS") - if(lines_blas) - if( NOT ScalFMM_USE_BLAS ) - MESSAGE( STATUS "This needs BLAS = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test FFT dependency - file(STRINGS "${exec}" lines_fft REGEX "@FUSE_FFT") - if(lines_fft) - if( NOT ScalFMM_USE_FFT ) - MESSAGE( STATUS "This needs FFT = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() - - # Test MPI dependency - file(STRINGS "${exec}" lines_mpi REGEX "@FUSE_MPI") - if(lines_mpi) - if( NOT ScalFMM_USE_MPI ) - MESSAGE( STATUS "This needs MPI = ${exec}" ) - set(compile_exec "FALSE") - endif() - endif() + set(compile_exec "TRUE") + + foreach(fuse_key ${FUSE_LIST}) + file(STRINGS "${exec}" lines_fuse REGEX "@FUSE_${fuse_key}") + if(lines_fuse) + if( NOT ScalFMM_USE_${fuse_key} ) + MESSAGE( STATUS "This needs ${fuse_key} = ${exec}" ) + set(compile_exec "FALSE") + endif() + endif() + endforeach() # Dependency are OK if( compile_exec ) -- GitLab