@@ -10,7 +10,7 @@ option(ZK_BUILD_SHARED "ZenKit: Build a shared library." OFF)
1010option (ZK_ENABLE_ASAN "ZenKit: Enable sanitizers in debug builds." ON )
1111option (ZK_ENABLE_DEPRECATION "ZenKit: Enable deprecation warnings." ON )
1212option (ZK_ENABLE_INSTALL "ZenKit: Enable CMake install target creation." ON )
13- option (ZK_ENABLE_MMAP "ZenKit: Build ZenKit with memory-mapping support ." ON )
13+ option (ZK_ENABLE_MMAP "ZenKit: Build ZenKit with memory-mapping if supported by platform ." ON )
1414option (ZK_ENABLE_FUTURE "ZenKit: Enable breaking changes to be release in a future version" OFF )
1515
1616add_subdirectory (vendor)
@@ -118,18 +118,25 @@ bs_select_cflags(${ZK_ENABLE_ASAN} _ZK_COMPILE_FLAGS _ZK_LINK_FLAGS)
118118bs_check_posix_mmap(_ZK_HAS_MMAP_POSIX)
119119bs_check_win32_mmap(_ZK_HAS_MMAP_WIN32)
120120
121- if (ZK_ENABLE_MMAP AND (_ZK_HAS_MMAP_POSIX OR _ZK_HAS_MMAP_WIN32))
122- if (_ZK_HAS_MMAP_POSIX)
123- message (STATUS "ZenKit: Building with POSIX memory mapping support" )
124- list (APPEND _ZK_SOURCES src/MmapPosix.cc)
125- target_compile_definitions (zenkit PUBLIC _ZK_WITH_MMAP=1)
126- elseif (_ZK_HAS_MMAP_WIN32)
127- message (STATUS "ZenKit: Building with Windows memory mapping support" )
128- list (APPEND _ZK_SOURCES src/MmapWin32.cc)
121+ if (_ZK_HAS_MMAP_POSIX)
122+ message (STATUS "ZenKit: POSIX memory mapping available" )
123+ list (APPEND _ZK_SOURCES src/MmapPosix.cc)
124+ target_compile_definitions (zenkit PUBLIC _ZK_MMAP_AVAILABLE=1)
125+ elseif (_ZK_HAS_MMAP_WIN32)
126+ message (STATUS "ZenKit: Windows memory mapping available" )
127+ list (APPEND _ZK_SOURCES src/MmapWin32.cc)
128+ target_compile_definitions (zenkit PUBLIC _ZK_MMAP_AVAILABLE=1)
129+ endif ()
130+
131+ if (ZK_ENABLE_MMAP)
132+ if (_ZK_HAS_MMAP_POSIX OR _ZK_HAS_MMAP_WIN32)
133+ message (STATUS "ZenKit: Memory mapping enabled" )
129134 target_compile_definitions (zenkit PUBLIC _ZK_WITH_MMAP=1)
135+ elseif (ZK_ENABLE_MMAP)
136+ message (WARNING "ZenKit: Memory mapping enabled but not supported!" )
130137 endif ()
131138else ()
132- message (WARNING "ZenKit: Building WITHOUT memory mapping support " )
139+ message (STATUS "ZenKit: Memory mapping disabled " )
133140endif ()
134141
135142target_sources (zenkit PRIVATE ${_ZK_SOURCES} ${_ZK_HEADERS} )
0 commit comments