-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup.py
More file actions
59 lines (48 loc) · 1.6 KB
/
Copy pathsetup.py
File metadata and controls
59 lines (48 loc) · 1.6 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This file is part of "echion" which is released under MIT.
#
# Copyright (c) 2023 Gabriele N. Tornetta <phoenix1987@gmail.com>.
import os
import sys
from pathlib import Path
from setuptools import Extension
from setuptools import find_packages
from setuptools import setup
PLATFORM = sys.platform.lower()
DISABLE_NATIVE = os.environ.get("UNWIND_NATIVE_DISABLE")
LDADD = {
"linux": ["-l:libunwind.a", "-l:liblzma.a"] if not DISABLE_NATIVE else [],
}
# add option to colorize compiler output
COLORS = [
"-fdiagnostics-color=always" if PLATFORM == "linux" else "-fcolor-diagnostics"
]
if PLATFORM == "darwin":
CFLAGS = ["-mmacosx-version-min=10.15"]
else:
CFLAGS = []
if DISABLE_NATIVE:
CFLAGS += ["-DUNWIND_NATIVE_DISABLE"]
echionmodule = Extension(
"echion.core",
sources=["echion/coremodule.cc", "echion/frame.cc", "echion/render.cc", "echion/danger.cc"],
include_dirs=["."],
define_macros=[(f"PL_{PLATFORM.upper()}", None)],
extra_compile_args=["-std=c++17", "-Wall", "-Wextra"] + CFLAGS + COLORS,
extra_link_args=LDADD.get(PLATFORM, []),
libraries=["unwind", "lzma"] if (PLATFORM != "darwin" and not DISABLE_NATIVE) else []
)
setup(
name="echion",
author="Gabriele N. Tornetta",
description="In-process Python sampling profiler",
long_description=Path("README.md")
.read_text()
.replace(
'src="art/', 'src="https://raw.githubusercontent.com/P403n1x87/echion/main/art/'
),
ext_modules=[echionmodule],
entry_points={
"console_scripts": ["echion=echion.__main__:main"],
},
packages=find_packages(exclude=["tests"]),
)