3
set(PCILIB_VERSION "0.1.0")
4
set(PCILIB_ABI_VERSION "1")
6
cmake_minimum_required(VERSION 2.6)
8
set(DISABLE_PCITOOL FALSE CACHE BOOL "Build only the library")
11
find_package(PkgConfig REQUIRED)
12
find_package(Threads REQUIRED)
14
#Check in sibling directory
15
pkg_check_modules(UFODECODE ufodecode>=0.2 REQUIRED)
17
if (NOT DISABLE_PCITOOL)
18
pkg_check_modules(FASTWRITER fastwriter REQUIRED)
19
endif (NOT DISABLE_PCITOOL)
21
set(HEADERS pcilib.h pci.h register.h kmem.h irq.h dma.h event.h default.h tools.h error.h)
22
add_definitions("-fPIC --std=c99 -Wall -O2")
23
#add_definitions("-fPIC --std=c99 -Wall -O2 -pthread")
26
add_subdirectory(ipecamera)
27
add_subdirectory(kapture)
28
add_subdirectory(pcitool)
29
add_subdirectory(apps)
32
${FASTWRITER_INCLUDE_DIRS}
36
${FASTWRITER_LIBRARY_DIRS}
37
${UFODECODE_LIBRARY_DIRS}
40
add_library(pcilib SHARED pci.c register.c kmem.c irq.c dma.c event.c default.c tools.c error.c)
41
target_link_libraries(pcilib dma ipecamera kapture ${CMAKE_THREAD_LIBS_INIT} ${UFODECODE_LIBRARIES} )
42
add_dependencies(pcilib dma ipecamera)
44
set_target_properties(pcilib PROPERTIES
45
VERSION ${PCILIB_VERSION}
46
SOVERSION ${PCILIB_ABI_VERSION}
47
# LINK_FLAGS "-pthread"
48
# LINK_FLAGS "-pthread -Wl,--whole-archive,dma/libdma.a,ipecamera/libipecamera.a,--no-whole-archive"
51
if (NOT DISABLE_PCITOOL)
52
add_executable(pci cli.c)
53
add_dependencies(pci pcitool)
54
target_link_libraries(pci pcilib pcitool ${FASTWRITER_LIBRARIES})
55
set_target_properties(pci PROPERTIES
56
LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT}
58
endif (NOT DISABLE_PCITOOL)
60
#set_target_properties(pci PROPERTIES
61
# LINK_FLAGS "-Wl,pcitool/libpcitool.a"
64
if(NOT DEFINED BIN_INSTALL_DIR)
65
set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
66
endif(NOT DEFINED BIN_INSTALL_DIR)
69
install(TARGETS pcilib
70
LIBRARY DESTINATION lib${LIB_SUFFIX}
73
if (NOT DISABLE_PCITOOL)
75
DESTINATION ${BIN_INSTALL_DIR}
77
endif (NOT DISABLE_PCITOOL)
79
install(FILES pcilib.h