xref: /libCEED/examples/python/setup_qfunctions.py (revision 7b3ff0698626cc2e5ce463afc10290072fd55c90)
1*7b3ff069SJeremy L Thompsonfrom setuptools import setup, Extension
2*7b3ff069SJeremy L Thompsonfrom sys import platform
3*7b3ff069SJeremy L Thompsonimport os
4*7b3ff069SJeremy L Thompson
5*7b3ff069SJeremy L Thompson# Get CEED directory
6*7b3ff069SJeremy L Thompsonceed_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
7*7b3ff069SJeremy L Thompson
8*7b3ff069SJeremy L Thompson# Include directories
9*7b3ff069SJeremy L Thompsoninclude_dirs = [os.path.join(ceed_dir, "include")]
10*7b3ff069SJeremy L Thompson
11*7b3ff069SJeremy L Thompson# Library directories
12*7b3ff069SJeremy L Thompsonlibrary_dirs = [os.path.join(ceed_dir, "lib")]
13*7b3ff069SJeremy L Thompson
14*7b3ff069SJeremy L Thompson# Source files
15*7b3ff069SJeremy L Thompsonsources = ["qfunctions/qfunctions.c"]
16*7b3ff069SJeremy L Thompson
17*7b3ff069SJeremy L Thompson# Compiler arguments
18*7b3ff069SJeremy L Thompsonextra_compile_args = []
19*7b3ff069SJeremy L Thompsonif platform == "linux" or platform == "linux2" or platform == "darwin":
20*7b3ff069SJeremy L Thompson    extra_compile_args = ["-O3", "-march=native", "-std=c99"]
21*7b3ff069SJeremy L Thompson
22*7b3ff069SJeremy L Thompson# Define the extension module
23*7b3ff069SJeremy L Thompsonqfunctions = Extension("libceed_c_qfunctions",
24*7b3ff069SJeremy L Thompson                       sources=sources,
25*7b3ff069SJeremy L Thompson                       include_dirs=include_dirs,
26*7b3ff069SJeremy L Thompson                       library_dirs=library_dirs,
27*7b3ff069SJeremy L Thompson                       libraries=["ceed"],
28*7b3ff069SJeremy L Thompson                       extra_compile_args=extra_compile_args)
29*7b3ff069SJeremy L Thompson
30*7b3ff069SJeremy L Thompson# Setup
31*7b3ff069SJeremy L Thompsonsetup(name="libceed_c_qfunctions",
32*7b3ff069SJeremy L Thompson      ext_modules=[qfunctions])
33