Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions vinca/templates/bld_ament_cmake.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ pushd build

:: try to fix long paths issues by using default generator
set "CMAKE_GENERATOR=Visual Studio %VS_MAJOR% %VS_YEAR%"
set "SP_DIR_FORWARDSLASHES=%SP_DIR:\=/%"

:: PYTHON_INSTALL_DIR should be a relative path, see
:: https://github.com/ament/ament_cmake/blob/2.3.2/ament_cmake_python/README.md
:: So we compute the relative path of %SP_DIR% w.r.t. to LIBRARY_PREFIX,
:: but it is not trivial to do this in Command Prompt scripting, so let's do it via
:: python

:: This line is scary, but it basically assigns the output of the command inside (` and `)
:: to the variable specified after DO SET
:: The equivalent in bash is PYTHON_INSTALL_DIR=`python -c ...`
FOR /F "tokens=* USEBACKQ" %%i IN (`python -c "import os;print(os.path.relpath(os.environ['SP_DIR'],os.environ['LIBRARY_PREFIX']))"`) DO SET PYTHON_INSTALL_DIR=%%i

cmake ^
-G "%CMAKE_GENERATOR%" ^
Expand All @@ -30,7 +40,7 @@ cmake ^
-DBUILD_SHARED_LIBS=ON ^
-DBUILD_TESTING=OFF ^
-DCMAKE_OBJECT_PATH_MAX=255 ^
-DPYTHON_INSTALL_DIR=%SP_DIR_FORWARDSLASHES% ^
-DPYTHON_INSTALL_DIR=%PYTHON_INSTALL_DIR% ^
--compile-no-warning-as-error ^
%SRC_DIR%\%PKG_NAME%\src\work
if errorlevel 1 exit 1
Expand Down
13 changes: 11 additions & 2 deletions vinca/templates/bld_colcon_merge.bat.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ setlocal
set CC=cl.exe
set CXX=cl.exe

set "SP_DIR_FORWARDSLASHES=%SP_DIR:\=/%"
:: PYTHON_INSTALL_DIR should be a relative path, see
:: https://github.com/ament/ament_cmake/blob/2.3.2/ament_cmake_python/README.md
:: So we compute the relative path of %SP_DIR% w.r.t. to LIBRARY_PREFIX,
:: but it is not trivial to do this in Command Prompt scripting, so let's do it via
:: python

:: This line is scary, but it basically assigns the output of the command inside (` and `)
:: to the variable specified after DO SET
:: The equivalent in bash is PYTHON_INSTALL_DIR=`python -c ...`
FOR /F "tokens=* USEBACKQ" %%i IN (`python -c "import os;print(os.path.relpath(os.environ['SP_DIR'],os.environ['LIBRARY_PREFIX']))"`) DO SET PYTHON_INSTALL_DIR=%%i

colcon build ^
--event-handlers console_cohesion+ ^
Expand All @@ -17,7 +26,7 @@ colcon build ^
-G Ninja ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_TESTING=OFF ^
-DPYTHON_INSTALL_DIR=%SP_DIR_FORWARDSLASHES% ^
-DPYTHON_INSTALL_DIR=%PYTHON_INSTALL_DIR% ^
-DPYTHON_EXECUTABLE=%PYTHON%
if errorlevel 1 exit 1

Expand Down
8 changes: 7 additions & 1 deletion vinca/templates/build_ament_cmake.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ if [[ $target_platform =~ linux.* ]]; then
ln -s $GXX ${BUILD_PREFIX}/bin/g++
fi;

# PYTHON_INSTALL_DIR should be a relative path, see
# https://github.com/ament/ament_cmake/blob/2.3.2/ament_cmake_python/README.md
# So we compute the relative path of $SP_DIR w.r.t. to $PREFIX,
# but it is not trivial to do this in bash scripting, so let's do it via python
export PYTHON_INSTALL_DIR=`python -c "import os;print(os.path.relpath(os.environ['FIXED_SP_DIR'],os.environ['PREFIX']))"`

cmake \
-G "Ninja" \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
Expand All @@ -58,7 +64,7 @@ cmake \
-DPython3_EXECUTABLE=$PYTHON_EXECUTABLE \
-DPython3_FIND_STRATEGY=LOCATION \
-DPKG_CONFIG_EXECUTABLE=$PKG_CONFIG_EXECUTABLE \
-DPYTHON_INSTALL_DIR=$FIXED_SP_DIR \
-DPYTHON_INSTALL_DIR=$PYTHON_INSTALL_DIR \
-DSETUPTOOLS_DEB_LAYOUT=OFF \
-DCATKIN_SKIP_TESTING=$SKIP_TESTING \
-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=True \
Expand Down