Skip to content

Commit 5f0c3f6

Browse files
authored
Merge pull request #14 from shishir-dey/feature/script-to-run-locally-on-windows-machine
Add a script to build and test everything locally on a Windows machine
2 parents 6cf6547 + cdcaae8 commit 5f0c3f6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

scripts/run_on_windows.bat

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
@echo off
2+
REM Turn off command echoing to make the output cleaner.
3+
4+
REM Define the name of the build directories for host and target builds.
5+
set HOST_BUILD_DIR=cmake-host-build-debug
6+
set TARGET_BUILD_DIR=cmake-target-build-debug
7+
8+
REM Check if the host build directory exists.
9+
IF EXIST %HOST_BUILD_DIR% (
10+
REM If it exists, remove all files and subdirectories inside it.
11+
echo "Emptying existing host build directory: %HOST_BUILD_DIR%"
12+
rd /s /q %HOST_BUILD_DIR%
13+
)
14+
15+
REM Create the host build directory (it will be empty after this).
16+
mkdir %HOST_BUILD_DIR%
17+
REM Change the current directory to the host build directory.
18+
cd %HOST_BUILD_DIR%
19+
20+
REM Run CMake to configure the build for the host environment.
21+
cmake .. -DHOST=True -G "MinGW Makefiles"
22+
23+
REM Execute the make command to build the project using the generated makefiles.
24+
mingw32-make
25+
26+
REM Change back to the previous directory (the original directory where the script was run).
27+
cd ..
28+
29+
REM Run tests using CTest in the host build directory.
30+
ctest --test-dir %HOST_BUILD_DIR%
31+
32+
REM Check if the target build directory exists.
33+
IF EXIST %TARGET_BUILD_DIR% (
34+
REM If it exists, remove all files and subdirectories inside it.
35+
echo "Emptying existing target build directory: %TARGET_BUILD_DIR%"
36+
rd /s /q %TARGET_BUILD_DIR%
37+
)
38+
39+
REM Create the target build directory for the target architecture.
40+
mkdir %TARGET_BUILD_DIR%
41+
REM Change the current directory to the target build directory.
42+
cd %TARGET_BUILD_DIR%
43+
44+
REM Run CMake to configure the build for the target environment.
45+
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/arm-none-eabi-gcc.cmake -G "MinGW Makefiles"
46+
47+
REM Execute the make command to build the project for the target architecture.
48+
mingw32-make
49+
50+
REM Change back to the previous directory after the target build is complete.
51+
cd ..

0 commit comments

Comments
 (0)