Skip to content

Commit

Permalink
Add BUILD_DEBIAN_PACKAGE option for Debian package support
Browse files Browse the repository at this point in the history
Introduced the `BUILD_DEBIAN_PACKAGE` CMake option to enable building a Debian package for the library.
When this option is enabled and the host system supports Debian, the library will be packaged accordingly.

Usage:
To enable debian package building:
`cmake -DBUILD_DEBIAN_PACKAGE=ON <other_config_options> ..

To build debian package:
`make package`
or
`cpack`

Signed-off-by: Meet Gandhi <meet.gandhi@einfochips.com>
  • Loading branch information
Meet Gandhi committed Sep 23, 2024
1 parent f4e1fa9 commit 61a1699
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ if (NOT DEVELOPER_BUILD)
endif()
endif()

option(BUILD_DEBIAN_PACKAGE "Build debian package" OFF)
# will work with cmake 3.22 and newer
# https://cmake.org/cmake/help/latest/command/cmake_host_system_information.html
if (BUILD_DEBIAN_PACKAGE)
cmake_host_system_information(RESULT ID_LIKE QUERY DISTRIB_ID_LIKE)
message(STATUS "Current Distrib ID_LIKE=${ID_LIKE}")
if(NOT ID_LIKE OR NOT ID_LIKE STREQUAL "debian")
message(WARNING "ID_LIKE is either blank or not 'debian'. Skipping debian package building.")
set(BUILD_DEBIAN_PACKAGE OFF)
endif()
endif()

# Default build type on single-config generators.
# For multi-config generators (e.g. Visual Studio), CMAKE_CONFIGURATION_TYPES
# will be set, and we don't specify a default CMAKE_BUILD_TYPE.
Expand Down
8 changes: 7 additions & 1 deletion cmake/Open3DPackaging.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# This is packaging for the Open3D library. See
# cpp/apps/Open3DViewer/Debian/CMakeLists.txt for packaging the Debian Open3D
# viewer
set(CPACK_GENERATOR TXZ)
if (BUILD_DEBIAN_PACKAGE)
set(CPACK_GENERATOR DEB)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS YES)
else()
set(CPACK_GENERATOR TXZ)
endif()
if(WIN32)
set(CPACK_GENERATOR ZIP)
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/Open3DPrintConfigurationSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function(open3d_print_configuration_summary)
else()
open3d_aligned_print("Force GLIBCXX_USE_CXX11_ABI=" "0")
endif()
open3d_aligned_print("Build debian package" "${BUILD_DEBIAN_PACKAGE}")

message(STATUS "================================================================================")
message(STATUS "Third-Party Dependencies:")
Expand Down

0 comments on commit 61a1699

Please sign in to comment.