Commit 1ae33537 authored by Burlen Loring's avatar Burlen Loring

cmake cleanup

* MPI to use extern "C" with included headers, solves
  name mangling issues with cmake 3.11 FindMPI and OpenMPI
* VTK-m cleanup, and test with vtk-m clone at a891e6d90a9f
* rename interface libraries to prevent clashes, eg diy
  renamed to sDIY, mpi renamed to sMPI, python to sPython, etc
parent dc9c0f43
......@@ -4,8 +4,8 @@ set(SENSEI_VERSION_MINOR "@SENSEI_VERSION_MINOR@")
set(SENSEI_VERSION_PATCH "@SENSEI_VERSION_PATCH@")
set(SENSEI_VERSION_DEVEL "@SENSEI_VERSION_DEVEL@")
if(NOT SENSEI_DIR)
if(@SENSEI_BUILD@)
if (NOT SENSEI_DIR)
if (@SENSEI_BUILD@)
set(SENSEI_DIR "@CMAKE_BINARY_DIR@")
else()
set(SENSEI_DIR "@CMAKE_INSTALL_PREFIX@")
......@@ -14,7 +14,7 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${SENSEI_DIR}")
set(SENSEI_LIB_TYPE STATIC)
if(@BUILD_SHARED_LIBS@)
if (@BUILD_SHARED_LIBS@)
set(SENSEI_LIB_TYPE SHARED)
endif()
......@@ -36,7 +36,6 @@ set(ENABLE_VTK_GENERIC_ARRAYS @ENABLE_VTK_GENERIC_ARRAYS@)
set(ENABLE_VTK_ACCELERATORS @ENABLE_VTK_ACCELERATORS@)
set(ENABLE_VTK_MPI @ENABLE_VTK_MPI@)
set(ENABLE_VTK_IO @ENABLE_VTK_IO@)
set(ENABLE_VTKM @ENABLE_VTKM@)
set(ENABLE_VTKM_RENDERING @ENABLE_VTKM_RENDERING@)
......@@ -46,40 +45,40 @@ if (NOT CMAKE_CXX_FLAGS)
FORCE)
endif()
if(ENABLE_CATALYST)
if(NOT ParaView_DIR)
if (ENABLE_CATALYST)
if (NOT ParaView_DIR)
set(ParaView_DIR "@ParaView_DIR@")
find_package(ParaView REQUIRED)
endif()
else()
if(NOT VTK_DIR)
if (NOT VTK_DIR)
set(VTK_DIR "@VTK_DIR@")
endif()
find_package(VTK REQUIRED)
endif()
include(thread)
include(mpi)
include(svtk)
include(sMPI)
include(sVTK)
include(timer)
include(pugixml)
include(timer)
include(diy)
if(ENABLE_VTKM)
include(vtkm)
include(sDIY)
if (ENABLE_VTKM)
include(sVTKm)
endif()
if(ENABLE_LIBSIM)
include(libsim)
if (ENABLE_LIBSIM)
include(sLibsim)
endif()
if(ENABLE_ADIOS)
include(adios)
if (ENABLE_ADIOS)
include(sADIOS)
endif()
if(ENABLE_CONDUIT)
include(sconduit)
if (ENABLE_CONDUIT)
include(sConduit)
endif()
include(senseiCore)
if(ENABLE_PYTHON)
include(python)
if (ENABLE_PYTHON)
include(sPython)
include(_PythonAnalysis)
endif()
include(sensei)
if(ENABLE_ADIOS)
find_package(ADIOS REQUIRED)
add_library(adios INTERFACE)
target_link_libraries(adios INTERFACE ${ADIOS_LIBRARIES})
target_include_directories(adios SYSTEM INTERFACE ${ADIOS_INCLUDE_DIRS})
add_library(sADIOS INTERFACE)
target_link_libraries(sADIOS INTERFACE ${ADIOS_LIBRARIES})
target_include_directories(sADIOS SYSTEM INTERFACE ${ADIOS_INCLUDE_DIRS})
if(ADIOS_DEFINITIONS)
target_compile_definitions(adios INTERFACE ${ADIOS_DEFINITIONS})
target_compile_definitions(sADIOS INTERFACE ${ADIOS_DEFINITIONS})
endif()
install(TARGETS adios EXPORT adios)
install(EXPORT adios DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS sADIOS EXPORT sADIOS)
install(EXPORT sADIOS DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
......@@ -13,11 +13,11 @@ if (ENABLE_CATALYST)
"containing `ParaViewConfig.cmake`.")
endif()
add_library(svtk INTERFACE)
target_link_libraries(svtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(svtk SYSTEM INTERFACE ${PARAVIEW_INCLUDE_DIRS})
target_compile_definitions(svtk INTERFACE ${VTK_DEFINITIONS})
add_library(sVTK INTERFACE)
target_link_libraries(sVTK INTERFACE ${VTK_LIBRARIES})
target_include_directories(sVTK SYSTEM INTERFACE ${PARAVIEW_INCLUDE_DIRS})
target_compile_definitions(sVTK INTERFACE ${VTK_DEFINITIONS})
install(TARGETS svtk EXPORT svtk)
install(EXPORT svtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS sVTK EXPORT sVTK)
install(EXPORT sVTK DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
if(ENABLE_LIBSIM)
find_package(LIBSIM REQUIRED)
add_library(libsim INTERFACE)
target_link_libraries(libsim INTERFACE ${LIBSIM_LIBRARIES})
target_include_directories(libsim SYSTEM INTERFACE ${LIBSIM_INCLUDE_DIRS})
install(TARGETS libsim EXPORT libsim)
install(EXPORT libsim DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
add_library(sLibsim INTERFACE)
target_link_libraries(sLibsim INTERFACE ${LIBSIM_LIBRARIES})
target_include_directories(sLibsim SYSTEM INTERFACE ${LIBSIM_INCLUDE_DIRS})
install(TARGETS sLibsim EXPORT sLibsim)
install(EXPORT sLibsim DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
find_package(MPI)
if (NOT MPI_C_FOUND)
message(FETAL_ERROR "Failed to locate MPI C libraries and headers")
endif()
add_library(mpi INTERFACE)
# MPI to use extern "C" when including headers
add_definitions(-DOMPI_SKIP_MPICXX=1 -DMPICH_SKIP_MPICXX=1)
# interface libarary for use elsewhere in the project
add_library(sMPI INTERFACE)
target_include_directories(mpi SYSTEM INTERFACE
target_include_directories(sMPI SYSTEM INTERFACE
${MPI_C_INCLUDE_PATH} ${MPI_C_INCLUDE_DIRS})
target_link_libraries(mpi INTERFACE ${MPI_C_LIBRARIES})
target_link_libraries(sMPI INTERFACE ${MPI_C_LIBRARIES})
install(TARGETS mpi EXPORT mpi)
install(EXPORT mpi DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS sMPI EXPORT sMPI)
install(EXPORT sMPI DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
......@@ -44,23 +44,14 @@ cmake_dependent_option(ENABLE_VTK_ACCELERATORS
"Enable analysis methods that use VTK-m via VTK's Accelerators module" OFF
"ENABLE_SENSEI" OFF)
# Build with vtk-m support
# If ENABLE_VTKM is ON, then linking your library/executable to vtkm_cont
# will add include-directories and preprocessor definitions required by vtk-m.
# The sensei library will transitively link to vtkm_cont.
cmake_dependent_option(ENABLE_VTKM
"Enable analysis methods that use VTK-m" OFF
"ENABLE_SENSEI" OFF)
# If ENABLE_VTKM_RENDERING is ON, then linking your library/executable to
# vtkm_rendering will add include-directories and preprocessor definitions
# required by vtk-m.
# The sensei library will transitively link to vtkm_rendering.
cmake_dependent_option(ENABLE_VTKM_RENDERING
"Enable analysis methods that use VTK-m's rendering library" OFF
"ENABLE_VTKM" OFF)
option(ENABLE_PARALLEL3D "Enable Parallel3D miniapp" ON)
option(ENABLE_OSCILLATORS "Enable Oscillators miniapp" ON)
option(ENABLE_CONDUITTEST "Enable Conduit miniapp" OFF)
......
......@@ -27,11 +27,11 @@ if (ENABLE_PYTHON)
endif()
find_package(MPI4PY REQUIRED)
add_library(python INTERFACE)
target_include_directories(python INTERFACE ${PYTHON_INCLUDE_PATH} ${MPI4PY_INCLUDE_DIR})
target_link_libraries(python INTERFACE ${PYTHON_LIBRARIES} svtk)
install(TARGETS python EXPORT python)
install(EXPORT python DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
add_library(sPython INTERFACE)
target_include_directories(sPython INTERFACE ${PYTHON_INCLUDE_PATH} ${MPI4PY_INCLUDE_DIR})
target_link_libraries(sPython INTERFACE ${PYTHON_LIBRARIES} sVTK)
install(TARGETS sPython EXPORT sPython)
install(EXPORT sPython DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
function(depend_swig input output)
set(input_file ${CMAKE_CURRENT_SOURCE_DIR}/${input})
......
......@@ -26,7 +26,7 @@ if (ENABLE_VTK_ACCELERATORS)
endif()
if (NOT ENABLE_CATALYST)
add_library(svtk INTERFACE)
add_library(sVTK INTERFACE)
find_package(VTK QUIET COMPONENTS ${SENSEI_VTK_COMPONENTS})
if (NOT VTK_FOUND)
......@@ -35,10 +35,10 @@ if (NOT ENABLE_CATALYST)
"VTK_DIR to point to a directory containing `VTKConfig.cmake`.")
endif()
target_link_libraries(svtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(svtk SYSTEM INTERFACE ${VTK_INCLUDE_DIRS})
target_compile_definitions(svtk INTERFACE ${VTK_DEFINITIONS})
target_link_libraries(sVTK INTERFACE ${VTK_LIBRARIES})
target_include_directories(sVTK SYSTEM INTERFACE ${VTK_INCLUDE_DIRS})
target_compile_definitions(sVTK INTERFACE ${VTK_DEFINITIONS})
install(TARGETS svtk EXPORT svtk)
install(EXPORT svtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS sVTK EXPORT sVTK)
install(EXPORT sVTK DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
set(SENSEI_VTKM_COMPONENTS Base)
if (ENABLE_VTKM_RENDERING)
list(APPEND SENSEI_VTKM_COMPONENTS Rendering)
endif()
if (ENABLE_VTKM)
find_package(VTKm QUIET REQUIRED COMPONENTS ${SENSEI_VTKM_COMPONENTS})
set(SENSEI_VTKM_COMPONENTS Base)
if (ENABLE_VTKM_RENDERING)
list(APPEND SENSEI_VTKM_COMPONENTS Rendering)
endif()
find_package(VTKm REQUIRED
COMPONENTS ${SENSEI_VTKM_COMPONENTS}
OPTIONAL_COMPONENTS TBB CUDA)
add_library(sVTKm INTERFACE)
target_link_libraries(sVTKm INTERFACE vtkm_cont)
#target_include_directories(sVTKm SYSTEM INTERFACE ${VTKm_INCLUDE_DIRS})
#target_compile_definitions(sVTKm INTERFACE ${VTKm_COMPILE_OPTIONS})
install(TARGETS sVTKm EXPORT sVTKm)
install(EXPORT sVTKm DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
......@@ -12,7 +12,7 @@ include(adios)
include(vtk)
include(libsim)
include(catalyst)
include(vtkm) # Place after vtk, catalyst, others that depend on vtkm
include(vtkm)
include(conduit)
include(python)
include(version)
......
if(ENABLE_ADIOS)
add_executable(ADIOSAnalysisEndPoint ADIOSAnalysisEndPoint.cxx)
target_link_libraries(ADIOSAnalysisEndPoint PRIVATE opts mpi adios sensei timer)
target_link_libraries(ADIOSAnalysisEndPoint PRIVATE opts sensei timer sADIOS sMPI)
endif()
set(sources conduitTest.cpp bridge.cpp)
set(libs mpi diy grid opts thread timer util sconduit sensei)
set(libs opts thread timer util sensei sConduit sDIY sMPI)
add_executable(conduitTest ${sources})
target_link_libraries(conduitTest ${libs})
......@@ -92,7 +92,7 @@ if(MPI_FOUND)
include_directories("tools")
set(libs mpi sconduit sensei)
set(libs mpi sConduit sensei)
if(ENABLE_OPENMP)
list(APPEND libs openmp)
endif()
......
set(sources main.cpp analysis.cpp)
set(libs mpi diy opts thread timer util)
set(libs sMPI sDIY opts thread timer util)
if(ENABLE_SENSEI)
list(APPEND sources bridge.cpp DataAdaptor.cpp Oscillator.cpp Particles.cpp Block.cpp)
......
set(sources parallel3d.c histogram.cpp)
set(libs m mpi timer)
set(libs m sMPI timer)
if (ENABLE_SENSEI)
list(APPEND sources DataAdaptor.cxx Bridge.cxx)
......
#include <vector>
#include <mpi.h>
#include <cstdio>
#include "histogram.h"
......
......@@ -8,7 +8,7 @@ if (ENABLE_PYTHON)
PYTHON_ADD_MODULE(_senseiPython ${CMAKE_CURRENT_BINARY_DIR}/senseiPython.cxx)
target_link_libraries(_senseiPython PUBLIC sensei python)
target_link_libraries(_senseiPython PUBLIC sensei sPython)
add_custom_command(TARGET _senseiPython POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
......
......@@ -8,11 +8,11 @@ if (ENABLE_SENSEI)
ProgrammableDataAdaptor.cxx VTKHistogram.cxx VTKDataAdaptor.cxx
VTKUtils.cxx)
set(senseiCore_libs mpi pugixml svtk thread timer diy)
set(senseiCore_libs pugixml thread timer sDIY sVTK sMPI)
if (ENABLE_CONDUIT)
list(APPEND senseiCore_sources ConduitDataAdaptor.cxx)
list(APPEND senseiCore_libs sconduit)
list(APPEND senseiCore_libs sConduit)
endif()
if (ENABLE_CATALYST)
......@@ -23,26 +23,26 @@ if (ENABLE_SENSEI)
if (ENABLE_VTKM)
list(APPEND senseiCore_sources VTKmVolumeReductionAnalysis.cxx
VTKmCDFAnalysis.cxx CDFReducer.cxx CinemaHelper.cxx)
list(APPEND senseiCore_libs vtkm_cont)
list(APPEND senseiCore_libs sVTKm)
endif()
if(ENABLE_ADIOS)
if (ENABLE_ADIOS)
list(APPEND senseiCore_sources ADIOSSchema.cxx ADIOSAnalysisAdaptor.cxx
ADIOSDataAdaptor.cxx)
list(APPEND senseiCore_libs adios)
list(APPEND senseiCore_libs sADIOS)
endif()
if(ENABLE_VTK_ACCELERATORS)
if (ENABLE_VTK_ACCELERATORS)
list(APPEND senseiCore_sources VTKmContourAnalysis.cxx)
endif()
if(ENABLE_LIBSIM)
if (ENABLE_LIBSIM)
list(APPEND senseiCore_sources LibsimAnalysisAdaptor.cxx
LibsimImageProperties.cxx)
list(APPEND senseiCore_libs libsim)
list(APPEND senseiCore_libs sLibsim)
endif()
if(ENABLE_VTK_IO)
if (ENABLE_VTK_IO)
list(APPEND senseiCore_sources VTKPosthocIO.cxx)
if (ENABLE_VTK_MPI)
list(APPEND senseiCore_sources VTKAmrWriter.cxx)
......@@ -68,9 +68,6 @@ if (ENABLE_SENSEI)
set(sensei_libs senseiCore)
# PythonAnalysis
# an analysis adaptor with a minimal set of Python bindings to enable an
# embedded interpreter to execute run time provided Python code implementing
# AnalysisAdaptor::Execute
if (ENABLE_PYTHON)
depend_swig(PythonAnalysis.i PythonAnalysis.dep)
......@@ -85,7 +82,7 @@ if (ENABLE_SENSEI)
${CMAKE_CURRENT_BINARY_DIR}/_PythonAnalysis.cxx)
set_target_properties(_PythonAnalysis PROPERTIES PREFIX "")
target_link_libraries(_PythonAnalysis PUBLIC senseiCore python)
target_link_libraries(_PythonAnalysis PUBLIC senseiCore sPython)
add_custom_command(TARGET _PythonAnalysis POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
......
add_library(diy INTERFACE)
target_include_directories(diy SYSTEM INTERFACE
add_library(sDIY INTERFACE)
target_include_directories(sDIY SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)
install(TARGETS diy EXPORT diy)
install(EXPORT diy DESTINATION lib/cmake)
install(TARGETS sDIY EXPORT sDIY)
install(EXPORT sDIY DESTINATION lib/cmake)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/diy"
DESTINATION include)
......
if (BUILD_TESTING)
add_executable(CompareImages CompareImages.cxx)
target_link_libraries(CompareImages svtk)
target_link_libraries(CompareImages sVTK)
endif()
......@@ -4,7 +4,7 @@ target_include_directories(timer SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/timer>)
target_link_libraries(timer svtk mpi)
target_link_libraries(timer sVTK sMPI)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION include/timer FILES_MATCHING PATTERN "*.h")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment