Skip to content

Commit

Permalink
CMake: allow user to build and install plotfile tools. Fixes issue AM…
Browse files Browse the repository at this point in the history
  • Loading branch information
mic84 committed Jun 18, 2019
1 parent 7f9c319 commit e19e107
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,15 @@ if (ENABLE_TUTORIALS)
add_subdirectory(Tutorials)
endif ()

#
# Plotfile tools
#
option(ENABLE_PLOTFILE_TOOLS "Enable Plotfile tools" NO)

if (ENABLE_PLOTFILE_TOOLS)
# If this get executed, it cannot be EXCLUDED_FROM_ALL
# because it needs to get installed
add_subdirectory(Tools/Plotfile)
endif ()


4 changes: 3 additions & 1 deletion Docs/sphinx_documentation/source/BuildingAMReX.rst
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,9 @@ below.
| ENABLE_ASCENT | Enable Ascent support | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
| ENABLE_HYPRE | Enable HYPRE interfaces | NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
+------------------------------+-------------------------------------------------+-------------+-----------------+
| ENABLE_PLOTFILE_TOOLS | Build and install plotfile postprocessing tools| NO | YES, NO |
+------------------------------+-------------------------------------------------+-------------+-----------------+
.. raw:: latex

\end{center}
Expand Down
36 changes: 36 additions & 0 deletions Tools/Plotfile/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
project(AMReX-PlotfileTools
DESCRIPTION "AMReX tools to postprocess plot files"
)

# Plotfile tools requires only AMReX sources from Src/Base which get always
# compiled, so no need to check which part of AMReX is enabled by user


# General Target to build all tools at once
add_custom_target(plotfile_tools)

set(_exe_names
fboxinfo
fcompare
fextract
fextrema
fnan
fsnapshot
ftime
fvarnames
)

# Build targets one by one
foreach( _exe IN LISTS _exe_names)
add_executable(${_exe} ${_exe}.cpp)
target_link_libraries(${_exe} PRIVATE amrex)
add_dependencies(plotfile_tools ${_exe})
endforeach()


# target snapshot needs a special treatment
target_include_directories(fsnapshot PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(fsnapshot PRIVATE AMReX_PPMUtil.H AMReX_PPMUtil.cpp)

# Installation
install(TARGETS ${_exe_names} RUNTIME DESTINATION bin)

0 comments on commit e19e107

Please sign in to comment.