CMakeLists.txt 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. project(pcitool)
  2. set(PCILIB_VERSION "0.1.0")
  3. set(PCILIB_ABI_VERSION "1")
  4. cmake_minimum_required(VERSION 2.6)
  5. set(DISABLE_PCITOOL FALSE CACHE BOOL "Build only the library")
  6. find_package(PkgConfig REQUIRED)
  7. find_package(Threads REQUIRED)
  8. #Check in sibling directory
  9. if (NOT DISABLE_PCITOOL)
  10. pkg_check_modules(FASTWRITER fastwriter REQUIRED)
  11. endif (NOT DISABLE_PCITOOL)
  12. set(HEADERS pcilib.h pci.h config.h model.h bank.h register.h kmem.h irq.h dma.h event.h tools.h error.h)
  13. add_definitions("-fPIC --std=c99 -Wall -O2 -gdwarf-2 -g3")
  14. #add_definitions("-fPIC --std=c99 -Wall -O2")
  15. add_subdirectory(dma)
  16. add_subdirectory(protocols)
  17. add_subdirectory(pcitool)
  18. add_subdirectory(apps)
  19. include_directories(
  20. .
  21. ${FASTWRITER_INCLUDE_DIRS}
  22. )
  23. link_directories(
  24. ${FASTWRITER_LIBRARY_DIRS}
  25. ${UFODECODE_LIBRARY_DIRS}
  26. )
  27. add_library(pcilib SHARED pci.c config.c model.c bank.c register.c kmem.c irq.c dma.c event.c tools.c error.c)
  28. target_link_libraries(pcilib dma protocols ${CMAKE_THREAD_LIBS_INIT} ${UFODECODE_LIBRARIES} )
  29. add_dependencies(pcilib dma protocols pcitool)
  30. set_target_properties(pcilib PROPERTIES
  31. VERSION ${PCILIB_VERSION}
  32. SOVERSION ${PCILIB_ABI_VERSION}
  33. )
  34. if (NOT DISABLE_PCITOOL)
  35. add_executable(pci cli.c)
  36. add_dependencies(pci pcitool)
  37. target_link_libraries(pci pcilib pcitool ${FASTWRITER_LIBRARIES})
  38. set_target_properties(pci PROPERTIES
  39. LINK_FLAGS ${CMAKE_THREAD_LIBS_INIT}
  40. )
  41. endif (NOT DISABLE_PCITOOL)
  42. #set_target_properties(pci PROPERTIES
  43. # LINK_FLAGS "-Wl,pcitool/libpcitool.a"
  44. #)
  45. if(NOT DEFINED BIN_INSTALL_DIR)
  46. set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
  47. endif(NOT DEFINED BIN_INSTALL_DIR)
  48. install(TARGETS pcilib
  49. LIBRARY DESTINATION lib${LIB_SUFFIX}
  50. )
  51. if (NOT DISABLE_PCITOOL)
  52. install(TARGETS pci
  53. DESTINATION ${BIN_INSTALL_DIR}
  54. )
  55. endif (NOT DISABLE_PCITOOL)
  56. install(FILES pcilib.h
  57. DESTINATION include
  58. )
  59. install(FILES bank.h register.h dma.h event.h model.h error.h tools.h
  60. DESTINATION include/pcilib
  61. )