Skip to content

Commit a00906c

Browse files
jureviciusrRokas Jurevicius
andauthored
[libcaer] New port for libcaer (#25110)
* 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 <rokas.jurevicius@inivation.com>
1 parent 3d054a1 commit a00906c

5 files changed

Lines changed: 114 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 3b1937a..a75db2b 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -20,6 +20,8 @@ OPTION(ENABLE_SERIALDEV "Enable support for serial port devices using libserialp
6+
OPTION(ENABLE_OPENCV "Enable support for frame enhancements using OpenCV" OFF)
7+
OPTION(UDEV_INSTALL "Install udev rules on Linux" ON)
8+
OPTION(EXAMPLES_INSTALL "Build and install examples" OFF)
9+
+OPTION(ENABLE_BINDIR_INSTALLATION "Split archive and binary installation targets [required for vcpkg installation]" OFF)
10+
+OPTION(BUILD_SHARED_LIBS "Build libcaer as a shared library" ON)
11+
12+
# Cross-compile support
13+
IF(NOT USER_LOCAL_PREFIX)
14+
@@ -98,7 +100,7 @@ INCLUDE(CMakePackageConfigHelpers)
15+
WRITE_BASIC_CONFIG_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${PROJECT_VERSION}
16+
COMPATIBILITY SameMajorVersion)
17+
SET(include_dirs ${CMAKE_INSTALL_INCLUDEDIR})
18+
-IF(CC_MSVC)
19+
+IF(ENABLE_BINDIR_INSTALLATION)
20+
SET(export_destination ${CMAKE_INSTALL_DATAROOTDIR}/${PROJECT_NAME})
21+
ELSE()
22+
SET(export_destination ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
23+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
24+
index 377a556..d9c29d7 100644
25+
--- a/src/CMakeLists.txt
26+
+++ b/src/CMakeLists.txt
27+
@@ -19,6 +19,10 @@ IF(NOT CC_MSVC)
28+
SET(LIBCAER_COMPILE_OPTIONS "-Wno-unused-function")
29+
ENDIF()
30+
31+
+IF(OS_MACOS)
32+
+ LIST(APPEND LIBCAER_COMPILE_OPTIONS "-Wno-implicit-function-declaration")
33+
+ENDIF()
34+
+
35+
SET(LIBCAER_LINK_LIBRARIES_PRIVATE ${BASE_LIBS})
36+
37+
IF(OS_LINUX)
38+
@@ -63,7 +67,7 @@ ENDIF()
39+
# Set full RPATH
40+
SET(CMAKE_INSTALL_RPATH ${USER_LOCAL_PREFIX}/${CMAKE_INSTALL_LIBDIR})
41+
42+
-ADD_LIBRARY(caer SHARED ${LIBCAER_SOURCES})
43+
+ADD_LIBRARY(caer ${LIBCAER_SOURCES})
44+
IF(CC_MSVC)
45+
# This flag needs to be propagated down to depending targets to avoid compilation errors
46+
TARGET_COMPILE_OPTIONS(caer INTERFACE -DWIN32_LEAN_AND_MEAN=ON)
47+
@@ -94,7 +98,7 @@ IF(ENABLE_STATIC)
48+
49+
SET_TARGET_PROPERTIES(caerStatic PROPERTIES OUTPUT_NAME caer)
50+
51+
- IF(OS_WINDOWS)
52+
+ IF(ENABLE_BINDIR_INSTALLATION)
53+
INSTALL(
54+
TARGETS caerStatic
55+
EXPORT libcaer-exports

ports/libcaer/portfile.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
vcpkg_from_gitlab(
2+
GITLAB_URL https://gitlab.com/inivation/
3+
OUT_SOURCE_PATH SOURCE_PATH
4+
REPO dv/libcaer
5+
REF 3.3.14
6+
SHA512 6e91ebd20796b59c51ebb10be58d12577f3b6370425bbeffcf1a96ff91ad9f3ffaefb2741d0a932b241f2664c157d77158cf475b0f7e39ba208d5482f408fc8b
7+
HEAD_REF ab9470e8900364822fb74ad3c1e99fa4088914df
8+
PATCHES
9+
libcaer-static-build.patch
10+
)
11+
12+
vcpkg_cmake_configure(
13+
SOURCE_PATH ${SOURCE_PATH}
14+
OPTIONS
15+
-DENABLE_OPENCV=ON
16+
-DEXAMPLES_INSTALL=OFF
17+
-DENABLE_BINDIR_INSTALLATION=ON
18+
)
19+
vcpkg_cmake_install()
20+
21+
vcpkg_fixup_pkgconfig()
22+
vcpkg_cmake_config_fixup(PACKAGE_NAME "libcaer" CONFIG_PATH "share/libcaer")
23+
24+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
25+
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
26+
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

ports/libcaer/vcpkg.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "libcaer",
3+
"version": "3.3.14",
4+
"description": "Minimal C library to access, configure and get data from neuromorphic sensors and processors.",
5+
"homepage": "https://gitlab.com/inivation/dv/libcaer",
6+
"license": "BSD-2-Clause",
7+
"dependencies": [
8+
"libusb",
9+
"opencv4",
10+
"pkgconf",
11+
{
12+
"name": "vcpkg-cmake",
13+
"host": true
14+
},
15+
{
16+
"name": "vcpkg-cmake-config",
17+
"host": true
18+
}
19+
]
20+
}

versions/baseline.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,6 +3468,10 @@
34683468
"baseline": "1.17.6",
34693469
"port-version": 1
34703470
},
3471+
"libcaer": {
3472+
"baseline": "3.3.14",
3473+
"port-version": 0
3474+
},
34713475
"libcanberra": {
34723476
"baseline": "0.30",
34733477
"port-version": 2

versions/l-/libcaer.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"versions": [
3+
{
4+
"git-tree": "4dffda61ffebd9440265c6edde057d1af909cf5c",
5+
"version": "3.3.14",
6+
"port-version": 0
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)