Commit a390ed9a authored by Michael Turner's avatar Michael Turner

update occ cmake

parent 9ee75aff
# Try to find OCE / OCC
# 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
# OCC_OCAF_LIBRARIES - Link this to use OCC OCAF framework
#
# Adapted from FreeCAD: http://free-cad.sf.net
SET(TEST_ENV $ENV{OCE_ROOT})
IF(NOT DEFINED OCE_DIR AND DEFINED TEST_ENV)
FILE(GLOB OCE_DIR $ENV{OCE_ROOT}/lib/oce-*)
ENDIF()
set(TEST_ENV $ENV{OCE_ROOT})
if(NOT DEFINED OCE_DIR AND DEFINED TEST_ENV)
file(GLOB OCE_DIR $ENV{OCE_ROOT}/lib/oce-*)
endif()
SET(TEST_ENV $ENV{OCE_DIR})
IF(NOT DEFINED OCE_DIR AND DEFINED TEST_ENV)
SET(OCE_DIR $ENV{OCE_DIR})
ENDIF()
set(TEST_ENV $ENV{OCE_DIR})
if(NOT DEFINED OCE_DIR AND DEFINED TEST_ENV)
set(OCE_DIR $ENV{OCE_DIR})
endif()
SET(OCE_FIND_COMPONENTS ${OCC_LIB_LIST})
SET(OCE_FIND_COMPONENTS
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
TKXCAF
TKLCAF
TKXDESTEP
)
# First try to find OpenCASCADE Community Edition
if(NOT DEFINED OCE_DIR)
# Check for OSX needs to come first because UNIX evaluates to true on OSX
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(DEFINED MACPORTS_PREFIX)
find_package(OCE 0.17 QUIET HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
elseif(DEFINED HOMEBREW_PREFIX)
find_package(OCE 0.17 QUIET HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
endif()
elseif(UNIX)
set(OCE_DIR "/usr/local/share/cmake/")
find_package(OCE 0.17 QUIET)
endif()
endif()
#First try to find OpenCASCADE Community Edition
IF(NOT DEFINED OCE_DIR)
#Check for OSX needs to come first because UNIX evaluates to true on OSX
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
IF(DEFINED MACPORTS_PREFIX)
FIND_PACKAGE(OCE 0.17 QUIET HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
ELSEIF(DEFINED HOMEBREW_PREFIX)
FIND_PACKAGE(OCE 0.17 QUIET HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
ENDIF()
ELSEIF(UNIX)
SET(OCE_DIR "/usr/local/share/cmake/")
FIND_PACKAGE(OCE 0.17 QUIET)
ENDIF()
ENDIF()
SET(OCC_FOUND FALSE)
if(OCE_FOUND AND OCE_ALL_FOUND)
message(STATUS "OpenCASCADE Community Edition has been found with all required components.")
SET(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
SET(OCC_FOUND TRUE)
else(OCE_FOUND AND OCE_ALL_FOUND) #look for OpenCASCADE
message(STATUS "OpenCASCADE Community Edition could not be found or has missing components.")
FIND_LIBRARY(OCC_LIBRARY TKernel
/usr/lib
/usr/local/lib
/usr/local/opt/opencascade/lib
/opt/opencascade/lib
opt/local/lib
)
IF(OCE_FOUND AND OCE_ALL_FOUND)
MESSAGE(STATUS "OpenCASCADE Community Edition has been found with all required components.")
SET(OCC_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
SET(OCC_FOUND TRUE)
ELSE(OCE_FOUND AND OCE_ALL_FOUND) #look for OpenCASCADE
MESSAGE(STATUS "OpenCASCADE Community Edition could not be found or has missing components.")
SET(OpenCASCADE_FIND_COMPONENTS ${OCE_FIND_COMPONENTS})
FIND_PACKAGE(OpenCASCADE 6.8 QUIET HINTS /opt/local)
if(OCC_LIBRARY)
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx ${OCC_LIBRARY_DIR}/../inc)
IF(OCC_INCLUDE_DIR)
message(STATUS "OpenCASCADE has been found.")
IF(OpenCASCADE_FOUND)
MESSAGE(STATUS "OpenCASCADE has been found with all required components.")
SET(OCC_INCLUDE_DIR ${OpenCASCADE_INCLUDE_DIR})
SET(OCC_FOUND TRUE)
ELSE()
MESSAGE(STATUS "OpenCASCADE could not be found or has missing components.")
ENDIF()
endif(OCC_LIBRARY)
endif(OCE_FOUND AND OCE_ALL_FOUND)
if(OCC_FOUND)
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})
ENDIF(OCE_FOUND AND OCE_ALL_FOUND)
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
IF(OCC_FOUND)
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})
if(OCC_VERSION_STRING VERSION_LESS 6.8)
MESSAGE(SEND_ERROR "OCC version too low")
endif(OCC_VERSION_STRING VERSION_LESS 6.8)
message(STATUS "-- Found OCE/OpenCASCADE with OCC version: ${OCC_VERSION_STRING}")
set(OCC_LIBRARIES ${OCE_FIND_COMPONENTS})
endif(OCC_FOUND)
SET(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
IF(OCC_VERSION_STRING VERSION_LESS 6.8)
MESSAGE(STATUS "OCC version too low, will build from source")
SET(OCC_FOUND FALSE)
ELSE()
MESSAGE(STATUS "-- Found OCE/OpenCASCADE with OCC version: ${OCC_VERSION_STRING}")
SET(OCC_LIBRARIES ${OCE_FIND_COMPONENTS})
ENDIF()
ENDIF(OCC_FOUND)
......@@ -7,6 +7,36 @@
########################################################################
IF(NEKTAR_USE_MESHGEN)
#required opencascade libraries
SET(OCC_LIB_LIST
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
TKXCAF
TKLCAF
TKXDESTEP
)
# Try to find installed version of OpenCascade
INCLUDE(FindOCC)
......@@ -22,35 +52,6 @@ IF(NEKTAR_USE_MESHGEN)
IF (THIRDPARTY_BUILD_OCE)
INCLUDE(ExternalProject)
SET(OCC_LIB_LIST
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
TKXCAF
TKLCAF
TKXDESTEP
)
IF(WIN32)
MESSAGE(SEND_ERROR "Cannot currently use OpenCascade with Nektar++ on Windows")
ENDIF()
......
......@@ -84,12 +84,7 @@ bool CADSurfOCE::IsPlanar()
Array<OneD, NekDouble> CADSurfOCE::BoundingBox()
{
BRepMesh_IncrementalMesh brmsh;
brmsh.SetShape(m_shape);
brmsh.SetDeflection(0.005);
brmsh.Perform();
BRepMesh_IncrementalMesh brmsh(m_shape, 0.005);
Bnd_Box B;
BRepBndLib::Add(m_shape, B);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment