-
Notifications
You must be signed in to change notification settings - Fork 163
/
CMakeLists.txt
142 lines (128 loc) · 3.72 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
cmake_minimum_required(VERSION 3.0)
# set(CMAKE_C_COMPILER "clang")
# set(CMAKE_CXX_COMPILER "clang++")
project(Apfs)
option(USE_FUSE3 "Use the FUSE 3 library (required on 32-bit systems)" ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -march=native -fsanitize=undefined")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -march=native -fsanitize=undefined")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
include_directories(. 3rdparty/lzfse/src)
add_library(lzfse
3rdparty/lzfse/src/lzfse.h
3rdparty/lzfse/src/lzfse_decode.c
3rdparty/lzfse/src/lzfse_decode_base.c
3rdparty/lzfse/src/lzfse_encode.c
3rdparty/lzfse/src/lzfse_encode_base.c
3rdparty/lzfse/src/lzfse_encode_tables.h
3rdparty/lzfse/src/lzfse_fse.c
3rdparty/lzfse/src/lzfse_fse.h
3rdparty/lzfse/src/lzfse_internal.h
3rdparty/lzfse/src/lzfse_tunables.h
3rdparty/lzfse/src/lzvn_decode_base.c
3rdparty/lzfse/src/lzvn_decode_base.h
3rdparty/lzfse/src/lzvn_encode_base.c
3rdparty/lzfse/src/lzvn_encode_base.h
)
add_library(crypto
Crypto/Aes.cpp
Crypto/Aes.h
Crypto/AesXts.cpp
Crypto/AesXts.h
Crypto/Asn1Der.cpp
Crypto/Asn1Der.h
Crypto/Crypto.cpp
Crypto/Crypto.h
Crypto/Des.cpp
Crypto/Des.h
Crypto/Sha1.cpp
Crypto/Sha1.h
Crypto/Sha256.cpp
Crypto/Sha256.h
Crypto/TripleDes.cpp
Crypto/TripleDes.h
)
add_library(apfs
ApfsLib/ApfsContainer.cpp
ApfsLib/ApfsContainer.h
ApfsLib/ApfsDir.cpp
ApfsLib/ApfsDir.h
ApfsLib/ApfsNodeMapper.cpp
ApfsLib/ApfsNodeMapper.h
ApfsLib/ApfsNodeMapperBTree.cpp
ApfsLib/ApfsNodeMapperBTree.h
ApfsLib/ApfsVolume.cpp
ApfsLib/ApfsVolume.h
ApfsLib/BlockDumper.cpp
ApfsLib/BlockDumper.h
ApfsLib/BTree.cpp
ApfsLib/BTree.h
ApfsLib/CheckPointMap.cpp
ApfsLib/CheckPointMap.h
ApfsLib/Crc32.cpp
ApfsLib/Crc32.h
ApfsLib/Decmpfs.cpp
ApfsLib/Decmpfs.h
ApfsLib/Device.cpp
ApfsLib/Device.h
ApfsLib/DeviceDMG.cpp
ApfsLib/DeviceDMG.h
ApfsLib/DeviceLinux.cpp
ApfsLib/DeviceLinux.h
ApfsLib/DeviceMac.cpp
ApfsLib/DeviceMac.h
ApfsLib/DeviceSparseImage.cpp
ApfsLib/DeviceSparseImage.h
ApfsLib/DeviceWinFile.cpp
ApfsLib/DeviceWinFile.h
ApfsLib/DeviceWinPhys.cpp
ApfsLib/DeviceWinPhys.h
ApfsLib/DiskImageFile.cpp
ApfsLib/DiskImageFile.h
ApfsLib/DiskStruct.h
ApfsLib/Endian.h
ApfsLib/Global.h
ApfsLib/GptPartitionMap.cpp
ApfsLib/GptPartitionMap.h
ApfsLib/KeyMgmt.cpp
ApfsLib/KeyMgmt.h
ApfsLib/PList.cpp
ApfsLib/PList.h
ApfsLib/Util.cpp
ApfsLib/Util.h
ApfsLib/Unicode.cpp
ApfsLib/Unicode.h)
target_link_libraries(apfs z bz2 lzfse crypto)
target_compile_definitions(apfs PUBLIC _FILE_OFFSET_BITS=64 _DARWIN_USE_64_BIT_INODE)
add_executable(apfs-dump
ApfsDump/Dumper.cpp
ApfsDump/Dumper.h
ApfsDump/Apfs.cpp)
target_link_libraries(apfs-dump apfs)
add_executable(apfs-dump-quick
ApfsDumpQuick/ApfsDumpQuick.cpp)
target_link_libraries(apfs-dump-quick apfs)
add_executable(apfs-fuse
apfsfuse/ApfsFuse.cpp)
target_compile_definitions(apfs-fuse PRIVATE _FILE_OFFSET_BITS=64 _DARWIN_USE_64_BIT_INODE)
if (APPLE)
target_include_directories(apfs-fuse PRIVATE /usr/local/include/osxfuse/)
# link_directories(/usr/local/lib/)
target_link_libraries(apfs-fuse apfs /usr/local/lib/libosxfuse.dylib)
else()
if (USE_FUSE3)
target_link_libraries(apfs-fuse apfs fuse3)
else()
target_link_libraries(apfs-fuse apfs fuse)
target_compile_definitions(apfs-fuse PRIVATE USE_FUSE2)
endif()
endif()
add_executable(apfsutil ApfsUtil/ApfsUtil.cpp)
target_link_libraries(apfsutil apfs)
include(GNUInstallDirs)
install(TARGETS apfs-fuse RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(TARGETS apfsutil RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")