Commit 8f05fcbb authored by Mark Olesen's avatar Mark Olesen

COMP: Catalyst with working directory support is now default

- disable only for old versions
parent fd89cf4b
...@@ -20,13 +20,14 @@ add_definitions( ...@@ -20,13 +20,14 @@ add_definitions(
-DWM_$ENV{WM_PRECISION_OPTION} -DWM_$ENV{WM_PRECISION_OPTION}
-DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE} -DWM_LABEL_SIZE=$ENV{WM_LABEL_SIZE}
-DNoRepository -DNoRepository
-std=c++11
) )
set(CMAKE_CXX_FLAGS_DEBUG set(CMAKE_CXX_FLAGS_DEBUG
"-g -O0 -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual" "-g -O0 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual"
) )
set(CMAKE_CXX_FLAGS_RELEASE set(CMAKE_CXX_FLAGS_RELEASE
"-O3 -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual" "-O3 -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -Wno-overloaded-virtual"
) )
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
project(catalyst) project(catalyst)
include(${PARAVIEW_USE_FILE}) set(CMAKE_BUILD_TYPE Release)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Test some characteristics unset(LINK_LIBRARIES)
set(test_file ${CMAKE_CURRENT_BINARY_DIR}/check_initialize.cxx)
file(WRITE ${test_file} # Prior to paraview-5.6 no working directory support in Catalyst
"#include <vtkCPProcessor.h>\n" if (${ParaView_VERSION} LESS 5.6)
"int main() {\n" add_definitions(-DNO_CATALYST_WORKING_DIRECTORY)
" vtkCPProcessor* p = vtkCPProcessor::New();\n" message(WARNING "==== CAUTION: Catalyst without chdir capability ====")
" p->Initialize(\"AAA\");\n" endif()
" p->Delete();\n"
" return 0;\n" if (${ParaView_VERSION} GREATER_EQUAL 5.7)
"}" if (TARGET "VTK::ParallelMPI")
) set(FOAM_USING_VTK_MPI TRUE)
try_compile(CATALYST_HAS_WORKING_DIRECTORY endif()
${CMAKE_CURRENT_BINARY_DIR} ${test_file}
LINK_LIBRARIES vtkPVPythonCatalyst
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${PARAVIEW_INCLUDE_DIRS}"
)
if (CATALYST_HAS_WORKING_DIRECTORY)
add_definitions(-DUSE_CATALYST_WORKING_DIRECTORY)
else()
message(WARNING "==== CAUTION: ParaView Catalyst without chdir capability ====")
endif() endif()
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
link_directories(
$ENV{FOAM_LIBBIN}
$ENV{FOAM_LIBBIN}/dummy
)
include_directories( include_directories(
${LIB_SRC}/OpenFOAM/include ${LIB_SRC}/OpenFOAM/include
${LIB_SRC}/OpenFOAM/lnInclude ${LIB_SRC}/OpenFOAM/lnInclude
...@@ -43,13 +40,6 @@ include_directories( ...@@ -43,13 +40,6 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
link_directories(
$ENV{FOAM_LIBBIN}
$ENV{FOAM_LIBBIN}/dummy
)
set(CMAKE_BUILD_TYPE Release)
file(GLOB SOURCE_FILES file(GLOB SOURCE_FILES
catalystCoprocess.C catalystCoprocess.C
...@@ -83,13 +73,6 @@ set(OPENFOAM_LIBRARIES ...@@ -83,13 +73,6 @@ set(OPENFOAM_LIBRARIES
overset overset
) )
if (PARAVIEW_USE_MPI)
set(LINK_LIBRARIES vtkPVPythonCatalyst vtkParallelMPI)
else()
set(LINK_LIBRARIES vtkPVPythonCatalyst)
endif()
add_library( add_library(
catalystFoam catalystFoam
SHARED SHARED
...@@ -99,12 +82,13 @@ add_library( ...@@ -99,12 +82,13 @@ add_library(
set_target_properties( set_target_properties(
catalystFoam catalystFoam
PROPERTIES PROPERTIES
VERSION ${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}.${PARAVIEW_VERSION_PATCH} VERSION ${pv_version}
SOVERSION ${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR} SOVERSION ${pv_api}
) )
target_link_libraries( target_link_libraries(
catalystFoam catalystFoam
${VTK_LIBRARIES}
${LINK_LIBRARIES} ${LINK_LIBRARIES}
${OPENFOAM_LIBRARIES} ${OPENFOAM_LIBRARIES}
) )
......
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8) 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 # Fail if not building out-of-source
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
...@@ -8,20 +9,36 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) ...@@ -8,20 +9,36 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
"In-source builds disallowed. Use a separate build directory") "In-source builds disallowed. Use a separate build directory")
endif() endif()
include(CMakeLists-OpenFOAM.txt)
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Simple sanity checks # Simple discovery and sanity checks
if (EXISTS "$ENV{ParaView_DIR}") if (EXISTS "$ENV{ParaView_DIR}")
find_package(ParaView REQUIRED COMPONENTS vtkPVPythonCatalyst) find_package(ParaView REQUIRED)
else() else()
message(FATAL_ERROR "ParaView_DIR not set") message(FATAL_ERROR "ParaView_DIR not set")
endif() endif()
# Define pv_api as MAJ.MIN
if (${ParaView_VERSION} GREATER_EQUAL 5.7)
string(REGEX MATCH [0-9]+[.][0-9]+ pv_api ${ParaView_VERSION})
set(pv_version "${ParaView_VERSION}")
else()
set(pv_api "${PARAVIEW_VERSION_MAJOR}.${ParaView_VERSION_MINOR}")
set(pv_version "${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}.${PARAVIEW_VERSION_PATCH}")
endif()
if (${ParaView_VERSION} GREATER_EQUAL 5.7)
find_package(ParaView REQUIRED
COMPONENTS PythonCatalyst
OPTIONAL_COMPONENTS VTK::ParallelMPI)
else()
find_package(ParaView REQUIRED
COMPONENTS vtkPVPythonCatalyst
OPTIONAL_COMPONENTS vtkParallelMPI)
## include(${PARAVIEW_USE_FILE})
endif()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# All messages
message("================") message("================")
message("Using OpenFOAM = $ENV{WM_PROJECT_DIR}") message("Using OpenFOAM = $ENV{WM_PROJECT_DIR}")
...@@ -32,9 +49,9 @@ endif() ...@@ -32,9 +49,9 @@ endif()
message("install prefix = ${CMAKE_INSTALL_PREFIX}") message("install prefix = ${CMAKE_INSTALL_PREFIX}")
message("================") message("================")
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
include(CMakeLists-OpenFOAM.txt)
include(CMakeLists-Project.txt) include(CMakeLists-Project.txt)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenCFD Ltd. Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018 CINECA Copyright (C) 2018 CINECA
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -118,7 +118,7 @@ void Foam::catalyst::coprocess::stop() ...@@ -118,7 +118,7 @@ void Foam::catalyst::coprocess::stop()
void Foam::catalyst::coprocess::reset(const fileName& outputDir) void Foam::catalyst::coprocess::reset(const fileName& outputDir)
{ {
#ifdef USE_CATALYST_WORKING_DIRECTORY #ifndef NO_CATALYST_WORKING_DIRECTORY
if (coproc_ == nullptr) if (coproc_ == nullptr)
{ {
coproc_ = vtkCPProcessor::New(); coproc_ = vtkCPProcessor::New();
......
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