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