Skip to content

Commit 8c77b9a

Browse files
committed
Added lib-mimalloc
1 parent c06ef50 commit 8c77b9a

3 files changed

Lines changed: 117 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from utils import *
2+
from mlc import utils
3+
import os
4+
import subprocess
5+
6+
7+
def preprocess(i):
8+
9+
env = i['env']
10+
state = i['state']
11+
12+
os_info = i['os_info']
13+
14+
cmake_command = f"""{env['MLC_CMAKE_BIN_WITH_PATH']} .. """
15+
16+
if env.get('MLC_MIMALLOC_CONFIG', '') != '':
17+
cmake_command += f""" {env['MLC_MIMALLOC_CONFIG'].replace("'", "")} """
18+
19+
env['MLC_MIMALLOC_CMAKE_COMMAND'] = cmake_command
20+
21+
return {'return': 0}
22+
23+
24+
def postprocess(i):
25+
26+
env = i['env']
27+
state = i['state']
28+
29+
os_info = i['os_info']
30+
31+
lib_path = os.path.join(os.getcwd(), "obj", "lib")
32+
33+
env['+LD_LIBRARY_PATH'] = [lib_path]
34+
env['MLC_MIMALLOC_PATH'] = os.path.dirname(lib_path)
35+
env['MLC_MIMALLOC_LIB_PATH'] = lib_path
36+
env['MLC_DEPENDENT_CACHED_PATH'] = os.path.join(lib_path, "libmimalloc.so")
37+
38+
return {'return': 0}

script/get-lib-mimalloc/meta.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
alias: get-lib-mimalloc
2+
automation_alias: script
3+
automation_uid: 5b4e0237da074764
4+
cache: true
5+
category: Detection or installation of tools and artifacts
6+
deps:
7+
- env:
8+
MLC_GIT_CHECKOUT_PATH_ENV_NAME: MLC_MIMALLOC_SRC_PATH
9+
extra_cache_tags: mimalloc,repo,mimalloc-repo
10+
force_env_keys:
11+
- MLC_GIT_*
12+
names:
13+
- mimalloc-repo
14+
tags: get,git,repo
15+
update_tags_from_env_with_prefix:
16+
_branch.:
17+
- MLC_GIT_CHECKOUT
18+
_repo.:
19+
- MLC_GIT_URL
20+
_sha.:
21+
- MLC_GIT_SHA
22+
_submodules.:
23+
- MLC_GIT_SUBMODULES
24+
- tags: get,cmake
25+
- env:
26+
MLC_GENERIC_SYS_UTIL_IGNORE_MISSING_PACKAGE: true
27+
tags: get,generic-sys-util,_build-essential
28+
new_env_keys:
29+
- MLC_MIMALLOC_PATH
30+
- MLC_MIMALLOC_LIB_PATH
31+
- +LD_LIBRARY_PATH
32+
new_state_keys: []
33+
post_deps: []
34+
posthook_deps: []
35+
prehook_deps: []
36+
tags:
37+
- get-lib-mimalloc
38+
- get
39+
- lib
40+
- mimalloc
41+
tests:
42+
run_inputs:
43+
- variations_list:
44+
- branch.main
45+
uid: 81d0dc1269fe41cc
46+
variations:
47+
branch.#:
48+
env:
49+
MLC_GIT_CHECKOUT: '#'
50+
config.#:
51+
env:
52+
MLC_MIMALLOC_CONFIG: '#'
53+
sha.#:
54+
env:
55+
MLC_GIT_SHA: '#'
56+
url.#:
57+
env:
58+
MLC_GIT_URL: '#'
59+
group: version
60+
url.official:
61+
default: true
62+
env:
63+
MLC_GIT_URL: https://github.com/microsoft/mimalloc.git
64+
group: version
65+
version.official:
66+
base:
67+
- url.official

script/get-lib-mimalloc/run.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
#Add your run commands here...
6+
# run "$MLC_RUN_CMD"
7+
cd ${MLC_MIMALLOC_SRC_PATH}
8+
mkdir -p obj
9+
cd obj
10+
echo "${MLC_MIMALLOC_CMAKE_COMMAND}"
11+
${MLC_MIMALLOC_CMAKE_COMMAND}
12+
make

0 commit comments

Comments
 (0)