CMakeLists.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. cmake_minimum_required(VERSION 2.6)
  2. PROJECT(fs-tools C)
  3. ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-format-truncation)
  4. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
  5. ADD_LIBRARY(fstools SHARED
  6. libfstools/common.c
  7. libfstools/snapshot.c
  8. libfstools/extroot.c
  9. libfstools/fit.c
  10. libfstools/overlay.c
  11. libfstools/volume.c
  12. libfstools/mtd.c
  13. libfstools/mount.c
  14. libfstools/ubi.c
  15. libfstools/rootdisk.c
  16. libfstools/partname.c
  17. libfstools/find.c)
  18. TARGET_LINK_LIBRARIES(fstools ubox)
  19. INSTALL(TARGETS fstools LIBRARY DESTINATION lib)
  20. ADD_LIBRARY(blkid-tiny SHARED
  21. libblkid-tiny/encode.c
  22. libblkid-tiny/libblkid-tiny.c
  23. libblkid-tiny/mkdev.c
  24. libblkid-tiny/probe.c
  25. libblkid-tiny/exfat.c
  26. libblkid-tiny/ext.c
  27. libblkid-tiny/jffs2.c
  28. libblkid-tiny/vfat.c
  29. libblkid-tiny/ntfs.c
  30. libblkid-tiny/hfs.c
  31. libblkid-tiny/swap.c
  32. libblkid-tiny/ubi.c
  33. libblkid-tiny/ubifs.c
  34. libblkid-tiny/squashfs.c
  35. libblkid-tiny/btrfs.c
  36. libblkid-tiny/f2fs.c
  37. )
  38. INSTALL(TARGETS blkid-tiny LIBRARY DESTINATION lib)
  39. INSTALL(FILES libblkid-tiny/libblkid-tiny.h DESTINATION include)
  40. ADD_LIBRARY(ubi-utils STATIC
  41. libubi/libubi.c
  42. libubi/libubi-tiny.c
  43. libubi/ubiutils-common.c)
  44. INSTALL(TARGETS ubi-utils ARCHIVE DESTINATION lib)
  45. FIND_PATH(ubox_include_dir libubox/ulog.h)
  46. INCLUDE_DIRECTORIES(${ubox_include_dir})
  47. SET_TARGET_PROPERTIES(ubi-utils PROPERTIES COMPILE_FLAGS
  48. "-ffunction-sections -fdata-sections")
  49. INSTALL(FILES libubi/libubi-tiny.h libubi/libubi.h libubi/ubi-media.h
  50. libubi/ubi-user.h libubi/ubi-media.h
  51. DESTINATION include
  52. )
  53. IF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
  54. ADD_DEFINITIONS(-DOVL_MOUNT_COMPRESS_ZLIB)
  55. ENDIF(DEFINED CMAKE_OVL_MOUNT_COMPRESS_ZLIB)
  56. IF(DEFINED CMAKE_OVL_MOUNT_FULL_ACCESS_TIME)
  57. ADD_DEFINITIONS(-DOVL_MOUNT_FULL_ACCESS_TIME)
  58. ENDIF(DEFINED CMAKE_OVL_MOUNT_FULL_ACCESS_TIME)
  59. ADD_EXECUTABLE(mount_root mount_root.c)
  60. TARGET_LINK_LIBRARIES(mount_root fstools)
  61. INSTALL(TARGETS mount_root RUNTIME DESTINATION sbin)
  62. find_library(json NAMES json-c json)
  63. ADD_EXECUTABLE(blockd blockd.c)
  64. TARGET_LINK_LIBRARIES(blockd fstools ubus blobmsg_json ${json})
  65. INSTALL(TARGETS blockd RUNTIME DESTINATION sbin)
  66. ADD_EXECUTABLE(block block.c probe.c probe-libblkid.c)
  67. IF(DEFINED CMAKE_UBIFS_EXTROOT)
  68. ADD_DEFINITIONS(-DUBIFS_EXTROOT)
  69. TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ubi-utils ${json})
  70. ELSE(DEFINED CMAKE_UBIFS_EXTROOT)
  71. TARGET_LINK_LIBRARIES(block blkid-tiny dl uci ubox ubus blobmsg_json ${json})
  72. ENDIF(DEFINED CMAKE_UBIFS_EXTROOT)
  73. INSTALL(TARGETS block RUNTIME DESTINATION sbin)
  74. ADD_EXECUTABLE(jffs2reset jffs2reset.c)
  75. TARGET_LINK_LIBRARIES(jffs2reset fstools)
  76. INSTALL(TARGETS jffs2reset RUNTIME DESTINATION sbin)
  77. ADD_EXECUTABLE(snapshot_tool snapshot.c)
  78. TARGET_LINK_LIBRARIES(snapshot_tool fstools)
  79. INSTALL(TARGETS snapshot_tool RUNTIME DESTINATION sbin)
  80. ADD_EXECUTABLE(ubi ubi.c)
  81. TARGET_LINK_LIBRARIES(ubi ubi-utils ubox)
  82. INSTALL(TARGETS ubi RUNTIME DESTINATION sbin)