Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
marckleinebudde committed Oct 5, 2018
2 parents 12664ef + b217774 commit b10cc9a
Show file tree
Hide file tree
Showing 10 changed files with 2,724 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ GNUmakefile.in
/config.log
/config.status
/config/autoconf/
/config/libsocketcan.pc
/config/m4/libtool.m4
/config/m4/ltoptions.m4
/config/m4/ltsugar.m4
/config/m4/ltversion.m4
/config/m4/lt~obsolete.m4
/include/libsocketcan_config.h.in

/asc2log
/bcmserver
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
cmake_minimum_required(VERSION 3.3)

project(can-utils LANGUAGES C)
set(LIB_CURRENT 4)
set(LIB_REVISION 1)
set(LIB_AGE 2)
math(EXPR LIB_SOVERSION "${LIB_CURRENT} - ${LIB_AGE}")
set(LIB_VERSION ${LIB_SOVERSION}.${LIB_AGE}.${LIB_REVISION})

include (GNUInstallDirs)

Expand All @@ -14,6 +19,7 @@ endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-parentheses")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSO_RXQ_OVFL=40")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPF_CAN=29")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DAF_CAN=PF_CAN")
Expand Down Expand Up @@ -73,6 +79,35 @@ add_library(j1939 STATIC
libj1939.c
)

add_library(socketcan SHARED
libsocketcan.c
)

set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
set(includedir \${prefix}/${CMAKE_INSTALL_INCLUDEDIR})
configure_file(config/libsocketcan.pc.in config/libsocketcan.pc @ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/config/libsocketcan.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

set_target_properties(socketcan
PROPERTIES PUBLIC_HEADER include/libsocketcan.h
SOVERSION ${LIB_SOVERSION}
VERSION ${LIB_VERSION}
)

install(TARGETS socketcan
LIBRARY
DESTINATION lib
COMPONENT Development
PUBLIC_HEADER
DESTINATION include
COMPONENT Development
)

foreach(name ${PROGRAMS})
add_executable(${name} ${name}.c)

Expand Down
9 changes: 9 additions & 0 deletions Documentation/main.dox
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @mainpage libsocketcan

This is libsocketcan, a userspace library to do some common tasks while dealing
with the socketcan Framework.

@defgroup extern External API
@defgroup intern Interally used callbacks and structures

*/
Loading

0 comments on commit b10cc9a

Please sign in to comment.