Просмотр исходного кода

cmake: make the PHYSFS_PLATFORM_SDL3 option actually buildable.

Ozkan Sezer 1 день назад
Родитель
Сommit
5f73e95b20
1 измененных файлов с 13 добавлено и 0 удалено
  1. 13 0
      CMakeLists.txt

+ 13 - 0
CMakeLists.txt

@@ -196,6 +196,7 @@ endif()
 
 option(PHYSFS_PLATFORM_SDL3 "Enable building for the SDL3 file system" FALSE)
 if(PHYSFS_PLATFORM_SDL3)
+    find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
     add_definitions(-DPHYSFS_PLATFORM_SDL3=1)
 endif()
 
@@ -228,6 +229,9 @@ if(PHYSFS_BUILD_STATIC)
         # no dll exports from the static library
         target_compile_definitions(physfs-static PRIVATE "PHYSFS_STATIC")
     endif()
+    if(PHYSFS_PLATFORM_SDL3)
+        target_link_libraries(physfs-static PUBLIC SDL3::Headers)
+    endif()
     target_include_directories(physfs-static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
     target_link_libraries(physfs-static PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
     list(APPEND PHYSFS_INSTALL_TARGETS "physfs-static")
@@ -255,6 +259,9 @@ if(PHYSFS_BUILD_SHARED)
     if(WINRT)
         set_property(TARGET physfs-shared PROPERTY VS_WINRT_COMPONENT TRUE)
     endif()
+    if(PHYSFS_PLATFORM_SDL3)
+        target_link_libraries(physfs-shared PUBLIC SDL3::SDL3-shared)
+    endif()
     target_include_directories(physfs-shared PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
     target_link_libraries(physfs-shared PRIVATE ${OPTIONAL_LIBRARY_LIBS} ${OTHER_LDFLAGS})
     list(APPEND PHYSFS_INSTALL_TARGETS "physfs-shared")
@@ -276,6 +283,9 @@ if(PHYSFS_BUILD_TEST)
     add_executable(test_physfs test/test_physfs.c)
     target_link_libraries(test_physfs PRIVATE PhysFS::PhysFS)
     sdl_add_warning_options(test_physfs WARNING_AS_ERROR ${PHYSFS_WERROR})
+    if(PHYSFS_PLATFORM_SDL3)
+        target_link_libraries(test_physfs PRIVATE SDL3::SDL3)
+    endif()
     if(DOS)
         set_target_properties(test_physfs PROPERTIES OUTPUT_NAME "TESTPHYS")   # 8.3 file names!
     endif()
@@ -295,6 +305,9 @@ if(PHYSFS_BUILD_TEST)
     if(UNIX)
         add_executable(physfshttpd extras/physfshttpd.c)
         target_link_libraries(physfshttpd PRIVATE PhysFS::PhysFS)
+        if(PHYSFS_PLATFORM_SDL3)
+            target_link_libraries(physfshttpd PRIVATE SDL3::SDL3)
+        endif()
         sdl_add_warning_options(physfshttpd WARNING_AS_ERROR ${PHYSFS_WERROR})
     endif()
 endif()