shaibu01/Titan-Engine
0
1"""2TITAN QUANT-OS: C++ COMPILER (v100.0 - STABLE CORE EDITION)3TYPE: PyBind11 Build Script4FEATURES: NumPy Header Injection, C++17 Fast-Math5UPGRADE: OpenMP strictly disabled to prevent Docker Segfaults (-11).6"""7 8import os9import sys10from setuptools import setup, Extension11 12# Ensure critical build dependencies are available before compiling13try:14 import pybind1115except ImportError:16 print("❌ FATAL: pybind11 is not installed. Please add pybind11 to your requirements.txt.")17 sys.exit(1)18 19try:20 import numpy as np21except ImportError:22 print("❌ FATAL: numpy is not installed. Please add numpy to your requirements.txt.")23 sys.exit(1)24 25# Institutional Grade Compiler Flags26# 🚨 THE FIX: -fopenmp has been completely eradicated to prevent Linux memory explosions.27compiler_args = [28 '-O3', # Maximum optimization level for speed29 '-std=c++17', # Modern C++17 standard for maximum PyBind11/NumPy compatibility30 '-ffast-math', # Aggressive floating-point math optimizations31 '-fPIC' # CRITICAL: Position Independent Code (Prevents memory segment crashes)32]33 34linker_args = []35 36ext_modules = [37 Extension(38 'titan_engine',39 ['titan_engine.cpp'],40 include_dirs=[41 pybind11.get_include(),42 np.get_include() # Injects NumPy C-headers into the compiler43 ],44 language='c++',45 extra_compile_args=compiler_args,46 extra_link_args=linker_args47 ),48]49 50setup(51 name='titan_engine',52 version='100.0',53 author='Titan Quant',54 description='C++ Accelerated Math Kernel for Titan OS',55 ext_modules=ext_modules,56)