-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
38 lines (29 loc) · 882 Bytes
/
setup.py
File metadata and controls
38 lines (29 loc) · 882 Bytes
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
# Copyright (c) 2022-2025 Blecic and Cubillos
# chemcat is open-source software under the GPL-2.0 license (see LICENSE)
import os
import re
import setuptools
from setuptools import setup, Extension
from numpy import get_include
srcdir = 'src_c/' # C-code source folder
incdir = 'src_c/include/' # Include filder with header files
cfiles = os.listdir(srcdir)
cfiles = list(filter(lambda x: re.search('.+[.]c$', x), cfiles))
cfiles = list(filter(lambda x: not re.search('[.#].+[.]c$', x), cfiles))
inc = [get_include(), incdir]
eca = ['-lm', '-O3', '-ffast-math']
ela = ['-lm']
extensions = [
Extension(
'chemcat.lib.' + cfile.rstrip('.c'),
sources=[f'{srcdir}{cfile}'],
include_dirs=inc,
extra_compile_args=eca,
extra_link_args=ela,
)
for cfile in cfiles
]
setup(
include_dirs = inc,
ext_modules = extensions,
)