From 3d15c00d8145cf95d71003dcf8326a09dc575afc Mon Sep 17 00:00:00 2001 From: "Roy, Biswajit" Date: Tue, 14 Jul 2026 02:49:15 +0530 Subject: [PATCH] simplify compilation workflow Signed-off-by: Roy, Biswajit --- .github/workflows/build.yml | 4 ++-- README.md | 5 ++--- build.bat | 28 +++++++--------------------- examples/MCP/sse/setup.bat | 2 +- examples/MCP/stdio/setup.bat | 2 +- third-party/CMakeLists.txt | 32 +------------------------------- 6 files changed, 14 insertions(+), 59 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4456dc..a005d9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -132,7 +132,7 @@ jobs: - name: Build shell: cmd - run: build.bat x64 + run: build.bat build-windows-arm64: needs: fetch-ftdi-windows-arm64 @@ -169,4 +169,4 @@ jobs: - name: Build shell: cmd - run: build.bat ARM64 + run: build.bat diff --git a/README.md b/README.md index 0a35f27..f7dce00 100644 --- a/README.md +++ b/README.md @@ -109,11 +109,10 @@ git clone https://github.com/qualcomm/qcom-test-automation-controller.git ### Build & Usage -Execute `build.bat` to generate executables: +Execute `build.bat` to generate executables. The build targets the host architecture automatically (x64 on an x64 host, ARM64 on an ARM64 host): ```cmd -build.bat (x64, default) -build.bat ARM64 (ARM64) +build.bat ``` **Build output**: diff --git a/build.bat b/build.bat index 4695b14..8df7846 100644 --- a/build.bat +++ b/build.bat @@ -4,32 +4,18 @@ @echo off @REM --------------------------------------------------------------------------- -@REM Detect target architecture +@REM Detect host architecture (native build only) @REM --------------------------------------------------------------------------- -set ARCH=%1 -if "%ARCH%"=="" ( - if "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( - set ARCH=ARM64 - ) else ( - set ARCH=x64 - ) -) - -if /i "%ARCH%"=="x64" ( - set EXPECTED_QT_PATH=msvc2022_64 - set VCVARS_SCRIPT=vcvars64.bat - set VS_COMPONENT=Desktop development with C++ -) else if /i "%ARCH%"=="ARM64" ( +if /i "%PROCESSOR_ARCHITECTURE%"=="ARM64" ( + set ARCH=ARM64 set EXPECTED_QT_PATH=msvc2022_arm64 set VCVARS_SCRIPT=vcvarsarm64.bat set VS_COMPONENT=MSVC v143 - VS 2022 C++ ARM64 build tools ) else ( - echo ERROR: Unsupported architecture '%ARCH%'. - echo Usage: - echo build.bat - auto-detect from host machine ^(current: %PROCESSOR_ARCHITECTURE%^) - echo build.bat x64 - build for x64 - echo build.bat ARM64 - build for ARM64 - exit /b 1 + set ARCH=x64 + set EXPECTED_QT_PATH=msvc2022_64 + set VCVARS_SCRIPT=vcvars64.bat + set VS_COMPONENT=Desktop development with C++ ) echo Architecture : %ARCH% diff --git a/examples/MCP/sse/setup.bat b/examples/MCP/sse/setup.bat index 6f3c6fb..a331f3d 100644 --- a/examples/MCP/sse/setup.bat +++ b/examples/MCP/sse/setup.bat @@ -66,7 +66,7 @@ if /i "%ARCH%"=="ARM64" ( set BUILD_DIR=%REPO_ROOT%\__Builds if not exist "%BUILD_DIR%" ( echo [1/3] Build not found. Running root build... - call "%REPO_ROOT%\build.bat" %ARCH% + call "%REPO_ROOT%\build.bat" if errorlevel 1 exit /b 1 ) else ( echo [1/3] Build found at %BUILD_DIR%, skipping recompile. diff --git a/examples/MCP/stdio/setup.bat b/examples/MCP/stdio/setup.bat index fdb2da4..1e41035 100644 --- a/examples/MCP/stdio/setup.bat +++ b/examples/MCP/stdio/setup.bat @@ -66,7 +66,7 @@ if /i "%ARCH%"=="ARM64" ( set BUILD_DIR=%REPO_ROOT%\__Builds if not exist "%BUILD_DIR%" ( echo [1/3] Build not found. Running root build... - call "%REPO_ROOT%\build.bat" %ARCH% + call "%REPO_ROOT%\build.bat" if errorlevel 1 exit /b 1 ) else ( echo [1/3] Build found at %BUILD_DIR%, skipping recompile. diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 7c5f6c7..d4f36d7 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -74,7 +74,7 @@ endif() file(REMOVE_RECURSE "${TEMP_DIR}") file(MAKE_DIRECTORY "${TEMP_DIR}") -execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf "${ARCHIVE_PATH}" WORKING_DIRECTORY "${TEMP_DIR}") +execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${ARCHIVE_PATH}" WORKING_DIRECTORY "${TEMP_DIR}") if(WIN32) file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/__Builds/${FTDI_WIN_ARCH}/Debug/lib") @@ -141,36 +141,6 @@ else() ) endif() -if(WIN32 AND DEFINED ENV{QTBIN}) - set(QT_BIN_DIR "$ENV{QTBIN}") - set(QT_PLUGINS_DIR "$ENV{QTBIN}/../plugins") - set(DEBUG_BIN_DIR "${CMAKE_SOURCE_DIR}/__Builds/${FTDI_WIN_ARCH}/Debug/bin") - set(RELEASE_BIN_DIR "${CMAKE_SOURCE_DIR}/__Builds/${FTDI_WIN_ARCH}/Release/bin") - - set(QT_DLLS Qt6Core Qt6Gui Qt6Widgets Qt6SerialPort Qt6Concurrent Qt6Network Qt6Xml Qt6Multimedia Qt6MultimediaWidgets) - - file(MAKE_DIRECTORY "${DEBUG_BIN_DIR}") - file(MAKE_DIRECTORY "${RELEASE_BIN_DIR}") - file(MAKE_DIRECTORY "${DEBUG_BIN_DIR}/platforms") - file(MAKE_DIRECTORY "${RELEASE_BIN_DIR}/platforms") - - foreach(QT_DLL ${QT_DLLS}) - if(EXISTS "${QT_BIN_DIR}/${QT_DLL}d.dll") - file(COPY "${QT_BIN_DIR}/${QT_DLL}d.dll" DESTINATION "${DEBUG_BIN_DIR}") - endif() - if(EXISTS "${QT_BIN_DIR}/${QT_DLL}.dll") - file(COPY "${QT_BIN_DIR}/${QT_DLL}.dll" DESTINATION "${RELEASE_BIN_DIR}") - endif() - endforeach() - - if(EXISTS "${QT_PLUGINS_DIR}/platforms/qwindowsd.dll") - file(COPY "${QT_PLUGINS_DIR}/platforms/qwindowsd.dll" DESTINATION "${DEBUG_BIN_DIR}/platforms") - endif() - if(EXISTS "${QT_PLUGINS_DIR}/platforms/qwindows.dll") - file(COPY "${QT_PLUGINS_DIR}/platforms/qwindows.dll" DESTINATION "${RELEASE_BIN_DIR}/platforms") - endif() -endif() - function(link_ftd2xx target_name) if(WIN32) target_link_libraries(${target_name} PRIVATE $<$:ftd2xx_debug> $<$:ftd2xx_release>)