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