-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup.py
More file actions
66 lines (57 loc) · 1.93 KB
/
setup.py
File metadata and controls
66 lines (57 loc) · 1.93 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
import sys
from setuptools import setup, find_packages, Extension
from pybind11.setup_helpers import Pybind11Extension, build_ext
from copy import copy
debug = False
# debug = True
optimization = True
base_args = ["-DRL_TOOLS_ENABLE_JSON"]
compile_args = {k:copy(base_args) for k in ['msvc', 'unix', 'macos']}
# Define platform-specific compile and link arguments
if optimization:
compile_args['msvc'] += ['/O2', '/fp:fast']
compile_args['unix'] += ['-Ofast', '-march=native', '-fmax-errors=1', '-fopenmp']
compile_args['macos'] += ['-Ofast', '-march=native', '-mmacosx-version-min=10.14']
if debug:
compile_args['msvc'] += ['/Zi', '/Od', '/D_DEBUG']
compile_args['unix'] += ['-g', '-D_DEBUG', '-w', '-fmax-errors=1']
compile_args['macos'] += ['-g', '-D_DEBUG']
link_args = {
'msvc': [],
'unix': ['-fopenmp'],
'macos': [],
}
# Determine the platform and select the appropriate arguments
if sys.platform == "win32":
compile_args['current'] = compile_args['msvc']
link_args['current'] = link_args['msvc']
elif sys.platform == "darwin":
compile_args['current'] = compile_args['macos']
link_args['current'] = link_args['macos']
else:
compile_args['current'] = compile_args['unix']
link_args['current'] = link_args['unix']
print(f"Compile args: {compile_args['current']}")
ext_modules = [
Pybind11Extension(
"l2f.interface",
["l2f/interface.cpp"],
include_dirs=[
"external/rl-tools/include",
"external/json"
],
extra_compile_args=compile_args['current'],
extra_link_args=link_args['current'],
),
]
setup(
name="l2f",
version="0.0.1",
description="Python bindings for the L2F (Learning to Fly) Simulator",
author="Jonas Eschmann",
author_email="jonas.eschmann@gmail.com",
packages=find_packages(include=['l2f']),
include_package_data=True,
ext_modules=ext_modules,
cmdclass={"build_ext": build_ext},
)