8000 rename src/ to physfs/ · Issue #71 · icculus/physfs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rename src/ to physfs/ #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
duarm 8000 opened this issue Nov 14, 2023 · 6 comments
Open

rename src/ to physfs/ #71

duarm opened this issue Nov 14, 2023 · 6 comments

Comments

@duarm
Copy link
duarm commented Nov 14, 2023

just a minor inconvenience, but when opting to just drop physfs into our project (as advised in CMakeLists.txt), it's inconvenient to just add -Ipath/to/physfs/, because we would then we would have to include #include <src/physfs.h>. If we use -Ipath/to/physfs/src/ we would then include #include <physfs.h>.
Because I prefer prefixed headers, I would like to include like this <physfs/physfs.h>, but there's no way without renaming or symlinking or creating a new file.

We also don't have an include/, so one less reason for the src/ folder.

@madebr
Copy link
Contributor
madebr commented Feb 22, 2024

When you drop physfs in your project, you ideally only need to do the following and don't need to worry about include paths:

add_subdirectory(third_party/physfs)
target_link_libraries(mygame PRIVATE PhysFS::PhysFS)

Thanks to these lines:

target_include_directories(physfs-static PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")

target_include_directories(physfs PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")

@duarm
Copy link
Author
duarm commented Feb 23, 2024

I'm not using cmake, thanks for the tip anyway. This issue is just a suggestion, because I much prefer prefixed includes like <physfs/physfs.h>. If you're dropping physfs onto your project, you can just rename src/ to physfs/, or just symlink src to physfs/ if you don't want to mess with the git tree

@madebr
Copy link
Contributor
madebr commented Feb 23, 2024

Your issue/nuisance is valid though. For SDL3, the headers were moved to include/SDL3. Projects now can include SDL3/SDL.h, no matter how they get SDL3.
A PhysicsFS install prefix currently looks as below, so we would need to move physfs.h to an include folder (and no physfs subfolder).

prefix
├── bin
│   └── test_physfs
├── include
│   └── physfs.h
└── lib
    ├── cmake
    │   └── PhysFS
    │       ├── PhysFSConfig.cmake
    │       └── PhysFSConfig-debug.cmake
    ├── libphysfs.a
    ├── libphysfs.so -> libphysfs.so.1
    ├── libphysfs.so.1 -> libphysfs.so.3.3.0
    ├── libphysfs.so.3.3.0
    └── pkgconfig
        └── physfs.pc

@madebr
Copy link
Contributor
madebr commented Feb 23, 2024

See #76

@icculus
Copy link
Owner
icculus commented Feb 23, 2024

Let's do this, but for PhysicsFS 4. Changing it now would be a surprising change to most people using the code that probably breaks their builds.

In the meantime, a hack would be to make a physfs.h file in whatever directory makes sense for your project, that simply contains #include "../somewhere_else/physfs/src/physfs.h" and maybe a link to this issue in a comment.

And maybe an extra comment cursing my name for being difficult. :)

@madebr
Copy link
Contributor
madebr commented Feb 23, 2024

In the meantime, a hack would be to make a physfs.h file in whatever directory makes sense for your project, that simply contains #include "../somewhere_else/physfs/src/physfs.h" and maybe a link to this issue in a comment.

I've removed the header move in #41.
Perhaps there's no issue at all here.

In the SDL2 branch, headers are stored in a include subfolder. Installed headers in <prefix>/include/SDL2.
So you couldn't do #include <SDL2/SDL.h>.
This is no problem with PhysicsFS, because you can only do #include <physfs.h>.
Doing #include <physfs/physfs.h> is "not supported" by this project's build scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
0