Skip to content

Commit

Permalink
Merge branch 'single-library' into 'main'
Browse files Browse the repository at this point in the history
Create a single libifm3d instead of multiple sublibraries

See merge request syntron/support/csr/ifm3d/ifm3d!380
  • Loading branch information
BigBoot committed Jun 6, 2024
2 parents c27df49 + 1419faa commit 8120568
Show file tree
Hide file tree
Showing 74 changed files with 684 additions and 2,154 deletions.
4 changes: 2 additions & 2 deletions .gitlab/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ build:linux:deb:
--no-push
${KANIKO_BUILD_ARGS}
${DOCKER_BUILD_ARGS}
- cp /out/*.tar ${CI_PROJECT_DIR}/
- cp /out/*.deb ${CI_PROJECT_DIR}/
artifacts:
paths:
- ifm3d-*.tar
- ifm3d-*.deb
expire_in: 1 week
rules:
- !reference [.tagged, rules]
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ release:github:
done
- gh --version
- gh release create $tag_value -R https://github.com/ifm/ifm3d.git --prerelease -F CHANGELOG --title $tag_value --verify-tag
- gh release upload $tag_value -R https://github.com/ifm/ifm3d.git ifm3d-*.tar
- gh release upload $tag_value -R https://github.com/ifm/ifm3d.git ifm3d-*.deb
- gh release upload $tag_value -R https://github.com/ifm/ifm3d.git ifm3d_installer/ifm3d_windows_*.exe
93 changes: 18 additions & 75 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ set(ROOT_PROJECT_VERSION_GIT_SHA ${${ROOT_PROJECT_NAME}_VERSION_GIT_SHA})
set(ROOT_PROJECT_VERSION_FULL_IN_CASE_OF_PATCHES ${${ROOT_PROJECT_NAME}_VERSION_FULL_IN_CASE_OF_PATCHES})
set(ROOT_PROJECT_VERSION_META ${${ROOT_PROJECT_NAME}_VERSION_META})
set(ROOT_PROJECT_VERSION_SIMPLE "${ROOT_PROJECT_VERSION_MAJOR}.${ROOT_PROJECT_VERSION_MINOR}.${ROOT_PROJECT_VERSION_PATCH}")
set(ROOT_PROJECT_DIR ${CMAKE_CURRENT_LIST_DIR})
project(${ROOT_PROJECT_NAME} LANGUAGES C CXX VERSION ${ROOT_PROJECT_VERSION_SIMPLE})

set(GIT_PROJECT_NAME "ifm3d")
Expand All @@ -46,7 +47,6 @@ option(BUILD_MODULE_PYBIND11 "Build the python bindings module" OFF)
option(BUILD_SDK_PKG "Build install packages for development purposes" ON)
option(BUILD_SHARED_LIBS "Build modules as shared libraries" ON)
option(BUILD_DOC "Build documentation" OFF)
option(BUILD_IN_DEPS "download and build dependencies" ON)
option(CREATE_WIN_INSTALLER "Create windows installer" OFF)
option(CREATE_PYTHON_STUBS "Create the Python stubs" OFF)

Expand Down Expand Up @@ -74,22 +74,8 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)
if(WIN32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DBOOST_ALL_NO_LIB)
endif(WIN32)

# create the cmake-package files
if(BUILD_SDK_PKG)
include(CMakePackageConfigHelpers)

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/ifm3d-config-version.cmake
VERSION ${IFM3D_VERSION}
COMPATIBILITY AnyNewerVersion
)

set(CONFIG_PACKAGE_LOCATION ${_lib}/cmake/ifm3d-${IFM3D_VERSION})
endif()

################################################
## Start deferring work to the submodules
################################################
Expand Down Expand Up @@ -129,6 +115,10 @@ list(APPEND DOXYGEN_MODULES "common")
add_subdirectory(modules/device)
list(APPEND DOXYGEN_MODULES "device")

if (BUILD_SHARED_LIBS)
add_subdirectory(modules/libifm3d)
endif()

if(BUILD_MODULE_FRAMEGRABBER)
add_definitions(-DBUILD_MODULE_FRAMEGRABBER=ON)
add_subdirectory(modules/framegrabber)
Expand Down Expand Up @@ -160,23 +150,6 @@ endif()
if(BUILD_MODULE_TOOLS)
add_subdirectory(modules/tools)
endif()
################################################
## Sub-modules are done, finish up the cmake package
################################################
if(BUILD_SDK_PKG)
configure_package_config_file(
${CMAKE_CURRENT_LIST_DIR}/cmake/modules/ifm3d-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/ifm3d-config.cmake
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
)

install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/ifm3d-config-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/ifm3d-config.cmake
DESTINATION ${CONFIG_PACKAGE_LOCATION}
COMPONENT common
)
endif()

#################################################
# Documentation
Expand All @@ -189,46 +162,22 @@ endif()
# Packaging stuff - for now, we build debs only
#################################################
if(NOT WIN32)
file(COPY ${IFM3D_SOURCE_DIR}/cmake/utils/ifm3d-dpkg-deps.py.in
DESTINATION ${IFM3D_BINARY_DIR}
FILE_PERMISSIONS OWNER_READ
OWNER_WRITE
OWNER_EXECUTE
GROUP_READ
GROUP_EXECUTE
WORLD_READ
WORLD_EXECUTE
)
configure_file(
${IFM3D_BINARY_DIR}/ifm3d-dpkg-deps.py.in
${IFM3D_BINARY_DIR}/ifm3d-dpkg-deps.py
@ONLY
)

# Turn on component-based installation
set(CPACK_DEB_COMPONENT_INSTALL ON)
set(CPACK_GENERATOR "DEB")
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
list(REMOVE_ITEM CPACK_COMPONENTS_ALL "Unspecified")

# Package architecture
find_program(DPKG_CMD dpkg)
if(NOT CMAKE_CROSSCOMPILING)
if(NOT DPKG_CMD)
message(STATUS
"Cannot find dpkg in your path, default to ${CMAKE_SYSTEM_PROCESSOR}.")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
else()
execute_process(COMMAND "${DPKG_CMD}" --print-architecture
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(NOT DPKG_CMD)
execute_process(COMMAND uname -m
OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if (CPACK_DEBIAN_PACKAGE_ARCHITECTURE STREQUAL "x86_64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
elseif(CPACK_DEBIAN_PACKAGE_ARCHITECTURE STREQUAL "aarch64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
else()
# big assumption here
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf")
message(FATAL_ERROR "Unsupported architecture: ${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
endif()

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

set(CPACK_DEBIAN_PACKAGE_SECTION Libraries)
set(CPACK_DEBIAN_PACKAGE_NAME ${GIT_PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ sensor interface to ifm 3D cameras")
Expand All @@ -240,11 +189,5 @@ if(NOT WIN32)
set(CPACK_PACKAGE_FILE_NAME
"${GIT_PROJECT_NAME}_${IFM3D_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")

# dynamically create dependencies of the various modules
#set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) # <-- Good idea, doesn't work for us
add_custom_target(repackage
COMMAND ${IFM3D_BINARY_DIR}/ifm3d-dpkg-deps.py ${IFM3D_BINARY_DIR}/*.deb
)

include(CPack)
endif(NOT WIN32)
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Unification of shared libraries into `libifm3d`, see the migration guide for details

## 1.5.3 - 2024-04-05
### Fixed
Expand Down
27 changes: 2 additions & 25 deletions cmake/modules/ifm3d-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
# 'commons' component is required
if(NOT TARGET ifm3d::common)
include("${CMAKE_CURRENT_LIST_DIR}/ifm3d-common-targets.cmake")
endif()

if(NOT TARGET ifm3d::common)
set(ifm3d_FOUND False)
message(FATAL_ERROR
"ifm3d installation is broken, common targets not found!"
)
else()
message(STATUS "ifm3d found component: common")
foreach(_comp ${ifm3d_FIND_COMPONENTS})
if(NOT "${_comp}" MATCHES "common")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/ifm3d-${_comp}-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ifm3d-${_comp}-targets.cmake")
message(STATUS "ifm3d found component: ${_comp}")
else()
if(ifm3d_FIND_REQUIRED_${_comp})
set(ifm3d_FOUND False)
message(WARNING "ifm3d could not find component: ${_comp}")
endif()
endif()
endif()
endforeach()
if(NOT TARGET ifm3d::ifm3d)
include("${CMAKE_CURRENT_LIST_DIR}/ifm3d-targets.cmake")
endif()
Loading

0 comments on commit 8120568

Please sign in to comment.