vcpkg/ports/opencascade/portfile.cmake
jim wang 0fe8c9dece
[opencascade] Update to 7.8.1 (#37912)
Fixes https://github.com/microsoft/vcpkg/issues/37909

- [X] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [X] SHA512s are updated for each updated download.
- [ ] ~~The "supports" clause reflects platforms that may be fixed by
this new version.~~
- [ ] ~~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~~
- [ ] ~~Any patches that are no longer applied are deleted from the
port's directory.~~
- [X] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [X] Only one version is added to each modified port's versions file.

Usage test pass with following triplets:

```
x86-windows
x64-windows
x64-windows-static
```
2024-04-09 11:29:42 -04:00

80 lines
2.6 KiB
CMake

string(REPLACE "." "_" VERSION_STR "V${VERSION}")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Open-Cascade-SAS/OCCT
REF "${VERSION_STR}"
SHA512 807c1f8732926cfdabcfbdf8d6a0e76b8dba1a1e614afe084a467ffb4cfd80623f5e3afa7e9905b1ac96667c93e01b5f98ceaa8948a576a1093d98df98cc8f81
HEAD_REF master
PATCHES
dependencies.patch
drop-bin-letter-d.patch
fix-pdb-find.patch
fix-install-prefix-path.patch
install-include-dir.patch
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(BUILD_TYPE "Shared")
else()
set(BUILD_TYPE "Static")
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
freeimage USE_FREEIMAGE
freetype USE_FREETYPE
rapidjson USE_RAPIDJSON
samples INSTALL_SAMPLES
tbb USE_TBB
vtk USE_VTK
)
# We turn off BUILD_MODULE_Draw as it requires TCL 8.6 and TK 8.6 specifically which conflicts with vcpkg only having TCL 9.0
# And pre-built ActiveTCL binaries are behind a marketing wall :(
# We use the Unix install layout for Windows as it matches vcpkg
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DBUILD_LIBRARY_TYPE=${BUILD_TYPE}
-DBUILD_MODULE_Draw=OFF
-DBUILD_DOC_Overview=OFF
-DBUILD_MODULE_DETools=OFF
-DINSTALL_DIR_LAYOUT=Unix
-DINSTALL_DIR_DOC=share/trash
-DINSTALL_DIR_SCRIPT=share/trash # not relocatable
-DINSTALL_TEST_CASES=OFF
-DUSE_TK=OFF
OPTIONS_DEBUG
-DINSTALL_SAMPLES=OFF
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/opencascade)
#make occt includes relative to source_file
file(GLOB extra_headers
LIST_DIRECTORIES false
RELATIVE "${CURRENT_PACKAGES_DIR}/include/opencascade"
"${CURRENT_PACKAGES_DIR}/include/opencascade/*.h"
)
list(JOIN extra_headers "|" extra_headers)
file(GLOB files "${CURRENT_PACKAGES_DIR}/include/opencascade/*.[hgl]xx")
foreach(file_name IN LISTS files)
file(READ "${file_name}" filedata)
string(REGEX REPLACE "(# *include) <([a-zA-Z0-9_]*[.][hgl]xx|${extra_headers})>" [[\1 "\2"]] filedata "${filedata}")
file(WRITE "${file_name}" "${filedata}")
endforeach()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/opencascade/samples/qt")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/trash")
vcpkg_install_copyright(
FILE_LIST
"${SOURCE_PATH}/LICENSE_LGPL_21.txt"
"${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt"
)