diff --git a/CMakeLists.txt b/CMakeLists.txt index a814c5da4d8..eb2880ceb7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,10 @@ -# -*- mode: cmake -*- -# Require cmake 2.8.8 or higher -cmake_minimum_required(VERSION 2.8.8) +cmake_minimum_required(VERSION 3.6) -if ("${CMAKE_PATCH_VERSION}" GREATER 3) - set(ADJUST_POLICY "True") -endif() +enable_language(CXX) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -if (${ADJUST_POLICY}) - cmake_policy(SET CMP0017 NEW) -endif() +enable_language(Fortran) # # Usage: @@ -112,7 +108,6 @@ ADD_INSTALL_INCLUDE_FILE(${CCSE_PERL_DIR}/AMReX_buildInfo.H) ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/CCSEOptions.cmake) ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/FindCCSE.cmake) ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/PreprocessAMReXFortran.cmake) -ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/PreprocessAMReXFortran90.cmake) ADD_INSTALL_CMAKE_FILES(${CCSE_MODULE_PATH}/CCSEConfigVersion-install.cmake.in) option(ENABLE_Config_Report "Print out detailed information at the end of a configuration") diff --git a/Src/Base/CMakeLists.txt b/Src/Base/CMakeLists.txt index 361deb1658f..447ed7af0aa 100644 --- a/Src/Base/CMakeLists.txt +++ b/Src/Base/CMakeLists.txt @@ -17,8 +17,7 @@ set(CXX_source_files AMReX_Arena.cpp AMReX_BArena.cpp AMReX_BaseFab.cpp AMReX_BC set(F77_source_files AMReX_BLProfiler_F.f AMReX_BLBoxLib_F.f AMReX_bl_flush.f AMReX_BLParmParse_F.f AMReX_BLutil_F.f) set(FPP_source_files AMReX_COORDSYS_${BL_SPACEDIM}D.F AMReX_FILCC_${BL_SPACEDIM}D.F) -set(F90PP_source_files AMReX_filcc_mod.F90 AMReX_omp_mod.F90 AMReX_fort_mod.F90 AMReX_parmparse_mod.F90 AMReX_string_mod.F90 AMReX_error_mod.F90 AMReX_bc_types_mod.F90) -set(F90_source_files AMReX_mempool_f.f90 AMReX_MultiFabUtil_${BL_SPACEDIM}d.f90 AMReX_BaseFab_nd.f90) +set(F90_source_files AMReX_mempool_f.f90 AMReX_MultiFabUtil_${BL_SPACEDIM}d.f90 AMReX_BaseFab_nd.f90 AMReX_filcc_mod.F90 AMReX_omp_mod.F90 AMReX_fort_mod.F90 AMReX_parmparse_mod.F90 AMReX_string_mod.F90 AMReX_error_mod.F90 ) set(CXX_header_files AMReX_Arena.H AMReX_Array.H AMReX_ArrayLim.H AMReX_BArena.H AMReX_BaseFab.H AMReX_BCRec.H AMReX_BC_TYPES.H AMReX_BLassert.H AMReX_BLBackTrace.H AMReX_BLFort.H AMReX_BLProfiler.H AMReX_BoxArray.H AMReX_BoxDomain.H AMReX_Box.H AMReX_BoxIterator.H AMReX.H AMReX_BoxList.H AMReX_CArena.H AMReX_ccse-mpi.H AMReX_CONSTANTS.H AMReX_CoordSys.H AMReX_DistributionMapping.H AMReX_FabArray.H AMReX_FabArrayBase.H AMReX_FACopyDescriptor.H AMReX_FabConv.H AMReX_FabFactory.H AMReX_FArrayBox.H AMReX_FPC.H AMReX_Geometry.H AMReX_MultiFabUtil.H AMReX_IArrayBox.H AMReX_IndexType.H AMReX_IntVect.H AMReX_Looping.H AMReX_iMultiFab.H AMReX_MakeType.H AMReX_MemPool.H AMReX_MultiFab.H AMReX_MFCopyDescriptor.H AMReX_MFIter.H AMReX_NFiles.H AMReX_Orientation.H AMReX_ParallelDescriptor.H AMReX_ParmParse.H AMReX_Array.H AMReX_Periodicity.H AMReX_PlotFileUtil.H AMReX_Print.H AMReX_RealBox.H AMReX_RealVect.H AMReX_REAL.H AMReX_SPACE.H AMReX_Tuple.H AMReX_TypeTraits.H AMReX_Utility.H AMReX_parstream.H AMReX_VisMF.H AMReX_PhysBCFunct.H AMReX_SPMD.H AMReX_SPMDI.H AMReX_TinyProfiler.H AMReX_BCUtil.H) @@ -27,39 +26,9 @@ set(FPP_header_files AMReX_COORDSYS_F.H AMReX_SPACE_F.H AMReX_BaseFab_f.H AMReX_ set(F90_header_files) preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files}) -preprocess_boxlib_fortran90(F90PP_out_files ${F90PP_source_files}) -set(local_source_files ${CXX_source_files} ${F77_source_files} ${FPP_out_files} ${F90PP_out_files} ${F90_source_files}) +set(local_source_files ${CXX_source_files} ${F77_source_files} ${FPP_out_files} ${F90_source_files}) set(local_header_files ${CXX_header_files} ${F77_header_files} ${FPP_header_files} ${F90_header_files}) add_library(box_c OBJECT ${local_source_files}) add_install_include_file(${local_header_files}) - -#if (BUILD_TESTS AND BL_SPACEDIM EQUAL 3) -# # Add UnitTest include directories -# include_directories(${UnitTest_INCLUDE_DIRS}) - -# set(BOXLIB_FILE_DIR "${BOXLIB_SOURCE_DIR}/test") - -# set(tBA_args ${BOXLIB_FILE_DIR}/ba.213 ${BOXLIB_FILE_DIR}/ba.60) -# add_executable(boxlib_tBA test/tBA.cpp) -# target_link_libraries(boxlib_tBA boxlib ${AMREX_EXTRA_LIBRARIES} ${UnitTest_LIBRARIES}) -# add_ccse_test("boxlib_1_tBA" "boxlib_tBA" KIND unit "${tBA_args}") - -# set(tDir_args "Testing/Temporary/dir_created_by_tDir_remove_me") -# add_executable(boxlib_tDir test/tDir.cpp) -# target_link_libraries(boxlib_tDir boxlib ${AMREX_EXTRA_LIBRARIES} ${UnitTest_LIBRARIES}) -# add_ccse_test("boxlib_2_tDir" "boxlib_tDir" KIND unit "${tDir_args}") - -# set(tDM_args ${BOXLIB_FILE_DIR}/ba.213 ${BOXLIB_FILE_DIR}/ba.60) -# add_executable(boxlib_tDM test/tDM.cpp) -# target_link_libraries(boxlib_tDM boxlib ${AMREX_EXTRA_LIBRARIES} ${UnitTest_LIBRARIES}) -# add_ccse_test("boxlib_3_tDM" "boxlib_tDM" KIND unit "${tDM_args}") - -# if(BOXLIB_IS_PARALLEL) -# set(tPD_args) -# add_executable(boxlib_tPD test/tPD.cpp) -# target_link_libraries(boxlib_tPD boxlib ${AMREX_EXTRA_LIBRARIES} ${UnitTest_LIBRARIES}) -# add_ccse_test("boxlib_4_tPD" "boxlib_tPD" KIND unit NPROCS 8 "${tPD_args}") -# endif() -#endif() diff --git a/Src/CMakeLists.txt b/Src/CMakeLists.txt index 1dd5de0b8c9..141c21c1748 100644 --- a/Src/CMakeLists.txt +++ b/Src/CMakeLists.txt @@ -18,7 +18,6 @@ install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ DESTINATION include) set(CBOXLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${CBOXDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CBNDRYDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CPARTDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CAMRDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CAMRCOREDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CMGDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CTMGDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CFMGDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${CAMRDATADIR} ${AMREX_EXTRA_CXX_INCLUDE_PATH}) include(PreprocessAMReXFortran) -include(PreprocessAMReXFortran90) add_subdirectory(${CBOXDIR}) add_subdirectory(${CBNDRYDIR}) diff --git a/Tools/CMake/PreprocessAMReXFortran90.cmake b/Tools/CMake/PreprocessAMReXFortran90.cmake deleted file mode 100644 index 012b7345124..00000000000 --- a/Tools/CMake/PreprocessAMReXFortran90.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# -*- mode: cmake -*- -# - Pass a list of Fortran files through a BoxLib-specific preprocessing -# -# PREPROCESS_BOXLIB_FORTRAN90( OUTVAR source1 ... sourceN ) -# -# OUTVAR A list containing all the output file names, suitable -# to be passed to add_executable or add_library. -# -# The output files are placed in the same relative location to -# CMAKE_CURRENT_BINARY_DIR as they are to CMAKE_CURRENT_SOURCE_DIR. -# -# Example: -# preprocess_boxlib_fortran90( SRCS src/test1.F src/test2.F ) -# add_executable( test ${SRCS} ) - -if(__PREPROCESS_BOXLIB_FORTRAN90_INCLUDED) - return() -endif() -set(__PREPROCESS_BOXLIB_FORTRAN90_INCLUDED) - -find_package(Perl REQUIRED) - -function(preprocess_boxlib_fortran90 OUTVAR) - - if(MSVC) - set(BL_DEFINE_FLAG "/D") - else(MSVC) - set(BL_DEFINE_FLAG "-D") - endif(MSVC) - - get_directory_property(cmpdefs COMPILE_DEFINITIONS) - set(defflags "${BL_DEFINE_FLAG}BL_LANG_FORT") - foreach (d ${cmpdefs}) - list(APPEND defflags "${BL_DEFINE_FLAG}${d}") - endforeach (d ${compdefs}) - - get_directory_property(incldirs INCLUDE_DIRECTORIES) - set(inclflags) - foreach (i ${incldirs}) - list(APPEND inclflags "${CMAKE_INCLUDE_FLAG_C}${i}${CMAKE_INCLUDE_FLAG_C_SEP}") - endforeach (i ${incldirs}) - - set(outfiles) - foreach( f ${ARGN} ) - - if(NOT IS_ABSOLUTE "${f}") - get_filename_component(f "${f}" ABSOLUTE) - endif() - file(RELATIVE_PATH r "${CMAKE_CURRENT_SOURCE_DIR}" "${f}") - get_filename_component(n "${r}" NAME_WE) - get_filename_component(p "${r}" PATH) - get_filename_component(e "${r}" EXT) - if(MSVC) - set(of "${CMAKE_CURRENT_BINARY_DIR}\${p}${n}${e}.f90") - add_custom_command( - OUTPUT ${of} - COMMAND fpp /m /ansi ${inclflags} ${defflags} ${f} > ${of} - DEPENDS ${f} - COMMENT "Preprocessing ${f}..." - ) - else(MSVC) - set(of "${CMAKE_CURRENT_BINARY_DIR}/${p}${n}${e}.f90") - set(PREPROCESS_FLAGS) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - list(APPEND PREPROCESS_FLAGS "-traditional") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel") - list(APPEND PREPROCESS_FLAGS "-traditional") - elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - list(APPEND PREPROCESS_FLAGS "-traditional") - endif() - - add_custom_command( - OUTPUT ${of} - COMMAND ${CMAKE_C_COMPILER} -E ${PREPROCESS_FLAGS} ${inclflags} ${defflags} ${f} > ${of} - DEPENDS ${f} - COMMENT "Preprocessing ${f}..." - ) - endif(MSVC) - set_source_files_properties(${of} PROPERTIES GENERATED ON) - list(APPEND outfiles "${of}") - endforeach(f) - set(${OUTVAR} ${outfiles} PARENT_SCOPE) - -endfunction(preprocess_boxlib_fortran90)