Skip to content

Commit

Permalink
Modify way of add include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mic84 committed Jul 25, 2017
1 parent 96d6723 commit 197c1ee
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 62 deletions.
39 changes: 0 additions & 39 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,6 @@ include ( AMReX_Version )
include ( AMReX_Options )
include ( AMReX_Config )

#
# Usage:
#
# Typically cmake is used to support an "out-of-source-tree" build. To this with default
# settings (see below):
#
# #> export bdir=`pwd`
# #> mkdir <new_build_dir>
# #> cd <new_build_dir>
# #> cmake -DCMAKE_INSTALL_PREFIX:PATH=<some_install_prefix_for_amrex> $bdir
# #> make
# #> make install
#
# The install target will place all C++/Fortran header and mod files in an include folder,
# the CCSE libraries in a lib folder, plus some stuff in perl and cmake folders.
#
# An example cmake input file to build an app that links to the libs built as above:
#
# ./Tutorials/MultiGrid_C/CMakeLists.txt
#
# To build this tutorial with cmake, follow instructions similar to the above for building
# AMReX:
#
# #> mkdir <new_build_dir>
# #> cd <new_build_dir>
# #> cmake -DAMREX_INSTALL_PREFIX:PATH=<some_install_prefix_for_amrex> $bdir/Tutorials/MultiGrid_C
# #> make
# #> mpiexec -np 4 ./mgc_tutorial inputs.3d
#

# Define the project name
# This command will define
# CCSE_SOURCE_DIR
# CCSE_BINARY_DIR


# None, Debug, Release, RelWithDebInfo, MinSizeRel
#set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Type of CMake build")

set(CMAKE_INSTALL_PREFIX "${CURRENT_CMAKE_BINDARY_DIR}" CACHE STRING "Root dir where AMReX files installed")

# Enable testing, ctest needs this
Expand Down
1 change: 0 additions & 1 deletion Src/Amr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CAMRLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_Amr.cpp AMReX_AmrLevel.cpp AMReX_AuxBoundaryData.cpp AMReX_Derive.cpp AMReX_Extrapolater.cpp AMReX_StateData.cpp AMReX_StateDescriptor.cpp)
set(FPP_source_files AMReX_ARRAYLIM_${BL_SPACEDIM}D.F)
Expand Down
1 change: 0 additions & 1 deletion Src/AmrCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include (TestManager)
project (CAMRCORELIB)

include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CBOXLIB_INCLUDE_DIRS})

set ( CXX_source_files
AMReX_AmrCore.cpp AMReX_Cluster.cpp AMReX_ErrorList.cpp
Expand Down
1 change: 0 additions & 1 deletion Src/Base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# through these variables.
project ( CBOXLIB )

include_directories(${CBOXLIB_INCLUDE_DIRS})

set ( CXX_source_files
AMReX_Arena.cpp AMReX_BArena.cpp AMReX_BaseFab.cpp AMReX_BCRec.cpp
Expand Down
1 change: 0 additions & 1 deletion Src/Boundary/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CBNDRYLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_BndryData.cpp AMReX_BndryRegister.cpp AMReX_FabSet.cpp AMReX_InterpBndryData.cpp AMReX_MacBndry.cpp AMReX_Mask.cpp AMReX_MultiMask.cpp)
set(FPP_source_files AMReX_INTERPBNDRYDATA_${BL_SPACEDIM}D.F AMReX_LO_UTIL.F )
Expand Down
51 changes: 42 additions & 9 deletions Src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#
# Set subdirectories path
#
set (CBOXDIR Base)
set (FBOXDIR F_BaseLib)
set (CBNDRYDIR Boundary)
Expand All @@ -9,15 +12,48 @@ set (CTMGDIR LinearSolvers/C_TensorMG)
set (CFMGDIR LinearSolvers/C_to_F_MG)
set (FMGDIR LinearSolvers/F_MG)
set (CAMRDATADIR Extern/amrdata)
set (FINTDIR F_Interfaces)

# Pick one place to put modules so everyone can see them
# set ( CMAKE_Fortran_MODULE_DIRECTORY
# ${CMAKE_CURRENT_BINARY_DIR}/mod_files
# CACHE PATH "Folder for fortran module files")
#
# Add all the subdir to the include path
#
include_directories ( ${AMREX_EXTRA_Fortran_INCLUDE_PATH} ${AMREX_EXTRA_CXX_INCLUDE_PATH} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CBOXDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CBNDRYDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CPARTDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CAMRDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CAMRCOREDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CMGDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CTMGDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CFMGDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${CAMRDATADIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${FBOXDIR} )
include_directories ( ${INCLUDE_PATHS} )

list_include_dirs ( INCLUDE_PATHS ${CMAKE_CURRENT_LIST_DIR}/${FMGDIR} )
include_directories ( ${INCLUDE_PATHS} )

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})

add_subdirectory(${CBOXDIR})
add_subdirectory(${CBNDRYDIR})
Expand All @@ -26,14 +62,11 @@ add_subdirectory(${CAMRDIR})
add_subdirectory(${CAMRCOREDIR})
add_subdirectory(${CMGDIR})
add_subdirectory(${CTMGDIR})

set(FBOXLIB_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/${FBOXDIR} ${CMAKE_CURRENT_SOURCE_DIR}/${FMGDIR} ${AMREX_EXTRA_Fortran_INCLUDE_PATH})

add_subdirectory(${FBOXDIR})
add_subdirectory(${FMGDIR})

add_subdirectory(${CFMGDIR})


add_library(cboxlib $<TARGET_OBJECTS:box_c> $<TARGET_OBJECTS:box_cbndry> $<TARGET_OBJECTS:box_cpart> $<TARGET_OBJECTS:box_camr> $<TARGET_OBJECTS:box_camrcore> $<TARGET_OBJECTS:box_cmg> $<TARGET_OBJECTS:box_ctmg> $<TARGET_OBJECTS:box_cfmg>)
add_library(cfboxlib $<TARGET_OBJECTS:box_cfmg>)
add_library(fboxlib $<TARGET_OBJECTS:box_f> $<TARGET_OBJECTS:box_fmg>)
Expand Down
1 change: 0 additions & 1 deletion Src/Extern/amrdata/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(AMRDATALIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_AmrData.cpp AMReX_DataServices.cpp)
set(FPP_source_files AMReX_FABUTIL_${BL_SPACEDIM}D.F)
Expand Down
2 changes: 0 additions & 2 deletions Src/F_BaseLib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ include(TestManager)
# through these variables.
project(FBOXLIB)

include_directories(${FBOXLIB_INCLUDE_DIRS})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files backtrace_c.cpp)
set(C_source_files fabio_c.c ppm_util_c.c system_util_c.c timer_c.c)
Expand Down
26 changes: 26 additions & 0 deletions Src/F_Interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project ( FINTERFACESLIB )


set ( CXXSRC
AmrCore/AMReX_amrcore_fi.cpp AmrCore/AMReX_tagbox_fi.cpp AmrCore/AMReX_FAmrCore.cpp
AmrCore/AMReX_fillpatch_fi.cpp AmrCore/AMReX_fluxregister_fi.cpp
Base/AMReX_boxarray_fi.cpp Base/AMReX_fi_main.cpp Base/AMReX_multifab_fi.cpp
Base/AMReX_plotfile_fi.cpp Base/AMReX_box_fi.cpp Base/AMReX_FPhysBC.cpp
Base/AMReX_multifabutil_fi.cpp Base/AMReX_vismf_fi.cpp Base/AMReX_distromap_fi.cpp
Base/AMReX_geometry_fi.cpp Base/AMReX_physbc_fi.cpp
Octree/AMReX_octree_fi.cpp )

set ( F90SRC
AmrCore/AMReX_amrcore_mod.F90 AmrCore/AMReX_fillpatch_mod.F90 AmrCore/AMReX_interpolater_mod.F90
AmrCore/AMReX_amr_mod.F90 AmrCore/AMReX_fluxregister_mod.F90 AmrCore/AMReX_tagbox_mod.F90
Base/AMReX_base_mod.F90 Base/AMReX_distromap_mod.F90 Base/AMReX_multifab_mod.F90 Base/AMReX_physbc_mod.F90
Base/AMReX_boxarray_mod.F90 Base/AMReX_fab_mod.F90 Base/AMReX_multifabutil_mod.F90 Base/AMReX_plotfile_mod.F90
Base/AMReX_box_mod.F90 Base/AMReX_geometry_mod.F90 Base/AMReX_parallel_mod.F90
Octree/AMReX_octree_mod.F90 )

set ( CXXHEADERS AmrCore/AMReX_FAmrCore.H Base/AMReX_FPhysBC.H )

add_library ( finterfaces OBJECT ${CXXSRC} ${F90SRC} )

install_include_files (${CXXHEADERS})

1 change: 0 additions & 1 deletion Src/LinearSolvers/C_CellMG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CMGLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_ABecLaplacian.cpp AMReX_CGSolver.cpp AMReX_Laplacian.cpp AMReX_LinOp.cpp AMReX_MultiGrid.cpp)
set(FPP_source_files AMReX_ABec_${BL_SPACEDIM}D.F AMReX_ABec_UTIL.F AMReX_LO_${BL_SPACEDIM}D.F AMReX_LP_${BL_SPACEDIM}D.F AMReX_MG_${BL_SPACEDIM}D.F)
Expand Down
1 change: 0 additions & 1 deletion Src/LinearSolvers/C_CellMG4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CMGLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_ABecLaplacian.cpp AMReX_CGSolver.cpp AMReX_Laplacian.cpp AMReX_LinOp.cpp AMReX_MultiGrid.cpp)
set(FPP_source_files AMReX_ABec_${BL_SPACEDIM}D.F AMReX_ABec_UTIL.F AMReX_LO_${BL_SPACEDIM}D.F AMReX_LP_${BL_SPACEDIM}D.F AMReX_MG_${BL_SPACEDIM}D.F)
Expand Down
1 change: 0 additions & 1 deletion Src/LinearSolvers/C_TensorMG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CTMGLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_DivVis.cpp AMReX_MCCGSolver.cpp AMReX_MCInterpBndryData.cpp AMReX_MCLinOp.cpp AMReX_MCMultiGrid.cpp)
set(FPP_source_files AMReX_MCINTERPBNDRYDATA_${BL_SPACEDIM}D.F AMReX_MCLO_${BL_SPACEDIM}D.F)
Expand Down
2 changes: 0 additions & 2 deletions Src/LinearSolvers/C_to_F_MG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ include(TestManager)
project(CFMGLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})
include_directories(${FBOXLIB_INCLUDE_DIRS})

set(CXX_source_files AMReX_MGT_Solver.cpp AMReX_FMultiGrid.cpp)
set(FPP_source_files)
Expand Down
1 change: 0 additions & 1 deletion Src/LinearSolvers/F_MG/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ include(TestManager)
# through these variables.
project(FMG)

include_directories(${FBOXLIB_INCLUDE_DIRS})

include_directories(${CMAKE_FORTRAN_MODULE_DIRECTORY})

Expand Down
1 change: 0 additions & 1 deletion Src/Particle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ include(TestManager)
project(CPARTLIB)

include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CBOXLIB_INCLUDE_DIRS})

set(CXX_source_files)
set(FPP_source_files)
Expand Down

0 comments on commit 197c1ee

Please sign in to comment.