Skip to content
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you picked 3.16 because of Ubuntu 20.04. Do we intend to support Focal past its EOL? More generally, do we have (or should we have) a policy for minimum version requirements for ROS-O?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, there is no minimum OS version because there are no fixed target distributions, but if we can avoid breakage without consequences it makes sense to keep compatibility.
There is also no single branch for "ROS-O" and while compatibility is important, there is no problem to change branches in the individual builders for target platforms.

The question then is whether any "obese-devel"/"ros1" etc branches should move forward with breaking changes or whether we simply add more branches ("occult-devel" suggests itself ;)).


set(catkin_EXTRAS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand Down
4 changes: 2 additions & 2 deletions cmake/all.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if(EXISTS ${_catkin_marker_file})
endif()
else()
# create a new develspace marker file
# NOTE: extra care must be taken when running multiple catkin jobs in parallel
# NOTE: extra care must be taken when running multiple catkin jobs in parallel
# so that this does not overwrite the result of a similar call in another package
file(WRITE ${_catkin_marker_file} "${CMAKE_SOURCE_DIR}")
endif()
Expand Down Expand Up @@ -120,7 +120,7 @@ endif()
include(CMakeParseArguments)

# functions/macros: list_append_unique, safe_execute_process
# python-integration: catkin_python_setup.cmake, interrogate_setup_dot_py.py, templates/__init__.py.in, templates/script.py.in, templates/python_distutils_install.bat.in, templates/python_distutils_install.sh.in, templates/safe_execute_install.cmake.in
# python-integration: catkin_python_setup.cmake, interrogate_setup_dot_py.py, templates/__init__.py.in, templates/script.py.in, templates/python_install.bat.in, templates/python_install.sh.in, templates/safe_execute_install.cmake.in
foreach(filename
assert
atomic_configure_file
Expand Down
9 changes: 5 additions & 4 deletions cmake/catkin_python_setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,20 @@ function(catkin_python_setup)
set(SETUPTOOLS_EGG_INFO "")
endif()

cmake_path(CONVERT "${CMAKE_BINARY_DIR}/setuptools_build" TO_NATIVE_PATH_LIST SETUPTOOLS_BUILD_DIR NORMALIZE)
set(INSTALL_CMD_WORKING_DIRECTORY ${${PROJECT_NAME}_SOURCE_DIR})
if(NOT WIN32)
set(INSTALL_SCRIPT
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_distutils_install.sh)
configure_file(${catkin_EXTRAS_DIR}/templates/python_distutils_install.sh.in
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_install.sh)
configure_file(${catkin_EXTRAS_DIR}/templates/python_install.sh.in
${INSTALL_SCRIPT}
@ONLY)
else()
# need to convert install prefix to native path for python setuptools --prefix (its fussy about \'s)
file(TO_NATIVE_PATH ${CMAKE_INSTALL_PREFIX} PYTHON_INSTALL_PREFIX)
set(INSTALL_SCRIPT
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_distutils_install.bat)
configure_file(${catkin_EXTRAS_DIR}/templates/python_distutils_install.bat.in
${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/python_install.bat)
configure_file(${catkin_EXTRAS_DIR}/templates/python_install.bat.in
${INSTALL_SCRIPT}
@ONLY)
endif()
Expand Down
17 changes: 11 additions & 6 deletions cmake/python.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# the CMake variable PYTHON_INSTALL_DIR has the same value as the Python function catkin.builder.get_python_install_dir()

set(PYTHON_VERSION "$ENV{ROS_PYTHON_VERSION}" CACHE STRING "Specify specific Python version to use ('major.minor' or 'major')")
find_package(PythonInterp ${PYTHON_VERSION} REQUIRED)
find_package(Python ${PYTHON_VERSION} COMPONENTS Interpreter REQUIRED)

message(STATUS "Using PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
# Set variables for compatibility with old find_package(PythonInterp)
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
set(PYTHON_VERSION_STRING ${Python_VERSION})
set(PYTHON_VERSION_MAJOR ${Python_VERSION_MAJOR})
set(PYTHON_VERSION_MINOR ${Python_VERSION_MINOR})
message(STATUS "Using Python_EXECUTABLE: ${Python_EXECUTABLE}")

set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
set(_PYTHON_PATH_VERSION_SUFFIX "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}")

set(enable_setuptools_deb_layout OFF)
if(EXISTS "/etc/debian_version")
Expand All @@ -16,10 +21,10 @@ option(SETUPTOOLS_DEB_LAYOUT "Enable debian style python package layout" ${enabl
if(SETUPTOOLS_DEB_LAYOUT)
message(STATUS "Using Debian Python package layout")
set(PYTHON_PACKAGES_DIR dist-packages)
set(SETUPTOOLS_ARG_EXTRA "--install-layout=deb")
set(PIP_EXTRA_ENV "DEB_PYTHON_INSTALL_LAYOUT=deb")
# use major version only when installing 3.x with debian layout
if("${PYTHON_VERSION_MAJOR}" STREQUAL "3")
set(_PYTHON_PATH_VERSION_SUFFIX "${PYTHON_VERSION_MAJOR}")
if("${Python_VERSION_MAJOR}" STREQUAL "3")
set(_PYTHON_PATH_VERSION_SUFFIX "${Python_VERSION_MAJOR}")
endif()
else()
message(STATUS "Using default Python package layout")
Expand Down
33 changes: 0 additions & 33 deletions cmake/templates/python_distutils_install.sh.in

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ if NOT EXIST "@SETUPTOOLS_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@\" (
)

set "PYTHONPATH=@SETUPTOOLS_INSTALL_PREFIX@\@PYTHON_INSTALL_DIR@;@CMAKE_BINARY_DIR@\@PYTHON_INSTALL_DIR@"
set "CATKIN_BINARY_DIR=@CMAKE_BINARY_DIR@"
for /f "usebackq tokens=*" %%a in ('@SETUPTOOLS_INSTALL_PREFIX@') do (
set _SETUPTOOLS_INSTALL_PATH=%%~pna
set _SETUPTOOLS_INSTALL_ROOT=%%~da
)

"@PYTHON_EXECUTABLE@" ^
"@CMAKE_CURRENT_SOURCE_DIR@\setup.py" ^
build --build-base "@CMAKE_CURRENT_BINARY_DIR@" ^
install %DESTDIR_ARG% @SETUPTOOLS_ARG_EXTRA@ ^
--prefix="%_SETUPTOOLS_INSTALL_PATH%" ^
--install-scripts="%_SETUPTOOLS_INSTALL_PATH%\@CATKIN_GLOBAL_BIN_DESTINATION@" ^
--root=%_SETUPTOOLS_INSTALL_ROOT%\
"@PYTHON_EXECUTABLE@" -m build --wheel --outdir "@SETUPTOOLS_BUILD_DIR@" --no-isolation ^
@SETUPTOOLS_OVERRIDE_BUILD_BASE@ ^
"@CMAKE_CURRENT_SOURCE_DIR@" &&

"@PYTHON_EXECUTABLE@" -m pip install --prefix "%_SETUPTOOLS_INSTALL_PATH%" --ignore-installed --no-deps ^
"@SETUPTOOLS_BUILD_DIR@"\*.whl
46 changes: 46 additions & 0 deletions cmake/templates/python_install.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/sh

if [ -n "$DESTDIR" ] ; then
case $DESTDIR in
/*) # ok
;;
*)
/bin/echo "DESTDIR argument must be absolute... "
/bin/echo "otherwise python's distutils will bork things."
exit 1
esac
fi

echo_and_run() { echo "+ $@" ; "$@" ; }

echo_and_run cd "@INSTALL_CMD_WORKING_DIRECTORY@"

# ensure that Python install destination exists
echo_and_run mkdir -p "$DESTDIR@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@"

# Note that PYTHONPATH is pulled from the environment to support installing
# into one location when some dependencies were installed in another
# location, #123.
echo_and_run /usr/bin/env \
@PIP_EXTRA_ENV@ \
PYTHONPATH="@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@:@CMAKE_BINARY_DIR@/@PYTHON_INSTALL_DIR@:$PYTHONPATH" \
"@PYTHON_EXECUTABLE@" -m build \
--wheel \
--outdir @SETUPTOOLS_BUILD_DIR@ \
--no-isolation \
--config-setting=--build-option=build --config-setting=--build-option=--build-base=@SETUPTOOLS_BUILD_DIR@ \
"@CMAKE_CURRENT_SOURCE_DIR@" &&

# Remove temporary *.egg-info directories created by setuptools during build
echo_and_run find -L "@CMAKE_CURRENT_SOURCE_DIR@" -name "*.egg-info" -print -exec rm -r {} + &&

echo_and_run /usr/bin/env \
@PIP_EXTRA_ENV@ \
PIP_BREAK_SYSTEM_PACKAGES=1 \
PYTHONPATH="@CMAKE_INSTALL_PREFIX@/@PYTHON_INSTALL_DIR@:@CMAKE_BINARY_DIR@/@PYTHON_INSTALL_DIR@:$PYTHONPATH" \
"@PYTHON_EXECUTABLE@" -m pip install \
--prefix "@CMAKE_INSTALL_PREFIX@" \
${DESTDIR:+--root "$DESTDIR"} \
--ignore-installed \
--no-deps \
"@SETUPTOOLS_BUILD_DIR@"/*.whl
2 changes: 1 addition & 1 deletion cmake/toplevel.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)

project(Project)

Expand Down
2 changes: 1 addition & 1 deletion doc/adv_user_guide/catkin_migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The contents of the /stick/stick/package.xml must look like this::

The contents of the /stick/stick/CMakeLists.txt looks like this::

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)
project(stick)
find_package(catkin REQUIRED)
catkin_metapackage()
Expand Down
2 changes: 1 addition & 1 deletion doc/howto/format1/catkin_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CMakeLists.txt
Catkin ``CMakeLists.txt`` files mostly contain ordinary CMake
commands, plus a few catkin-specific ones. They begin like this::

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)
project(your_package)

Substitute the actual name of your package in the ``project()``
Expand Down
2 changes: 1 addition & 1 deletion doc/howto/format2/catkin_overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ CMakeLists.txt
Catkin ``CMakeLists.txt`` files mostly contain ordinary CMake
commands, plus a few catkin-specific ones. They begin like this::

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)
project(your_package)

Substitute the actual name of your package in the ``project()``
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For inspiration, look at the guideline examples here:

The following lines must always appear the CMakeLists.txt in this order::

cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)
project(myproject)
find_package(catkin REQUIRED <COMPONENTS ...>)
catkin_package(<...>)
Expand Down
6 changes: 6 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@
<buildtool_depend>cmake</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 2">python-setuptools</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 2">python-pip</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-pip</buildtool_depend>
<buildtool_depend condition="$ROS_PYTHON_VERSION == 3">python3-build</buildtool_depend>

<buildtool_export_depend>cmake</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-setuptools</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 2">python-pip</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-pip</buildtool_export_depend>
<buildtool_export_depend condition="$ROS_PYTHON_VERSION == 3">python3-build</buildtool_export_depend>

<build_export_depend>google-mock</build_export_depend>
<build_export_depend>gtest</build_export_depend>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)

project(badly_specified_changelog)
find_package(catkin)
Expand Down
3 changes: 1 addition & 2 deletions test/mock_resources/src-fail/noproject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.0.2)
cmake_minimum_required(VERSION 3.16)
# commented to cause failure
# project(noproject)
find_package(catkin)

catkin_package()