vcpkg/ports/opencascade/portfile.cmake

109 lines
4.2 KiB
CMake
Raw Normal View History

2020-10-09 12:56:28 +08:00
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Open-Cascade-SAS/OCCT
REF 80ffc5f84dae96de6ed093d3e5d2466a9e368b27 #V7.6.0
SHA512 1dfee9c59eb6ea61735f0807d44ccf62019a2649f506a5a8197e04b1533592dc95d6d67ab7a3bb392785755ed60b6fc489bea049f658d4ae7d05dfe0d7d5bdcd
2020-10-09 12:56:28 +08:00
HEAD_REF master
PATCHES
fix-pdb-find.patch
[opencascade] fix #16252 (#16513) * [opencascade] fix #16252 by exporting includ directories with the targets and replacing internal includes from #include "..." to #include<...> post installation * [opencascade] added port version * [opencascade] update SHA of versions/o-/opencascade.json * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * remove commented line for BUILD_INTERFACE * updated version * remove replacement of includes form #include <...> to #include "..." * update port version * added fix-install-prefix-path.patch, which was removed by #15997 * fix fix-install-prefix-path.patch * update port version * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * update port version * [opencascade]Revert "remove replacement of includes form #include <...> to #include "..."" also refined regex to allow white spaces between # and 'include' This reverts commit 4b362739f5e57449b3d6b1fcd6f2817b3be144a4. * [opencascade] update port version * [opencascade] change exported include directory from include/opencascade to include * [opencascade] update port version Co-authored-by: bloess <josua.bloess@uni-bayreuth.de> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-03-23 06:19:06 +08:00
fix-install-prefix-path.patch
install-include-dir.patch
2020-10-09 12:56:28 +08:00
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BUILD_TYPE "Shared")
else()
set(BUILD_TYPE "Static")
endif()
2020-10-09 12:56:28 +08:00
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"freeimage" USE_FREEIMAGE
"tbb" USE_TBB
"rapidjson" USE_RAPIDJSON
2020-10-09 12:56:28 +08:00
)
# VTK option in opencascade not currently supported because only 6.1.0 is supported but vcpkg has >= 9.0
# 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}
2020-10-09 12:56:28 +08:00
-DBUILD_MODULE_Draw=OFF
-DINSTALL_DIR_LAYOUT=Unix
-DBUILD_SAMPLES_MFC=OFF
-DBUILD_SAMPLES_QT=OFF
-DBUILD_DOC_Overview=OFF
-DINSTALL_TEST_CASES=OFF
-DINSTALL_SAMPLES=OFF
2020-10-09 12:56:28 +08:00
)
vcpkg_cmake_install()
2020-10-09 12:56:28 +08:00
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/opencascade)
[opencascade] fix #16252 (#16513) * [opencascade] fix #16252 by exporting includ directories with the targets and replacing internal includes from #include "..." to #include<...> post installation * [opencascade] added port version * [opencascade] update SHA of versions/o-/opencascade.json * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * remove commented line for BUILD_INTERFACE * updated version * remove replacement of includes form #include <...> to #include "..." * update port version * added fix-install-prefix-path.patch, which was removed by #15997 * fix fix-install-prefix-path.patch * update port version * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * update port version * [opencascade]Revert "remove replacement of includes form #include <...> to #include "..."" also refined regex to allow white spaces between # and 'include' This reverts commit 4b362739f5e57449b3d6b1fcd6f2817b3be144a4. * [opencascade] update port version * [opencascade] change exported include directory from include/opencascade to include * [opencascade] update port version Co-authored-by: bloess <josua.bloess@uni-bayreuth.de> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-03-23 06:19:06 +08:00
#make occt includes relative to source_file
list(APPEND ADDITIONAL_HEADERS
"ExprIntrp.tab.h"
"FlexLexer.h"
"glext.h"
"igesread.h"
"NCollection_Haft.h"
"OSD_PerfMeter.h"
"Standard_values.h"
)
file(GLOB files "${CURRENT_PACKAGES_DIR}/include/opencascade/[a-zA-Z0-9_]*\.[hgl]xx")
foreach(file_name IN LISTS files)
file(READ "${file_name}" filedata)
[opencascade] fix #16252 (#16513) * [opencascade] fix #16252 by exporting includ directories with the targets and replacing internal includes from #include "..." to #include<...> post installation * [opencascade] added port version * [opencascade] update SHA of versions/o-/opencascade.json * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * remove commented line for BUILD_INTERFACE * updated version * remove replacement of includes form #include <...> to #include "..." * update port version * added fix-install-prefix-path.patch, which was removed by #15997 * fix fix-install-prefix-path.patch * update port version * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * update port version * [opencascade]Revert "remove replacement of includes form #include <...> to #include "..."" also refined regex to allow white spaces between # and 'include' This reverts commit 4b362739f5e57449b3d6b1fcd6f2817b3be144a4. * [opencascade] update port version * [opencascade] change exported include directory from include/opencascade to include * [opencascade] update port version Co-authored-by: bloess <josua.bloess@uni-bayreuth.de> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-03-23 06:19:06 +08:00
string(REGEX REPLACE "# *include \<([a-zA-Z0-9_]*\.[hgl]xx)\>" "#include \"\\1\"" filedata "${filedata}")
foreach(extra_header IN LISTS ADDITIONAL_HEADERS)
[opencascade] fix #16252 (#16513) * [opencascade] fix #16252 by exporting includ directories with the targets and replacing internal includes from #include "..." to #include<...> post installation * [opencascade] added port version * [opencascade] update SHA of versions/o-/opencascade.json * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * remove commented line for BUILD_INTERFACE * updated version * remove replacement of includes form #include <...> to #include "..." * update port version * added fix-install-prefix-path.patch, which was removed by #15997 * fix fix-install-prefix-path.patch * update port version * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * update port version * [opencascade]Revert "remove replacement of includes form #include <...> to #include "..."" also refined regex to allow white spaces between # and 'include' This reverts commit 4b362739f5e57449b3d6b1fcd6f2817b3be144a4. * [opencascade] update port version * [opencascade] change exported include directory from include/opencascade to include * [opencascade] update port version Co-authored-by: bloess <josua.bloess@uni-bayreuth.de> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-03-23 06:19:06 +08:00
string(REGEX REPLACE "# *include \<${extra_header}\>" "#include \"${extra_header}\"" filedata "${filedata}")
endforeach()
file(WRITE "${file_name}" "${filedata}")
[opencascade] fix #16252 (#16513) * [opencascade] fix #16252 by exporting includ directories with the targets and replacing internal includes from #include "..." to #include<...> post installation * [opencascade] added port version * [opencascade] update SHA of versions/o-/opencascade.json * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * remove commented line for BUILD_INTERFACE * updated version * remove replacement of includes form #include <...> to #include "..." * update port version * added fix-install-prefix-path.patch, which was removed by #15997 * fix fix-install-prefix-path.patch * update port version * Update ports/opencascade/portfile.cmake Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * update port version * [opencascade]Revert "remove replacement of includes form #include <...> to #include "..."" also refined regex to allow white spaces between # and 'include' This reverts commit 4b362739f5e57449b3d6b1fcd6f2817b3be144a4. * [opencascade] update port version * [opencascade] change exported include directory from include/opencascade to include * [opencascade] update port version Co-authored-by: bloess <josua.bloess@uni-bayreuth.de> Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
2021-03-23 06:19:06 +08:00
endforeach()
2020-10-09 12:56:28 +08:00
# Remove libd to lib, libd just has cmake files we dont want too
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/libd" "${CURRENT_PACKAGES_DIR}/debug/lib")
2020-10-09 12:56:28 +08:00
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
2020-10-09 12:56:28 +08:00
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
# debug creates libd and bind directories that need moving
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/bind" "${CURRENT_PACKAGES_DIR}/debug/bin")
# fix paths in target files
list(APPEND TARGET_FILES
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEApplicationFrameworkTargets-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADECompileDefinitionsAndFlags-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEDataExchangeTargets-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEFoundationClassesTargets-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingAlgorithmsTargets-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEModelingDataTargets-debug.cmake"
"${CURRENT_PACKAGES_DIR}/share/opencascade/OpenCASCADEVisualizationTargets-debug.cmake"
)
foreach(TARGET_FILE IN LISTS TARGET_FILES)
file(READ "${TARGET_FILE}" filedata)
string(REGEX REPLACE "libd" "lib" filedata "${filedata}")
string(REGEX REPLACE "bind" "bin" filedata "${filedata}")
file(WRITE "${TARGET_FILE}" "${filedata}")
endforeach()
2020-10-09 12:56:28 +08:00
# the bin directory ends up with bat files that are noise, let's clean that up
file(GLOB BATS "${CURRENT_PACKAGES_DIR}/bin/*.bat")
file(REMOVE_RECURSE ${BATS})
else()
# remove scripts in bin dir
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
2020-10-09 12:56:28 +08:00
file(INSTALL "${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)