From d15913193cd81e4c26812181ab057411d08f8fc3 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 11 Nov 2019 11:21:45 +0100 Subject: [PATCH] COMP: adjust common paraview library name to vtkPVFoamCommon - similar prefixing as the dependent readers, making it easier to identify - add FOAM_API information as server module version --- src/paraview-plugins/Allwclean | 2 +- src/paraview-plugins/Allwmake | 2 +- .../blockMeshReader/CMakeLists-Project.txt | 8 +++++--- .../blockMeshReader/CMakeLists.txt | 19 ++++++++++++++++--- .../blockMeshReader/library/Make/options | 4 ++-- src/paraview-plugins/common/Make/files | 3 +++ .../{foamPv => common}/Make/options | 0 .../{foamPv => common}/foamPvCore.C | 0 .../{foamPv => common}/foamPvCore.H | 0 .../{foamPv => common}/foamPvCoreTemplates.C | 0 src/paraview-plugins/foamPv/Make/files | 3 --- .../foamReader/CMakeLists-Project.txt | 9 +++++---- .../foamReader/CMakeLists.txt | 17 ++++++++++++++--- .../foamReader/library/Make/options | 4 ++-- 14 files changed, 49 insertions(+), 22 deletions(-) create mode 100644 src/paraview-plugins/common/Make/files rename src/paraview-plugins/{foamPv => common}/Make/options (100%) rename src/paraview-plugins/{foamPv => common}/foamPvCore.C (100%) rename src/paraview-plugins/{foamPv => common}/foamPvCore.H (100%) rename src/paraview-plugins/{foamPv => common}/foamPvCoreTemplates.C (100%) delete mode 100644 src/paraview-plugins/foamPv/Make/files diff --git a/src/paraview-plugins/Allwclean b/src/paraview-plugins/Allwclean index 4336df9..405031c 100755 --- a/src/paraview-plugins/Allwclean +++ b/src/paraview-plugins/Allwclean @@ -7,7 +7,7 @@ cd ${0%/*} || exit 1 # Run from this directory get_pvplugin_api || echo "No ParaView plugin information found" 1>&2 # Cleanup libraries -wclean libso foamPv +wclean libso common wclean libso blockMeshReader/library wclean libso foamReader/library diff --git a/src/paraview-plugins/Allwmake b/src/paraview-plugins/Allwmake index 4e9cccf..c81120f 100755 --- a/src/paraview-plugins/Allwmake +++ b/src/paraview-plugins/Allwmake @@ -15,7 +15,7 @@ warnIncomplete() if have_pvplugin_support then ( - wmakeLibPv foamPv + wmakeLibPv common wmakeLibPv blockMeshReader/library wmakeLibPv foamReader/library diff --git a/src/paraview-plugins/blockMeshReader/CMakeLists-Project.txt b/src/paraview-plugins/blockMeshReader/CMakeLists-Project.txt index f8b8e45..cc78eac 100644 --- a/src/paraview-plugins/blockMeshReader/CMakeLists-Project.txt +++ b/src/paraview-plugins/blockMeshReader/CMakeLists-Project.txt @@ -1,6 +1,8 @@ #----------------------------------------------------------------------------- # OpenFOAM blockMeshDict reader plugin for ParaView GUI (pre-5.7) +set(CMAKE_BUILD_TYPE Release) + link_directories( $ENV{FOAM_LIBBIN} ) @@ -10,7 +12,7 @@ include_directories( ${LIB_SRC}/OpenFOAM/lnInclude ${LIB_SRC}/OSspecific/${WM_OSTYPE}/lnInclude ${LIB_SRC}/meshing/blockMesh/lnInclude - ${PROJECT_SOURCE_DIR}/../foamPv + ${PROJECT_SOURCE_DIR}/../common ${PROJECT_SOURCE_DIR}/library ${PROJECT_SOURCE_DIR}/plugin ${PROJECT_SOURCE_DIR}/plugin/reader @@ -37,7 +39,7 @@ add_paraview_property_group_widget(IFACES0 IFACES0_SRCS ) add_paraview_plugin( - PVblockMeshReader_SM "1.0" + PVblockMeshReader_SM "${foam_api}" SERVER_MANAGER_XML plugin/PVblockMeshReader_SM.xml SERVER_MANAGER_SOURCES @@ -53,7 +55,7 @@ add_paraview_plugin( target_link_libraries( PVblockMeshReader_SM LINK_PUBLIC - foamPv${foamPvLibQualifier} + vtkPVFoamCommon${foamPvLibQualifier} vtkPVblockMesh${foamPvLibQualifier} ${OPENFOAM_LIBNAMES} ) diff --git a/src/paraview-plugins/blockMeshReader/CMakeLists.txt b/src/paraview-plugins/blockMeshReader/CMakeLists.txt index 9062310..1259ea1 100644 --- a/src/paraview-plugins/blockMeshReader/CMakeLists.txt +++ b/src/paraview-plugins/blockMeshReader/CMakeLists.txt @@ -1,7 +1,7 @@ #----------------------------------------------------------------------------- - cmake_minimum_required(VERSION 2.8) -cmake_policy(SET CMP0002 NEW) # Policy CMP0002 required for for cmake >= 3 +cmake_policy(SET CMP0002 NEW) # For cmake >= 3 +cmake_policy(SET CMP0057 NEW) # For cmake >= 3.10.2 # Fail if not building out-of-source if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) @@ -32,16 +32,29 @@ else() endif() endif() +# Pass through the OpenFOAM API value to the reader +set(foam_api "$ENV{FOAM_API}") +if (NOT "${foam_api}") + set(foam_api "2.0") +endif() + set(foamPvLibQualifier "-pv${pv_api}") -message("OpenFOAM libraries qualified with ${foamPvLibQualifier}") + +#----------------------------------------------------------------------------- + +message("================") +message("Using ParaView = $ENV{ParaView_DIR}") +message("OpenFOAM api = ${foam_api}, libs = ${foamPvLibQualifier}") #----------------------------------------------------------------------------- include(CMakeLists-OpenFOAM.txt) if (${ParaView_VERSION} GREATER_EQUAL 5.7) + message("================") include(CMakeLists-Project57.txt) else() + message("================") include(${PARAVIEW_USE_FILE}) include(CMakeLists-Project.txt) endif() diff --git a/src/paraview-plugins/blockMeshReader/library/Make/options b/src/paraview-plugins/blockMeshReader/library/Make/options index f6b3113..a3bafe7 100644 --- a/src/paraview-plugins/blockMeshReader/library/Make/options +++ b/src/paraview-plugins/blockMeshReader/library/Make/options @@ -6,11 +6,11 @@ EXE_INC = \ -I$(LIB_SRC)/mesh/blockMesh/lnInclude \ -I$(PARAVIEW_INC_DIR) \ -I$(PARAVIEW_INC_DIR)/vtkkwiml \ - -I../../foamPv \ + -I../../common \ -I../plugin/reader LIB_LIBS = \ -lmeshTools \ -lblockMesh \ - -L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \ + -L$(FOAM_LIBBIN) -lvtkPVFoamCommon-pv${PARAVIEW_API} \ $(GLIBS) diff --git a/src/paraview-plugins/common/Make/files b/src/paraview-plugins/common/Make/files new file mode 100644 index 0000000..8710846 --- /dev/null +++ b/src/paraview-plugins/common/Make/files @@ -0,0 +1,3 @@ +foamPvCore.C + +LIB = $(FOAM_LIBBIN)/libvtkPVFoamCommon-pv${PARAVIEW_API} diff --git a/src/paraview-plugins/foamPv/Make/options b/src/paraview-plugins/common/Make/options similarity index 100% rename from src/paraview-plugins/foamPv/Make/options rename to src/paraview-plugins/common/Make/options diff --git a/src/paraview-plugins/foamPv/foamPvCore.C b/src/paraview-plugins/common/foamPvCore.C similarity index 100% rename from src/paraview-plugins/foamPv/foamPvCore.C rename to src/paraview-plugins/common/foamPvCore.C diff --git a/src/paraview-plugins/foamPv/foamPvCore.H b/src/paraview-plugins/common/foamPvCore.H similarity index 100% rename from src/paraview-plugins/foamPv/foamPvCore.H rename to src/paraview-plugins/common/foamPvCore.H diff --git a/src/paraview-plugins/foamPv/foamPvCoreTemplates.C b/src/paraview-plugins/common/foamPvCoreTemplates.C similarity index 100% rename from src/paraview-plugins/foamPv/foamPvCoreTemplates.C rename to src/paraview-plugins/common/foamPvCoreTemplates.C diff --git a/src/paraview-plugins/foamPv/Make/files b/src/paraview-plugins/foamPv/Make/files deleted file mode 100644 index f3fb1b8..0000000 --- a/src/paraview-plugins/foamPv/Make/files +++ /dev/null @@ -1,3 +0,0 @@ -foamPvCore.C - -LIB = $(FOAM_LIBBIN)/libfoamPv-pv${PARAVIEW_API} diff --git a/src/paraview-plugins/foamReader/CMakeLists-Project.txt b/src/paraview-plugins/foamReader/CMakeLists-Project.txt index c3bf5d1..8d08198 100644 --- a/src/paraview-plugins/foamReader/CMakeLists-Project.txt +++ b/src/paraview-plugins/foamReader/CMakeLists-Project.txt @@ -1,6 +1,8 @@ #----------------------------------------------------------------------------- # OpenFOAM reader plugin for ParaView GUI (pre-5.7) +set(CMAKE_BUILD_TYPE Release) + link_directories( $ENV{FOAM_LIBBIN} ) @@ -13,7 +15,7 @@ include_directories( ${LIB_SRC}/conversion/lnInclude ${LIB_SRC}/finiteArea/lnInclude ${LIB_SRC}/finiteVolume/lnInclude - ${PROJECT_SOURCE_DIR}/../foamPv + ${PROJECT_SOURCE_DIR}/../common ${PROJECT_SOURCE_DIR}/library ${PROJECT_SOURCE_DIR}/plugin ${PROJECT_SOURCE_DIR}/plugin/reader @@ -43,7 +45,7 @@ add_paraview_property_group_widget(IFACES0 IFACES0_SRCS ) add_paraview_plugin( - PVFoamReader_SM "1.0" + PVFoamReader_SM "${foam_api}" SERVER_MANAGER_XML plugin/PVFoamReader_SM.xml SERVER_MANAGER_SOURCES @@ -56,11 +58,10 @@ add_paraview_plugin( plugin/pqFoamReaderControls.cxx ) - target_link_libraries( PVFoamReader_SM LINK_PUBLIC - foamPv${foamPvLibQualifier} + vtkPVFoamCommon${foamPvLibQualifier} vtkPVFoam${foamPvLibQualifier} ${OPENFOAM_LIBNAMES} ) diff --git a/src/paraview-plugins/foamReader/CMakeLists.txt b/src/paraview-plugins/foamReader/CMakeLists.txt index 9062310..e434f07 100644 --- a/src/paraview-plugins/foamReader/CMakeLists.txt +++ b/src/paraview-plugins/foamReader/CMakeLists.txt @@ -1,7 +1,7 @@ #----------------------------------------------------------------------------- - cmake_minimum_required(VERSION 2.8) -cmake_policy(SET CMP0002 NEW) # Policy CMP0002 required for for cmake >= 3 +cmake_policy(SET CMP0002 NEW) # For cmake >= 3 +cmake_policy(SET CMP0057 NEW) # For cmake >= 3.10.2 # Fail if not building out-of-source if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) @@ -32,16 +32,27 @@ else() endif() endif() +# Pass through the OpenFOAM API value to the reader +set(foam_api "$ENV{FOAM_API}") +if (NOT "${foam_api}") + set(foam_api "2.0") +endif() + set(foamPvLibQualifier "-pv${pv_api}") -message("OpenFOAM libraries qualified with ${foamPvLibQualifier}") #----------------------------------------------------------------------------- +message("================") +message("Using ParaView = $ENV{ParaView_DIR}") +message("OpenFOAM api = ${foam_api}, libs = ${foamPvLibQualifier}") + include(CMakeLists-OpenFOAM.txt) if (${ParaView_VERSION} GREATER_EQUAL 5.7) + message("================") include(CMakeLists-Project57.txt) else() + message("================") include(${PARAVIEW_USE_FILE}) include(CMakeLists-Project.txt) endif() diff --git a/src/paraview-plugins/foamReader/library/Make/options b/src/paraview-plugins/foamReader/library/Make/options index 7315fd9..0e6f37d 100644 --- a/src/paraview-plugins/foamReader/library/Make/options +++ b/src/paraview-plugins/foamReader/library/Make/options @@ -9,7 +9,7 @@ EXE_INC = \ -I$(LIB_SRC)/lagrangian/basic/lnInclude \ -I$(PARAVIEW_INC_DIR) \ -I$(PARAVIEW_INC_DIR)/vtkkwiml \ - -I../../foamPv \ + -I../../common \ -I../plugin/reader LIB_LIBS = \ @@ -21,5 +21,5 @@ LIB_LIBS = \ -ldynamicMesh \ -lgenericPatchFields \ -llagrangian \ - -L$(FOAM_LIBBIN) -lfoamPv-pv${PARAVIEW_API} \ + -L$(FOAM_LIBBIN) -lvtkPVFoamCommon-pv${PARAVIEW_API} \ $(GLIBS) -- GitLab