From d16f03b5b5be616532cfb4e1f9a25aaeb8374a24 Mon Sep 17 00:00:00 2001 From: dpasukhi Date: Sat, 12 Oct 2024 18:15:44 +0000 Subject: [PATCH] Configuration - Restoring VTK toolkit processing #99 Migration to PCH breaks some VTK search functionality. Fixed non-unique package name caching --- adm/cmake/occt_macros.cmake | 10 ++++++---- adm/cmake/occt_toolkit.cmake | 7 +++++-- src/IVtk/IVtk_Types.hxx | 2 ++ src/IVtkDraw/IVtkDraw.cxx | 1 - .../IVtkDraw_HighlightAndSelectionPipeline.cxx | 3 +++ src/IVtkDraw/IVtkDraw_Interactor.hxx | 1 - src/IVtkTools/IVtkTools.hxx | 2 ++ 7 files changed, 18 insertions(+), 8 deletions(-) diff --git a/adm/cmake/occt_macros.cmake b/adm/cmake/occt_macros.cmake index 50f139ea5d..5b423275ad 100644 --- a/adm/cmake/occt_macros.cmake +++ b/adm/cmake/occt_macros.cmake @@ -271,9 +271,11 @@ function(EXTRACT_TOOLKIT_EXTERNLIB RELATIVE_PATH OCCT_TOOLKIT RESULT_LIBS) endfunction() function (EXTRACT_PACKAGE_FILES RELATIVE_PATH OCCT_PACKAGE RESULT_FILES RESULT_INCLUDE_FOLDER) + # package name is not unique, it can be reuse in tools and src, + # use extra parameter as relative path to distinguish between them set (OCCT_PACKAGE_FILES "") - get_property(OCCT_PACKAGE_FILES GLOBAL PROPERTY OCCT_PACKAGE_${OCCT_PACKAGE}_FILES) - get_property(OCCT_PACKAGE_INCLUDE_DIR GLOBAL PROPERTY OCCT_PACKAGE_${OCCT_PACKAGE}_INCLUDE_DIR) + get_property(OCCT_PACKAGE_FILES GLOBAL PROPERTY OCCT_PACKAGE_${RELATIVE_PATH}_${OCCT_PACKAGE}_FILES) + get_property(OCCT_PACKAGE_INCLUDE_DIR GLOBAL PROPERTY OCCT_PACKAGE_${RELATIVE_PATH}_${OCCT_PACKAGE}_INCLUDE_DIR) if (OCCT_PACKAGE_FILES) set (${RESULT_FILES} ${OCCT_PACKAGE_FILES} PARENT_SCOPE) set (${RESULT_INCLUDE_FOLDER} ${OCCT_PACKAGE_INCLUDE_DIR} PARENT_SCOPE) @@ -310,8 +312,8 @@ function (EXTRACT_PACKAGE_FILES RELATIVE_PATH OCCT_PACKAGE RESULT_FILES RESULT_I set (${RESULT_FILES} ${FILE_PATH_LIST} PARENT_SCOPE) set (${RESULT_INCLUDE_FOLDER} ${OCCT_PACKAGE_INCLUDE_DIR} PARENT_SCOPE) - set_property(GLOBAL PROPERTY OCCT_PACKAGE_${OCCT_PACKAGE}_FILES "${FILE_PATH_LIST}") - set_property(GLOBAL PROPERTY OCCT_PACKAGE_${OCCT_PACKAGE}_INCLUDE_DIR "${OCCT_PACKAGE_INCLUDE_DIR}") + set_property(GLOBAL PROPERTY OCCT_PACKAGE_${RELATIVE_PATH}_${OCCT_PACKAGE}_FILES "${FILE_PATH_LIST}") + set_property(GLOBAL PROPERTY OCCT_PACKAGE_${RELATIVE_PATH}_${OCCT_PACKAGE}_INCLUDE_DIR "${OCCT_PACKAGE_INCLUDE_DIR}") endfunction() function(EXCTRACT_TOOLKIT_DEPS RELATIVE_PATH OCCT_TOOLKIT RESULT_TKS_AS_DEPS RESULT_INCLUDE_FOLDERS) diff --git a/adm/cmake/occt_toolkit.cmake b/adm/cmake/occt_toolkit.cmake index 3dfd0b6661..60032361e1 100644 --- a/adm/cmake/occt_toolkit.cmake +++ b/adm/cmake/occt_toolkit.cmake @@ -229,8 +229,11 @@ foreach (USED_ITEM ${USED_EXTERNLIB_AND_TOOLKITS}) string (REGEX MATCH "^CSF_" CSF_FOUND ${USED_ITEM}) string (REGEX MATCH "^vtk" VTK_FOUND ${USED_ITEM}) - if (NOT "${VTK_FOUND}" STREQUAL "" AND BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK) - OCCT_INSTALL_VTK(${USED_ITEM}) + if (NOT "${VTK_FOUND}" STREQUAL "") + list (APPEND USED_TOOLKITS_BY_CURRENT_PROJECT ${USED_ITEM}) + if (BUILD_SHARED_LIBS AND INSTALL_VTK AND COMMAND OCCT_INSTALL_VTK) + OCCT_INSTALL_VTK(${USED_ITEM}) + endif() continue() endif() # Search for 3rd-party libraries as a dependency diff --git a/src/IVtk/IVtk_Types.hxx b/src/IVtk/IVtk_Types.hxx index b1e00f5300..5c7acab9ca 100644 --- a/src/IVtk/IVtk_Types.hxx +++ b/src/IVtk/IVtk_Types.hxx @@ -24,6 +24,8 @@ #include #include +#include + #ifdef VTK_USE_64BIT_IDS #if defined(_WIN32) && !defined(_WIN64) #error "64-bit VTK library can not be linked for 32-bit target platform" diff --git a/src/IVtkDraw/IVtkDraw.cxx b/src/IVtkDraw/IVtkDraw.cxx index aedfc709a3..0f995d79b2 100644 --- a/src/IVtkDraw/IVtkDraw.cxx +++ b/src/IVtkDraw/IVtkDraw.cxx @@ -77,7 +77,6 @@ #include #ifndef _WIN32 #include - #include #include #include #include diff --git a/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx b/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx index b6fa1399aa..220678b90e 100644 --- a/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx +++ b/src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx @@ -13,6 +13,9 @@ // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. +// Workaround for PCH +#include + #include // prevent disabling some MSVC warning messages by VTK headers diff --git a/src/IVtkDraw/IVtkDraw_Interactor.hxx b/src/IVtkDraw/IVtkDraw_Interactor.hxx index 41c92fb0fc..547e877e3c 100644 --- a/src/IVtkDraw/IVtkDraw_Interactor.hxx +++ b/src/IVtkDraw/IVtkDraw_Interactor.hxx @@ -25,7 +25,6 @@ #else #include #include -#include #include #include #endif diff --git a/src/IVtkTools/IVtkTools.hxx b/src/IVtkTools/IVtkTools.hxx index f7263adf1f..b2e64996c0 100644 --- a/src/IVtkTools/IVtkTools.hxx +++ b/src/IVtkTools/IVtkTools.hxx @@ -19,6 +19,8 @@ #include #include +#include + class vtkLookupTable; class vtkMapper;