2020-10-09 12:56:28 +08:00
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO Open-Cascade-SAS/OCCT
|
2023-09-14 06:32:26 +08:00
|
|
|
REF cec1ecd0c9f3b3d2572c47035d11949e8dfa85e2 #V7.7.2
|
|
|
|
SHA512 2fe98eadd7f9b922729bf80b56f260729d1c257c41392e4be4f070667ee77e94e2b286a873430b41ea61076acf1388aee7ba8b91789aa6199db56066796bb2d3
|
2020-10-09 12:56:28 +08:00
|
|
|
HEAD_REF master
|
2020-12-05 08:38:05 +08:00
|
|
|
PATCHES
|
2021-02-04 03:16:04 +08:00
|
|
|
fix-pdb-find.patch
|
2021-03-23 06:19:06 +08:00
|
|
|
fix-install-prefix-path.patch
|
|
|
|
install-include-dir.patch
|
2022-05-10 05:12:27 +08:00
|
|
|
fix-depend-freetype.patch
|
2023-09-14 06:32:26 +08:00
|
|
|
fix-depend-vtk.patch
|
2023-06-22 13:59:16 +08:00
|
|
|
fix-dependence.patch
|
2023-09-14 06:32:26 +08:00
|
|
|
fix-find-tbb.patch
|
2020-10-09 12:56:28 +08:00
|
|
|
)
|
|
|
|
|
2023-05-17 23:57:42 +08:00
|
|
|
if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2020-12-05 08:38:05 +08:00
|
|
|
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
|
2021-10-22 15:49:45 +08:00
|
|
|
FEATURES
|
|
|
|
"freeimage" USE_FREEIMAGE
|
|
|
|
"tbb" USE_TBB
|
|
|
|
"rapidjson" USE_RAPIDJSON
|
2023-09-14 06:32:26 +08:00
|
|
|
"samples" INSTALL_SAMPLES
|
|
|
|
"vtk" USE_VTK
|
2020-10-09 12:56:28 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
# 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
|
2021-10-22 15:49:45 +08:00
|
|
|
vcpkg_cmake_configure(
|
2021-11-13 08:40:40 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
OPTIONS
|
|
|
|
${FEATURE_OPTIONS}
|
2020-12-05 08:38:05 +08:00
|
|
|
-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
|
2020-12-05 08:38:05 +08:00
|
|
|
-DINSTALL_TEST_CASES=OFF
|
2023-09-14 06:32:26 +08:00
|
|
|
-DBUILD_MODULE_DETools=OFF
|
2020-10-09 12:56:28 +08:00
|
|
|
)
|
|
|
|
|
2021-10-22 15:49:45 +08:00
|
|
|
vcpkg_cmake_install()
|
2020-10-09 12:56:28 +08:00
|
|
|
|
2021-10-22 15:49:45 +08:00
|
|
|
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/opencascade)
|
2021-03-23 06:19:06 +08:00
|
|
|
|
|
|
|
#make occt includes relative to source_file
|
|
|
|
list(APPEND ADDITIONAL_HEADERS
|
|
|
|
"ExprIntrp.tab.h"
|
2022-05-10 05:12:27 +08:00
|
|
|
"FlexLexer.h"
|
|
|
|
"glext.h"
|
|
|
|
"igesread.h"
|
|
|
|
"NCollection_Haft.h"
|
|
|
|
"OSD_PerfMeter.h"
|
|
|
|
"Standard_values.h"
|
2021-03-23 06:19:06 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
file(GLOB files "${CURRENT_PACKAGES_DIR}/include/opencascade/[a-zA-Z0-9_]*\.[hgl]xx")
|
2021-10-22 15:49:45 +08:00
|
|
|
foreach(file_name IN LISTS files)
|
2022-05-10 05:12:27 +08:00
|
|
|
file(READ "${file_name}" filedata)
|
|
|
|
string(REGEX REPLACE "# *include \<([a-zA-Z0-9_]*\.[hgl]xx)\>" "#include \"\\1\"" filedata "${filedata}")
|
|
|
|
foreach(extra_header IN LISTS ADDITIONAL_HEADERS)
|
|
|
|
string(REGEX REPLACE "# *include \<${extra_header}\>" "#include \"${extra_header}\"" filedata "${filedata}")
|
|
|
|
endforeach()
|
|
|
|
file(WRITE "${file_name}" "${filedata}")
|
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
|
2022-06-23 05:41:13 +08:00
|
|
|
if( WIN32 )
|
2021-10-22 15:49:45 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib")
|
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/debug/libd" "${CURRENT_PACKAGES_DIR}/debug/lib")
|
2022-06-23 05:41:13 +08:00
|
|
|
endif()
|
2020-10-09 12:56:28 +08:00
|
|
|
|
2021-10-22 15:49:45 +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
|
|
|
|
2023-05-17 23:57:42 +08:00
|
|
|
if (NOT VCPKG_BUILD_TYPE)
|
2020-12-05 08:38:05 +08:00
|
|
|
# fix paths in target files
|
|
|
|
list(APPEND TARGET_FILES
|
2021-10-22 15:49:45 +08:00
|
|
|
"${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"
|
2020-12-05 08:38:05 +08:00
|
|
|
)
|
2023-05-17 23:57:42 +08:00
|
|
|
|
2021-10-22 15:49:45 +08:00
|
|
|
foreach(TARGET_FILE IN LISTS TARGET_FILES)
|
|
|
|
file(READ "${TARGET_FILE}" filedata)
|
2023-05-17 23:57:42 +08:00
|
|
|
string(REGEX REPLACE "/libd" "/lib" filedata "${filedata}")
|
|
|
|
string(REGEX REPLACE "/bind" "/bin" filedata "${filedata}")
|
2021-10-22 15:49:45 +08:00
|
|
|
file(WRITE "${TARGET_FILE}" "${filedata}")
|
2020-12-05 08:38:05 +08:00
|
|
|
endforeach()
|
2020-10-09 12:56:28 +08:00
|
|
|
|
2023-05-17 23:57:42 +08:00
|
|
|
endif()
|
|
|
|
|
2023-06-06 04:37:51 +08:00
|
|
|
if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
2023-05-17 23:57:42 +08:00
|
|
|
# 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")
|
|
|
|
|
2020-12-05 08:38:05 +08:00
|
|
|
# the bin directory ends up with bat files that are noise, let's clean that up
|
2021-10-22 15:49:45 +08:00
|
|
|
file(GLOB BATS "${CURRENT_PACKAGES_DIR}/bin/*.bat")
|
2020-12-05 08:38:05 +08:00
|
|
|
file(REMOVE_RECURSE ${BATS})
|
|
|
|
else()
|
|
|
|
# remove scripts in bin dir
|
2021-10-22 15:49:45 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
|
2020-12-05 08:38:05 +08:00
|
|
|
endif()
|
2020-10-09 12:56:28 +08:00
|
|
|
|
2023-09-19 00:19:45 +08:00
|
|
|
if (INSTALL_SAMPLES)
|
|
|
|
foreach(dir "Tutorial" "FuncDemo" "IESample" "OCCTOverview")
|
|
|
|
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/opencascade/samples/qt/${dir}/env.sh" "${CURRENT_PACKAGES_DIR}/bin/env.sh" "<not/existing>")
|
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
|
2023-05-17 23:57:42 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/OCCT_LGPL_EXCEPTION.txt")
|