compileMsbuild.bat 957 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
@ECHO Off
:: add *_HOME to PATH temporarily
IF NOT [%cmake_HOME%] == [] (
   set PATH="%cmake_HOME%;%PATH%"
)
IF NOT [%msbuild_HOME%] == [] (
   set PATH="%msbuild_HOME%;%PATH%"
)

:: check if needed programs are in PATH
where cmake
IF NOT %ERRORLEVEL% EQU 0 (
   echo "Can not find cmake in PATH! Aborting."
   exit /B 1
)
where vcvars64.bat
IF NOT %ERRORLEVEL% EQU 0 (
   echo "Can not find vcvars64.bat in PATH! Aborting."
   exit /B 1
)
21 22 23 24 25 26

:: source additional environment variables
call vcvars64.bat
call %ROS2_HOME%\local_setup.bat

:: Post source check if needed programs are in PATH
27 28 29 30 31
where msbuild
IF NOT %ERRORLEVEL% EQU 0 (
   echo "Can not find msbuild in PATH! Aborting."
   exit /B 1
)
32 33 34 35 36
where ros2
IF NOT %ERRORLEVEL% EQU 0 (
   echo "Can not find ros2 in PATH! Aborting."
   exit /B 1
)
37 38 39 40 41 42

:: cmake
cmake -B./build/ -G "Visual Studio 15 2017 Win64" %* ./src

:: msbuild
cd .\build
43
msbuild /m /t:build /p:Configuration=Release ALL_BUILD.vcxproj
44
cd ..