-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.py
More file actions
111 lines (96 loc) · 3.6 KB
/
setup.py
File metadata and controls
111 lines (96 loc) · 3.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_PATCH = 5
VERSION_STRING = '%s.%s.%s' % (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH)
__version__ = VERSION_STRING
from setuptools import Extension, setup, find_namespace_packages
from Cython.Build import cythonize
import sys
import glob
import numpy as np
import platform
if sys.version_info[0] == 2:
raise Exception('Python 2.x is no longer supported')
with open("README.md", 'r') as f:
long_description = f.read()
debug_mode = False
if '--debug' in sys.argv:
debug_mode = True
common_src = glob.glob("gomea/src/common/*.cpp") + glob.glob("gomea/src/utils/*.cpp")
fitness_src = glob.glob("gomea/src/fitness/*.cpp") + glob.glob("gomea/src/fitness/benchmarks-rv/*.cpp") + glob.glob("gomea/src/fitness/benchmarks-discrete/*.cpp")
compile_args = ["-std=c++17"]
link_args = ["-std=c++17"]
if debug_mode:
compile_args.extend(['-UNDEBUG','-g'])
link_args.extend(['-UNDEBUG','-g'])
else:
compile_args.extend(['-O3','-g0'])
link_args.extend(['-O3','-g0'])
if platform.system() == "Darwin":
compile_args.extend(["-stdlib=libc++","-mmacosx-version-min=10.15"])
link_args.extend(["-stdlib=libc++","-mmacosx-version-min=10.15"])
if platform.system() == "Windows":
compile_args = ["/std:c++17"]
link_args = []
if debug_mode:
compile_args.extend(['/UNDEBUG','/Zi','/g0'])
else:
compile_args.extend(['/O2'])
extensions = []
extensions.append( Extension("gomea.discrete",
["gomea/discrete.pyx"] + glob.glob("gomea/src/discrete/*.cpp") + common_src + fitness_src,
include_dirs = ["."] + ["gomea/lib/cxxopts-3.1.1/include/"] + [np.get_include()],
language="c++",
extra_compile_args=compile_args,
extra_link_args=link_args)
)
extensions.append( Extension("gomea.real_valued",
["gomea/real_valued.pyx"] + glob.glob("gomea/src/real_valued/*.cpp") + common_src + fitness_src,
include_dirs = ["."] + ["gomea/lib/Eigen"] + [np.get_include()],
language="c++",
extra_compile_args=compile_args,
extra_link_args=link_args,
library_dirs=[],
extra_objects=[])
)
extensions.append( Extension("gomea.fitness",
["gomea/fitness.pyx"] + fitness_src + common_src,
include_dirs = ["."] + [np.get_include()],
language="c++",
extra_compile_args=compile_args,
extra_link_args=link_args)
)
extensions.append( Extension("gomea.linkage",
["gomea/linkage.pyx"] + common_src,
include_dirs = ["."] + [np.get_include()],
language="c++",
extra_compile_args=compile_args,
extra_link_args=link_args)
)
extensions.append( Extension("gomea.output",
["gomea/output.pyx"] + common_src,
include_dirs = ["."] + [np.get_include()],
language="c++",
extra_compile_args=compile_args,
extra_link_args=link_args)
)
setup(
name = "gomea",
description = 'Library for the use of various variants of the Gene-pool Optimal Mixing Evolutionary Algorith (GOMEA).',
author = 'Anton Bouter',
author_email = 'Anton.Bouter@cwi.nl',
url = 'https://github.com/abouter/gomea',
version = __version__,
long_description = long_description,
long_description_content_type = 'text/markdown',
packages=["gomea"],
include_package_data=True,
include_dirs=["gomea"],
ext_modules = cythonize(extensions,
include_path = ["."] + [np.get_include()],
gdb_debug = debug_mode,
language_level = "3"),
python_requires='<3.12',
install_requires=["numpy>=1.23.0","tqdm"],
zip_safe = False
)