Skip to content

Commit b10cc9a

Browse files
2 parents 12664ef + b217774 commit b10cc9a

File tree

10 files changed

+2724
-5
lines changed

10 files changed

+2724
-5
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ GNUmakefile.in
1515
/config.log
1616
/config.status
1717
/config/autoconf/
18+
/config/libsocketcan.pc
1819
/config/m4/libtool.m4
1920
/config/m4/ltoptions.m4
2021
/config/m4/ltsugar.m4
2122
/config/m4/ltversion.m4
2223
/config/m4/lt~obsolete.m4
24+
/include/libsocketcan_config.h.in
2325

2426
/asc2log
2527
/bcmserver

CMakeLists.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
cmake_minimum_required(VERSION 3.3)
22

33
project(can-utils LANGUAGES C)
4+
set(LIB_CURRENT 4)
5+
set(LIB_REVISION 1)
6+
set(LIB_AGE 2)
7+
math(EXPR LIB_SOVERSION "${LIB_CURRENT} - ${LIB_AGE}")
8+
set(LIB_VERSION ${LIB_SOVERSION}.${LIB_AGE}.${LIB_REVISION})
49

510
include (GNUInstallDirs)
611

@@ -14,6 +19,7 @@ endif()
1419

1520
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
1621
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
22+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
1723
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
1824
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
1925
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
@@ -73,6 +79,35 @@ add_library(j1939 STATIC
7379
libj1939.c
7480
)
7581

82+
add_library(socketcan SHARED
83+
libsocketcan.c
84+
)
85+
86+
set(prefix ${CMAKE_INSTALL_PREFIX})
87+
set(exec_prefix \${prefix})
88+
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
89+
set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
90+
configure_file(config/libsocketcan.pc.in config/libsocketcan.pc @ONLY)
91+
install(
92+
FILES ${CMAKE_CURRENT_BINARY_DIR}/config/libsocketcan.pc
93+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
94+
)
95+
96+
set_target_properties(socketcan
97+
PROPERTIES PUBLIC_HEADER include/libsocketcan.h
98+
SOVERSION ${LIB_SOVERSION}
99+
VERSION ${LIB_VERSION}
100+
)
101+
102+
install(TARGETS socketcan
103+
LIBRARY
104+
DESTINATION lib
105+
COMPONENT Development
106+
PUBLIC_HEADER
107+
DESTINATION include
108+
COMPONENT Development
109+
)
110+
76111
foreach(name ${PROGRAMS})
77112
add_executable(${name} ${name}.c)
78113

Documentation/main.dox

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/** @mainpage libsocketcan
2+
3+
This is libsocketcan, a userspace library to do some common tasks while dealing
4+
with the socketcan Framework.
5+
6+
@defgroup extern External API
7+
@defgroup intern Interally used callbacks and structures
8+
9+
*/

0 commit comments

Comments
 (0)