CONFIG: cmake targets are globally unique

- unify CMakeLists naming and align content
This commit is contained in:
Mark Olesen
2018-07-20 12:49:25 +02:00
parent 96b65a781d
commit 56dd71ab11
9 changed files with 225 additions and 188 deletions

View File

@ -0,0 +1,26 @@
#-----------------------------------------------------------------------------
# Standard definitions when using OpenFOAM
if (NOT EXISTS "$ENV{WM_PROJECT_DIR}")
message(FATAL_ERROR "WM_PROJECT_DIR not set - no OpenFOAM??")
endif()
# WM_OSTYPE env variable is optional (only POSIX anyhow)
if (EXISTS "$ENV{WM_OSTYPE}")
set(WM_OSTYPE "$ENV{WM_OSTYPE}")
else()
set(WM_OSTYPE "POSIX")
endif()
# Convenience name, as per wmake internals
set(LIB_SRC "$ENV{WM_PROJECT_DIR}/src")
# Needed for internal label-size, scalar-size, templates
add_definitions(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
-DNoRepository
-std=c++11
)
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,65 @@
#-----------------------------------------------------------------------------
# OpenFOAM reader plugin for ParaView GUI
link_directories(
$ENV{FOAM_LIBBIN}
)
include_directories(
${LIB_SRC}/OpenFOAM/lnInclude
${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude
${LIB_SRC}/conversion/lnInclude
${LIB_SRC}/finiteArea/lnInclude
${LIB_SRC}/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../foamPv
${PROJECT_SOURCE_DIR}/../vtkPVFoam
)
set(OPENFOAM_LIBRARIES
OpenFOAM
finiteVolume
finiteArea
conversion
)
# Set output library destination to plugin directory
set(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
qt5_wrap_cpp(MOC_SRCS pqFoamReaderControls.h)
else()
qt4_wrap_cpp(MOC_SRCS pqFoamReaderControls.h)
endif()
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
TYPE "openfoam_reader_general_controls"
CLASS_NAME pqFoamReaderControls
)
add_paraview_plugin(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
GUI_INTERFACES
${IFACES0}
SOURCES
${IFACES0_SRCS}
${MOC_SRCS}
pqFoamReaderControls.cxx
)
target_link_libraries(
PVFoamReader_SM
LINK_PUBLIC
vtkPVFoam-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
${OPENFOAM_LIBRARIES}
)
#-----------------------------------------------------------------------------

View File

@ -1,101 +1,23 @@
# Create a plugin to add a reader to the ParaView GUI
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0002 NEW) # Policy CMP0002 required for for cmake >= 3
# Fail if not building out-of-source
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR
"In-source builds disallowed. Use a separate build directory")
endif()
#-----------------------------------------------------------------------------
# Simple discovery and sanity checks
find_package(ParaView REQUIRED)
include(${PARAVIEW_USE_FILE})
#-----------------------------------------------------------------------------
# Standard definitions when using OpenFOAM
if (NOT EXISTS "$ENV{WM_PROJECT_DIR}")
message(FATAL_ERROR "WM_PROJECT_DIR not set - no OpenFOAM??")
endif()
# WM_OSTYPE env variable is optional (only POSIX anyhow)
if (EXISTS "$ENV{WM_OSTYPE}")
set(WM_OSTYPE "$ENV{WM_OSTYPE}")
else()
set(WM_OSTYPE "POSIX")
endif()
# Convenience name, as per wmake internals
set(LIB_SRC "$ENV{WM_PROJECT_DIR}/src")
# Needed for internal label-size, scalar-size, templates
add_definitions(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
-DNoRepository
-std=c++11
)
#-----------------------------------------------------------------------------
link_directories(
$ENV{FOAM_LIBBIN}
)
include_directories(
${LIB_SRC}/OpenFOAM/lnInclude
${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude
${LIB_SRC}/conversion/lnInclude
${LIB_SRC}/finiteArea/lnInclude
${LIB_SRC}/finiteVolume/lnInclude
${PROJECT_SOURCE_DIR}/../foamPv
${PROJECT_SOURCE_DIR}/../vtkPVFoam
)
set(OPENFOAM_LIBRARIES
OpenFOAM
finiteVolume
finiteArea
conversion
)
# Set output library destination to plugin directory
set(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
qt5_wrap_cpp(MOC_SRCS
pqFoamReaderControls.h
)
else()
qt4_wrap_cpp(MOC_SRCS
pqFoamReaderControls.h
)
endif()
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
TYPE "openfoam_reader_general_controls"
CLASS_NAME pqFoamReaderControls
)
add_paraview_plugin(
PVFoamReader_SM "1.0"
SERVER_MANAGER_XML PVFoamReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVFoamReader.cxx
GUI_INTERFACES
${IFACES0}
SOURCES
${IFACES0_SRCS}
${MOC_SRCS}
pqFoamReaderControls.cxx
)
target_link_libraries(
PVFoamReader_SM
LINK_PUBLIC
vtkPVFoam-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
${OPENFOAM_LIBRARIES}
)
include(CMakeLists-OpenFOAM.txt)
include(CMakeLists-Project.txt)
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,26 @@
#-----------------------------------------------------------------------------
# Standard definitions when using OpenFOAM
if (NOT EXISTS "$ENV{WM_PROJECT_DIR}")
message(FATAL_ERROR "WM_PROJECT_DIR not set - no OpenFOAM??")
endif()
# WM_OSTYPE env variable is optional (only POSIX anyhow)
if (EXISTS "$ENV{WM_OSTYPE}")
set(WM_OSTYPE "$ENV{WM_OSTYPE}")
else()
set(WM_OSTYPE "POSIX")
endif()
# Convenience name, as per wmake internals
set(LIB_SRC "$ENV{WM_PROJECT_DIR}/src")
# Needed for internal label-size, scalar-size, templates
add_definitions(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
-DNoRepository
-std=c++11
)
#-----------------------------------------------------------------------------

View File

@ -0,0 +1,61 @@
#-----------------------------------------------------------------------------
# OpenFOAM blockMeshDict reader plugin for ParaView GUI
link_directories(
$ENV{FOAM_LIBBIN}
)
include_directories(
${LIB_SRC}/OpenFOAM/lnInclude
${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude
${LIB_SRC}/meshing/blockMesh/lnInclude
${PROJECT_SOURCE_DIR}/../foamPv
${PROJECT_SOURCE_DIR}/../vtkPVblockMesh
)
set(OPENFOAM_LIBRARIES
OpenFOAM
blockMesh
)
# Set output library destination to plugin directory
set(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
qt5_wrap_cpp(MOC_SRCS pqFoamBlockMeshControls.h)
else()
qt4_wrap_cpp(MOC_SRCS pqFoamBlockMeshControls.h)
endif()
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
TYPE "openfoam_blockMesh_general_controls"
CLASS_NAME pqFoamBlockMeshControls
)
add_paraview_plugin(
PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES
${IFACES0}
SOURCES
${IFACES0_SRCS}
${MOC_SRCS}
pqFoamBlockMeshControls.cxx
)
target_link_libraries(
PVblockMeshReader_SM
LINK_PUBLIC
vtkPVblockMesh-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
${OPENFOAM_LIBRARIES}
)
#-----------------------------------------------------------------------------

View File

@ -1,96 +1,23 @@
# Create a plugin to add a reader to the ParaView GUI
#-----------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0002 NEW) # Policy CMP0002 required for for cmake >= 3
# Fail if not building out-of-source
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR
"In-source builds disallowed. Use a separate build directory")
endif()
#-----------------------------------------------------------------------------
# Simple discovery and sanity checks
find_package(ParaView REQUIRED)
include(${PARAVIEW_USE_FILE})
link_directories(
$ENV{FOAM_LIBBIN}
)
#-----------------------------------------------------------------------------
# Standard definitions when using OpenFOAM
if (NOT EXISTS "$ENV{WM_PROJECT_DIR}")
message(FATAL_ERROR "WM_PROJECT_DIR not set - no OpenFOAM??")
endif()
# WM_OSTYPE env variable is optional (only POSIX anyhow)
if (EXISTS "$ENV{WM_OSTYPE}")
set(WM_OSTYPE "$ENV{WM_OSTYPE}")
else()
set(WM_OSTYPE "POSIX")
endif()
# Convenience name, as per wmake internals
set(LIB_SRC "$ENV{WM_PROJECT_DIR}/src")
# Needed for internal label-size, scalar-size, templates
add_definitions(
-DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
-DNoRepository
-std=c++11
)
#-----------------------------------------------------------------------------
include_directories(
${LIB_SRC}/OpenFOAM/lnInclude
${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude
${LIB_SRC}/meshing/blockMesh/lnInclude
${PROJECT_SOURCE_DIR}/../foamPv
${PROJECT_SOURCE_DIR}/../vtkPVblockMesh
)
set(OPENFOAM_LIBRARIES
OpenFOAM
blockMesh
)
# Set output library destination to plugin directory
set(
LIBRARY_OUTPUT_PATH $ENV{PV_PLUGIN_PATH}
CACHE INTERNAL
"Single output directory for building all libraries."
)
if (PARAVIEW_QT_VERSION VERSION_GREATER "4")
qt5_wrap_cpp(MOC_SRCS
pqFoamBlockMeshControls.h
)
else()
qt4_wrap_cpp(MOC_SRCS
pqFoamBlockMeshControls.h
)
endif()
add_paraview_property_group_widget(IFACES0 IFACES0_SRCS
TYPE "openfoam_blockMesh_general_controls"
CLASS_NAME pqFoamBlockMeshControls
)
add_paraview_plugin(
PVblockMeshReader_SM "1.0"
SERVER_MANAGER_XML PVblockMeshReader_SM.xml
SERVER_MANAGER_SOURCES vtkPVblockMeshReader.cxx
GUI_INTERFACES
${IFACES0}
SOURCES
${IFACES0_SRCS}
${MOC_SRCS}
pqFoamBlockMeshControls.cxx
)
target_link_libraries(
PVblockMeshReader_SM
LINK_PUBLIC
vtkPVblockMesh-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
foamPv-pv${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}
${OPENFOAM_LIBRARIES}
)
#-----------------------------------------------------------------------------
include(CMakeLists-OpenFOAM.txt)
include(CMakeLists-Project.txt)
#-----------------------------------------------------------------------------

View File

@ -1,4 +1,5 @@
#-----------------------------------------------------------------------------
project(runTimePostProcessing)
include(${VTK_USE_FILE})
@ -28,7 +29,8 @@ link_directories(
set(CMAKE_BUILD_TYPE Release)
# Set output library destination to plugin directory
# Build intermediate (library) directly into the OpenFOAM libdir
# - implies CMAKE_INSTALL_PREFIX is ignored and there is no 'install' phase
set(LIBRARY_OUTPUT_PATH $ENV{FOAM_LIBBIN}
CACHE INTERNAL
""

View File

@ -1,9 +1,15 @@
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0002 NEW) # Policy CMP0002 required for for cmake >= 3
project(runTimePostProcessing)
# Fail if not building out-of-source
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
message(FATAL_ERROR
"In-source builds disallowed. Use a separate build directory")
endif()
# Set policy for CMP0002 needed for cmake > 3
cmake_policy(SET CMP0002 OLD)
#-----------------------------------------------------------------------------
# Simple discovery and sanity checks
if (EXISTS "$ENV{VTK_DIR}")
message("Building with VTK from $ENV{VTK_DIR}")
@ -11,7 +17,7 @@ if (EXISTS "$ENV{VTK_DIR}")
include(${VTK_USE_FILE})
elseif (EXISTS "$ENV{ParaView_DIR}")
message("Building with Paraview from $ENV{ParaView_DIR}")
find_package(ParaView REQUIRED)
find_package(ParaView REQUIRED HINTS $ENV{ParaView_DIR})
include(${VTK_USE_FILE})
set(
VTK_VERSION
@ -21,7 +27,9 @@ else()
message(FATAL_ERROR "VTK not found using VTK_DIR or ParaView_DIR")
endif()
#-----------------------------------------------------------------------------
include(CMakeLists-OpenFOAM.txt)
include(CMakeLists-Common.txt)
include(CMakeLists-Project.txt)
#-----------------------------------------------------------------------------