Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup-ninja/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runs:
echo "cache-key=${archive}-${{ inputs.version }}-${{ runner.os }}-${{ runner.arch }}" >> ${GITHUB_OUTPUT}
- name: 'Restore cached ${{ steps.calc.outputs.archive }}'
id: cache-restore
uses: actions/cache/restore@v4
uses: actions/cache/restore@v5
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
Expand All @@ -47,7 +47,7 @@ runs:
Invoke-WebRequest "https://github.com/ninja-build/ninja/releases/download/v${{ inputs.version }}/${{ steps.calc.outputs.archive }}" -OutFile "${{ runner.temp }}/${{ steps.calc.outputs.archive }}"
- name: 'Cache ${{ steps.calc.outputs.archive }}'
if: ${{ (!steps.cache-restore.outputs.cache-hit || steps.cache-restore.outputs.cache-hit == 'false') }}
uses: actions/cache/save@v4
uses: actions/cache/save@v5
with:
path: '${{ runner.temp }}/${{ steps.calc.outputs.archive }}'
key: ${{ steps.calc.outputs.cache-key }}
Expand Down
19 changes: 10 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ include("${PROJECT_SOURCE_DIR}/cmake/sdlmanpages.cmake")
# Increment this if/when we break backwards compatibility.
set(PHYSFS_SOVERSION 1)

set(PC_PRIVATE_REQUIRES "")

set(PHYSFS_M_SRCS)
set(PHYSFS_CPP_SRCS)

Expand Down Expand Up @@ -196,8 +198,8 @@ 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)
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS Headers SDL3)
list(APPEND PC_PRIVATE_REQUIRES "sdl3")
endif()

if(EMSCRIPTEN)
Expand Down Expand Up @@ -230,6 +232,7 @@ if(PHYSFS_BUILD_STATIC)
target_compile_definitions(physfs-static PRIVATE "PHYSFS_STATIC")
endif()
if(PHYSFS_PLATFORM_SDL3)
target_compile_definitions(physfs-static PRIVATE PHYSFS_PLATFORM_SDL3=1)
target_link_libraries(physfs-static PUBLIC SDL3::Headers)
endif()
target_include_directories(physfs-static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
Expand Down Expand Up @@ -260,7 +263,9 @@ if(PHYSFS_BUILD_SHARED)
set_property(TARGET physfs-shared PROPERTY VS_WINRT_COMPONENT TRUE)
endif()
if(PHYSFS_PLATFORM_SDL3)
target_link_libraries(physfs-shared PUBLIC SDL3::SDL3-shared)
target_compile_definitions(physfs-shared PRIVATE PHYSFS_PLATFORM_SDL3=1)
target_link_libraries(physfs-shared PUBLIC SDL3::Headers)
target_link_libraries(physfs-shared PRIVATE 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})
Expand All @@ -283,9 +288,6 @@ 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()
Expand All @@ -305,9 +307,6 @@ 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()
Expand Down Expand Up @@ -375,6 +374,7 @@ if(PHYSFS_INSTALL)
install(FILES LICENSE.txt
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/PhysicsFS${PROJECT_VERSION_MAJOR}")

string(REPLACE ";" " " PC_PRIVATE_REQUIRES "${PC_PRIVATE_REQUIRES}")
configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY)
add_custom_target(uninstall-physfs
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
Expand Down Expand Up @@ -450,6 +450,7 @@ message_bool_option("VDF support" PHYSFS_ARCHIVE_VDF)
message_bool_option("ISO9660 support" PHYSFS_ARCHIVE_ISO9660)
message_bool_option("GOB/LAB/LFD support" PHYSFS_ARCHIVE_LECARCHIVES)
message_bool_option("POD support" PHYSFS_ARCHIVE_POD)
message_bool_option("SDL3 filesystem support" PHYSFS_PLATFORM_SDL3)
message_bool_option("Build static library" PHYSFS_BUILD_STATIC)
message_bool_option("Build shared library" PHYSFS_BUILD_SHARED)
message_bool_option("Build stdio test program" PHYSFS_BUILD_TEST)
Expand Down
8 changes: 8 additions & 0 deletions cmake/PhysFSConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set_package_properties(PhysicsFS PROPERTIES

@PACKAGE_INIT@

set(PHYSFS_PLATFORM_SDL3 @PHYSFS_PLATFORM_SDL3@)

set(PhysFS_PhysFS_FOUND)

set(PhysFS_PhysFS-shared_FOUND)
Expand All @@ -17,6 +19,12 @@ endif()

set(PhysFS_PhysFS-static_FOUND)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/PhysFS-static-targets.cmake")

if(PHYSFS_PLATFORM_SDL3)
include(CMakeFindDependencyMacro)
find_dependency(SDL3)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/PhysFS-static-targets.cmake")
set(PhysFS_PhysFS-static_FOUND TRUE)
set(PhysFS_PhysFS_FOUND TRUE)
Expand Down
1 change: 1 addition & 0 deletions cmake/physfs.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Name: PhysicsFS
Description: PhysicsFS is a library to provide abstract access to various archives.
URL: https://icculus.org/physfs/
Version: @PHYSFS_VERSION@
Requires.private: @PC_PRIVATE_REQUIRES@
Libs: -L${libdir} -lphysfs
Cflags: -I${includedir}
3 changes: 1 addition & 2 deletions test/test_physfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,9 @@ static void cmd_tree_recursive(const char *prefix, const char *fullPath, const c
}
else
{
int file_count;
char **i;
printf("\n");
for (i = rc, file_count = 0; *i != NULL; i++, file_count++) {
for (i = rc; *i != NULL; i++) {
char *newFullPath = malloc(strlen(fullPath) + strlen(*i) + 2);
char *thisPrefix;
strcpy(newFullPath, fullPath);
Expand Down
Loading