OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
setup.in.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # This file (setup.in.py) is a template, which cmakes uses to generate setup.py
4 # in build directory where it can be used for installation into python environment.
5 
6 from Cython.Build import cythonize
7 from distutils.core import setup, Extension
8 
9 import os
10 import sys
11 import numpy as np
12 import pyarrow as pa
13 
14 root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
15 
16 # conda-forge packages omniscidbe and pyomniscidbe are built
17 # separately. OMNISCI_ROOT_PATH is defined by the omniscidbe activate
18 # script that determines the location of libDBEngine.so and is
19 # required for linking Python extension module omniscidbe.
20 extra_library_dirs = []
21 if 'OMNISCI_ROOT_PATH' in os.environ:
22  extra_library_dirs.append(os.path.join(os.environ['OMNISCI_ROOT_PATH'], 'lib'))
23 
24 dbe = Extension(
25  "omniscidbe",
26  ["@CMAKE_CURRENT_SOURCE_DIR@/Python/dbe.pyx"],
27  language="c++17",
28  include_dirs=[
29  np.get_include(),
30  pa.get_include(),
31  root,
32  "@CMAKE_SOURCE_DIR@",
33  "@CMAKE_CURRENT_SOURCE_DIR@",
34  "@CMAKE_SOURCE_DIR@/ThirdParty/rapidjson",
35  "@CMAKE_SOURCE_DIR@/Distributed/os",
36  ],
37  library_dirs=pa.get_library_dirs() + ["@CMAKE_CURRENT_BINARY_DIR@", "."] + extra_library_dirs,
38  runtime_library_dirs=pa.get_library_dirs() + ["$ORIGIN/../../"] + extra_library_dirs,
39  libraries=pa.get_libraries() + ["DBEngine", "boost_system"],
40  extra_compile_args=["-std=c++17", "-DRAPIDJSON_HAS_STDSTRING"],
41 )
42 # Try uncommenting the following line on Linux
43 # if you get weird linker errors or runtime crashes
44 # dbe.define_macros.append(("_GLIBCXX_USE_CXX11_ABI", "0"))
45 
46 # "fat" wheel
47 data_files = []
48 if False: # TODO: implement an option?
49  data_files = [
50  ("lib", ["$<TARGET_FILE:DBEngine>"]),
51  (
52  "bin",
53  ["@CMAKE_BINARY_DIR@/bin/calcite-1.0-SNAPSHOT-jar-with-dependencies.jar"],
54  ),
55  (
56  "QueryEngine",
57  [
58  "@CMAKE_BINARY_DIR@/QueryEngine/RuntimeFunctions.bc",
59  "@CMAKE_BINARY_DIR@/QueryEngine/ExtensionFunctions.ast",
60  ],
61  ),
62  (
63  "include",
64  [
65  "@CMAKE_CURRENT_SOURCE_DIR@/DBEngine.h",
66  "@CMAKE_CURRENT_SOURCE_DIR@/DBEngine.pxd",
67  ],
68  ),
69  ]
70 
71 setup(
72  name="omniscidbe",
73  version="0.1",
74  ext_modules=cythonize(
75  dbe,
76  compiler_directives={
77  "c_string_type": "str",
78  "c_string_encoding": "utf8",
79  "language_level": "3",
80  },
81  include_path=[
82  "@CMAKE_CURRENT_SOURCE_DIR@",
83  "@CMAKE_CURRENT_SOURCE_DIR@/Python",
84  ],
85  ),
86  data_files=data_files,
87 )
Definition: setup.in.py:1