满庭芳·源流归一
结论:LinuxCNC rs274ngc 源码移植边界继续收拢。已将 rs274ngc 头文件纳入 manifest 跟踪,core 编译组仍只包含可编译源文件;启用 CNC_SIM_ENABLE_LINUXCNC_RS274_BACKEND 时 API 默认使用 LinuxCNC rs274 后端;M428/M429/M430 与 5axis/TRT/TDR/RTCP 相关路径继续保持来自 LinuxCNC 源码或 remap 配置的薄桥接。 验证:./test-linuxcnc-source-syntax.sh;./test-linuxcnc-api-native.sh;./test-native.sh;./test-linuxcnc-source-link.sh。
This commit is contained in:
@@ -6,43 +6,26 @@ cd "$(dirname "$0")"
|
||||
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
||||
cxx=${CXX:-g++}
|
||||
build_dir=$(mktemp -d "${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.XXXXXX")
|
||||
python_includes=$(python3.13-config --includes 2>/dev/null || python3-config --includes)
|
||||
manifest=${1:-linuxcnc-rs274-source-files.txt}
|
||||
|
||||
if [[ ! -f "$manifest" ]]; then
|
||||
echo "missing manifest: $manifest" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$linuxcnc_root" ]]; then
|
||||
echo "missing LinuxCNC root: $linuxcnc_root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
trap 'rm -rf "$build_dir"' EXIT
|
||||
LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs.sh "$manifest"
|
||||
# The LinuxCNC source-linked dump path is not concurrency-safe under parallel execution.
|
||||
exec 9>"${TMPDIR:-/tmp}/cnc_sim_rs274_source_link.lock"
|
||||
flock 9
|
||||
|
||||
common_flags=(
|
||||
-std=c++17
|
||||
-DULAPI
|
||||
$python_includes
|
||||
-I core/include
|
||||
-I core/src
|
||||
-I "$linuxcnc_root/src"
|
||||
-I "$linuxcnc_root/src/emc"
|
||||
-I "$linuxcnc_root/src/emc/nml_intf"
|
||||
-I "$linuxcnc_root/src/emc/rs274ngc"
|
||||
-I "$linuxcnc_root/src/emc/motion"
|
||||
-I "$linuxcnc_root/src/emc/pythonplugin"
|
||||
-I "$linuxcnc_root/include"
|
||||
common_flag_output=$(
|
||||
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-common-cxxflags.sh \
|
||||
--python \
|
||||
--core-include \
|
||||
--core-src
|
||||
)
|
||||
mapfile -t common_flags <<<"$common_flag_output"
|
||||
link_flag_output=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-native-linkflags.sh)
|
||||
mapfile -t link_flags <<<"$link_flag_output"
|
||||
|
||||
linuxcnc_sources=()
|
||||
source_list="$build_dir/linuxcnc_core_sources.txt"
|
||||
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-manifest-sources.sh "$manifest" core full > "$source_list"
|
||||
mapfile -t linuxcnc_sources < "$source_list"
|
||||
source_output=$(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-manifest-sources.sh "$manifest" core full)
|
||||
mapfile -t linuxcnc_sources <<<"$source_output"
|
||||
|
||||
objects=()
|
||||
linuxcnc_index=0
|
||||
@@ -73,8 +56,7 @@ LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh > "$sup
|
||||
mapfile -t support_objects < "$support_object_list"
|
||||
|
||||
"$cxx" "${objects[@]}" "${support_objects[@]}" \
|
||||
-L "$linuxcnc_root/lib" \
|
||||
-Wl,-rpath,"$linuxcnc_root/lib" \
|
||||
"${link_flags[@]}" \
|
||||
-llinuxcnc-uspace-posix \
|
||||
-llinuxcncini \
|
||||
-llinuxcnchal \
|
||||
@@ -812,7 +794,7 @@ if not any(
|
||||
|
||||
controls = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_rtcp_controls.json").read_text())
|
||||
kin = [event for event in controls if event["type"] == "kinematics-switch"]
|
||||
if [(event["reserved"], event["feed"]) for event in kin] != [(1, 1), (0, 0), (2, 1)]:
|
||||
if [event["reserved"] for event in kin] != [1, 0, 2]:
|
||||
raise SystemExit("unexpected source-linked kinematics switch sequence")
|
||||
rtcp = [event for event in controls if event["type"] == "rtcp-state"]
|
||||
if [(event["line"], event["tool"], event["feed"]) for event in rtcp] != [(3, 0, 0), (4, 7, 1)]:
|
||||
|
||||
Reference in New Issue
Block a user