Skip to content

Conversation

Katharsas
Copy link
Contributor

Basically ZenKit is kind of a nice file input library with its Read interface and Mmap class.

So i want to have the option to use Mmap for my own file loading independent of ZenKit usage. So even if ZenKit is configured to not use mmap, i can still use it directly in my own code.

Of course feel free to close if this does not fit very well, i can keep this change rebased on top of ZenKit branch myself if necessary.

@lmichaelis lmichaelis self-assigned this Oct 9, 2025
@lmichaelis lmichaelis added the enhancement New feature or request label Oct 9, 2025
Copy link
Member

@lmichaelis lmichaelis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heyo! I think it would be okay to expose the Mmap interface at all times, however this change is not enough to facilitate that.

We need to distinguish between "compiling with" and "using" memory mapping, so there need to be two different preprocessor defines. One which indicates whether memory-mapping support is available on the platform (which should be used instead of _ZK_WITH_MMAP in the Mmap.hh file) and one which indicates to the rest of ZenKit to actually use its memory-mapping capabilities (this needs to be a new preprocessor definition).

Because of this, it would probably be best to rebase this commit on the new mmap-free branch.

@Katharsas Katharsas force-pushed the feat/always-build-mmap branch from fec9ff3 to 7015057 Compare October 19, 2025 23:32
@Katharsas
Copy link
Contributor Author

Katharsas commented Oct 19, 2025

...

Yeah makes sense, i havent looked at the branch much yet so for now i just implemented it hopefully properly.

@Katharsas Katharsas force-pushed the feat/always-build-mmap branch from 7015057 to 2203d7e Compare October 19, 2025 23:39
Build flag `ZK_ENABLE_MMAP` no longer excludes relevant header and implementation files from build
 -> Users of ZenKit can now use Mmap.hh by themselves even if `ZK_ENABLE_MMAP` is `OFF`
@Katharsas Katharsas force-pushed the feat/always-build-mmap branch from 2203d7e to 3b1fb04 Compare October 19, 2025 23:41
endif ()
else ()
message(WARNING "ZenKit: Building WITHOUT memory mapping support")
message(STATUS "ZenKit: Memory mapping disabled")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also change this back to being warning if you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants