Skip to content

Commit

Permalink
Fix some bugs with new cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
mic84 committed Jun 22, 2017
1 parent 5ada997 commit 5b56f85
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 24 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ create_exports()
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}/CCSEConfigVersion-install.cmake.in)

option(ENABLE_Config_Report "Print out detailed information at the end of a configuration")
Expand Down
64 changes: 50 additions & 14 deletions Src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- mode: cmake -*-

include(TestManager)
#include(TestManager)

#
# Define a project name
Expand All @@ -9,25 +8,62 @@ include(TestManager)
# CBOXLIB_BINARY_DIR
# Other projects (subdirectories) can reference this directory
# through these variables.
project(CBOXLIB)
project ( CBOXLIB )

include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_Arena.cpp AMReX_BArena.cpp AMReX_BaseFab.cpp AMReX_BCRec.cpp AMReX_BLBackTrace.cpp AMReX_BoxArray.cpp AMReX_Box.cpp AMReX_BoxIterator.cpp AMReX_BoxDomain.cpp AMReX.cpp AMReX_BoxList.cpp AMReX_CArena.cpp AMReX_CoordSys.cpp AMReX_DistributionMapping.cpp AMReX_FabArrayBase.cpp AMReX_FabConv.cpp AMReX_FArrayBox.cpp AMReX_FPC.cpp AMReX_Geometry.cpp AMReX_MultiFabUtil.cpp AMReX_IArrayBox.cpp AMReX_IndexType.cpp AMReX_IntVect.cpp AMReX_iMultiFab.cpp AMReX_MemPool.cpp AMReX_MultiFab.cpp AMReX_MFCopyDescriptor.cpp AMReX_MFIter.cpp AMReX_NFiles.cpp AMReX_Orientation.cpp AMReX_ParallelDescriptor.cpp AMReX_ParmParse.cpp AMReX_Periodicity.cpp AMReX_PhysBCFunct.cpp AMReX_PlotFileUtil.cpp AMReX_RealBox.cpp AMReX_RealVect.cpp AMReX_Utility.cpp AMReX_VisMF.cpp AMReX_parmparse_fi.cpp AMReX_error_fi.cpp AMReX_BLProfiler.cpp)
set ( CXX_source_files
AMReX_Arena.cpp AMReX_BArena.cpp AMReX_BaseFab.cpp AMReX_BCRec.cpp
AMReX_BLBackTrace.cpp AMReX_BoxArray.cpp AMReX_Box.cpp AMReX_BoxIterator.cpp
AMReX_BoxDomain.cpp AMReX.cpp AMReX_BoxList.cpp AMReX_CArena.cpp
AMReX_CoordSys.cpp AMReX_DistributionMapping.cpp AMReX_FabArrayBase.cpp
AMReX_FabConv.cpp AMReX_FArrayBox.cpp AMReX_FPC.cpp AMReX_Geometry.cpp
AMReX_MultiFabUtil.cpp AMReX_IArrayBox.cpp AMReX_IndexType.cpp
AMReX_IntVect.cpp AMReX_iMultiFab.cpp AMReX_MemPool.cpp AMReX_MultiFab.cpp
AMReX_MFCopyDescriptor.cpp AMReX_MFIter.cpp AMReX_NFiles.cpp
AMReX_Orientation.cpp AMReX_ParallelDescriptor.cpp AMReX_ParmParse.cpp
AMReX_Periodicity.cpp AMReX_PhysBCFunct.cpp AMReX_PlotFileUtil.cpp
AMReX_RealBox.cpp AMReX_RealVect.cpp AMReX_Utility.cpp AMReX_VisMF.cpp
AMReX_parmparse_fi.cpp AMReX_error_fi.cpp AMReX_BLProfiler.cpp)

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(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 ( F77_source_files
AMReX_BLProfiler_F.f AMReX_BLBoxLib_F.f AMReX_bl_flush.f
AMReX_BLParmParse_F.f AMReX_BLutil_F.f)

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)
set ( FPP_source_files AMReX_COORDSYS_${BL_SPACEDIM}D.F
AMReX_FILCC_${BL_SPACEDIM}D.F )

set(F77_header_files AMReX_bc_types.fi)
set(FPP_header_files AMReX_COORDSYS_F.H AMReX_SPACE_F.H AMReX_BaseFab_f.H AMReX_filcc_f.H)
set(F90_header_files)
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 )

set ( F77_header_files AMReX_bc_types.fi)
set ( FPP_header_files AMReX_COORDSYS_F.H AMReX_SPACE_F.H AMReX_BaseFab_f.H AMReX_filcc_f.H)
set ( F90_header_files )

set_F77_properties ( FPP_out_files ${FPP_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} )

preprocess_boxlib_fortran(FPP_out_files ${FPP_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})
Expand Down
6 changes: 2 additions & 4 deletions Src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,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)

add_subdirectory(${CBOXDIR})
add_subdirectory(${CBNDRYDIR})
add_subdirectory(${CPARTDIR})
Expand All @@ -44,8 +42,8 @@ add_install_library(cfboxlib)
add_install_library(fboxlib)

# Move Tools dir to install location
install(CODE "MESSAGE(\"-- Copying : ${CCSE_TOOLS_DIR} --> ${CCSE_INSTALL_DIR}\")" )
install(CODE "FILE( COPY ${CCSE_TOOLS_DIR} DESTINATION ${CCSE_INSTALL_DIR} )")
install(CODE "MESSAGE(\"-- Copying : ${AMREX_TOOLS_DIR} --> ${CCSE_INSTALL_DIR}\")" )
install(CODE "FILE( COPY ${AMREX_TOOLS_DIR} DESTINATION ${CCSE_INSTALL_DIR} )")
SET_TARGET_PROPERTIES(cboxlib PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(cfboxlib PROPERTIES LINKER_LANGUAGE C)
SET_TARGET_PROPERTIES(fboxlib PROPERTIES LINKER_LANGUAGE C)
Expand Down
4 changes: 3 additions & 1 deletion Tools/CMake/AMReX_CMakeVariables.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ set (AMREX_Cray_CXXFLAGS_DEBUG "-O0")
set (AMREX_Cray_CXXFLAGS_RELEASE "-02")
set (AMREX_Cray_CXXFLAGS_REQUIRED "")#-ftemplate-depth-64 -Wno-deprecated")


#
# Compile- and link-time variables
#
Expand All @@ -104,6 +103,9 @@ set (AMREX_EXTRA_Fortran_LIBRARIES)
set (AMREX_EXTRA_C_LINK_FLAGS)
set (AMREX_EXTRA_CXX_LINK_FLAGS)
set (AMREX_EXTRA_Fortran_LINK_FLAGS)
set (AMREX_EXTRA_C_LINK_LINE)
set (AMREX_EXTRA_CXX_LINK_LINE)
set (AMREX_EXTRA_Fortran_LINK_LINE)

# Variable to show this file was loaded
set ( AMREX_VARIABLES_LOADED "TRUE" )
8 changes: 4 additions & 4 deletions Tools/CMake/AMReX_Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,15 @@ endif()
# ------------------------------------------------------------- #
# Setup compiler flags
# ------------------------------------------------------------- #
if ( AMREX_FFLAGS_OVERRIDE )
set ( AMREX_Fortran_FLAGS ${AMREX_FFLAGS_OVERRIDE} )
if ( AMREX_FFLAGS_OVERRIDES )
set ( AMREX_Fortran_FLAGS ${AMREX_FFLAGS_OVERRIDES} )
else ()
append ( AMREX_${FC_ID}_FFLAGS_${AMREX_BUILD_TYPE}
AMREX_Fortran_FLAGS )
endif ()

if ( AMREX_CXXLAGS_OVERRIDE )
set ( AMREX_CXX_FLAGS ${AMREX_CXXFLAGS_OVERRIDE} )
if ( AMREX_CXXLAGS_OVERRIDES )
set ( AMREX_CXX_FLAGS ${AMREX_CXXFLAGS_OVERRIDES} )
else ()
append ( AMREX_${CXX_ID}_CXXFLAGS_${AMREX_BUILD_TYPE}
AMREX_CXX_FLAGS )
Expand Down
9 changes: 9 additions & 0 deletions Tools/CMake/AMReX_Utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ function ( add_define new_define all_defines )

endfunction ()


function (set_F77_properties OUTVAR)
set_source_files_properties(${ARGN} PROPERTIES COMPILE_DEFINITIONS "BL_LANG_FORT")
set(${OUTVAR} ${ARGN} PARENT_SCOPE)
endfunction (set_F77_properties)




function(preprocess_boxlib_fortran OUTVAR)
set_source_files_properties(${ARGN} PROPERTIES COMPILE_DEFINITIONS "BL_LANG_FORT")
set(${OUTVAR} ${ARGN} PARENT_SCOPE)
Expand Down

0 comments on commit 5b56f85

Please sign in to comment.