diff --git a/.gitignore b/.gitignore index 9723bd9..570e6a4 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ **/tools/ **/src/build/ **/upm/com.microsoft.ros_mrtk_native/Plugins/ +**/upm/com.microsoft.ros_mrtk_native/link.xml **/nuget/nuget.exe # User-specific files (MonoDevelop/Xamarin Studio) diff --git a/build.cmd b/build.cmd index d382c6f..9143d2a 100644 --- a/build.cmd +++ b/build.cmd @@ -13,147 +13,70 @@ echo "VSInstallDir is %VSINSTALLDIR%" set clean=false set DEBUG_CMD= -: Call to build the isolated ROS2 build system -set ChocolateyInstall=c:\opt\chocolatey - -set CMAKE_PREFIX_PATH_ORIG=%CMAKE_PREFIX_PATH% -set PATH=c:\opt\chocolatey\bin;C:\opt\python37amd64\;C:\opt\python37amd64\Scripts;C:\opt\python37amd64\DLLs;%PATH% -set PATH_ORIG=%PATH% - -set VCPKG_ROOT=c:\opt\vcpkg -set PYTHONHOME=C:\opt\python37amd64\ - :: Parse options :GETOPTS if /I "%~1" == "/?" goto USAGE if /I "%~1" == "/Help" goto USAGE - if /I "%~1" == "/x86" set BUILD=x86 - if /I "%~1" == "/x64" set BUILD=x64 - if /I "%~1" == "/arm64" set BUILD=arm64 - if /I "%~1" == "/arm" set BUILD=arm - if /I "%~1" == "/unity" set BUILD=unity - if /I "%~1" == "/clean" set clean=true - shift -if not (%1)==() goto GETOPTS - -if "%BUILD%"=="x86" goto :build_x86 -if "%BUILD%"=="x64" goto :build_x64 -if "%BUILD%"=="unity" goto :build_unity -if "%BUILD%"=="arm" goto :build_arm -if "%BUILD%"=="arm64" goto :build_arm64 - -:build_unity -setlocal -set ROS2_ARCH=x64 -call tools\unity\local_setup.bat - -pushd target -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x64-windows;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x64-windows\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" + + if /I "%~1" == "/x64" ( + set BUILD_ARCH=x64 + set BUILD_BASE=x64 + set BUILD_SYSTEM=WindowsStore + ) + + if /I "%~1" == "/arm64" ( + set BUILD_ARCH=arm64 + set BUILD_BASE=arm64 + set BUILD_SYSTEM=WindowsStore + ) + + if /I "%~1" == "/unity" ( + set BUILD_ARCH=x64 + set BUILD_BASE=unity + set BUILD_SYSTEM=Windows + ) +if /I "%~1" == "/clean" set clean=true +shift -if "%clean%"=="true" ( - if exist unity_build rd /s /q unity_build - if exist unity rd /s /q unity -) - -: Disable Shared Memory when running under unity -: TODO: figure out why shared memory isn't happy -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\unity_build --install-base .\unity --packages-ignore tf2_bullet tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DSHM_TRANSPORT_DEFAULT=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -if "%BUILD%"=="unity" goto :build_succeeded - -:build_x64 -setlocal -set ROS2_ARCH=x64 -call tools\x64\local_setup.bat - -pushd target -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x64-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x64-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" +if not (%1)==() goto GETOPTS -if "%clean%"=="true" ( - if exist x64_build rd /s /q x64_build - if exist x64 rd /s /q x64 -) +: Call to build the isolated ROS2 build system +set ChocolateyInstall=c:\opt\chocolatey -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x64_build --install-base .\x64 --packages-ignore tf2_bullet tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -if "%BUILD%"=="x64" goto :build_succeeded +set PATH_ORIG=%PATH% -:build_arm64 -setlocal -set ROS2_ARCH=arm64 -call tools\arm64\local_setup.bat +set CMAKE_PREFIX_PATH_ORIG=%CMAKE_PREFIX_PATH% +set PYTHONHOME=C:\opt\mrtk_python +set ChocolateyInstall=c:\opt\mrtk_chocolatey +set PATH=c:\opt\mrtk_vcpkg;c:\opt\chocolatey\bin;C:\opt\mrtk_python;C:\opt\mrtk_python\Scripts;%PATH% +set VCPKG_ROOT=c:\opt\mrtk_vcpkg -pushd target -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/arm64-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\arm64-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +set ARCH_LIST=x64 arm64 unity if "%clean%"=="true" ( - if exist arm64_build rd /s /q arm64_build - if exist install rd /s /q install -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm64_build --install-base .\arm64 --packages-ignore tf2_bullet tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm64 -DDOTNET_CORE_ARCH=arm64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -if "%BUILD%"=="arm64" goto :build_succeeded - - - -:build_arm -setlocal -set ROS2_ARCH=arm -call tools\arm\local_setup.bat - -pushd target -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/arm-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\arm-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_arm.bat" + pushd tools + for %%a in (%ARCH_LIST%) do ( + if exist %%a_build rd /s /q %%a_build + if exist %%a rd /s /q %%a + ) + popd -if "%clean%"=="true" ( - if exist arm64_build rd /s /q arm64_build - if exist install rd /s /q install + if "%BUILD_ARCH%" == "" ( + goto :eof + ) ) -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm_build --install-base .\arm --packages-ignore tf2_bullet tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm -DDOTNET_CORE_ARCH=arm -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -if "%BUILD%"=="arm" goto :build_succeeded - -: build x86 -:build_x86 setlocal -: x86 is called Win32 in cmakelandia -set ROS2_ARCH=Win32 -call tools\x86\local_setup.bat - -pushd target -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x86-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x86-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_x86.bat" - -if "%clean%"=="true" ( - if exist x86_build rd /s /q x86_build - if exist x86 rd /s /q x86 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x86_build --install-base .\x86 --packages-ignore tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x86 -DDOTNET_CORE_ARCH=x86 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev +call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\%BUILD_BASE%_build --install-base .\%BUILD_BASE% --cmake-args -A %BUILD_ARCH% -DCSHARP_PLATFORM=%BUILD_ARCH% -DCMAKE_SYSTEM_NAME=%BUILD_SYSTEM% -DDOTNET_CORE_ARCH=%BUILD_ARCH% -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev +endlocal if "%ERRORLEVEL%" NEQ "0" goto :build_fail -if "%BUILD%"=="x86" goto :build_succeeded - -goto :build_succeeded +goto :eof :build_fail -popd goto :eof :USAGE - echo "build [/x64|/x86|/arm64|/arm] [/clean]" + echo "build [/arm64 | /unity / x64] [/clean]" goto :eof -:build_succeeded -endlocal -popd \ No newline at end of file diff --git a/build_dotnet.cmd b/build_dotnet.cmd deleted file mode 100644 index a45bb19..0000000 --- a/build_dotnet.cmd +++ /dev/null @@ -1,169 +0,0 @@ -: @echo off -setlocal enableextensions disabledelayedexpansion - -if "%VSINSTALLDIR%" == "" ( - if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( - set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\" - ) - if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" ( - set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\" - ) -) -echo "VSInstallDir is %VSINSTALLDIR%" - -set clean=false -set DEBUG_CMD= -: Call to build the isolated ROS2 build system -set ChocolateyInstall=c:\opt\chocolatey - -set CMAKE_PREFIX_PATH_ORIG=%CMAKE_PREFIX_PATH% -set PATH=c:\opt\chocolatey\bin;C:\opt\python37amd64\;C:\opt\python37amd64\Scripts;C:\opt\python37amd64\DLLs;%PATH% -set PATH_ORIG=%PATH% - -set VCPKG_ROOT=c:\opt\vcpkg -set PYTHONHOME=C:\opt\python37amd64\ - - -:: Parse options -:GETOPTS - if /I "%~1" == "/?" goto USAGE - if /I "%~1" == "/Help" goto USAGE - if /I "%~1" == "/x86" set BUILD=x86 - if /I "%~1" == "/x64" set BUILD=x64 - if /I "%~1" == "/arm64" set BUILD=arm64 - if /I "%~1" == "/arm" set BUILD=arm - if /I "%~1" == "/unity" set BUILD=unity - if /I "%~1" == "/clean" set clean=true - if /I "%~1" == "/debug" set DEBUG_CMD=-DCMAKE_BUILD_TYPE=RelWithDebInfo - shift -if not (%1)==() goto GETOPTS - -if "%BUILD%"=="x86" goto :build_x86 -if "%BUILD%"=="x64" goto :build_x64 -if "%BUILD%"=="unity" goto :build_unity -if "%BUILD%"=="arm" goto :build_arm -if "%BUILD%"=="arm64" goto :build_arm64 - -:build_unity -setlocal -set ROS2_ARCH=x64 -call tools\unity\local_setup.bat -call target\unity\local_setup.bat - -pushd ros2dotnet -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x64-windows;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x64-windows\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" - -if "%clean%"=="true" ( - if exist unity_build rd /s /q build - if exist unity rd /s /q unity -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\unity_build --install-base .\unity --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli %DEBUG_CMD% -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :eof -endlocal -popd -if "%BUILD%"=="unity" goto :eof - -:build_x64 -setlocal -set ROS2_ARCH=x64 -call tools\x64\local_setup.bat -call target\x64\local_setup.bat - -pushd ros2dotnet -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x64-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x64-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" - -if "%clean%"=="true" ( - if exist x64_build rd /s /q x64_build - if exist x64 rd /s /q x64 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x64_build --install-base .\x64 --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli %DEBUG_CMD% -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="x64" goto :eof - -:build_arm64 -setlocal -set ROS2_ARCH=arm64 -call tools\arm64\local_setup.bat -call target\arm64\local_setup.bat - -pushd ros2dotnet -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/arm64-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\arm64-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" - -if "%clean%"=="true" ( - if exist arm64_build rd /s /q arm64_build - if exist arm64 rd /s /q arm64 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm64_build --install-base .\arm64 --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm64 -DDOTNET_CORE_ARCH=arm64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli %DEBUG_CMD% -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="arm64" goto :eof - - - -:build_arm -setlocal -set ROS2_ARCH=arm -call tools\arm\local_setup.bat -call target\arm\local_setup.bat - -pushd ros2dotnet -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/arm-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\arm-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_arm.bat" - -if "%clean%"=="true" ( - if exist arm_build rd /s /q arm_build - if exist arm rd /s /q arm -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm_build --install-base .\arm--cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm -DDOTNET_CORE_ARCH=arm -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli %DEBUG_CMD% -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="arm" goto :eof - -: build x86 -:build_x86 -setlocal -: x86 is called Win32 in cmakelandia -set ROS2_ARCH=Win32 -call tools\x86\local_setup.bat -call target\x86\local_setup.bat - -pushd ros2dotnet -set CMAKE_PREFIX_PATH=C:/opt/vcpkg/installed/x86-uwp;%CMAKE_PREFIX_PATH_ORIG% -set PATH=c:\opt\vcpkg;c:\opt\vcpkg\installed\x86-uwp\bin;%PATH_ORIG% -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_x86.bat" - -if "%clean%"=="true" ( - if exist x86_build rd /s /q x86_build - if exist x86 rd /s /q x86 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x86_build --install-base .\x86 --packages-ignore tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x86 -DDOTNET_CORE_ARCH=x86 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli %DEBUG_CMD% -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="x86" goto :eof - -goto :eof - -:build_fail -popd -goto :eof - -:USAGE - echo "build [/x64|/x86|/arm64|/arm] [/clean]" - goto :eof diff --git a/build_nuget.cmd b/build_nuget.cmd index 0859da4..0d54d13 100644 --- a/build_nuget.cmd +++ b/build_nuget.cmd @@ -23,8 +23,6 @@ pushd nuget if /I "%~1" == "/Help" goto USAGE if /I "%~1" == "/clean" set CLEAN=1 if /I "%~1" == "/nopack" set NOPACK=1 - if /I "%~1" == "/arm" set NUSPEC="Microsoft.ROS.MRTK.Foxy.arm" - if /I "%~1" == "/x86" set NUSPEC="Microsoft.ROS.MRTK.Foxy.x86" if /I "%~1" == "/x64" set NUSPEC="Microsoft.ROS.MRTK.Foxy.x64" if /I "%~1" == "/arm64" set NUSPEC="Microsoft.ROS.MRTK.Foxy.arm64" if /I "%~1" == "/unity" set NUSPEC="Microsoft.ROS.MRTK.Foxy.unity" diff --git a/build_target.cmd b/build_target.cmd new file mode 100644 index 0000000..af31694 --- /dev/null +++ b/build_target.cmd @@ -0,0 +1,103 @@ +: @echo off +setlocal enableextensions disabledelayedexpansion + +if "%VSINSTALLDIR%" == "" ( + if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( + set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\" + ) + if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" ( + set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\" + ) +) +echo "VSInstallDir is %VSINSTALLDIR%" +echo "Current dir is %~dp0" + +set clean=false +set DEBUG_CMD= +set CMAKE_PREFIX_PATH_ORIG=%CMAKE_PREFIX_PATH% +set PATH_ORIG=%PATH% + +set PYTHONHOME=C:\opt\mrtk_python +set ChocolateyInstall=c:\opt\mrtk_chocolatey +set PATH=c:\opt\mrtk_vcpkg;c:\opt\chocolatey\bin;C:\opt\mrtk_python;C:\opt\mrtk_python\Scripts;%PATH% +set VCPKG_ROOT=c:\opt\mrtk_vcpkg + +set ROS_TOOLS_DIR=%~dp0\tools + +:: Parse options +:GETOPTS +if /I "%~1" == "/?" goto USAGE +if /I "%~1" == "/Help" goto USAGE +if /I "%~1" == "/x64" ( + set BUILD_ARCH=x64 + set BUILD_BASE=x64 + set BUILD_SYSTEM=WindowsStore + call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" + set "VCPKG_INSTALLED=%VCPKG_ROOT%\installed\x64-uwp" +) + +if /I "%~1" == "/arm64" ( + set BUILD_ARCH=arm64 + set BUILD_BASE=arm64 + set BUILD_SYSTEM=WindowsStore + call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" + set "VCPKG_INSTALLED=%VCPKG_ROOT%\installed\arm64-uwp" +) + +if /I "%~1" == "/unity" ( + set BUILD_ARCH=x64 + set BUILD_BASE=unity + set BUILD_SYSTEM=Windows + call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" + set "VCPKG_INSTALLED=%VCPKG_ROOT%\installed\x64-windows" +) + +if /I "%~1" == "/clean" set clean=true +shift + +if not (%1)==() goto GETOPTS + +set ARCH_LIST=x64 arm64 unity + +if "%clean%"=="true" ( + pushd target + for %%a in (%ARCH_LIST%) do ( + if exist %%a_build rd /s /q %%a_build + if exist %%a rd /s /q %%a + ) + popd + + if "%BUILD_ARCH%" == "" ( + goto :eof + ) + +) + +: Instead of calling tools\build_arch\setup.bat, we need to break it out manually +: This is done because cmake will resolve a ROS install in opt rather than the one we built here. +: just now. +: in this directory... +echo "CMAKE_PREFIX_PATH is %CMAKE_PREFIX_PATH%" +echo "PATH is %PATH%" + +call tools\%BUILD_ARCH%\local_setup.bat + +set "CMAKE_PREFIX_PATH=%VCPKG_INSTALLED%;%ROS_TOOLS_DIR%\%BUILD_ARCH%;%CMAKE_PREFIX_PATH%" +set "PATH=%VCPKG_INSTALLED%\bin;%ROS_TOOLS_DIR%\%BUILD_ARCH%\bin;%ROS_TOOLS_DIR%\%BUILD_ARCH%\Scripts;%PATH%" + +pushd target +call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\%BUILD_BASE%_build --install-base .\%BUILD_BASE% --packages-ignore tf2_bullet tf2_py examples_tf2_py rmw_fastrtps_dynamic_cpp rcl_logging_log4cxx rcl_logging_spdlog ros2trace tracetools_launch tracetools_read tracetools_test tracetools_trace rcldotnet_examples --cmake-args -A %BUILD_ARCH% -DCSHARP_PLATFORM=%BUILD_ARCH% -DDOTNET_CORE_ARCH=%BUILD_ARCH% -DCMAKE_SYSTEM_NAME=%BUILD_SYSTEM% -DCMAKE_SYSTEM_VERSION=10.0 -DTHIRDPARTY=ON -DINSTALL_EXAMPLES=OFF -DBUILD_TESTING=OFF -DSHM_TRANSPORT_DEFAULT=OFF -DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -DCMAKE_CXX_FLAGS=" /EHsc /DOPENSSL_NO_DEPRECATED /DOPENSSL_NO_DEPRECATED_3_0" +if "%ERRORLEVEL%" NEQ "0" goto :build_fail +goto :build_succeeded + +:build_fail + echo "build has failed" +popd +goto :eof + +:USAGE + echo "build [/x64|/x86|/arm64|/arm] [/clean]" + goto :eof + +:build_succeeded +popd \ No newline at end of file diff --git a/build_tools.cmd b/build_tools.cmd new file mode 100644 index 0000000..46ef6ce --- /dev/null +++ b/build_tools.cmd @@ -0,0 +1,6 @@ +: @echo off +pushd tools +call ..\build /x64 +call ..\build /arm64 +call ..\build /unity +popd \ No newline at end of file diff --git a/inittools.cmd b/inittools.cmd deleted file mode 100644 index 3c0bbf3..0000000 --- a/inittools.cmd +++ /dev/null @@ -1,138 +0,0 @@ -: @echo off -setlocal enableextensions disabledelayedexpansion - -if "%VSINSTALLDIR%" == "" ( - if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( - set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\" - ) - if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" ( - set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\" - ) -) -echo "VSInstallDir is %VSINSTALLDIR%" -call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" - -set clean=false -set DEBUG_CMD= - -:: Parse options -:GETOPTS - if /I "%~1" == "/?" goto USAGE - if /I "%~1" == "/Help" goto USAGE - if /I "%~1" == "/x86" set BUILD=x86 - if /I "%~1" == "/x64" set BUILD=x64 - if /I "%~1" == "/arm64" set BUILD=arm64 - if /I "%~1" == "/arm" set BUILD=arm - if /I "%~1" == "/unity" set BUILD=unity - if /I "%~1" == "/clean" set clean=true - shift -if not (%1)==() goto GETOPTS - -: Call to build the isolated ROS2 build system -set ChocolateyInstall=c:\opt\chocolatey - -set CMAKE_PREFIX_PATH_ORIG=%CMAKE_PREFIX_PATH% -set PATH=c:\opt\chocolatey\bin;C:\opt\python37amd64\;C:\opt\python37amd64\Scripts;C:\opt\python37amd64\DLLs;%PATH% -set PATH_ORIG=%PATH% -set VCPKG_ROOT=c:\opt\vcpkg -set PYTHONHOME=C:\opt\python37amd64\ - -if "%BUILD%"=="x86" goto :build_x86 -if "%BUILD%"=="x64" goto :build_x64 -if "%BUILD%"=="unity" goto :build_unity -if "%BUILD%"=="arm" goto :build_arm -if "%BUILD%"=="arm64" goto :build_arm64 - -:build_unity -pushd tools -setlocal -set ROS2_ARCH=x64 -if "%clean%"=="true" ( - if exist unity_build rd /s /q build - if exist unity rd /s /q unity -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\unity_build --install-base .\unity --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev - -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="unity" goto :eof - -:build_x64 -pushd tools -setlocal -set ROS2_ARCH=x64 -if "%clean%"=="true" ( - if exist x64_build rd /s /q x64_build - if exist x64 rd /s /q x64 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x64_build --install-base .\x64 --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x64 -DDOTNET_CORE_ARCH=x64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev - -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -popd -if "%BUILD%"=="x64" goto :eof - - -:build_arm64 -pushd tools -setlocal -set ROS2_ARCH=arm64 -if "%clean%"=="true" ( - if exist arm64_build rd /s /q arm64_build - if exist arm64 rd /s /q arm64 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm64_build --install-base .\arm64 --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm64 -DDOTNET_CORE_ARCH=arm64 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev - -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="arm64" goto :eof - -:build_arm -pushd tools -setlocal -set ROS2_ARCH=arm -if "%clean%"=="true" ( - if exist arm_build rd /s /q arm_build - if exist arm rd /s /q arm -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\arm_build --install-base .\arm --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=arm -DDOTNET_CORE_ARCH=arm -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev - -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="arm" goto :eof - -: build x86 -:build_x86 -pushd tools -setlocal -: x86 is called Win32 in cmakelandia -set ROS2_ARCH=Win32 - -if "%clean%"=="true" ( - if exist x86_build rd /s /q x86_build - if exist x86 rd /s /q x86 -) - -call colcon build --event-handlers console_cohesion+ --merge-install --build-base .\x86_build --install-base .\x86 --cmake-args -A %ROS2_ARCH% -DCSHARP_PLATFORM=x86 -DDOTNET_CORE_ARCH=x86 -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 --no-warn-unused-cli -DCMAKE_BUILD_TYPE=RelWithDebInfo -Wno-dev -if "%ERRORLEVEL%" NEQ "0" goto :build_fail -endlocal -popd -if "%BUILD%"=="x86" goto :eof - -goto :eof - -:build_fail -endlocal -popd -goto :eof - -:USAGE - echo "build [/x86 | /arm64 | /unity | /arm]" - goto :eof - diff --git a/inittree.cmd b/inittree.cmd index 9b0ee7d..712a499 100644 --- a/inittree.cmd +++ b/inittree.cmd @@ -1,8 +1,6 @@ : @echo off setlocal enableextensions disabledelayedexpansion -if NOT EXIST "c:\opt\vcpkg\vcpkg.exe" goto :novcpkg - if "%VSINSTALLDIR%" == "" ( if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community" ( set "VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\" @@ -17,32 +15,56 @@ call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvars64.bat" set VisualStudioVersion=16.0 : Call to initialize the isolated ROS2 build system -mkdir c:\opt\chocolatey -set PYTHONHOME=C:\opt\python37amd64\ -set ChocolateyInstall=c:\opt\chocolatey -set PATH=c:\opt\chocolatey\bin;C:\opt\python37amd64\;C:\opt\python37amd64\Scripts;C:\opt\python37amd64\DLLs;%PATH% -choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1 -choco upgrade ros-colcon-tools -y --execution-timeout=0 --pre +mkdir c:\opt\mrtk_chocolatey +set PYTHONHOME=C:\opt\mrtk_python +set ChocolateyInstall=c:\opt\mrtk_chocolatey +set PATH=c:\opt\mrtk_vcpkg;c:\opt\chocolatey\bin;C:\opt\mrtk_python;C:\opt\mrtk_python\Scripts;%PATH% +set VCPKG_ROOT=c:\opt\mrtk_vcpkg -: choco upgrade ros_vcpkg -y --execution-timeout=0 --pre -: include staged vcpkgs +choco install python3 --params "/InstallDir:C:\opt\mrtk_python" --version=3.8.5 -y +: choco source add -n=ros-win -s="https://aka.ms/ros/public" --priority=1 -y -set VCPKG_ROOT=c:\opt\vcpkg call pip install vcstool call pip install lark-parser +call pip install colcon-common-extensions + +if exist "%VCPKG_ROOT%" goto :build_tools +mkdir c:\opt\ +pushd c:\opt\ +git clone https://github.com/ooeygui/vcpkg c:\opt\mrtk_vcpkg +cd c:\opt\mrtk_vcpkg +call bootstrap-vcpkg.bat +popd + +:build_tools +vcpkg install openssl:arm64-uwp +vcpkg install foonathan-memory:x64-windows +vcpkg install foonathan-memory[core]:arm64-uwp +vcpkg install foonathan-memory[core]:x64-uwp + +vcpkg install eigen3:x64-windows +vcpkg install eigen3:arm64-uwp +vcpkg install eigen3:x64-uwp + +vcpkg install openssl:x64-windows +vcpkg install openssl:arm64-uwp +vcpkg install openssl:x64-uwp + +vcpkg install asio:x64-windows +vcpkg install asio:arm64-uwp +vcpkg install asio:x64-uwp -dir C:\opt\python37amd64\Scripts\ mkdir tools\src mkdir target\src pushd tools -C:\opt\python37amd64\Scripts\vcs.exe import src < ..\build_tools.repos +%PYTHONHOME%\Scripts\vcs.exe import src < ..\build_tools.repos popd pushd target -C:\opt\python37amd64\Scripts\vcs.exe import src < ..\ros2_uwp.repos +%PYTHONHOME%\Scripts\vcs.exe import src < ..\ros2_uwp.repos xcopy /y src\ros2\orocos_kinematics_dynamics\orocos_kdl\config\FindEigen3.cmake src\ros2\eigen3_cmake_module\cmake\Modules popd @@ -53,7 +75,5 @@ popd goto :eof :novcpkg -echo "VCPkg not found at c:\opt\vcpkg\vcpkg.exe" +echo "VCPkg not found at %VCPKG_ROOT%\vcpkg.exe" dir c:\opt - -exit /1 diff --git a/initvcpkg.cmd b/initvcpkg.cmd deleted file mode 100644 index 3a0576e..0000000 --- a/initvcpkg.cmd +++ /dev/null @@ -1,78 +0,0 @@ -@echo off -setlocal enableextensions disabledelayedexpansion - -:: Parse options -:GETOPTS - if /I "%~1" == "/?" goto USAGE - if /I "%~1" == "/Help" goto USAGE - if /I "%~1" == "/x86" set BUILD=x86 - if /I "%~1" == "/arm64" set BUILD=arm64 - if /I "%~1" == "/arm" set BUILD=arm - if /I "%~1" == "/x64" set BUILD=x64 - if /I "%~1" == "/unity" set BUILD=unity - shift -if not (%1)==() goto GETOPTS - -set PATH_ORIG=%PATH% -set PATH=c:\opt\vcpkg;c:\opt\chocolatey\bin;C:\opt\python37amd64\;C:\opt\python37amd64\Scripts;C:\opt\python37amd64\DLLs;%PATH% -set VCPKG_ROOT=c:\opt\vcpkg - -if exist "%VCPKG_ROOT%" goto :build_tools -mkdir c:\opt -pushd c:\opt -git clone https://github.com/ooeygui/vcpkg -call bootstrap-vcpkg.bat -popd - -:build_tools -: Build tooling -vcpkg install protobuf:x86-windows -vcpkg install foonathan-memory:x64-windows - -if "%BUILD%"=="x86" goto :build_x86 -if "%BUILD%"=="x64" goto :build_x64 -if "%BUILD%"=="arm64" goto :build_arm64 -if "%BUILD%"=="arm" goto :build_arm -if "%BUILD%"=="unity" goto :build_unity - -:build_x86 -vcpkg install protobuf:x86-uwp -: vcpkg install asio:x86-uwp -vcpkg install eigen3:x86-uwp -vcpkg install foonathan-memory:x86-uwp -vcpkg install poco:x86-uwp -if "%BUILD%"=="x86" goto :eof - -:build_arm64 -vcpkg install protobuf:arm64-uwp -: vcpkg install asio:arm64-uwp -vcpkg install tinyxml2:arm64-uwp -vcpkg install eigen3:arm64-uwp -vcpkg install foonathan-memory[core]:arm64-uwp -vcpkg install poco:arm64-uwp -if "%BUILD%"=="arm64" goto :eof - -:build_arm -vcpkg install protobuf:arm-uwp -: vcpkg install asio:arm-uwp -vcpkg install tinyxml2:arm-uwp -vcpkg install eigen3:arm-uwp -vcpkg install foonathan-memory[core]:arm-uwp -vcpkg install poco:arm-uwp -if "%BUILD%"=="arm" goto :eof - -:build_x64 -vcpkg install protobuf:x64-uwp -: vcpkg install asio:x64-uwp -vcpkg install eigen3:x64-uwp -vcpkg install foonathan-memory[core]:x64-uwp -vcpkg install poco:x64-uwp -if "%BUILD%"=="x64" goto :eof - -:build_unity -vcpkg install protobuf:x64-windows -: vcpkg install asio:x64-windows -vcpkg install eigen3:x64-windows -vcpkg install foonathan-memory:x64-windows -vcpkg install poco:x64-windows -if "%BUILD%"=="unity" goto :eof diff --git a/ros2_uwp.repos b/ros2_uwp.repos index 9227957..5890a20 100644 --- a/ros2_uwp.repos +++ b/ros2_uwp.repos @@ -99,10 +99,6 @@ repositories: type: git url: https://github.com/ros2/rclcpp.git version: foxy - ros2/poco_vendor: - type: git - url: https://github.com/ms-iot/poco_vendor.git - version: master ros2/spdlog_vendor: type: git url: https://github.com/ros2/spdlog_vendor.git diff --git a/upm/build_upm.ps1 b/upm/build_upm.ps1 index 55db744..bafd078 100644 --- a/upm/build_upm.ps1 +++ b/upm/build_upm.ps1 @@ -106,56 +106,32 @@ function populateArchAndPlat } } +function generate_link +{ + $currentDir = Get-Location + $linkXml = Join-Path -Path $currentDir -ChildPath "com.microsoft.ros_mrtk_native\link.xml" + + Get-ChildItem -Path $linkXml | Remove-Item + Add-Content $linkXml "" + $filespec = Join-Path -Path $currentDir -ChildPath "com.microsoft.ros_mrtk_native\Plugins\Windows-x64\*_assemblies.dll" + $files = Get-Item $filespec -Filter $extSpec + foreach ($file in $files) + { + $filename = [System.IO.Path]::GetFileNameWithoutExtension($file) + + Add-Content $linkXml " " + } + Add-Content $linkXml "" +} + function populate { populateArchAndPlat -arch "x64" -platform "Windows" -sourceArch "Unity" -templateName 'x86_64_meta.txt' #populateArchAndPlat -arch "x64" -platform "uwp" -sourceArch "x64" -templateName 'wsa_x64_meta.txt' #populateArchAndPlat -arch "x86" -platform "uwp" -sourceArch "x86" -templateName 'wsa_x86_meta.txt' populateArchAndPlat -arch "arm64" -platform "uwp" -sourceArch "arm64" -templateName 'wsa_arm64_meta.txt' -} -function GenerateUnityMeta -{ - - param - ( - $templateName, - $folder - ) - - $template = Get-Content $templateName -Raw - - $files = Get-ChildItem -Filter "*.dll" -Recurse $folder - - foreach ($file in $files) - { - $ext = [IO.Path]::GetExtension($file) - if ($ext -notmatch ".meta") - { - $guidRaw = New-Guid - $guid = $guidRaw.ToString().Replace("-", "") - $newMetafilename = $file.FullName + ".meta" - - Write-Host "Generating $newMetafilename" - - $newMetafile = $template.Replace("@@newGuid@@", $guid) - Set-Content $newMetafilename $newMetafile - } - } } populate - -<# -GenerateUnityMeta -templateName 'wsa_arm64_meta.txt' -folder "..\target\arm64" -GenerateUnityMeta -templateName 'wsa_x64_meta.txt' -folder "..\target\x64" -GenerateUnityMeta -templateName 'x86_64_meta.txt' -folder "..\target\x86" - -GenerateUnityMeta -templateName 'wsa_arm64_meta.txt' -folder "C:\opt\vcpkg\installed\arm64-uwp\bin" -GenerateUnityMeta -templateName 'wsa_x64_meta.txt' -folder "C:\opt\vcpkg\installed\x64-uwp\bin" -GenerateUnityMeta -templateName 'x86_64_meta.txt' -folder "C:\opt\vcpkg\installed\x86-windows\bin" - -GenerateUnityMeta -templateName 'wsa_arm64_meta.txt' -folder "C:\opt\vcpkg\buildtrees\apriltag\arm64-uwp-rel\Release" -GenerateUnityMeta -templateName 'wsa_x64_meta.txt' -folder "C:\opt\vcpkg\buildtrees\apriltag\x64-uwp-rel\Release" -GenerateUnityMeta -templateName 'x86_64_meta.txt' -folder "C:\opt\vcpkg\buildtrees\apriltag\x86-windows-rel\Release" -#> \ No newline at end of file +generate_link