You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

62 lines
2.3 KiB

  1. cmake_minimum_required(VERSION 3.12)
  2. project(WiringPiLib)
  3. # Read version from version.h
  4. file(READ "${CMAKE_CURRENT_SOURCE_DIR}/version.h" WIRINGPI_VERSION)
  5. string(REGEX REPLACE ".*VERSION \"([0-9]+.[0-9]+)\".*" "\\1" WIRINGPI_VERSION "${WIRINGPI_VERSION}")
  6. if(NOT WIRINGPI_VERSION MATCHES "([0-9]+)\.([0-9]+)")
  7. message(FATAL_ERROR "Could not retrieve WiringPi versions")
  8. endif()
  9. set(WIRINGPI_VERSION_MAJOR ${CMAKE_MATCH_1})
  10. set(WIRINGPI_VERSION_MINOR ${CMAKE_MATCH_2})
  11. # Include subdirectories
  12. add_subdirectory(devLib)
  13. add_subdirectory(gpio)
  14. #add_subdirectory(pins)
  15. add_subdirectory(wiringPi)
  16. #add_subdirectory(wiringPiD)
  17. # CPack
  18. set(CPACK_PACKAGE_NAME "wiringpi")
  19. set(CPACK_PACKAGE_DESCRIPTION
  20. "The wiringPi libraries, headers and gpio command
  21. Libraries to allow GPIO access on a Raspberry Pi from C and C++
  22. programs as well as from the command-line")
  23. set(CPACK_DEBIAN_PACKAGE_SECTION "libraries")
  24. set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/WiringPi/WiringPi")
  25. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER")
  26. set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
  27. set(CPACK_PACKAGE_VERSION_MAJOR ${WIRINGPI_VERSION_MAJOR})
  28. set(CPACK_PACKAGE_VERSION_MINOR ${WIRINGPI_VERSION_MINOR})
  29. set(CPACK_PACKAGE_VERSION_PATCH "")
  30. set(CPACK_GENERATOR "DEB")
  31. set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
  32. set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Grazer Computer Club - GC2 <wiringpi@gc2.at>")
  33. set(CPACK_DEBIAN_RUNTIME_PACKAGE_DEPENDS "libc6, libcrypt1")
  34. set(CPACK_DEBIAN_RUNTIME_PACKAGE_CONTROL_EXTRA
  35. "${CMAKE_CURRENT_SOURCE_DIR}/debian-template/wiringPi/DEBIAN/postinst"
  36. "${CMAKE_CURRENT_SOURCE_DIR}/debian-template/wiringPi/DEBIAN/postrm")
  37. set(CPACK_DEB_COMPONENT_INSTALL TRUE)
  38. set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "${CPACK_PACKAGE_NAME}")
  39. set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_NAME "${CPACK_PACKAGE_NAME}-dev")
  40. set(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS ON)
  41. set(CPACK_DEBIAN_DEVELOPMENT_PACKAGE_DEPENDS "${CPACK_DEBIAN_RUNTIME_PACKAGE_NAME}")
  42. # Check for arm or arm64 architecture
  43. # Let CMake determine a value otherwise
  44. if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm")
  45. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf")
  46. elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
  47. set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64")
  48. endif()
  49. set(CPACK_SOURCE_GENERATOR "TGZ")
  50. include(CPack)