2026-09-05 16:01:15 +08:00
|
|
|
@echo off
|
|
|
|
|
setlocal
|
|
|
|
|
call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" >nul
|
|
|
|
|
cd /d G:\Robot_v2\DCU\tools\ecat
|
|
|
|
|
if not exist build_native mkdir build_native
|
|
|
|
|
rem SII default image (ecat_native.c's #include "eeprom_image.h"): gen_eeprom.py stdout is
|
|
|
|
|
rem already a clean C header (self-check line goes to stderr); assert failure -> non-zero
|
|
|
|
|
rem exit -> build aborts. To change SII just rerun this script.
|
|
|
|
|
venv\Scripts\python.exe "G:\Robot_v2\DCU\DCU_APP\GD32E508_DCU_APP\comm\ssc\port\gen_eeprom.py" > build_native\eeprom_image.h
|
|
|
|
|
if errorlevel 1 (echo [FAIL] gen_eeprom.py image generation failed & exit /b 1)
|
|
|
|
|
if not exist build_native\wpcap.lib (
|
|
|
|
|
dumpbin /exports C:\Windows\System32\Npcap\wpcap.dll > build_native\exports.txt
|
|
|
|
|
venv\Scripts\python.exe exports2def.py build_native\exports.txt build_native\wpcap.def wpcap
|
|
|
|
|
lib /def:build_native\wpcap.def /machine:X64 /out:build_native\wpcap.lib
|
|
|
|
|
if errorlevel 1 exit /b 1
|
|
|
|
|
)
|
|
|
|
|
cl /nologo /O2 /W3 /utf-8 /D_CRT_SECURE_NO_WARNINGS /DWIN32 /I build_native /I soem-src\soem /I soem-src\osal /I soem-src\osal\win32 /I soem-src\oshw\win32 /I soem-src\oshw\win32\wpcap\Include /Fo:build_native\ ecat_native.c soem-src\soem\ethercatbase.c soem-src\soem\ethercatcoe.c soem-src\soem\ethercatconfig.c soem-src\soem\ethercatdc.c soem-src\soem\ethercateoe.c soem-src\soem\ethercatfoe.c soem-src\soem\ethercatmain.c soem-src\soem\ethercatprint.c soem-src\soem\ethercatsoe.c soem-src\osal\win32\osal.c soem-src\oshw\win32\nicdrv.c soem-src\oshw\win32\oshw.c /link /OUT:build_native\ecat_native.exe build_native\wpcap.lib ws2_32.lib winmm.lib
|
|
|
|
|
if errorlevel 1 exit /b 1
|
|
|
|
|
echo [OK] build_native\ecat_native.exe
|