mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0025244: CMake building procedure should support VTK usage
Added functionality for searching VTK products. Added procedure install for VTK.
This commit is contained in:
parent
8591531065
commit
09c597c998
@ -41,6 +41,7 @@ if (APPLE)
|
||||
endif()
|
||||
|
||||
set (USE_FREEIMAGE OFF CACHE BOOL "Is freeimage used or not")
|
||||
set (USE_VTK OFF CACHE BOOL "Is VTK used or not")
|
||||
|
||||
if (NOT DEFINED ANDROID)
|
||||
set (USE_GL2PS OFF CACHE BOOL "Is gl2ps used or not")
|
||||
@ -106,12 +107,6 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_TK_LIBRARY_DIR")
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
if (USE_GLX)
|
||||
add_definitions (-DMACOSX_USE_GLX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/glx")
|
||||
endif()
|
||||
|
||||
# search for CSF_FREETYPE variable in EXTERNLIB of each being used toolkit
|
||||
OCCT_IS_PRODUCT_REQUIRED(CSF_FREETYPE USE_FREETYPE)
|
||||
|
||||
@ -126,10 +121,21 @@ else()
|
||||
OCCT_CHECK_AND_UNSET ("3RDPARTY_FREETYPE_LIBRARY_DIR")
|
||||
endif()
|
||||
|
||||
# VTK
|
||||
if (USE_VTK)
|
||||
add_definitions (-DHAVE_VTK)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/vtk")
|
||||
endif()
|
||||
|
||||
# GLX
|
||||
if (USE_GLX)
|
||||
add_definitions (-DMACOSX_USE_GLX)
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/glx")
|
||||
endif()
|
||||
|
||||
# FREEIMAGE
|
||||
if (USE_FREEIMAGE)
|
||||
add_definitions (-DHAVE_FREEIMAGE)
|
||||
message (STATUS "Info: freeimage is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimage")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/freeimageplus")
|
||||
else()
|
||||
@ -142,7 +148,6 @@ endif()
|
||||
# GL2PS
|
||||
if (USE_GL2PS)
|
||||
add_definitions (-DHAVE_GL2PS)
|
||||
message (STATUS "Info: gl2ps is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/gl2ps")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_GL2PS")
|
||||
@ -152,7 +157,6 @@ endif()
|
||||
# OPENCL
|
||||
if (USE_OPENCL)
|
||||
add_definitions (-DHAVE_OPENCL)
|
||||
message (STATUS "Info: OpenCL is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/opencl")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_OPENCL")
|
||||
@ -164,7 +168,6 @@ endif()
|
||||
# TBB
|
||||
if (USE_TBB)
|
||||
ADD_DEFINITIONS(-DHAVE_TBB)
|
||||
message (STATUS "Info: tbb is used by OCCT")
|
||||
OCCT_INCLUDE_CMAKE_FILE ("adm/templates/tbb")
|
||||
else()
|
||||
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
|
||||
|
@ -8,6 +8,7 @@ if "%VCVER%" == "@COMPILER@" (
|
||||
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIR@"
|
||||
set "GL2PS_DIR=@3RDPARTY_GL2PS_DLL_DIR@"
|
||||
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
|
||||
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -8,6 +8,7 @@ if [ "$COMPILER" == "@COMPILER@" ]; then
|
||||
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIR@"
|
||||
export GL2PS_DIR="@3RDPARTY_GL2PS_LIBRARY_DIR@"
|
||||
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
|
||||
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -27,6 +27,7 @@ if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
|
||||
if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
|
||||
if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
|
||||
if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
|
||||
if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
|
||||
|
||||
rem ----- Set path to 3rd party and OCCT libraries -----
|
||||
set "BIN_TAIL=win%ARCH%/%VCVER%/bin%CASDEB%"
|
||||
|
@ -57,6 +57,10 @@ if [ "$TBB_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${TBB_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
if [ "$VTK_DIR" != "" ]; then
|
||||
THRDPARTY_PATH="${VTK_DIR}:${THRDPARTY_PATH}"
|
||||
fi
|
||||
|
||||
BIN_PATH="${WOKSTATION}${ARCH}/${COMPILER}/bin${CASDEB}"
|
||||
LIBS_PATH="${WOKSTATION}${ARCH}/${COMPILER}/lib${CASDEB}"
|
||||
|
||||
|
@ -312,8 +312,8 @@ if (INSTALL_TCL)
|
||||
if (TCL_TCLSH_VERSION)
|
||||
# tcl is required to install in lib folder (without ${BUILD_POSTFIX})
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl8" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${3RDPARTY_TCL_LIBRARY_VERSION_WITH_DOT}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${3RDPARTY_TK_LIBRARY_VERSION_WITH_DOT}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tcl${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
install (DIRECTORY "${3RDPARTY_TCL_LIBRARY_DIR}/tk${TCL_TCLSH_VERSION}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib")
|
||||
else()
|
||||
message (STATUS "\nWarning: tclX.X and tkX.X subdirs won't be copyied during the installation process.")
|
||||
message (STATUS "Try seeking tcl within another folder by changing 3RDPARTY_TCL_DIR variable.")
|
||||
|
147
adm/templates/vtk.cmake
Normal file
147
adm/templates/vtk.cmake
Normal file
@ -0,0 +1,147 @@
|
||||
# vtk
|
||||
|
||||
if (NOT DEFINED INSTALL_VTK)
|
||||
set (INSTALL_VTK OFF CACHE BOOL "Is vtk required to be copied into install directory")
|
||||
endif()
|
||||
|
||||
# vtk directory
|
||||
if (NOT DEFINED 3RDPARTY_VTK_DIR)
|
||||
set (3RDPARTY_VTK_DIR "" CACHE PATH "The directory containing vtk")
|
||||
endif()
|
||||
|
||||
# vtk include directory
|
||||
if (NOT DEFINED 3RDPARTY_VTK_INCLUDE_DIR)
|
||||
set (3RDPARTY_VTK_INCLUDE_DIR "" CACHE FILEPATH "The directory containing headers of vtk")
|
||||
endif()
|
||||
|
||||
# vtk library directory
|
||||
if (NOT DEFINED 3RDPARTY_VTK_LIBRARY_DIR)
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "" CACHE FILEPATH "The directory containing vtk library")
|
||||
endif()
|
||||
|
||||
# vtk dll directory
|
||||
if (WIN32 AND NOT DEFINED 3RDPARTY_VTK_DLL_DIR)
|
||||
set (3RDPARTY_VTK_DLL_DIR "" CACHE FILEPATH "The directory containing VTK dll")
|
||||
endif()
|
||||
|
||||
# search for vtk in user defined directory
|
||||
if (NOT 3RDPARTY_VTK_DIR AND 3RDPARTY_DIR)
|
||||
FIND_PRODUCT_DIR("${3RDPARTY_DIR}" vtk VTK_DIR_NAME)
|
||||
if (VTK_DIR_NAME)
|
||||
set (3RDPARTY_VTK_DIR "${3RDPARTY_DIR}/${VTK_DIR_NAME}" CACHE PATH "The directory containing vtk product" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# find installed vtk
|
||||
find_package(VTK QUIET)
|
||||
|
||||
# find native vtk
|
||||
if (NOT VTK_FOUND)
|
||||
find_package(VTK QUIET PATHS "${3RDPARTY_VTK_DIR}")
|
||||
endif()
|
||||
|
||||
if (NOT VTK_FOUND AND NOT 3RDPARTY_VTK_DIR OR NOT EXISTS "${3RDPARTY_VTK_DIR}")
|
||||
message(SEND_ERROR "VTK not found. Set the 3RDPARTY_VTK_DIR cmake cache entry to the directory containing VTK.")
|
||||
set (3RDPARTY_VTK_DIR "3RDPARTY_VTK_DIR-NOTFOUND" CACHE PATH "The directory containing vtk product" FORCE)
|
||||
endif()
|
||||
|
||||
OCCT_MAKE_BUILD_POSTFIX()
|
||||
set(VTK_VERSION "")
|
||||
if (3RDPARTY_VTK_DIR AND EXISTS "${3RDPARTY_VTK_DIR}")
|
||||
get_filename_component(3RDPARTY_VTK_DIR_NAME "${3RDPARTY_VTK_DIR}" NAME)
|
||||
string(REGEX MATCH "^VTK-([0-9].[0-9])" VTK_VERSION "${3RDPARTY_VTK_DIR_NAME}")
|
||||
set(VTK_VERSION "${CMAKE_MATCH_1}")
|
||||
if (NOT 3RDPARTY_VTK_INCLUDE_DIR OR NOT EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
|
||||
set (3RDPARTY_VTK_INCLUDE_DIR "${3RDPARTY_VTK_DIR}/include/vtk-${VTK_VERSION}" CACHE FILEPATH "The directory containing includes of VTK" FORCE)
|
||||
endif()
|
||||
if (NOT 3RDPARTY_VTK_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_VTK_LIBRARY_DIR}")
|
||||
if(EXISTS "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}")
|
||||
set (3RDPARTY_VTK_LIBRARY_DIR "${3RDPARTY_VTK_DIR}/lib${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing libs of VTK" FORCE)
|
||||
endif()
|
||||
else()
|
||||
list (APPEND 3RDPARTY_LIBRARY_DIRS "${3RDPARTY_VTK_LIBRARY_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# vtk libraries
|
||||
# lib
|
||||
set (VTK_LIBRARY_NAMES vtkCommonCore-${VTK_VERSION}.lib vtkCommonDataModel-${VTK_VERSION}.lib vtkCommonExecutionModel-${VTK_VERSION}.lib
|
||||
vtkCommonMath-${VTK_VERSION}.lib vtkCommonTransforms-${VTK_VERSION}.lib vtkRenderingCore-${VTK_VERSION}.lib
|
||||
vtkRenderingOpenGL-${VTK_VERSION}.lib vtkFiltersGeneral-${VTK_VERSION}.lib vtkIOCore-${VTK_VERSION}.lib
|
||||
vtkIOImage-${VTK_VERSION}.lib vtkImagingCore-${VTK_VERSION}.lib vtkInteractionStyle-${VTK_VERSION}.lib )
|
||||
|
||||
#dll
|
||||
set (VTK_DLL_NAMES vtkCommonComputationalGeometry-${VTK_VERSION}.dll
|
||||
vtkCommonCore-${VTK_VERSION}.dll
|
||||
vtkCommonDataModel-${VTK_VERSION}.dll
|
||||
vtkCommonExecutionModel-${VTK_VERSION}.dll
|
||||
vtkCommonMath-${VTK_VERSION}.dll
|
||||
vtkCommonMisc-${VTK_VERSION}.dll
|
||||
vtkCommonSystem-${VTK_VERSION}.dll
|
||||
vtkCommonTransforms-${VTK_VERSION}.dll
|
||||
vtkDICOMParser-${VTK_VERSION}.dll
|
||||
vtkFiltersCore-${VTK_VERSION}.dll
|
||||
vtkFiltersExtraction-${VTK_VERSION}.dll
|
||||
vtkFiltersGeneral-${VTK_VERSION}.dll
|
||||
vtkFiltersGeometry-${VTK_VERSION}.dll
|
||||
vtkFiltersSources-${VTK_VERSION}.dll
|
||||
vtkFiltersStatistics-${VTK_VERSION}.dll
|
||||
vtkIOCore-${VTK_VERSION}.dll
|
||||
vtkIOImage-${VTK_VERSION}.dll
|
||||
vtkImagingCore-${VTK_VERSION}.dll
|
||||
vtkImagingFourier-${VTK_VERSION}.dll
|
||||
vtkImagingHybrid-${VTK_VERSION}.dll
|
||||
vtkInteractionStyle-${VTK_VERSION}.dll
|
||||
vtkRenderingCore-${VTK_VERSION}.dll
|
||||
vtkRenderingOpenGL-${VTK_VERSION}.dll
|
||||
vtkalglib-${VTK_VERSION}.dll
|
||||
vtkjpeg-${VTK_VERSION}.dll
|
||||
vtkmetaio-${VTK_VERSION}.dll
|
||||
vtkpng-${VTK_VERSION}.dll
|
||||
vtksys-${VTK_VERSION}.dll
|
||||
vtktiff-${VTK_VERSION}.dll
|
||||
vtkzlib-${VTK_VERSION}.dll )
|
||||
|
||||
# search for dll directory
|
||||
if (WIN32)
|
||||
if (NOT 3RDPARTY_VTK_DLL_DIR OR NOT EXISTS "${3RDPARTY_VTK_DLL_DIR}")
|
||||
if(EXISTS "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}")
|
||||
set (3RDPARTY_VTK_DLL_DIR "${3RDPARTY_VTK_DIR}/bin${BUILD_POSTFIX}" CACHE FILEPATH "The directory containing dll of VTK" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
OCCT_CHECK_AND_UNSET(VTK_DIR)
|
||||
|
||||
if (3RDPARTY_VTK_INCLUDE_DIR AND EXISTS "${3RDPARTY_VTK_INCLUDE_DIR}")
|
||||
list (APPEND 3RDPARTY_INCLUDE_DIRS "${3RDPARTY_VTK_INCLUDE_DIR}")
|
||||
else()
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED 3RDPARTY_VTK_INCLUDE_DIR)
|
||||
endif()
|
||||
|
||||
if (INSTALL_VTK)
|
||||
OCCT_MAKE_OS_WITH_BITNESS()
|
||||
OCCT_MAKE_COMPILER_SHORT_NAME()
|
||||
if (WIN32)
|
||||
if(3RDPARTY_VTK_DLL_DIR AND EXISTS "${3RDPARTY_VTK_DLL_DIR}")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
|
||||
foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
|
||||
set (3RDPARTY_VTK_DLL "3RDPARTY_VTK_DLL-NOTFOUND" CACHE FILEPATH "VTK shared library" FORCE)
|
||||
find_library(3RDPARTY_VTK_DLL "${VTK_DLL_NAME}" PATHS "${3RDPARTY_VTK_DLL_DIR}" NO_DEFAULT_PATH)
|
||||
if (NOT 3RDPARTY_VTK_DLL OR NOT EXISTS "${3RDPARTY_VTK_DLL}")
|
||||
list (APPEND 3RDPARTY_NOT_INCLUDED "${3RDPARTY_VTK_DLL}")
|
||||
else()
|
||||
install (FILES ${3RDPARTY_VTK_DLL} DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/bin${BUILD_POSTFIX}")
|
||||
endif()
|
||||
endforeach()
|
||||
OCCT_CHECK_AND_UNSET(3RDPARTY_VTK_DLL)
|
||||
endif()
|
||||
else ()
|
||||
foreach(VTK_DLL_NAME ${VTK_DLL_NAMES})
|
||||
string(REPLACE ".dll" ".so.1" VTK_DLL_NAME "${VTK_DLL_NAME}")
|
||||
install(FILES "${3RDPARTY_VTK_LIBRARY_DIR}/lib${VTK_DLL_NAME}" DESTINATION "${INSTALL_DIR}/${OS_WITH_BIT}/${COMPILER}/lib${BUILD_POSTFIX}" RENAME "lib${VTK_DLL_NAME}")
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced (VTK_INCLUDE_DIRS VTK_LIBRARY_DIRS VTK_DIR)
|
Loading…
x
Reference in New Issue
Block a user