netgen/cmake/cmake_modules/FindOpenCasCade.cmake

98 lines
2.5 KiB
CMake
Raw Normal View History

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)
if(OCC_LIBRARY)
get_filename_component(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
endif(OCC_LIBRARY)
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
)
foreach( libname ${OCC_LIBRARY_NAMES} )
find_library( ${libname} ${libname} ${OCC_LIBRARY_DIR} )
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