2016-03-14 18:19:35 +05:00
|
|
|
# Try to find OCC
|
2015-04-09 15:39:41 +05:00
|
|
|
# Once done this will define
|
|
|
|
#
|
|
|
|
# OCC_FOUND - system has OCC - OpenCASCADE
|
|
|
|
# OCC_INCLUDE_DIR - where the OCC include directory can be found
|
|
|
|
# OCC_LIBRARY_DIR - where the OCC library directory can be found
|
|
|
|
# OCC_LIBRARIES - Link this to use OCC
|
|
|
|
|
2016-03-14 18:19:35 +05:00
|
|
|
if(WIN32)
|
|
|
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx PATH_SUFFIXES inc ../inc)
|
|
|
|
find_library(OCC_LIBRARY TKernel)
|
|
|
|
else(WIN32)
|
|
|
|
find_path(OCC_INCLUDE_DIR Standard_Version.hxx
|
2015-04-09 15:39:41 +05:00
|
|
|
/usr/include/opencascade
|
|
|
|
/usr/local/include/opencascade
|
2016-04-05 19:06:17 +05:00
|
|
|
/usr/include/oce
|
|
|
|
/usr/local/include/oce
|
2015-04-09 15:39:41 +05:00
|
|
|
/opt/opencascade/include
|
|
|
|
/opt/opencascade/inc
|
|
|
|
)
|
2016-03-14 18:19:35 +05:00
|
|
|
find_library(OCC_LIBRARY TKernel
|
2015-04-09 15:39:41 +05:00
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
|
|
|
/opt/opencascade/lib
|
|
|
|
)
|
2016-03-14 18:19:35 +05:00
|
|
|
endif(WIN32)
|
|
|
|
|
2020-03-02 21:04:11 +05:00
|
|
|
if(OCC_LIBRARY AND NOT OCC_LIBRARY_DIR)
|
2016-03-14 18:19:35 +05:00
|
|
|
get_filename_component(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
|
2020-06-19 20:36:48 +05:00
|
|
|
endif(OCC_LIBRARY AND NOT OCC_LIBRARY_DIR)
|
2015-04-09 15:39:41 +05:00
|
|
|
|
|
|
|
if(OCC_INCLUDE_DIR)
|
2016-03-14 18:19:35 +05:00
|
|
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
|
|
|
|
REGEX "#define OCC_VERSION_MAJOR.*"
|
|
|
|
)
|
|
|
|
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
|
|
|
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
|
|
|
|
REGEX "#define OCC_VERSION_MINOR.*"
|
|
|
|
)
|
|
|
|
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
|
|
|
|
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
|
|
|
|
REGEX "#define OCC_VERSION_MAINTENANCE.*"
|
|
|
|
)
|
|
|
|
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
|
2015-04-09 15:39:41 +05:00
|
|
|
|
2016-03-14 18:19:35 +05:00
|
|
|
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
|
2015-04-09 15:39:41 +05:00
|
|
|
endif(OCC_INCLUDE_DIR)
|
|
|
|
|
|
|
|
|
2016-03-14 18:19:35 +05:00
|
|
|
set(OCC_LIBRARY_NAMES
|
|
|
|
TKBO
|
|
|
|
TKBool
|
|
|
|
TKBRep
|
|
|
|
TKCAF
|
|
|
|
TKCDF
|
2015-04-09 15:39:41 +05:00
|
|
|
TKernel
|
|
|
|
TKG2d
|
|
|
|
TKG3d
|
|
|
|
TKGeomAlgo
|
|
|
|
TKGeomBase
|
2016-03-14 18:19:35 +05:00
|
|
|
TKHLR
|
|
|
|
TKIGES
|
|
|
|
TKLCAF
|
|
|
|
TKMath
|
|
|
|
TKMesh
|
2015-04-09 15:39:41 +05:00
|
|
|
TKOffset
|
|
|
|
TKPrim
|
2016-03-14 18:19:35 +05:00
|
|
|
TKService
|
|
|
|
TKShHealing
|
2015-04-09 15:39:41 +05:00
|
|
|
TKSTEP
|
2016-03-14 18:19:35 +05:00
|
|
|
TKSTEP209
|
2015-04-09 15:39:41 +05:00
|
|
|
TKSTEPAttr
|
2016-03-14 18:19:35 +05:00
|
|
|
TKSTEPBase
|
|
|
|
TKSTL
|
|
|
|
TKTopAlgo
|
|
|
|
TKV3d
|
2015-04-09 15:39:41 +05:00
|
|
|
TKXCAF
|
|
|
|
TKXDEIGES
|
|
|
|
TKXDESTEP
|
2016-03-14 18:19:35 +05:00
|
|
|
TKXSBase
|
2021-07-29 13:22:32 +05:00
|
|
|
TKFillet
|
2016-03-14 18:19:35 +05:00
|
|
|
)
|
|
|
|
|
2019-10-28 18:19:57 +05:00
|
|
|
if(OCC_LINK_FREETYPE)
|
|
|
|
set(OCC_LIBRARY_NAMES ${OCC_LIBRARY_NAMES} freetype)
|
|
|
|
endif(OCC_LINK_FREETYPE)
|
|
|
|
|
2019-10-28 21:03:59 +05:00
|
|
|
if(OCC_VERSION_STRING VERSION_GREATER_EQUAL "7.3.0")
|
|
|
|
set(OCC_LIBRARY_NAMES ${OCC_LIBRARY_NAMES} TKVCAF)
|
|
|
|
endif()
|
|
|
|
|
2016-03-14 18:19:35 +05:00
|
|
|
foreach( libname ${OCC_LIBRARY_NAMES} )
|
2020-03-02 21:04:11 +05:00
|
|
|
find_library( ${libname} ${libname} ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
|
2016-03-14 18:19:35 +05:00
|
|
|
set(OCC_LIBRARIES ${OCC_LIBRARIES} ${${libname}})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING ${OCC_LIBRARIY_NAMES})
|
|
|
|
|
|
|
|
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}")
|
2015-04-09 15:39:41 +05:00
|
|
|
endif(OCC_FOUND)
|
2016-03-14 18:19:35 +05:00
|
|
|
|