2021-09-17 07:19:50 +08:00
|
|
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
vcpkg_from_github(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
REPO onnx/optimizer
|
2023-07-27 10:51:16 +08:00
|
|
|
REF "v${VERSION}"
|
|
|
|
SHA512 919790201f0d4d3eb107de9ed34c71d289d3c442f38f62721c838c9f60067a8c3478e991682983d8dad59476cab93466e2d23cc6d10b8b921282b939c29a1ad7
|
2021-09-17 07:19:50 +08:00
|
|
|
HEAD_REF master
|
|
|
|
PATCHES
|
|
|
|
fix-cmakelists.patch
|
|
|
|
)
|
|
|
|
|
2023-07-27 10:51:16 +08:00
|
|
|
string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" USE_STATIC_RUNTIME)
|
|
|
|
|
2021-09-17 07:19:50 +08:00
|
|
|
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
|
|
|
FEATURES
|
|
|
|
pybind11 BUILD_ONNX_PYTHON
|
|
|
|
)
|
|
|
|
if("pybind11" IN_LIST FEATURES)
|
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
list(APPEND FEATURE_OPTIONS
|
|
|
|
-DPython3_EXECUTABLE=${PYTHON3}
|
|
|
|
-DONNX_USE_PROTOBUF_SHARED_LIBS=ON # /wd4251
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_cmake_configure(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
OPTIONS
|
|
|
|
${FEATURE_OPTIONS}
|
2023-07-27 10:51:16 +08:00
|
|
|
-DONNX_USE_MSVC_STATIC_RUNTIME=${USE_STATIC_RUNTIME}
|
2021-09-17 07:19:50 +08:00
|
|
|
)
|
|
|
|
if("pybind11" IN_LIST FEATURES)
|
|
|
|
# This target is not in install/export
|
|
|
|
vcpkg_cmake_build(TARGET onnx_opt_cpp2py_export)
|
|
|
|
endif()
|
|
|
|
vcpkg_cmake_install()
|
|
|
|
vcpkg_copy_pdbs()
|
|
|
|
vcpkg_cmake_config_fixup(PACKAGE_NAME ONNXOptimizer CONFIG_PATH lib/cmake/ONNXOptimizer)
|
|
|
|
|
2023-07-27 10:51:16 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
2021-09-17 07:19:50 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/debug/share"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/include/onnxoptimizer/test"
|
|
|
|
)
|