CMakeLists.txt 2.9 KB

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