xref: /libCEED/examples/python/setup_qfunctions.py (revision 506c99b823b792d61b71c4ce79f89b431690045e)
17b3ff069SJeremy L Thompsonfrom setuptools import setup, Extension
27b3ff069SJeremy L Thompsonfrom sys import platform
37b3ff069SJeremy L Thompsonimport os
47b3ff069SJeremy L Thompson
57b3ff069SJeremy L Thompson# Get CEED directory
67b3ff069SJeremy L Thompsonceed_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
77b3ff069SJeremy L Thompson
87b3ff069SJeremy L Thompson# Include directories
97b3ff069SJeremy L Thompsoninclude_dirs = [os.path.join(ceed_dir, "include")]
107b3ff069SJeremy L Thompson
117b3ff069SJeremy L Thompson# Library directories
127b3ff069SJeremy L Thompsonlibrary_dirs = [os.path.join(ceed_dir, "lib")]
137b3ff069SJeremy L Thompson
147b3ff069SJeremy L Thompson# Source files
157b3ff069SJeremy L Thompsonsources = ["qfunctions/qfunctions.c"]
167b3ff069SJeremy L Thompson
177b3ff069SJeremy L Thompson# Compiler arguments
187b3ff069SJeremy L Thompsonextra_compile_args = []
197b3ff069SJeremy L Thompsonif platform == "linux" or platform == "linux2" or platform == "darwin":
20*d4f9124cSJed Brown    extra_compile_args = ["-O3", "-march=native", "-std=c11"]
217b3ff069SJeremy L Thompson
227b3ff069SJeremy L Thompson# Define the extension module
237b3ff069SJeremy L Thompsonqfunctions = Extension("libceed_c_qfunctions",
247b3ff069SJeremy L Thompson                       sources=sources,
257b3ff069SJeremy L Thompson                       include_dirs=include_dirs,
267b3ff069SJeremy L Thompson                       library_dirs=library_dirs,
277b3ff069SJeremy L Thompson                       libraries=["ceed"],
287b3ff069SJeremy L Thompson                       extra_compile_args=extra_compile_args)
297b3ff069SJeremy L Thompson
307b3ff069SJeremy L Thompson# Setup
317b3ff069SJeremy L Thompsonsetup(name="libceed_c_qfunctions",
327b3ff069SJeremy L Thompson      ext_modules=[qfunctions])
33