summaryrefslogtreecommitdiff
path: root/source/luametatex/cmake/mimalloc.cmake
blob: 78d3944e240a8184713bebaece1ad056e0189314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
include("source/libraries/mimalloc/cmake/mimalloc-config-version.cmake")

set(mimalloc_sources

    source/libraries/mimalloc/src/stats.c
    source/libraries/mimalloc/src/random.c
    source/libraries/mimalloc/src/os.c
    source/libraries/mimalloc/src/bitmap.c
    source/libraries/mimalloc/src/arena.c
 #  source/libraries/mimalloc/src/region.c
    source/libraries/mimalloc/src/segment-cache.c
    source/libraries/mimalloc/src/segment.c
    source/libraries/mimalloc/src/page.c
    source/libraries/mimalloc/src/alloc.c
    source/libraries/mimalloc/src/alloc-aligned.c
    source/libraries/mimalloc/src/alloc-posix.c
    source/libraries/mimalloc/src/heap.c
    source/libraries/mimalloc/src/options.c
    source/libraries/mimalloc/src/init.c
)

add_library(mimalloc STATIC ${mimalloc_sources})

# set(CMAKE_C_STANDARD 11)
# set(CMAKE_CXX_STANDARD 17)

target_include_directories(mimalloc PRIVATE
    source/libraries/mimalloc
    source/libraries/mimalloc/src
    source/libraries/mimalloc/include
)

target_compile_definitions(mimalloc PRIVATE
    MIMALLOC_LARGE_OS_PAGES=1
    MI_DEBUG=0
    MI_SECURE=0
)

if (NOT MSVC)
    target_compile_options(mimalloc PRIVATE
        -Wno-cast-align
        -Wno-cast-qual
    )
endif ()