@@ -31,7 +31,62 @@ project(libusbhsfs
3131option (USBHSFS_GPL "ext4 and ntfs support" OFF )
3232option (USBHSFS_EXAMPLES "build examples" OFF )
3333
34- add_subdirectory (source )
34+ add_library (libusbhsfs
35+ source /usbhsfs_drive.c
36+ source /usbhsfs_log.c
37+ source /usbhsfs_manager.c
38+ source /usbhsfs_mount.c
39+ source /usbhsfs_request.c
40+ source /usbhsfs_scsi.c
41+ source /usbhsfs_utils.c
42+ )
43+
44+ target_include_directories (libusbhsfs PUBLIC ${CMAKE_CURRENT_SOURCE_DIR } /include )
45+
46+ # fatfs stuff
47+ target_sources (libusbhsfs PRIVATE
48+ source /fatfs/diskio.c
49+ source /fatfs/ff_dev.c
50+ source /fatfs/ff.c
51+ source /fatfs/ffsystem.c
52+ source /fatfs/ffunicode.c
53+ )
54+
55+ # sxos stuff
56+ target_sources (libusbhsfs PRIVATE
57+ source /sxos/usbfs_dev.c
58+ source /sxos/usbfs.c
59+ )
60+
61+ if (USBHSFS_GPL)
62+ target_sources (libusbhsfs PRIVATE
63+ source /lwext4/ext_dev.c
64+ source /lwext4/ext_disk_io.c
65+ source /lwext4/ext.c
66+
67+ source /ntfs-3g/ntfs_dev.c
68+ source /ntfs-3g/ntfs_disk_io.c
69+ source /ntfs-3g/ntfs.c
70+ )
71+
72+ find_library (ntfs_3g_lib ntfs-3g )
73+ find_path (ntfs_3g_inc ntfs-3g )
74+
75+ find_library (lwext4_lib lwext4 )
76+ find_path (lwext4_inc ext4.h )
77+
78+ if (NOT ntfs-3g_lib OR NOT ntfs-3g_inc)
79+ message (FATAL_ERROR "ntfs-3g is not installed!" )
80+ endif ()
81+
82+ if (NOT lwext4_lib OR NOT lwext4_inc)
83+ message (FATAL_ERROR "lwext4 is not installed!" )
84+ endif ()
85+
86+ target_link_libraries (libusbhsfs PRIVATE ${ntfs_3g_lib} ${lwext4_lib} )
87+ target_include_directories (libusbhsfs PRIVATE ${ntfs_3g_inc} ${lwext4_inc} )
88+ target_compile_definitions (libusbhsfs PRIVATE GPL_BUILD )
89+ endif ()
3590
3691if (USBHSFS_EXAMPLES)
3792 add_subdirectory (example_callback )
0 commit comments