mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-27 06:10:34 +05:00
cleanup FindOpenCasCade.cmake
This commit is contained in:
parent
ce561d56af
commit
2dcbd988b8
@ -1,141 +1,95 @@
|
|||||||
# Try to find OCE / OCC
|
# Try to find OCC
|
||||||
# Once done this will define
|
# Once done this will define
|
||||||
#
|
#
|
||||||
# OCC_FOUND - system has OCC - OpenCASCADE
|
# OCC_FOUND - system has OCC - OpenCASCADE
|
||||||
# OCC_INCLUDE_DIR - where the OCC include directory can be found
|
# OCC_INCLUDE_DIR - where the OCC include directory can be found
|
||||||
# OCC_LIBRARY_DIR - where the OCC library directory can be found
|
# OCC_LIBRARY_DIR - where the OCC library directory can be found
|
||||||
# OCC_LIBRARIES - Link this to use OCC
|
# OCC_LIBRARIES - Link this to use OCC
|
||||||
# OCC_OCAF_LIBRARIES - Link this to use OCC OCAF framework
|
|
||||||
|
|
||||||
# First try to find OpenCASCADE Community Edition
|
if(WIN32)
|
||||||
if(NOT DEFINED OCE_DIR)
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx PATH_SUFFIXES inc ../inc)
|
||||||
if(UNIX)
|
find_library(OCC_LIBRARY TKernel)
|
||||||
set(OCE_DIR "/usr/local/share/cmake/")
|
else(WIN32)
|
||||||
elseif(WIN32)
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx
|
||||||
set(OCE_DIR "c:/OCE-0.4.0/share/cmake")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(OCE QUIET)
|
|
||||||
if(0 AND OCE_FOUND)
|
|
||||||
message(STATUS "-- OpenCASCADE Community Edition has been found.")
|
|
||||||
# Disable this define. For more details see bug #0001872
|
|
||||||
#add_definitions (-DHAVE_CONFIG_H)
|
|
||||||
set(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
|
|
||||||
#set(OCC_LIBRARY_DIR ${OCE_LIBRARY_DIR})
|
|
||||||
else(0 AND OCE_FOUND) #look for OpenCASCADE
|
|
||||||
if(WIN32)
|
|
||||||
if(CYGWIN OR MINGW)
|
|
||||||
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
|
|
||||||
/usr/include/oce
|
|
||||||
/usr/include/opencascade
|
|
||||||
/usr/local/include/opencascade
|
|
||||||
/opt/opencascade/include
|
|
||||||
/opt/opencascade/inc
|
|
||||||
)
|
|
||||||
FIND_LIBRARY(OCC_LIBRARY TKernel
|
|
||||||
/usr/lib
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/opencascade/lib
|
|
||||||
)
|
|
||||||
else(CYGWIN OR MINGW)
|
|
||||||
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
|
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/include"
|
|
||||||
)
|
|
||||||
FIND_LIBRARY(OCC_LIBRARY TKernel
|
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\SIM\\OCC\\2;Installation Path]/lib"
|
|
||||||
)
|
|
||||||
endif(CYGWIN OR MINGW)
|
|
||||||
else(WIN32)
|
|
||||||
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
|
|
||||||
/usr/include/oce
|
|
||||||
/usr/include/opencascade
|
/usr/include/opencascade
|
||||||
/usr/local/include/opencascade
|
/usr/local/include/opencascade
|
||||||
/opt/opencascade/include
|
/opt/opencascade/include
|
||||||
/opt/opencascade/inc
|
/opt/opencascade/inc
|
||||||
)
|
)
|
||||||
FIND_LIBRARY(OCC_LIBRARY TKernel
|
find_library(OCC_LIBRARY TKernel
|
||||||
/usr/lib
|
/usr/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/opt/opencascade/lib
|
/opt/opencascade/lib
|
||||||
)
|
)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
if(OCC_LIBRARY)
|
|
||||||
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
|
if(OCC_LIBRARY)
|
||||||
endif(OCC_LIBRARY)
|
get_filename_component(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
|
||||||
endif(0 AND OCE_FOUND)
|
endif(OCC_LIBRARY)
|
||||||
|
|
||||||
if(OCC_INCLUDE_DIR)
|
if(OCC_INCLUDE_DIR)
|
||||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
|
||||||
REGEX "#define OCC_VERSION_MAJOR.*"
|
REGEX "#define OCC_VERSION_MAJOR.*"
|
||||||
)
|
)
|
||||||
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
|
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
|
||||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
|
||||||
REGEX "#define OCC_VERSION_MINOR.*"
|
REGEX "#define OCC_VERSION_MINOR.*"
|
||||||
)
|
)
|
||||||
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
|
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
|
||||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
|
||||||
REGEX "#define OCC_VERSION_MAINTENANCE.*"
|
REGEX "#define OCC_VERSION_MAINTENANCE.*"
|
||||||
)
|
)
|
||||||
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
|
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
|
||||||
|
|
||||||
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
|
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
|
||||||
endif(OCC_INCLUDE_DIR)
|
endif(OCC_INCLUDE_DIR)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set OCC_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING)
|
|
||||||
|
|
||||||
if(OCC_FOUND)
|
set(OCC_LIBRARY_NAMES
|
||||||
set(OCC_LIBRARIES
|
TKBO
|
||||||
-L${OCC_LIBRARY_DIR}
|
TKBool
|
||||||
FWOSPlugin
|
TKBRep
|
||||||
TKFillet
|
TKCAF
|
||||||
TKMesh
|
TKCDF
|
||||||
TKernel
|
TKernel
|
||||||
TKG2d
|
TKG2d
|
||||||
TKG3d
|
TKG3d
|
||||||
TKMath
|
|
||||||
TKIGES
|
|
||||||
TKSTL
|
|
||||||
TKShHealing
|
|
||||||
TKXSBase
|
|
||||||
TKBool
|
|
||||||
TKBO
|
|
||||||
TKBRep
|
|
||||||
TKTopAlgo
|
|
||||||
TKGeomAlgo
|
TKGeomAlgo
|
||||||
TKGeomBase
|
TKGeomBase
|
||||||
|
TKHLR
|
||||||
|
TKIGES
|
||||||
|
TKLCAF
|
||||||
|
TKMath
|
||||||
|
TKMesh
|
||||||
TKOffset
|
TKOffset
|
||||||
TKPrim
|
TKPrim
|
||||||
|
TKService
|
||||||
|
TKShHealing
|
||||||
TKSTEP
|
TKSTEP
|
||||||
TKSTEPBase
|
TKSTEP209
|
||||||
TKSTEPAttr
|
TKSTEPAttr
|
||||||
TKHLR
|
TKSTEPBase
|
||||||
TKFeat
|
TKSTL
|
||||||
TKCAF
|
TKTopAlgo
|
||||||
|
TKV3d
|
||||||
TKXCAF
|
TKXCAF
|
||||||
TKLCAF
|
|
||||||
TKXDESTEP
|
|
||||||
TKXDEIGES
|
TKXDEIGES
|
||||||
TKMeshVS
|
|
||||||
)
|
|
||||||
set(OCC_OCAF_LIBRARIES
|
|
||||||
TKCAF
|
|
||||||
TKXCAF
|
|
||||||
TKLCAF
|
|
||||||
TKXDESTEP
|
TKXDESTEP
|
||||||
TKXDEIGES
|
TKXSBase
|
||||||
TKMeshVS
|
)
|
||||||
)
|
|
||||||
if(OCC_VERSION_STRING VERSION_LESS 6.7.3)
|
foreach( libname ${OCC_LIBRARY_NAMES} )
|
||||||
list(APPEND OCC_OCAF_LIBRARIES TKAdvTools)
|
find_library( ${libname} ${libname} ${OCC_LIBRARY_DIR} )
|
||||||
endif(OCC_VERSION_STRING VERSION_LESS 6.7.3)
|
set(OCC_LIBRARIES ${OCC_LIBRARIES} ${${libname}})
|
||||||
message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
|
endforeach()
|
||||||
message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
|
|
||||||
message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
|
include(FindPackageHandleStandardArgs)
|
||||||
message(STATUS "-- OCE/OpenCASCADE shared libraries :\n ${OCC_LIBRARIES}")
|
find_package_handle_standard_args(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING ${OCC_LIBRARIY_NAMES})
|
||||||
else(OCC_FOUND)
|
|
||||||
message("Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not build CAD modules!")
|
if(OCC_FOUND)
|
||||||
|
message(STATUS "-- Found OpenCASCADE version: ${OCC_VERSION_STRING}")
|
||||||
|
message(STATUS "-- OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
|
||||||
|
message(STATUS "-- OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
|
||||||
|
message(STATUS "-- OpenCASCADE shared libraries :\n ${OCC_LIBRARIES}")
|
||||||
endif(OCC_FOUND)
|
endif(OCC_FOUND)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user