@@ -216,96 +216,130 @@ if (FTPSRV_LIB_BUILD)
216
216
)
217
217
else ()
218
218
if (NINTENDO_SWITCH )
219
+ if (NOT DEFINED USE_VFS_SAVE )
220
+ set (USE_VFS_SAVE TRUE )
221
+ endif ()
222
+ if (NOT DEFINED USE_VFS_STORAGE )
223
+ set (USE_VFS_STORAGE TRUE )
224
+ endif ()
225
+ if (NOT DEFINED USE_VFS_GC )
226
+ set (USE_VFS_GC TRUE )
227
+ endif ()
228
+ if (NOT DEFINED USE_VFS_USBHSFS )
229
+ set (USE_VFS_USBHSFS TRUE )
230
+ endif ()
231
+
219
232
ftp_set_options (ftpsrv 769 128 1024*64 )
220
233
fetch_minini ()
221
234
222
- set (USBHSFS_GPL ON )
223
- FetchContent_Declare (libusbhsfs
224
- GIT_REPOSITORY https://github.com/DarkMatterCore/libusbhsfs.git
225
- GIT_TAG v0.2.9
235
+ set (NX_SRC
236
+ src/platform/nx/vfs_nx.c
237
+ src/platform/nx/vfs/vfs_nx_none.c
238
+ src/platform/nx/vfs/vfs_nx_root.c
239
+ src/platform/nx/vfs/vfs_nx_fs.c
240
+ src/platform/nx/reboot_to_payload/ams_bpc.c
241
+ src/platform/nx/reboot_to_payload/reboot_to_payload.c
242
+ src/platform/nx/rtc/max77620-rtc.c
243
+ src/platform/nx/custom_commands.c
244
+ src/platform/nx/utils.c
245
+ src/log/log.c
226
246
)
227
247
228
- FetchContent_MakeAvailable (libusbhsfs )
229
- add_library (libusbhsfs
230
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_drive.c
231
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_log.c
232
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_manager.c
233
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_mount.c
234
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_request.c
235
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_scsi.c
236
- ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_utils.c
248
+ target_compile_definitions (ftpsrv PUBLIC
249
+ FTP_VFS_HEADER= "${CMAKE_CURRENT_SOURCE_DIR} /src/platform/nx/vfs_nx.h"
250
+ FTP_SOCKET_HEADER= "${CMAKE_CURRENT_SOURCE_DIR} /src/platform/unistd/socket_unistd.h"
251
+ VFS_NX_BUFFER_WRITES=1
237
252
)
238
253
239
- target_include_directories (libusbhsfs PUBLIC ${libusbhsfs_SOURCE_DIR} /include )
254
+ if (USE_VFS_SAVE )
255
+ list (APPEND NX_SRC src/platform/nx/vfs/vfs_nx_save.c )
256
+ endif ()
257
+ if (USE_VFS_STORAGE )
258
+ list (APPEND NX_SRC src/platform/nx/vfs/vfs_nx_storage.c )
259
+ endif ()
260
+ if (USE_VFS_GC )
261
+ list (APPEND NX_SRC src/platform/nx/vfs/vfs_nx_gc.c )
262
+ endif ()
240
263
241
- # fatfs stuff
242
- target_sources (libusbhsfs PRIVATE
243
- ${libusbhsfs_SOURCE_DIR} /source/fatfs/diskio.c
244
- ${libusbhsfs_SOURCE_DIR} /source/fatfs/ff_dev.c
245
- ${libusbhsfs_SOURCE_DIR} /source/fatfs/ff.c
246
- ${libusbhsfs_SOURCE_DIR} /source/fatfs/ffsystem.c
247
- ${libusbhsfs_SOURCE_DIR} /source/fatfs/ffunicode.c
264
+ add_executable (ftpexe
265
+ src/platform/nx/main.c
266
+ ${NX_SRC}
248
267
)
249
268
250
- # sxos stuff
251
- target_sources (libusbhsfs PRIVATE
252
- ${libusbhsfs_SOURCE_DIR} /source/sxos/usbfs_dev.c
253
- ${libusbhsfs_SOURCE_DIR} /source/sxos/usbfs.c
269
+ target_compile_definitions (ftpexe PUBLIC
270
+ USE_VFS_SAVE=$<BOOL:${USE_VFS_SAVE}>
271
+ USE_VFS_STORAGE=$<BOOL:${USE_VFS_STORAGE}>
272
+ USE_VFS_GC=$<BOOL:${USE_VFS_GC}>
273
+ USE_VFS_USBHSFS=$<BOOL:${USE_VFS_USBHSFS}>
254
274
)
255
275
256
- if (USBHSFS_GPL )
276
+ if (USE_VFS_USBHSFS )
277
+ set (USBHSFS_GPL ON )
278
+ FetchContent_Declare (libusbhsfs
279
+ GIT_REPOSITORY https://github.com/DarkMatterCore/libusbhsfs.git
280
+ GIT_TAG v0.2.9
281
+ )
282
+
283
+ FetchContent_MakeAvailable (libusbhsfs )
284
+ add_library (libusbhsfs
285
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_drive.c
286
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_log.c
287
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_manager.c
288
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_mount.c
289
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_request.c
290
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_scsi.c
291
+ ${libusbhsfs_SOURCE_DIR} /source/usbhsfs_utils.c
292
+ )
293
+
294
+ target_include_directories (libusbhsfs PUBLIC ${libusbhsfs_SOURCE_DIR} /include )
295
+
296
+ # fatfs stuff
257
297
target_sources (libusbhsfs PRIVATE
258
- ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext_dev.c
259
- ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext_disk_io.c
260
- ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext.c
298
+ ${libusbhsfs_SOURCE_DIR} /source/fatfs/diskio.c
299
+ ${libusbhsfs_SOURCE_DIR} /source/fatfs/ff_dev.c
300
+ ${libusbhsfs_SOURCE_DIR} /source/fatfs/ff.c
301
+ ${libusbhsfs_SOURCE_DIR} /source/fatfs/ffsystem.c
302
+ ${libusbhsfs_SOURCE_DIR} /source/fatfs/ffunicode.c
303
+ )
261
304
262
- ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs_dev.c
263
- ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs_disk_io.c
264
- ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs.c
305
+ # sxos stuff
306
+ target_sources (libusbhsfs PRIVATE
307
+ ${libusbhsfs_SOURCE_DIR} /source/sxos/usbfs_dev.c
308
+ ${libusbhsfs_SOURCE_DIR} /source/sxos/usbfs.c
265
309
)
266
310
267
- find_library (ntfs_3g_lib ntfs-3g REQUIRED )
268
- find_path (ntfs_3g_inc ntfs-3g REQUIRED )
311
+ if (USBHSFS_GPL )
312
+ target_sources (libusbhsfs PRIVATE
313
+ ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext_dev.c
314
+ ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext_disk_io.c
315
+ ${libusbhsfs_SOURCE_DIR} /source/lwext4/ext.c
269
316
270
- find_library (lwext4_lib lwext4 REQUIRED )
271
- find_path (lwext4_inc ext4.h REQUIRED )
317
+ ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs_dev.c
318
+ ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs_disk_io.c
319
+ ${libusbhsfs_SOURCE_DIR} /source/ntfs-3g/ntfs.c
320
+ )
272
321
273
- target_link_libraries (libusbhsfs PRIVATE ${ntfs_3g_lib} ${lwext4_lib} )
274
- target_include_directories (libusbhsfs PRIVATE ${ntfs_3g_inc} ${lwext4_inc} )
275
- target_compile_definitions (libusbhsfs PRIVATE GPL_BUILD )
276
- endif ()
322
+ find_library (ntfs_3g_lib ntfs-3g REQUIRED )
323
+ find_path (ntfs_3g_inc ntfs-3g REQUIRED )
277
324
278
- target_compile_definitions (ftpsrv PUBLIC
279
- FTP_VFS_HEADER= "${CMAKE_CURRENT_SOURCE_DIR} /src/platform/nx/vfs_nx.h"
280
- FTP_SOCKET_HEADER= "${CMAKE_CURRENT_SOURCE_DIR} /src/platform/unistd/socket_unistd.h"
281
- VFS_NX_BUFFER_WRITES=1
282
- )
325
+ find_library (lwext4_lib lwext4 REQUIRED )
326
+ find_path (lwext4_inc ext4.h REQUIRED )
283
327
284
- set (NX_SRC
285
- src/platform/nx/vfs_nx.c
286
- src/platform/nx/vfs/vfs_nx_none.c
287
- src/platform/nx/vfs/vfs_nx_root.c
288
- src/platform/nx/vfs/vfs_nx_fs.c
289
- src/platform/nx/vfs/vfs_nx_save.c
290
- src/platform/nx/vfs/vfs_nx_storage.c
291
- src/platform/nx/vfs/vfs_nx_gc.c
292
- src/platform/nx/utils.c
293
- src/platform/nx/reboot_to_payload/ams_bpc.c
294
- src/platform/nx/reboot_to_payload/reboot_to_payload.c
295
- src/platform/nx/rtc/max77620-rtc.c
296
- src/platform/nx/custom_commands.c
297
- src/log/log.c
298
- )
328
+ target_link_libraries (libusbhsfs PRIVATE ${ntfs_3g_lib} ${lwext4_lib} )
329
+ target_include_directories (libusbhsfs PRIVATE ${ntfs_3g_inc} ${lwext4_inc} )
330
+ target_compile_definitions (libusbhsfs PRIVATE GPL_BUILD )
331
+ endif ()
332
+
333
+ target_link_libraries (ftpexe PRIVATE libusbhsfs )
334
+
335
+ target_sources (ftpexe PRIVATE
336
+ src/platform/nx/vfs/vfs_nx_stdio.c
337
+ src/platform/nx/vfs/vfs_nx_hdd.c
338
+ )
339
+ endif ()
299
340
300
- add_executable (ftpexe
301
- src/platform/nx/main.c
302
- src/platform/nx/vfs/vfs_nx_stdio.c
303
- src/platform/nx/vfs/vfs_nx_hdd.c
304
- ${NX_SRC}
305
- )
306
- target_compile_definitions (ftpexe PUBLIC USE_USBHSFS=1 )
307
341
ftp_add (ftpexe )
308
- target_link_libraries (ftpexe PRIVATE ftpsrv minIni libusbhsfs )
342
+ target_link_libraries (ftpexe PRIVATE ftpsrv minIni )
309
343
310
344
nx_generate_nacp (
311
345
OUTPUT ftpexe.nacp
@@ -337,6 +371,12 @@ else()
337
371
ftp_add (sysftp )
338
372
target_link_libraries (sysftp PRIVATE ftpsrv_sysmod minIni )
339
373
374
+ target_compile_definitions (ftpexe PUBLIC
375
+ USE_VFS_SAVE=$<BOOL:${USE_VFS_SAVE}>
376
+ USE_VFS_STORAGE=$<BOOL:${USE_VFS_STORAGE}>
377
+ USE_VFS_GC=$<BOOL:${USE_VFS_GC}>
378
+ )
379
+
340
380
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /420000000000011B )
341
381
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} /420000000000011B/flags )
342
382
0 commit comments