Files

44 lines
1.8 KiB
CMake
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# P4 / ABI 1.4:vde_plugin_tool 对 mesher 扩展点的 --abi / --check 适配 smoke。
cmake_minimum_required(VERSION 3.20)
foreach(_required VDE_TOOL VDE_MESHER_DIR)
if(NOT DEFINED ${_required})
message(FATAL_ERROR "VDE_PluginToolMesherAbi: missing -D${_required}")
endif()
endforeach()
execute_process(COMMAND "${VDE_TOOL}" --abi
RESULT_VARIABLE _rc OUTPUT_VARIABLE _out ERROR_VARIABLE _err)
if(NOT _rc EQUAL 0)
message(FATAL_ERROR "--abi failed (${_rc}):\n${_out}\n${_err}")
endif()
if(NOT _out MATCHES "1\\.4")
message(FATAL_ERROR "--abi does not report plugin ABI 1.4:\n${_out}")
endif()
if(NOT _out MATCHES "VdeMesherPlugin")
message(FATAL_ERROR "--abi does not report VdeMesherPlugin size:\n${_out}")
endif()
# MSVC 多配置生成器默认把 DLL 放在 <config>/ 下;--check 需要同目录
# 的 vde-plugin.json。把实际配置产物复制到包根,测试不依赖调用方的
# CMAKE_BUILD_TYPE / 生成器布局。
if(NOT EXISTS "${VDE_MESHER_DIR}/vde_sample_mesher.dll")
file(GLOB _mesher_dlls "${VDE_MESHER_DIR}/*/vde_sample_mesher.dll")
if(_mesher_dlls)
list(GET _mesher_dlls 0 _mesher_dll)
file(COPY "${_mesher_dll}" DESTINATION "${VDE_MESHER_DIR}")
endif()
endif()
execute_process(COMMAND "${VDE_TOOL}" --check "${VDE_MESHER_DIR}"
RESULT_VARIABLE _rc OUTPUT_VARIABLE _out ERROR_VARIABLE _err)
if(NOT _rc EQUAL 0)
message(FATAL_ERROR "--check sample_mesher failed (${_rc}):\n${_out}\n${_err}")
endif()
if(NOT _out MATCHES "kind: mesher")
message(FATAL_ERROR "--check output missing 'kind: mesher':\n${_out}")
endif()
if(NOT _out MATCHES "capabilities: mesher:tet")
message(FATAL_ERROR "--check output missing mesher:tet capability:\n${_out}")
endif()
message(STATUS "VDE_PluginToolMesherAbi: PASS (--abi 1.4 + --check mesher)")