forked from dealii/dealii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDEAL_II_OPENCASCADE.cmake
94 lines (83 loc) · 2.97 KB
/
FindDEAL_II_OPENCASCADE.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
## ---------------------------------------------------------------------
##
## Copyright (C) 2012 - 2022 by the deal.II authors
##
## This file is part of the deal.II library.
##
## The deal.II library is free software; you can use it, redistribute
## it, and/or modify it under the terms of the GNU Lesser General
## Public License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
## The full text of the license can be found in the file LICENSE.md at
## the top level directory of deal.II.
##
## ---------------------------------------------------------------------
#
# Try to find the OpenCASCADE (OCC) library. This scripts supports the
# OpenCASCADE Community Edition (OCE) library, which is a cmake based
# OCC library. You might try the original OpenCASCADE library, but your
# mileage may vary.
#
# This module exports:
#
# OPENCASCADE_DIR
# OPENCASCADE_INCLUDE_DIRS
# OPENCASCADE_LIBRARIES
# OPENCASCADE_VERSION
# OPENCASCADE_VERSION_MAJOR
# OPENCASCADE_VERSION_MINOR
# OPENCASCADE_VERSION_SUBMINOR
#
set(OPENCASCADE_DIR "" CACHE PATH "An optional hint to a OpenCASCADE installation")
set_if_empty(OPENCASCADE_DIR "$ENV{OPENCASCADE_DIR}")
set_if_empty(OPENCASCADE_DIR "$ENV{OCC_DIR}")
set_if_empty(OPENCASCADE_DIR "$ENV{OCE_DIR}")
set_if_empty(OPENCASCADE_DIR "$ENV{CASROOT}")
deal_ii_find_path(OPENCASCADE_INCLUDE_DIR Standard_Version.hxx
HINTS ${OPENCASCADE_DIR}
PATH_SUFFIXES include include/oce include/opencascade inc
)
if(EXISTS ${OPENCASCADE_INCLUDE_DIR}/Standard_Version.hxx)
file(STRINGS "${OPENCASCADE_INCLUDE_DIR}/Standard_Version.hxx" OPENCASCADE_VERSION
REGEX "^[ \t]*#[ \t]*define[ \t]+OCC_VERSION_COMPLETE "
)
string(REGEX REPLACE
"#define OCC_VERSION_COMPLETE.*\"(.*)\"" "\\1"
OPENCASCADE_VERSION "${OPENCASCADE_VERSION}"
)
string(REGEX REPLACE
"^([0-9]+).*$" "\\1"
OPENCASCADE_VERSION_MAJOR "${OPENCASCADE_VERSION}"
)
string(REGEX REPLACE
"^[0-9]+\\.([0-9]+).*$" "\\1"
OPENCASCADE_VERSION_MINOR "${OPENCASCADE_VERSION}"
)
string(REGEX REPLACE
"^[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1"
OPENCASCADE_VERSION_SUBMINOR "${OPENCASCADE_VERSION}"
)
endif()
# These seem to be pretty much the only required ones.
set(_opencascade_libraries
TKBO TKBool TKBRep TKernel TKFeat TKFillet TKG2d TKG3d TKGeomAlgo
TKGeomBase TKHLR TKIGES TKMath TKMesh TKOffset TKPrim TKShHealing TKSTEP
TKSTEPAttr TKSTEPBase TKSTEP209 TKSTL TKTopAlgo TKXSBase
)
set(_libraries "")
foreach(_library ${_opencascade_libraries})
list(APPEND _libraries OPENCASCADE_${_library})
deal_ii_find_library(OPENCASCADE_${_library}
NAMES ${_library}
HINTS ${OPENCASCADE_DIR}
PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib mac64/clang/lib mac32/clang/lib lin64/gcc/lib lin32/gcc/lib
)
endforeach()
process_feature(OPENCASCADE
LIBRARIES
REQUIRED ${_libraries}
INCLUDE_DIRS
REQUIRED OPENCASCADE_INCLUDE_DIR
CLEAR
_opencascade_libraries ${_libraries}
)