Commit 895734cd authored by 's avatar
Browse files

changes to oce cmake

parent d860427d
......@@ -189,7 +189,7 @@ INCLUDE (ThirdPartyPETSc)
INCLUDE (ThirdPartyVTK)
INCLUDE (ThirdPartyQT4)
INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyOCC)
INCLUDE (ThirdPartyOCE)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyANN)
INCLUDE (ThirdPartyCCM)
......
# 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()
# 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 HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
elseif(DEFINED HOMEBREW_PREFIX)
find_package(OCE HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
endif()
elseif(UNIX)
set(OCE_DIR "/usr/local/share/cmake/")
elseif(WIN32)
set(OCE_DIR "c:/OCE-0.4.0/share/cmake")
endif()
endif()
find_package(OCE QUIET)
if(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(OCE_FOUND) #look for OpenCASCADE
if(WIN32)
if(CYGWIN OR MINGW)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
/usr/include/opencascade
/usr/local/include/opencascade
/usr/local/opt/opencascade/include
/opt/opencascade/include
/opt/opencascade/inc
)
FIND_LIBRARY(OCC_LIBRARY TKernel
/usr/lib
/usr/local/lib
/usr/local/opt/opencascade/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/opencascade
/usr/local/include/opencascade
/usr/local/opt/opencascade/include
/opt/opencascade/include
/opt/opencascade/inc
/opt/local/include/oce
)
FIND_LIBRARY(OCC_LIBRARY TKernel
/usr/lib
/usr/local/lib
/usr/local/opt/opencascade/lib
/opt/opencascade/lib
opt/local/lib
)
endif(WIN32)
if(OCC_LIBRARY)
GET_FILENAME_COMPONENT(OCC_LIBRARY_DIR ${OCC_LIBRARY} PATH)
IF(NOT OCC_INCLUDE_DIR)
FIND_PATH(OCC_INCLUDE_DIR Standard_Version.hxx
${OCC_LIBRARY_DIR}/../inc
)
ENDIF()
endif(OCC_LIBRARY)
endif(OCE_FOUND)
if(OCC_INCLUDE_DIR)
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})
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
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_LIBRARIES
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
)
set(OCC_OCAF_LIBRARIES
TKCAF
TKXCAF
TKLCAF
TKXDESTEP
TKXDEIGES
TKMeshVS
)
if(OCC_VERSION_STRING VERSION_LESS 6.7.3)
list(APPEND OCC_OCAF_LIBRARIES TKAdvTools)
endif(OCC_VERSION_STRING VERSION_LESS 6.7.3)
message(STATUS "-- Found OCE/OpenCASCADE version: ${OCC_VERSION_STRING}")
message(STATUS "-- OCE/OpenCASCADE include directory: ${OCC_INCLUDE_DIR}")
message(STATUS "-- OCE/OpenCASCADE shared libraries directory: ${OCC_LIBRARY_DIR}")
else(OCC_FOUND)
#message(SEND_ERROR "Neither OpenCASCADE Community Edition nor OpenCasCade were found: will not build CAD modules!")
endif(OCC_FOUND)
# Try to find OCE
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()
# 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 HINTS ${MACPORTS_PREFIX}/Library/Frameworks)
elseif(DEFINED HOMEBREW_PREFIX)
find_package(OCE 0.17 HINTS ${HOMEBREW_PREFIX}/Cellar/oce/*)
endif()
elseif(UNIX)
set(OCE_DIR "/usr/local/share/cmake/")
elseif(WIN32)
set(OCE_DIR "c:/OCE-0.4.0/share/cmake")
endif()
endif()
find_package(OCE 0.17 QUIET)
if(OCE_FOUND)
message(STATUS "Found OpenCASCADE Community Edition. Version ${OCE_VERSION}")
file(STRINGS ${OCE_INCLUDE_DIRS}/Standard_Version.hxx OCC_MAJOR
REGEX "#define OCC_VERSION_MAJOR.*"
)
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
file(STRINGS ${OCE_INCLUDE_DIRS}/Standard_Version.hxx OCC_MINOR
REGEX "#define OCC_VERSION_MINOR.*"
)
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
file(STRINGS ${OCE_INCLUDE_DIRS}/Standard_Version.hxx OCC_MAINT
REGEX "#define OCC_VERSION_MAINTENANCE.*"
)
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
message(STATUS "-- OCC version: ${OCC_VERSION_STRING}")
set(OCE_LIBRARIES
TKFillet
TKMesh
TKernel
TKG2d
TKG3d
TKMath
TKIGES
TKSTL
TKShHealing
TKXSBase
TKBool
TKBO
TKBRep
TKTopAlgo
TKGeomAlgo
TKGeomBase
TKOffset
TKPrim
TKSTEP
TKSTEPBase
TKSTEPAttr
TKHLR
TKFeat
)
endif(OCE_FOUND)
......@@ -8,42 +8,42 @@
IF(NEKTAR_USE_MESHGEN)
# Try to find installed version of OpenCascade
INCLUDE(FindOCC)
INCLUDE(FindOCCE)
IF (OCC_FOUND)
SET(BUILD_OCC OFF)
IF (OCE_FOUND)
SET(BUILD_OCE OFF)
ELSE()
SET(BUILD_OCC ON)
SET(BUILD_OCE ON)
ENDIF()
OPTION(THIRDPARTY_BUILD_OCC "Build OpenCascade library from ThirdParty."
${BUILD_OCC})
OPTION(THIRDPARTY_BUILD_OCE "Build OpenCascade community edition library from ThirdParty."
${BUILD_OCE})
IF (THIRDPARTY_BUILD_OCC)
IF (THIRDPARTY_BUILD_OCE)
INCLUDE(ExternalProject)
SET(OCC_LIBRARIES_TMP PTKernel TKernel TKMath TKBRep TKIGES TKSTEP TKSTEPAttr
SET(OCE_LIBRARIES_TMP PTKernel TKernel TKMath TKBRep TKIGES TKSTEP TKSTEPAttr
TKSTEP209 TKSTEPBase TKShapeSchema TKGeomBase TKGeomAlgo TKG3d TKG2d
TKXSBase TKPShape TKTopAlgo TKShHealing)
FOREACH(OCC_LIB ${OCC_LIBRARIES_TMP})
LIST(APPEND OCC_LIBRARIES ${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${OCC_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX})
FOREACH(OCE_LIB ${OCE_LIBRARIES_TMP})
LIST(APPEND OCE_LIBRARIES ${TPDIST}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${OCE_LIB}${CMAKE_SHARED_LIBRARY_SUFFIX})
ENDFOREACH()
UNSET(OCC_LIBRARIES_TMP)
UNSET(OCE_LIBRARIES_TMP)
IF(WIN32)
MESSAGE(SEND_ERROR "Cannot currently use OpenCascade with Nektar++ on Windows")
ENDIF()
EXTERNALPROJECT_ADD(
opencascade-6.9
oce-0.17
PREFIX ${TPSRC}
URL ${TPURL}/OCE-0.17.2.tar.gz
URL_MD5 bf2226be4cd192606af677cf178088e5
STAMP_DIR ${TPBUILD}/stamp
BINARY_DIR ${TPBUILD}/opencascade-6.9
BINARY_DIR ${TPBUILD}/oce-0.17
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/opencascade-6.9
INSTALL_DIR ${TPBUILD}/opencascade-6.9/dist
SOURCE_DIR ${TPSRC}/oce-0.17
INSTALL_DIR ${TPBUILD}/oce-0.17/dist
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-G ${CMAKE_GENERATOR}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
......@@ -52,21 +52,22 @@ IF(NEKTAR_USE_MESHGEN)
-DOCE_TESTING=OFF
-DOCE_VISUALISATION=OFF
-DOCE_DISABLE_X11=ON
${TPSRC}/opencascade-6.9
-DOCE_OCAF=OFF
${TPSRC}/oce-0.17
)
# Patch OS X libraries to fix install name problems.
EXTERNALPROJECT_ADD_STEP(opencascade-6.9 patch-install-path
EXTERNALPROJECT_ADD_STEP(oce-0.17 patch-install-path
COMMAND bash ${CMAKE_SOURCE_DIR}/cmake/scripts/patch-occ.sh ${TPDIST}/lib ${CMAKE_INSTALL_PREFIX}/${NEKTAR_LIB_DIR}
ALWAYS 1
DEPENDEES install)
MESSAGE(STATUS "Build OpenCascade: ${TPDIST}/lib")
MESSAGE(STATUS "Build OpenCascade community edition: ${TPDIST}/lib")
LINK_DIRECTORIES(${TPDIST}/lib)
INCLUDE_DIRECTORIES(SYSTEM ${TPDIST}/include/oce)
ELSE()
ADD_CUSTOM_TARGET(opencascade-6.9 ALL)
SET(OPENCASCADE_CONFIG_INCLUDE_DIR ${OCC_INCLUDE_DIR})
INCLUDE_DIRECTORIES(SYSTEM ${OCC_INCLUDE_DIR})
ADD_CUSTOM_TARGET(oce-0.17 ALL)
SET(OPENCASCADE_CONFIG_INCLUDE_DIR ${OCE_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(SYSTEM ${OCE_INCLUDE_DIRS})
ENDIF()
ENDIF()
......@@ -94,11 +94,9 @@ ENDIF()
IF(NEKTAR_USE_MESHGEN)
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PRIVATE ${TETGEN_LIBRARY})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PUBLIC ${OCC_LIBRARIES})
TARGET_LINK_LIBRARIES(NekMeshUtils LINK_PUBLIC ${OCE_LIBRARIES})
SET(OCC_DEF LIN LININTEL HAVE_WOK_CONFIG_H HAVE_CONFIG_H CSFDB)
SET_PROPERTY(TARGET NekMeshUtils APPEND PROPERTY COMPILE_DEFINITIONS ${OCC_DEF})
ADD_DEPENDENCIES(NekMeshUtils opencascade-6.9 tetgen-1.5)
ADD_DEPENDENCIES(NekMeshUtils oce-0.17 tetgen-1.5)
ENDIF()
IF(NEKTAR_USE_CFI)
......
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