Skip to content

Commit

Permalink
[libcaer] New port for libcaer (#25110)
Browse files Browse the repository at this point in the history
* Adding libcaer port file

* Formatting libcaer config

* Adding version info

* Git tree update for libcaer

* Updating static builds and osx / linux platforms

* Version update

* Removing deprecated methods and fixing linux build

* libcaer version update

* Fix macos build

* Version update

* Macos test

* Version update

* Update patch file

* Version update

* Version update

* Fixing comments

* Formatting

* Versioning update

* Adding pkgconfig fixup

* Version update

Co-authored-by: Rokas Jurevicius <[email protected]>
  • Loading branch information
jureviciusr and Rokas Jurevicius authored Jun 15, 2022
1 parent 3d054a1 commit a00906c
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 0 deletions.
55 changes: 55 additions & 0 deletions ports/libcaer/libcaer-static-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3b1937a..a75db2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,8 @@ OPTION(ENABLE_SERIALDEV "Enable support for serial port devices using libserialp
OPTION(ENABLE_OPENCV "Enable support for frame enhancements using OpenCV" OFF)
OPTION(UDEV_INSTALL "Install udev rules on Linux" ON)
OPTION(EXAMPLES_INSTALL "Build and install examples" OFF)
+OPTION(ENABLE_BINDIR_INSTALLATION "Split archive and binary installation targets [required for vcpkg installation]" OFF)
+OPTION(BUILD_SHARED_LIBS "Build libcaer as a shared library" ON)

# Cross-compile support
IF(NOT USER_LOCAL_PREFIX)
@@ -98,7 +100,7 @@ INCLUDE(CMakePackageConfigHelpers)
WRITE_BASIC_CONFIG_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion)
SET(include_dirs ${CMAKE_INSTALL_INCLUDEDIR})
-IF(CC_MSVC)
+IF(ENABLE_BINDIR_INSTALLATION)
SET(export_destination ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
ELSE()
SET(export_destination ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 377a556..d9c29d7 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -19,6 +19,10 @@ IF(NOT CC_MSVC)
SET(LIBCAER_COMPILE_OPTIONS "-Wno-unused-function")
ENDIF()

+IF(OS_MACOS)
+ LIST(APPEND LIBCAER_COMPILE_OPTIONS "-Wno-implicit-function-declaration")
+ENDIF()
+
SET(LIBCAER_LINK_LIBRARIES_PRIVATE ${BASE_LIBS})

IF(OS_LINUX)
@@ -63,7 +67,7 @@ ENDIF()
# Set full RPATH
SET(CMAKE_INSTALL_RPATH ${USER_LOCAL_PREFIX}/${CMAKE_INSTALL_LIBDIR})

-ADD_LIBRARY(caer SHARED ${LIBCAER_SOURCES})
+ADD_LIBRARY(caer ${LIBCAER_SOURCES})
IF(CC_MSVC)
# This flag needs to be propagated down to depending targets to avoid compilation errors
TARGET_COMPILE_OPTIONS(caer INTERFACE -DWIN32_LEAN_AND_MEAN=ON)
@@ -94,7 +98,7 @@ IF(ENABLE_STATIC)

SET_TARGET_PROPERTIES(caerStatic PROPERTIES OUTPUT_NAME caer)

- IF(OS_WINDOWS)
+ IF(ENABLE_BINDIR_INSTALLATION)
INSTALL(
TARGETS caerStatic
EXPORT libcaer-exports
26 changes: 26 additions & 0 deletions ports/libcaer/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com/inivation/
OUT_SOURCE_PATH SOURCE_PATH
REPO dv/libcaer
REF 3.3.14
SHA512 6e91ebd20796b59c51ebb10be58d12577f3b6370425bbeffcf1a96ff91ad9f3ffaefb2741d0a932b241f2664c157d77158cf475b0f7e39ba208d5482f408fc8b
HEAD_REF ab9470e8900364822fb74ad3c1e99fa4088914df
PATCHES
libcaer-static-build.patch
)

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DENABLE_OPENCV=ON
-DEXAMPLES_INSTALL=OFF
-DENABLE_BINDIR_INSTALLATION=ON
)
vcpkg_cmake_install()

vcpkg_fixup_pkgconfig()
vcpkg_cmake_config_fixup(PACKAGE_NAME "libcaer" CONFIG_PATH "share/libcaer")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
20 changes: 20 additions & 0 deletions ports/libcaer/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "libcaer",
"version": "3.3.14",
"description": "Minimal C library to access, configure and get data from neuromorphic sensors and processors.",
"homepage": "https://gitlab.com/inivation/dv/libcaer",
"license": "BSD-2-Clause",
"dependencies": [
"libusb",
"opencv4",
"pkgconf",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3468,6 +3468,10 @@
"baseline": "1.17.6",
"port-version": 1
},
"libcaer": {
"baseline": "3.3.14",
"port-version": 0
},
"libcanberra": {
"baseline": "0.30",
"port-version": 2
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/libcaer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "4dffda61ffebd9440265c6edde057d1af909cf5c",
"version": "3.3.14",
"port-version": 0
}
]
}

0 comments on commit a00906c

Please sign in to comment.