compileMsbuild.bat 1.37 KB
Newer Older
1 2 3
@ECHO Off
:: add *_HOME to PATH temporarily
IF NOT [%cmake_HOME%] == [] (
4
	set PATH="%cmake_HOME%;%PATH%"
5 6
)
IF NOT [%msbuild_HOME%] == [] (
7
	set PATH="%msbuild_HOME%;%PATH%"
8 9 10 11 12
)

:: check if needed programs are in PATH
where cmake
IF NOT %ERRORLEVEL% EQU 0 (
13 14 15
	echo "Can not find cmake in PATH! Aborting."
	echo "Try setting the environment variable cmake_HOME to the base of your installation or adding it to your PATH!"
	exit /B 1
16 17 18
)
where vcvars64.bat
IF NOT %ERRORLEVEL% EQU 0 (
19 20 21
	echo "Can not find vcvars64.bat in PATH! Aborting."
	echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
	exit /B 1
22
)
23 24 25 26 27 28

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

:: Post source check if needed programs are in PATH
29 30
where msbuild
IF NOT %ERRORLEVEL% EQU 0 (
31 32 33
	echo "Can not find msbuild in PATH! Aborting."
	echo "Try setting the environment variable msbuild_HOME to the base of your installation or adding it to your PATH!"
	exit /B 1
34
)
35 36
where ros2
IF NOT %ERRORLEVEL% EQU 0 (
37 38 39
	echo "Can not find ros2 in PATH! Aborting."
	echo "Try setting the environment variable ROS2_HOME to the base of your installation or adding it to your PATH!"
	exit /B 1
40
)
41 42 43 44 45 46

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

:: msbuild
cd .\build
47
msbuild /m /t:build /p:Configuration=Release ALL_BUILD.vcxproj
48
cd ..