73 lines
2.1 KiB
Bash
Executable File
73 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# LinuxCNC source basis: native RS274/source-link builds consume headers from
|
|
# src/Makefile SUBDIRS plus src/emc/rs274ngc/Submakefile, pythonplugin,
|
|
# nml_intf, motion, and include exports used by librs274 and its bindings.
|
|
linuxcnc_root=${LINUXCNC_ROOT:-../linuxcnc}
|
|
preflight_cache_dir=${CNC_SIM_PREFLIGHT_CACHE_DIR:-build/linuxcnc-helper-preflight-cache}
|
|
include_python=0
|
|
include_core_include=0
|
|
include_core_src=0
|
|
syntax_only=0
|
|
emit_ulapi=1
|
|
|
|
while [[ "$#" -gt 0 ]]; do
|
|
case "$1" in
|
|
--python)
|
|
include_python=1
|
|
shift
|
|
;;
|
|
--core-include)
|
|
include_core_include=1
|
|
shift
|
|
;;
|
|
--core-src)
|
|
include_core_src=1
|
|
shift
|
|
;;
|
|
--syntax-only)
|
|
syntax_only=1
|
|
shift
|
|
;;
|
|
--no-ulapi)
|
|
emit_ulapi=0
|
|
shift
|
|
;;
|
|
--)
|
|
shift
|
|
break
|
|
;;
|
|
*)
|
|
echo "unknown source cxxflag option: $1" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
LINUXCNC_ROOT="$linuxcnc_root" ./check-linuxcnc-inputs-cached.sh --cache-dir "$preflight_cache_dir" --root-only
|
|
|
|
python_includes=()
|
|
if [[ "$include_python" -eq 1 ]]; then
|
|
python_include_output=$(python3.13-config --includes 2>/dev/null || python3-config --includes)
|
|
read -r -a python_includes <<<"$python_include_output"
|
|
fi
|
|
|
|
printf '%s\n' \
|
|
-std=c++17 \
|
|
-fpermissive \
|
|
$([[ "$emit_ulapi" -eq 1 ]] && printf '%s\n' -DULAPI) \
|
|
$([[ "$syntax_only" -eq 1 ]] && printf '%s\n' -fsyntax-only) \
|
|
"${python_includes[@]}" \
|
|
$([[ "$include_core_include" -eq 1 ]] && printf '%s\n' -I core/include) \
|
|
$([[ "$include_core_src" -eq 1 ]] && printf '%s\n' -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"
|