Skip to content

Commit bf700d1

Browse files
committed
add BUILD_ONLY_PYTHON_INTERFACE option
1 parent 2ede15d commit bf700d1

File tree

5 files changed

+13
-4
lines changed

5 files changed

+13
-4
lines changed

base.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
# .. variable:: PROJECT_USE_CMAKE_EXPORT
9191
#
9292
# This tells jrl-cmakemodules that you are using export functionalities so it
93-
# will hook the installation of your configuration files. Defaults to false
93+
# will hook the installation of your configuration files. Defaults to true
9494
#
9595
# .. variable:: PROJECT_EXPORT_NO_TARGET
9696
#

header.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ endfunction(GENERATE_CONFIGURATION_HEADER_V2)
272272
#
273273
macro(_SETUP_PROJECT_HEADER_FINALIZE)
274274
# If the header list is set, install it.
275-
if(DEFINED ${PROJECT_NAME}_HEADERS)
275+
if(DEFINED ${PROJECT_NAME}_HEADERS AND NOT BUILD_ONLY_PYTHON_INTERFACE)
276276
HEADER_INSTALL(${${PROJECT_NAME}_HEADERS})
277277
endif(DEFINED ${PROJECT_NAME}_HEADERS)
278278
endmacro(_SETUP_PROJECT_HEADER_FINALIZE)

post-project.cmake

+6-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,12 @@ cmake_dependent_option(
4747
BUILD_DOCUMENTATION
4848
OFF
4949
)
50-
option(INSTALL_GENERATED_HEADERS "Generate and install standard headers" ON)
51-
option(INSTALL_PKG_CONFIG_FILE "Generate and install standard .pc file" ON)
50+
51+
option(BUILD_PYTHON_INTERFACE "Build the python bindings" ON)
52+
cmake_dependent_option(BUILD_ONLY_PYTHON_INTERFACE "Build only the python bindings" OFF BUILD_PYTHON_INTERFACE OFF)
53+
cmake_dependent_option(INSTALL_GENERATED_HEADERS "Generate and install standard headers" ON "NOT BUILD_ONLY_PYTHON_INTERFACE" OFF)
54+
cmake_dependent_option(INSTALL_PKG_CONFIG_FILE "Generate and install standard .pc file" ON "NOT BUILD_ONLY_PYTHON_INTERFACE" OFF)
55+
cmake_dependent_option(PROJECT_USE_CMAKE_EXPORT "Generate and install CMake exports" ON "NOT BUILD_ONLY_PYTHON_INTERFACE" OFF)
5256

5357
include(CTest)
5458
enable_testing()

python.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# You should have received a copy of the GNU General Public License along with
1414
# this program. If not, see <http://www.gnu.org/licenses/>.
1515

16+
1617
# .rst: .. command:: FINDPYTHON
1718
#
1819
# Find python interpreter and python libs. Arguments are passed to the

ros2.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ macro(_install_project_ros2_ament_files)
2222
if(BUILDING_ROS2_PACKAGE)
2323
message(STATUS "Create files for AMENT (ROS 2)")
2424
# Allows Colcon to find non-Ament packages when using workspace underlays
25+
if(NOT BUILD_ONLY_PYTHON_INTERFACE)
2526
file(
2627
WRITE
2728
${CMAKE_CURRENT_BINARY_DIR}/share/ament_index/resource_index/packages/${PROJECT_NAME}
@@ -42,6 +43,8 @@ macro(_install_project_ros2_ament_files)
4243
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/ament_prefix_path.dsv
4344
DESTINATION share/${PROJECT_NAME}/hook
4445
)
46+
endif()
47+
if(BUILD_PYTHON_INTERFACE)
4548
file(
4649
WRITE
4750
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
@@ -52,5 +55,6 @@ macro(_install_project_ros2_ament_files)
5255
${CMAKE_CURRENT_BINARY_DIR}/share/${PROJECT_NAME}/hook/python_path.dsv
5356
DESTINATION share/${PROJECT_NAME}/hook
5457
)
58+
endif()
5559
endif(BUILDING_ROS2_PACKAGE)
5660
endmacro(_install_project_ros2_ament_files)

0 commit comments

Comments
 (0)