use std::fmt;
pub const COMBINED_PROJECT_NAMES: &[&str] = &[
"cassandra",
"couchbase",
"neo4j",
"influxdb",
"timescaledb",
"etcd",
"consul",
"foundationdb",
"tikv",
"apache_traffic_server",
"haproxy",
"envoy",
"caddy",
"lighttpd",
"uwsgi",
"gunicorn",
"tornado",
"luajit",
"quickjs",
"duktape",
"jerryscript",
"mruby",
"micropython",
"tinygo",
"wren",
"blender",
"ogre3d",
"irrlicht",
"oiio",
"openexr",
"libvpx",
"x264",
"x265",
"libtheora",
"libvorbis",
"opus",
"numpy_core",
"scipy",
"pytorch_cc",
"tensorflow_capi",
"onnx_runtime",
"xgboost",
"lightgbm",
"catboost",
"faiss",
"llama_cpp",
"openssl_full",
"libressl",
"boringssl",
"libsodium",
"botan",
"openssh",
"libssh2",
"gnutls",
"systemd",
"dbus",
"libevent",
"libuv",
"liburing",
"dpdk",
"spdk",
"rdma_core",
];
pub const X86_COMBINED_DEFAULT_PARALLEL_JOBS: usize = 8;
pub const X86_COMBINED_DEFAULT_TIMEOUT_SECS: u64 = 3600;
pub const X86_COMBINED_MAX_JOBS: usize = 64;
pub const X86_COMBINED_BUILD_SCRIPT_TEMPLATE: &str = r#"#!/bin/bash
set -e
PROJECT_ROOT="{{root}}"
BUILD_DIR="{{build_dir}}"
cd "$PROJECT_ROOT" || exit 1
mkdir -p "$BUILD_DIR"
{{configure_cmd}}
{{build_cmd}}
{{install_cmd}}
"#;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum CombinedProjectCategory {
Database,
WebNetwork,
LanguageRuntime,
GraphicsMedia,
ScientificML,
Security,
Systems,
BuildOrchestration,
}
impl CombinedProjectCategory {
pub fn as_str(&self) -> &'static str {
match self {
Self::Database => "database",
Self::WebNetwork => "web_network",
Self::LanguageRuntime => "language_runtime",
Self::GraphicsMedia => "graphics_media",
Self::ScientificML => "scientific_ml",
Self::Security => "security",
Self::Systems => "systems",
Self::BuildOrchestration => "build_orchestration",
}
}
pub fn display_name(&self) -> &'static str {
match self {
Self::Database => "Database/Storage",
Self::WebNetwork => "Web/Network",
Self::LanguageRuntime => "Languages/Runtimes",
Self::GraphicsMedia => "Graphics/Media",
Self::ScientificML => "Scientific/ML",
Self::Security => "Security",
Self::Systems => "Systems",
Self::BuildOrchestration => "Build Orchestration",
}
}
}
impl fmt::Display for CombinedProjectCategory {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.display_name())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CombinedBuildSystem {
CMake,
Make,
Autotools,
Meson,
Bazel,
SCons,
Ninja,
Cargo,
Custom,
Unknown,
}
impl CombinedBuildSystem {
pub fn as_str(&self) -> &'static str {
match self {
Self::CMake => "cmake",
Self::Make => "make",
Self::Autotools => "autotools",
Self::Meson => "meson",
Self::Bazel => "bazel",
Self::SCons => "scons",
Self::Ninja => "ninja",
Self::Cargo => "cargo",
Self::Custom => "custom",
Self::Unknown => "unknown",
}
}
}
impl fmt::Display for CombinedBuildSystem {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.as_str())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum CombinedSimdLevel {
None,
MMX,
SSE,
SSE2,
SSE3,
SSSE3,
SSE41,
SSE42,
AVX,
AVX2,
AVX512F,
}
impl CombinedSimdLevel {
pub fn to_march(&self) -> Option<&'static str> {
match self {
Self::None => None,
Self::MMX => Some("-mmmx"),
Self::SSE => Some("-msse"),
Self::SSE2 => Some("-msse2"),
Self::SSE3 => Some("-msse3"),
Self::SSSE3 => Some("-mssse3"),
Self::SSE41 => Some("-msse4.1"),
Self::SSE42 => Some("-msse4.2"),
Self::AVX => Some("-mavx"),
Self::AVX2 => Some("-mavx2"),
Self::AVX512F => Some("-mavx512f"),
}
}
pub fn to_defines(&self) -> Vec<&'static str> {
match self {
Self::None => vec![],
Self::MMX => vec!["__MMX__"],
Self::SSE => vec!["__SSE__"],
Self::SSE2 => vec!["__SSE2__"],
Self::SSE3 => vec!["__SSE3__"],
Self::SSSE3 => vec!["__SSSE3__"],
Self::SSE41 => vec!["__SSE4_1__"],
Self::SSE42 => vec!["__SSE4_2__"],
Self::AVX => vec!["__AVX__"],
Self::AVX2 => vec!["__AVX2__"],
Self::AVX512F => vec!["__AVX512F__"],
}
}
}
impl Default for CombinedSimdLevel {
fn default() -> Self {
Self::SSE2
}
}
impl fmt::Display for CombinedSimdLevel {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::None => write!(f, "none"),
Self::MMX => write!(f, "mmx"),
Self::SSE => write!(f, "sse"),
Self::SSE2 => write!(f, "sse2"),
Self::SSE3 => write!(f, "sse3"),
Self::SSSE3 => write!(f, "ssse3"),
Self::SSE41 => write!(f, "sse4.1"),
Self::SSE42 => write!(f, "sse4.2"),
Self::AVX => write!(f, "avx"),
Self::AVX2 => write!(f, "avx2"),
Self::AVX512F => write!(f, "avx512f"),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CombinedProjectVersion {
pub major: u32,
pub minor: u32,
pub patch: u32,
pub pre_release: Option<String>,
pub build_metadata: Option<String>,
}
impl CombinedProjectVersion {
pub fn new(major: u32, minor: u32, patch: u32) -> Self {
Self {
major,
minor,
patch,
pre_release: None,
build_metadata: None,
}
}
pub fn parse(s: &str) -> Option<Self> {
let (num_part, extra) = match s.find('-') {
Some(idx) => (&s[..idx], Some(&s[idx + 1..])),
None => (s, None),
};
let parts: Vec<&str> = num_part.split('.').collect();
if parts.len() < 2 {
return None;
}
let major = parts.get(0).and_then(|x| x.parse().ok())?;
let minor = parts.get(1).and_then(|x| x.parse().ok())?;
let patch = parts.get(2).and_then(|x| x.parse().ok()).unwrap_or(0);
let (pre_release, build_metadata) = match extra {
Some(extra_str) => {
if let Some(plus) = extra_str.find('+') {
(
Some(extra_str[..plus].to_string()),
Some(extra_str[plus + 1..].to_string()),
)
} else {
(Some(extra_str.to_string()), None)
}
}
None => (None, None),
};
Some(Self {
major,
minor,
patch,
pre_release,
build_metadata,
})
}
pub fn to_string(&self) -> String {
let mut s = format!("{}.{}.{}", self.major, self.minor, self.patch);
if let Some(ref pre) = self.pre_release {
s.push_str(&format!("-{}", pre));
}
if let Some(ref meta) = self.build_metadata {
s.push_str(&format!("+{}", meta));
}
s
}
}
impl fmt::Display for CombinedProjectVersion {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.to_string())
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CombinedArch {
X86_64,
X86_32,
X86_X32,
}
impl CombinedArch {
pub fn pointer_width(&self) -> u32 {
match self {
Self::X86_64 => 64,
Self::X86_32 => 32,
Self::X86_X32 => 32,
}
}
pub fn as_str(&self) -> &'static str {
match self {
Self::X86_64 => "x86_64",
Self::X86_32 => "i686",
Self::X86_X32 => "x32",
}
}
pub fn to_triple(&self) -> &'static str {
match self {
Self::X86_64 => "x86_64-unknown-linux-gnu",
Self::X86_32 => "i686-unknown-linux-gnu",
Self::X86_X32 => "x86_64-unknown-linux-gnux32",
}
}
pub fn is_64bit(&self) -> bool {
matches!(self, Self::X86_64)
}
}
impl Default for CombinedArch {
fn default() -> Self {
Self::X86_64
}
}
impl fmt::Display for CombinedArch {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.as_str())
}
}
pub trait X86CombinedProjectConfigurable {
fn name(&self) -> &'static str;
fn version(&self) -> CombinedProjectVersion;
fn category(&self) -> CombinedProjectCategory;
fn sources(&self) -> Vec<String>;
fn defines(&self) -> Vec<(String, Option<String>)>;
fn includes(&self) -> Vec<String>;
fn compiler_flags(&self) -> Vec<String>;
fn linker_flags(&self) -> Vec<String>;
fn libraries(&self) -> Vec<String>;
fn compile_database(&self) -> Vec<CombinedCompileEntry>;
fn test_commands(&self) -> Vec<String>;
fn build_system(&self) -> CombinedBuildSystem;
fn simd_level(&self) -> CombinedSimdLevel;
fn notes(&self) -> Option<&'static str> {
None
}
}
#[derive(Debug, Clone)]
pub struct CombinedCompileEntry {
pub directory: String,
pub source_file: String,
pub output_file: String,
pub command: String,
pub flags: Vec<String>,
pub defines: Vec<(String, Option<String>)>,
}
impl CombinedCompileEntry {
pub fn new(directory: &str, source: &str) -> Self {
Self {
directory: directory.to_string(),
source_file: source.to_string(),
output_file: String::new(),
command: String::new(),
flags: Vec::new(),
defines: Vec::new(),
}
}
}
#[derive(Debug, Clone)]
pub struct CombinedBuildResult {
pub project_name: String,
pub success: bool,
pub duration_ms: u64,
pub binary_size_bytes: u64,
pub errors: Vec<String>,
pub warnings: Vec<String>,
pub exit_code: i32,
}
impl CombinedBuildResult {
pub fn new(name: &str) -> Self {
Self {
project_name: name.to_string(),
success: false,
duration_ms: 0,
binary_size_bytes: 0,
errors: Vec::new(),
warnings: Vec::new(),
exit_code: -1,
}
}
pub fn is_success(&self) -> bool {
self.success && self.errors.is_empty()
}
pub fn summary(&self) -> String {
format!(
"{}: {} ({}ms, {} bytes, {} errors, {} warnings)",
self.project_name,
if self.success { "OK" } else { "FAIL" },
self.duration_ms,
self.binary_size_bytes,
self.errors.len(),
self.warnings.len(),
)
}
}
#[derive(Debug, Clone)]
pub struct CombinedTestResult {
pub project_name: String,
pub suite_name: String,
pub total: usize,
pub passed: usize,
pub failed: usize,
pub skipped: usize,
pub duration_ms: u64,
pub failures: Vec<(String, String)>, }
impl CombinedTestResult {
pub fn new(project: &str, suite: &str) -> Self {
Self {
project_name: project.to_string(),
suite_name: suite.to_string(),
total: 0,
passed: 0,
failed: 0,
skipped: 0,
duration_ms: 0,
failures: Vec::new(),
}
}
pub fn all_passed(&self) -> bool {
self.failed == 0
}
pub fn pass_rate(&self) -> f64 {
if self.total == 0 {
100.0
} else {
(self.passed as f64 / self.total as f64) * 100.0
}
}
pub fn summary(&self) -> String {
format!(
"{}::{}: {}/{} passed ({:.1}%), {} failed, {} skipped ({}ms)",
self.project_name,
self.suite_name,
self.passed,
self.total,
self.pass_rate(),
self.failed,
self.skipped,
self.duration_ms,
)
}
}
pub struct X86ProjectsCombined {
pub arch: CombinedArch,
pub configs: Vec<Box<dyn X86CombinedProjectConfigurable>>,
pub build_orchestrator: CombinedBuildOrchestrator,
pub cross_compile: CombinedCrossCompileConfig,
pub test_suite: CombinedTestSuite,
pub build_results: Vec<CombinedBuildResult>,
pub test_results: Vec<CombinedTestResult>,
pub verbose: bool,
}
impl Clone for X86ProjectsCombined {
fn clone(&self) -> Self {
Self {
arch: self.arch,
configs: Vec::new(),
build_orchestrator: self.build_orchestrator.clone(),
cross_compile: self.cross_compile.clone(),
test_suite: self.test_suite.clone(),
build_results: self.build_results.clone(),
test_results: self.test_results.clone(),
verbose: self.verbose,
}
}
}
#[derive(Debug, Clone)]
pub struct CombinedBuildOrchestrator {
pub build_root: String,
pub parallel_jobs: usize,
pub timeout_secs: u64,
pub incremental: bool,
pub clean_first: bool,
pub use_ccache: bool,
pub generate_cdb: bool,
pub cdb_output_path: String,
pub stop_on_error: bool,
pub max_retries: usize,
pub build_order: Vec<String>,
pub active_builds: usize,
}
impl Default for CombinedBuildOrchestrator {
fn default() -> Self {
Self {
build_root: "build/combined".into(),
parallel_jobs: X86_COMBINED_DEFAULT_PARALLEL_JOBS,
timeout_secs: X86_COMBINED_DEFAULT_TIMEOUT_SECS,
incremental: true,
clean_first: false,
use_ccache: true,
generate_cdb: true,
cdb_output_path: "build/combined/compile_commands.json".into(),
stop_on_error: false,
max_retries: 2,
build_order: Vec::new(),
active_builds: 0,
}
}
}
impl CombinedBuildOrchestrator {
pub fn with_parallel(mut self, jobs: usize) -> Self {
self.parallel_jobs = jobs.min(X86_COMBINED_MAX_JOBS);
self
}
pub fn with_timeout(mut self, secs: u64) -> Self {
self.timeout_secs = secs;
self
}
pub fn determine_build_order(&mut self, configs: &[Box<dyn X86CombinedProjectConfigurable>]) {
self.build_order = configs.iter().map(|c| c.name().to_string()).collect();
}
pub fn estimate_max_memory_mb(&self) -> u64 {
self.parallel_jobs as u64 * 512
}
pub fn describe(&self) -> String {
format!(
"BuildOrchestrator {{ root: {}, jobs: {}, timeout: {}s, incremental: {}, ccache: {} }}",
self.build_root,
self.parallel_jobs,
self.timeout_secs,
self.incremental,
self.use_ccache,
)
}
}
#[derive(Debug, Clone)]
pub struct CombinedCrossCompileConfig {
pub enabled: bool,
pub host_triple: String,
pub target_triple: String,
pub sysroot: String,
pub toolchain_file: Option<String>,
pub cross_prefix: String,
pub target_cflags: Vec<String>,
pub target_ldflags: Vec<String>,
pub emulate_host_build: bool,
}
impl Default for CombinedCrossCompileConfig {
fn default() -> Self {
Self {
enabled: false,
host_triple: "x86_64-unknown-linux-gnu".into(),
target_triple: "x86_64-unknown-linux-gnu".into(),
sysroot: "/usr/x86_64-linux-gnu".into(),
toolchain_file: None,
cross_prefix: String::new(),
target_cflags: Vec::new(),
target_ldflags: Vec::new(),
emulate_host_build: false,
}
}
}
impl CombinedCrossCompileConfig {
pub fn for_arm64(mut self) -> Self {
self.enabled = true;
self.target_triple = "aarch64-unknown-linux-gnu".into();
self.sysroot = "/usr/aarch64-linux-gnu".into();
self.cross_prefix = "aarch64-linux-gnu-".into();
self.target_cflags = vec![
"-march=armv8-a".into(),
"--sysroot=/usr/aarch64-linux-gnu".into(),
];
self.target_ldflags = vec!["--sysroot=/usr/aarch64-linux-gnu".into()];
self
}
pub fn for_arm32(mut self) -> Self {
self.enabled = true;
self.target_triple = "armv7-unknown-linux-gnueabihf".into();
self.sysroot = "/usr/arm-linux-gnueabihf".into();
self.cross_prefix = "arm-linux-gnueabihf-".into();
self.target_cflags = vec![
"-march=armv7-a".into(),
"-mfpu=neon".into(),
"--sysroot=/usr/arm-linux-gnueabihf".into(),
];
self.target_ldflags = vec!["--sysroot=/usr/arm-linux-gnueabihf".into()];
self
}
pub fn for_riscv64(mut self) -> Self {
self.enabled = true;
self.target_triple = "riscv64-unknown-linux-gnu".into();
self.sysroot = "/usr/riscv64-linux-gnu".into();
self.cross_prefix = "riscv64-linux-gnu-".into();
self.target_cflags = vec![
"-march=rv64gc".into(),
"--sysroot=/usr/riscv64-linux-gnu".into(),
];
self.target_ldflags = vec!["--sysroot=/usr/riscv64-linux-gnu".into()];
self
}
pub fn for_mips64(mut self) -> Self {
self.enabled = true;
self.target_triple = "mips64-unknown-linux-gnuabi64".into();
self.sysroot = "/usr/mips64-linux-gnuabi64".into();
self.cross_prefix = "mips64-linux-gnuabi64-".into();
self.target_cflags = vec![
"-mabi=64".into(),
"--sysroot=/usr/mips64-linux-gnuabi64".into(),
];
self.target_ldflags = vec!["--sysroot=/usr/mips64-linux-gnuabi64".into()];
self
}
pub fn to_cmake_toolchain(&self) -> String {
format!(
r#"set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR {})
set(CMAKE_C_COMPILER {}gcc)
set(CMAKE_CXX_COMPILER {}g++)
set(CMAKE_FIND_ROOT_PATH {})
set(CMAKE_SYSROOT {})
"#,
self.target_triple.split('-').next().unwrap_or("unknown"),
self.cross_prefix,
self.cross_prefix,
self.sysroot,
self.sysroot,
)
}
}
#[derive(Debug, Clone)]
pub struct CombinedTestSuite {
pub run_after_build: bool,
pub fail_fast: bool,
pub timeout_per_test_secs: u64,
pub max_parallel_tests: usize,
pub rerun_failed: bool,
pub rerun_attempts: usize,
pub baseline_path: Option<String>,
pub exclude_patterns: Vec<String>,
}
impl Default for CombinedTestSuite {
fn default() -> Self {
Self {
run_after_build: true,
fail_fast: false,
timeout_per_test_secs: 300,
max_parallel_tests: 4,
rerun_failed: true,
rerun_attempts: 2,
baseline_path: None,
exclude_patterns: Vec::new(),
}
}
}
impl CombinedTestSuite {
pub fn with_fail_fast(mut self) -> Self {
self.fail_fast = true;
self
}
pub fn without_rerun(mut self) -> Self {
self.rerun_failed = false;
self
}
pub fn describe(&self) -> String {
format!(
"TestSuite {{ fail_fast: {}, timeout: {}s, parallel: {}, rerun: {} }}",
self.fail_fast, self.timeout_per_test_secs, self.max_parallel_tests, self.rerun_failed,
)
}
}
impl X86ProjectsCombined {
pub fn new(arch: CombinedArch) -> Self {
Self {
arch,
configs: Vec::new(),
build_orchestrator: CombinedBuildOrchestrator::default(),
cross_compile: CombinedCrossCompileConfig::default(),
test_suite: CombinedTestSuite::default(),
build_results: Vec::new(),
test_results: Vec::new(),
verbose: false,
}
}
pub fn with_verbose(mut self) -> Self {
self.verbose = true;
self
}
pub fn with_cross_compile(mut self, cc: CombinedCrossCompileConfig) -> Self {
self.cross_compile = cc;
self
}
pub fn register(&mut self, config: Box<dyn X86CombinedProjectConfigurable>) {
self.configs.push(config);
}
pub fn register_all(&mut self) {
self.register_database_projects();
self.register_web_network_projects();
self.register_language_runtime_projects();
self.register_graphics_media_projects();
self.register_scientific_ml_projects();
self.register_security_projects();
self.register_systems_projects();
self.build_orchestrator.determine_build_order(&self.configs);
}
fn register_database_projects(&mut self) {
self.register(Box::new(CassandraConfig::default()));
self.register(Box::new(CouchbaseConfig::default()));
self.register(Box::new(Neo4jConfig::default()));
self.register(Box::new(InfluxDBConfig::default()));
self.register(Box::new(TimescaleDBConfig::default()));
self.register(Box::new(EtcdConfig::default()));
self.register(Box::new(ConsulConfig::default()));
self.register(Box::new(FoundationDBConfig::default()));
self.register(Box::new(TiKVConfig::default()));
}
fn register_web_network_projects(&mut self) {
self.register(Box::new(ApacheTrafficServerConfig::default()));
self.register(Box::new(HAProxyConfig::default()));
self.register(Box::new(EnvoyConfig::default()));
self.register(Box::new(CaddyConfig::default()));
self.register(Box::new(LighttpdConfig::default()));
self.register(Box::new(UWSGIConfig::default()));
self.register(Box::new(GunicornConfig::default()));
self.register(Box::new(TornadoConfig::default()));
}
fn register_language_runtime_projects(&mut self) {
self.register(Box::new(LuaJITConfig::default()));
self.register(Box::new(QuickJSConfig::default()));
self.register(Box::new(DuktapeConfig::default()));
self.register(Box::new(JerryScriptConfig::default()));
self.register(Box::new(MrubyConfig::default()));
self.register(Box::new(MicroPythonConfig::default()));
self.register(Box::new(TinyGoConfig::default()));
self.register(Box::new(WrenConfig::default()));
}
fn register_graphics_media_projects(&mut self) {
self.register(Box::new(BlenderConfig::default()));
self.register(Box::new(Ogre3DConfig::default()));
self.register(Box::new(IrrlichtConfig::default()));
self.register(Box::new(OpenImageIOConfig::default()));
self.register(Box::new(OpenEXRConfig::default()));
self.register(Box::new(LibVPXConfig::default()));
self.register(Box::new(X264Config::default()));
self.register(Box::new(X265Config::default()));
self.register(Box::new(LibTheoraConfig::default()));
self.register(Box::new(LibVorbisConfig::default()));
self.register(Box::new(OpusConfig::default()));
}
fn register_scientific_ml_projects(&mut self) {
self.register(Box::new(NumPyCoreConfig::default()));
self.register(Box::new(SciPyConfig::default()));
self.register(Box::new(PyTorchCCConfig::default()));
self.register(Box::new(TensorFlowCAPIConfig::default()));
self.register(Box::new(ONNXRuntimeConfig::default()));
self.register(Box::new(XGBoostConfig::default()));
self.register(Box::new(LightGBMConfig::default()));
self.register(Box::new(CatBoostConfig::default()));
self.register(Box::new(FAISSConfig::default()));
self.register(Box::new(LlamaCppConfig::default()));
}
fn register_security_projects(&mut self) {
self.register(Box::new(OpenSSLFullConfig::default()));
self.register(Box::new(LibreSSLConfig::default()));
self.register(Box::new(BoringSSLConfig::default()));
self.register(Box::new(LibSodiumConfig::default()));
self.register(Box::new(BotanConfig::default()));
self.register(Box::new(OpenSSHConfig::default()));
self.register(Box::new(LibSSH2Config::default()));
self.register(Box::new(GnuTLSConfig::default()));
}
fn register_systems_projects(&mut self) {
self.register(Box::new(SystemdConfig::default()));
self.register(Box::new(DBusConfig::default()));
self.register(Box::new(LibEventConfig::default()));
self.register(Box::new(LibUVConfig::default()));
self.register(Box::new(LibUringConfig::default()));
self.register(Box::new(DPDKConfig::default()));
self.register(Box::new(SPDKConfig::default()));
self.register(Box::new(RDMAConfig::default()));
}
pub fn project_count(&self) -> usize {
self.configs.len()
}
pub fn list_projects(&self) -> Vec<String> {
self.configs.iter().map(|c| c.name().to_string()).collect()
}
pub fn list_by_category(&self, cat: CombinedProjectCategory) -> Vec<String> {
self.configs
.iter()
.filter(|c| c.category() == cat)
.map(|c| c.name().to_string())
.collect()
}
pub fn get_project(&self, name: &str) -> Option<&Box<dyn X86CombinedProjectConfigurable>> {
self.configs.iter().find(|c| c.name() == name)
}
pub fn build_all_flags(&self) -> Vec<String> {
let mut flags = vec![
format!("-march={}", self.arch.as_str()),
"-O2".into(),
"-Wall".into(),
"-Wextra".into(),
];
if self.build_orchestrator.use_ccache {
flags.push("-DCCACHE_SUPPORT".into());
}
flags
}
pub fn generate_build_scripts(&self) -> String {
let mut out = String::new();
for config in &self.configs {
out.push_str(&format!(
"# === {} ({}) ===\n# Build System: {}\n# Simd: {}\n\n",
config.name(),
config.category(),
config.build_system(),
config.simd_level(),
));
out.push_str(&format!(
"mkdir -p build/{} && cd build/{}\n",
config.name(),
config.name(),
));
let cflags = config.compiler_flags().join(" ");
out.push_str(&format!("CFLAGS=\"{}\" ", cflags));
let defines = config
.defines()
.iter()
.map(|(k, v)| {
if let Some(val) = v {
format!("-D{}={}", k, val)
} else {
format!("-D{}", k)
}
})
.collect::<Vec<_>>()
.join(" ");
out.push_str(&format!("DEFINES=\"{}\" ", defines));
out.push_str(&format!(
"make -j{}\n\n",
self.build_orchestrator.parallel_jobs
));
}
out
}
pub fn generate_report(&self) -> String {
let mut report = String::from("# X86 Combined Projects Report\n\n");
report.push_str(&format!("Architecture: {}\n", self.arch));
report.push_str(&format!("Total Projects: {}\n", self.project_count()));
report.push_str(&format!(
"Cross Compile: {}\n\n",
if self.cross_compile.enabled {
"yes"
} else {
"no"
}
));
report.push_str("## Categories\n\n");
for cat in &[
CombinedProjectCategory::Database,
CombinedProjectCategory::WebNetwork,
CombinedProjectCategory::LanguageRuntime,
CombinedProjectCategory::GraphicsMedia,
CombinedProjectCategory::ScientificML,
CombinedProjectCategory::Security,
CombinedProjectCategory::Systems,
] {
let names = self.list_by_category(*cat);
report.push_str(&format!("### {}\n", cat.display_name()));
for name in &names {
report.push_str(&format!("- {}\n", name));
}
report.push('\n');
}
if !self.build_results.is_empty() {
report.push_str("## Build Results\n\n");
for r in &self.build_results {
report.push_str(&format!("- {}\n", r.summary()));
}
report.push('\n');
}
if !self.test_results.is_empty() {
report.push_str("## Test Results\n\n");
for r in &self.test_results {
report.push_str(&format!("- {}\n", r.summary()));
}
report.push('\n');
}
report
}
}
impl Default for X86ProjectsCombined {
fn default() -> Self {
Self::new(CombinedArch::default())
}
}
#[derive(Debug, Clone)]
pub struct CassandraConfig {
pub version: CombinedProjectVersion,
pub use_dse: bool,
pub enable_sstable_tools: bool,
pub with_jemalloc: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for CassandraConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(5, 0, 0),
use_dse: false,
enable_sstable_tools: true,
with_jemalloc: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for CassandraConfig {
fn name(&self) -> &'static str {
"cassandra"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"src/java/org/apache/cassandra/db/".into(),
"src/java/org/apache/cassandra/io/".into(),
"src/java/org/apache/cassandra/net/".into(),
];
if self.enable_sstable_tools {
s.push("tools/sstable/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("CASSANDRA_VERSION".into(), Some(self.version.to_string())),
("CASSANDRA_X86_OPTIMIZED".into(), None),
];
if self.use_dse {
d.push(("DSE_ENABLED".into(), None));
}
if self.with_jemalloc {
d.push(("USE_JEMALLOC".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/include/jvm".into(), "/usr/include/cassandra".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-ljvm".into(), "-lpthread".into(), "-ljemalloc".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libcassandra.so".into(), "libsstableutil.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/java/org/apache/cassandra/db", "commitlog.cc"),
CombinedCompileEntry::new("src/java/org/apache/cassandra/io", "sstable_writer.cc"),
CombinedCompileEntry::new("tools/sstable", "sstable_verify.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ant test -Dtest.include=**/cassandra/db/**".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("C++ native components only")
}
}
#[derive(Debug, Clone)]
pub struct CouchbaseConfig {
pub version: CombinedProjectVersion,
pub build_type: String,
pub enable_forestdb: bool,
pub with_tcmalloc: bool,
pub couchstore_only: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for CouchbaseConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(7, 6, 0),
build_type: "ReleaseOptimized".into(),
enable_forestdb: true,
with_tcmalloc: false,
couchstore_only: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for CouchbaseConfig {
fn name(&self) -> &'static str {
"couchbase"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"couchstore/src/".into(),
"forestdb/src/".into(),
"platform/src/".into(),
];
if !self.couchstore_only {
s.push("kv_engine/engines/ep/src/".into());
s.push("kv_engine/engines/ep/management/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("CB_VERSION".into(), Some(self.version.to_string())),
("CB_DEVELOPER_ASSERTS".into(), None),
];
if self.enable_forestdb {
d.push(("CB_USE_FORESTDB".into(), None));
}
if self.with_tcmalloc {
d.push(("USE_TCMALLOC".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"couchstore/include".into(),
"platform/include".into(),
"/usr/include/libevent".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-Werror".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f.push("-DNDEBUG".into());
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-levent".into(),
"-lssl".into(),
"-lcrypto".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libcouchstore.so".into(),
"libforestdb.a".into(),
"libplatform.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("couchstore/src", "couch_db.cc"),
CombinedCompileEntry::new("forestdb/src", "btree.cc"),
CombinedCompileEntry::new("platform/src", "cb_arena_malloc.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest --test-dir build/couchstore -j4".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct Neo4jConfig {
pub version: CombinedProjectVersion,
pub community_edition: bool,
pub enable_bolt_ssl: bool,
pub with_fabric: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for Neo4jConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(5, 19, 0),
community_edition: true,
enable_bolt_ssl: true,
with_fabric: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for Neo4jConfig {
fn name(&self) -> &'static str {
"neo4j"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"community/cypher/".into(),
"community/kernel/".into(),
"community/io/".into(),
"community/bolt/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("NEO4J_VERSION".into(), Some(self.version.to_string()))];
if self.community_edition {
d.push(("NEO4J_COMMUNITY".into(), None));
}
if self.enable_bolt_ssl {
d.push(("BOLT_SSL_ENABLED".into(), None));
}
if self.with_fabric {
d.push(("NEO4J_FABRIC".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"community/kernel/src/main/java".into(),
"/usr/include/jvm".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-ljvm".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libneo4j-native.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("community/bolt/src/main/native", "bolt_connector.cc"),
CombinedCompileEntry::new("community/io/src/main/native", "io_uring.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["mvn test -pl community/io -Dtest=NativeIOTest".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct InfluxDBConfig {
pub version: CombinedProjectVersion,
pub storage_engine: String,
pub use_rust_core: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for InfluxDBConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 0, 0),
storage_engine: "tsm".into(),
use_rust_core: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for InfluxDBConfig {
fn name(&self) -> &'static str {
"influxdb"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"tsdb/engine/tsm1/".into(),
"tsdb/index/tsi1/".into(),
"influxql/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("INFLUXDB_VERSION".into(), Some(self.version.to_string())),
("STORAGE_ENGINE".into(), Some(self.storage_engine.clone())),
];
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/local/include".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-ffast-math".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libtsm1.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("tsdb/engine/tsm1", "engine.cc"),
CombinedCompileEntry::new("tsdb/engine/tsm1", "wal.cc"),
CombinedCompileEntry::new("tsdb/index/tsi1", "index.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["go test ./tsdb/engine/tsm1/...".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct TimescaleDBConfig {
pub version: CombinedProjectVersion,
pub pg_config_path: String,
pub enable_compression: bool,
pub with_telemetry: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for TimescaleDBConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 14, 0),
pg_config_path: "/usr/bin/pg_config".into(),
enable_compression: true,
with_telemetry: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for TimescaleDBConfig {
fn name(&self) -> &'static str {
"timescaledb"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"tsl/src/".into(),
"src/bgw/".into(),
"src/chunk/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("TIMESCALEDB_VERSION".into(), Some(self.version.to_string()))];
if self.enable_compression {
d.push(("TIMESCALEDB_COMPRESSION".into(), None));
}
if !self.with_telemetry {
d.push(("TIMESCALEDB_TELEMETRY_DEFAULT_OFF".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"/usr/include/postgresql/16/server".into(),
"/usr/include/postgresql/16".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-fPIC".into(),
"-Wall".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpq".into(), "-shared".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["timescaledb.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "hypertable.c"),
CombinedCompileEntry::new("src", "chunk.c"),
CombinedCompileEntry::new("tsl/src", "compression.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make installcheck PG_REGRESS_OPTS='--temp-config=test/postgresql.conf'".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct EtcdConfig {
pub version: CombinedProjectVersion,
pub enable_grpc_gateway: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for EtcdConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 5, 14),
enable_grpc_gateway: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for EtcdConfig {
fn name(&self) -> &'static str {
"etcd"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"server/".into(),
"raft/".into(),
"mvcc/".into(),
"wal/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("ETCD_VERSION".into(), Some(self.version.to_string()))];
if self.enable_grpc_gateway {
d.push(("ETCD_GRPC_GATEWAY".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/local/include".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c11".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lprotobuf".into(), "-lgrpc".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["etcd".into(), "etcdctl".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("server", "etcd_server.c"),
CombinedCompileEntry::new("raft", "raft.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["go test ./server/...".into(), "go test ./raft/...".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct ConsulConfig {
pub version: CombinedProjectVersion,
pub enable_ui: bool,
pub with_acls: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for ConsulConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 19, 0),
enable_ui: true,
with_acls: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for ConsulConfig {
fn name(&self) -> &'static str {
"consul"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"agent/".into(),
"api/".into(),
"command/".into(),
"lib/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("CONSUL_VERSION".into(), Some(self.version.to_string()))];
if self.enable_ui {
d.push(("CONSUL_UI_ENABLED".into(), None));
}
if self.with_acls {
d.push(("CONSUL_ACL_ENABLED".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/local/include".into()]
}
fn compiler_flags(&self) -> Vec<String> {
vec!["-std=c11".into(), "-O2".into(), "-Wall".into()]
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lserf".into(), "-lraft".into(), "-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["consul".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![CombinedCompileEntry::new("agent", "agent.c")]
}
fn test_commands(&self) -> Vec<String> {
vec!["go test ./agent/...".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct FoundationDBConfig {
pub version: CombinedProjectVersion,
pub with_rocksdb: bool,
pub enable_client_libs: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for FoundationDBConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(7, 3, 38),
with_rocksdb: true,
enable_client_libs: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for FoundationDBConfig {
fn name(&self) -> &'static str {
"foundationdb"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"fdbserver/".into(),
"fdbclient/".into(),
"fdbrpc/".into(),
"flow/".into(),
"fdbcli/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("FDB_VERSION".into(), Some(self.version.to_string())),
("USE_ROCKSDB_EXPERIMENTAL".into(), None),
];
if !self.with_rocksdb {
d.push(("FDB_USE_SQLITE".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"flow/include".into(),
"fdbrpc/include".into(),
"/usr/include/rocksdb".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-lrocksdb".into(),
"-lssl".into(),
"-lcrypto".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libfdb_c.so".into(),
"libfdbclient.so".into(),
"libflow.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("fdbserver", "masterproxy.cc"),
CombinedCompileEntry::new("fdbrpc", "flow_transport.cc"),
CombinedCompileEntry::new("flow", "actorcompiler.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest --test-dir build -j8 --timeout 600".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct TiKVConfig {
pub version: CombinedProjectVersion,
pub engine: String,
pub enable_titan: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for TiKVConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(8, 1, 0),
engine: "raftstore".into(),
enable_titan: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for TiKVConfig {
fn name(&self) -> &'static str {
"tikv"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Database
}
fn sources(&self) -> Vec<String> {
vec![
"src/server/".into(),
"src/storage/".into(),
"src/raftstore/".into(),
"src/coprocessor/".into(),
"src/pd/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("TIKV_VERSION".into(), Some(self.version.to_string())),
("TIKV_ENABLE_ROCKSDB".into(), None),
];
if self.enable_titan {
d.push(("TITAN_ENABLED".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src/".into(), "/usr/include/rocksdb".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-march=native".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into(), "-lrocksdb".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libtikv.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/server", "server.cc"),
CombinedCompileEntry::new("src/storage", "kv_engine.cc"),
CombinedCompileEntry::new("src/raftstore", "store.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct ApacheTrafficServerConfig {
pub version: CombinedProjectVersion,
pub enable_experimental_plugins: bool,
pub with_hwloc: bool,
pub with_profiler: bool,
pub enable_wccp: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for ApacheTrafficServerConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(10, 0, 0),
enable_experimental_plugins: false,
with_hwloc: true,
with_profiler: false,
enable_wccp: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for ApacheTrafficServerConfig {
fn name(&self) -> &'static str {
"apache_traffic_server"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"src/traffic_server/".into(),
"src/traffic_manager/".into(),
"iocore/net/".into(),
"iocore/eventsystem/".into(),
"proxy/".into(),
"proxy/http/".into(),
"proxy/http2/".into(),
];
if self.enable_experimental_plugins {
s.push("plugins/experimental/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("TS_VERSION".into(), Some(self.version.to_string())),
(
"TS_HAS_PROFILER".into(),
Some(if self.with_profiler { "1" } else { "0" }.into()),
),
];
if self.enable_wccp {
d.push(("TS_USE_WCCP".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"lib/ts".into(),
"iocore/net".into(),
"/usr/include/libxml2".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f.push("-D_GNU_SOURCE".into());
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-lssl".into(),
"-lcrypto".into(),
"-lxml2".into(),
"-lz".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libtscore.a".into(),
"libtsutil.a".into(),
"traffic_server".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("proxy/http", "HttpSM.cc"),
CombinedCompileEntry::new("iocore/net", "UnixNet.cc"),
CombinedCompileEntry::new("proxy/http2", "Http2ConnectionState.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct HAProxyConfig {
pub version: CombinedProjectVersion,
pub target: String,
pub use_openssl: bool,
pub use_pcre: bool,
pub use_zlib: bool,
pub use_lua: bool,
pub use_systemd: bool,
pub use_thread: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for HAProxyConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 9, 0),
target: "linux-glibc".into(),
use_openssl: true,
use_pcre: true,
use_zlib: true,
use_lua: true,
use_systemd: true,
use_thread: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for HAProxyConfig {
fn name(&self) -> &'static str {
"haproxy"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"include/haproxy/".into(),
"src/ssl_sock.c".into(),
"src/h2.c".into(),
"src/h3.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("HAPROXY_VERSION".into(), Some(self.version.to_string())),
("TARGET".into(), Some(self.target.clone())),
];
if self.use_openssl {
d.push(("USE_OPENSSL".into(), None));
}
if self.use_pcre {
d.push(("USE_PCRE".into(), None));
}
if self.use_zlib {
d.push(("USE_ZLIB".into(), None));
}
if self.use_lua {
d.push(("USE_LUA".into(), None));
}
if self.use_systemd {
d.push(("USE_SYSTEMD".into(), None));
}
if self.use_thread {
d.push(("USE_THREAD".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include/".into(),
"/usr/include/openssl".into(),
"/usr/include/pcre".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-Wno-address-of-packed-member".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lssl".into(),
"-lcrypto".into(),
"-lpcre".into(),
"-lz".into(),
"-llua".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["haproxy".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "haproxy.c"),
CombinedCompileEntry::new("src", "ssl_sock.c"),
CombinedCompileEntry::new("src", "h2.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make reg-tests VTEST_PROGRAM=../vtest/vtest".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct EnvoyConfig {
pub version: CombinedProjectVersion,
pub build_type: String,
pub enable_gperftools: bool,
pub enable_boringssl: bool,
pub use_libcpp: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for EnvoyConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 30, 1),
build_type: "opt".into(),
enable_gperftools: true,
enable_boringssl: true,
use_libcpp: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for EnvoyConfig {
fn name(&self) -> &'static str {
"envoy"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
vec![
"source/common/http/".into(),
"source/common/network/".into(),
"source/common/ssl/".into(),
"source/common/router/".into(),
"source/extensions/".into(),
"source/server/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("ENVOY_VERSION".into(), Some(self.version.to_string())),
("ENVOY_SSL_VERSION".into(), Some("BoringSSL-FIPS".into())),
];
if self.enable_gperftools {
d.push(("ENVOY_GPERFTOOLS".into(), None));
}
if self.enable_boringssl {
d.push(("ENVOY_BORINGSSL".into(), None));
}
if self.use_libcpp {
d.push(("ENVOY_USE_LIBCPP".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"source/".into(),
"include/".into(),
"bazel-envoy/external/".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++20".into(),
"-O3".into(),
"-Wall".into(),
"-Werror".into(),
"-fno-omit-frame-pointer".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lssl".into(),
"-lcrypto".into(),
"-lpthread".into(),
"-ldl".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libenvoy_common.a".into(),
"libenvoy_network.a".into(),
"envoy".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("source/common/http", "codec_client.cc"),
CombinedCompileEntry::new("source/common/network", "connection_impl.cc"),
CombinedCompileEntry::new("source/server", "server.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["bazel test //test/... --test_output=errors".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Bazel
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct CaddyConfig {
pub version: CombinedProjectVersion,
pub with_forwardproxy: bool,
pub with_cors: bool,
pub with_cache: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for CaddyConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 8, 0),
with_forwardproxy: false,
with_cors: true,
with_cache: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for CaddyConfig {
fn name(&self) -> &'static str {
"caddy"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"caddyhttp/".into(),
"modules/caddyhttp/".into(),
"modules/caddytls/".into(),
"listeners/".into(),
];
if self.with_forwardproxy {
s.push("modules/caddyhttp/forwardproxy/".into());
}
if self.with_cors {
s.push("modules/caddyhttp/cors/".into());
}
if self.with_cache {
s.push("modules/caddyhttp/cache/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("CADDY_VERSION".into(), Some(self.version.to_string()))];
if self.with_forwardproxy {
d.push(("CADDY_FORWARDPROXY".into(), None));
}
if self.with_cors {
d.push(("CADDY_CORS".into(), None));
}
if self.with_cache {
d.push(("CADDY_CACHE_HANDLER".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/local/include".into()]
}
fn compiler_flags(&self) -> Vec<String> {
vec!["-std=c11".into(), "-O2".into(), "-Wall".into()]
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lssl".into(), "-lcrypto".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["caddy".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![CombinedCompileEntry::new("caddyhttp", "caddyfile.c")]
}
fn test_commands(&self) -> Vec<String> {
vec!["go test ./...".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LighttpdConfig {
pub version: CombinedProjectVersion,
pub with_openssl: bool,
pub with_zlib: bool,
pub with_bzip2: bool,
pub with_pcre: bool,
pub with_lua: bool,
pub with_webdav: bool,
pub with_kqueue: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LighttpdConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 4, 75),
with_openssl: true,
with_zlib: true,
with_bzip2: false,
with_pcre: true,
with_lua: false,
with_webdav: true,
with_kqueue: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LighttpdConfig {
fn name(&self) -> &'static str {
"lighttpd"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
let mut s = vec!["src/".into(), "src/mod_*.c".into()];
if self.with_webdav {
s.push("src/mod_webdav.c".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
(
"LIGHTTPD_VERSION_ID".into(),
Some(format!(
"{}",
self.version.major * 10000 + self.version.minor * 100 + self.version.patch
)),
),
(
"HAVE_OPENSSL".into(),
Some(if self.with_openssl { "1" } else { "0" }.into()),
),
(
"HAVE_ZLIB".into(),
Some(if self.with_zlib { "1" } else { "0" }.into()),
),
(
"HAVE_BZ2".into(),
Some(if self.with_bzip2 { "1" } else { "0" }.into()),
),
(
"HAVE_PCRE".into(),
Some(if self.with_pcre { "1" } else { "0" }.into()),
),
];
if self.with_lua {
d.push(("HAVE_LUA".into(), Some("1".into())));
}
if self.with_kqueue {
d.push(("HAVE_KQUEUE".into(), Some("1".into())));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src/".into(), "/usr/include/pcre".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-Wno-unused".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lssl".into(),
"-lcrypto".into(),
"-lz".into(),
"-lpcre".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["lighttpd".into(), "mod_access.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "server.c"),
CombinedCompileEntry::new("src", "connections.c"),
CombinedCompileEntry::new("src", "http-header-glue.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct UWSGIConfig {
pub version: CombinedProjectVersion,
pub plugins: Vec<String>,
pub with_ssl: bool,
pub with_pcre: bool,
pub with_yaml: bool,
pub with_xml: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for UWSGIConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 0, 25),
plugins: vec!["python".into(), "http".into(), "routing".into()],
with_ssl: true,
with_pcre: true,
with_yaml: false,
with_xml: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for UWSGIConfig {
fn name(&self) -> &'static str {
"uwsgi"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"core/".into(),
"plugins/python/".into(),
"plugins/http/".into(),
];
for p in &["pcre", "ssl", "yaml", "xml"] {
if self.plugins.contains(&p.to_string()) {
s.push(format!("plugins/{}/", p));
}
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("UWSGI_VERSION".into(), Some(self.version.to_string())),
(
"UWSGI_PLUGIN_DIR".into(),
Some("\"/usr/lib/uwsgi/plugins\"".into()),
),
];
if self.with_ssl {
d.push(("UWSGI_SSL".into(), None));
}
if self.with_pcre {
d.push(("UWSGI_PCRE".into(), None));
}
if self.with_yaml {
d.push(("UWSGI_YAML".into(), None));
}
if self.with_xml {
d.push(("UWSGI_XML".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["core/".into(), "/usr/include/python3.12".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c11".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lssl".into(),
"-lcrypto".into(),
"-lpcre".into(),
"-lpython3.12".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["uwsgi".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("core", "uwsgi.c"),
CombinedCompileEntry::new("plugins/python", "python_plugin.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["python -m pytest tests/".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct GunicornConfig {
pub version: CombinedProjectVersion,
pub worker_class: String,
pub with_gthread: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for GunicornConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(22, 0, 0),
worker_class: "sync".into(),
with_gthread: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for GunicornConfig {
fn name(&self) -> &'static str {
"gunicorn"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
vec!["gunicorn/workers/".into(), "gunicorn/http/".into()]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("GUNICORN_VERSION".into(), Some(self.version.to_string()))];
if self.with_gthread {
d.push(("GUNICORN_GTHREAD".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/include/python3.12".into()]
}
fn compiler_flags(&self) -> Vec<String> {
vec![
"-std=c11".into(),
"-O2".into(),
"-fPIC".into(),
"-Wall".into(),
]
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpython3.12".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["gunicorn_workers.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![CombinedCompileEntry::new("gunicorn/workers", "sync.c")]
}
fn test_commands(&self) -> Vec<String> {
vec!["python -m pytest tests/".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("C extension accelerators only")
}
}
#[derive(Debug, Clone)]
pub struct TornadoConfig {
pub version: CombinedProjectVersion,
pub with_accelerated_http: bool,
pub with_caresolver: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for TornadoConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(6, 4, 1),
with_accelerated_http: true,
with_caresolver: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for TornadoConfig {
fn name(&self) -> &'static str {
"tornado"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::WebNetwork
}
fn sources(&self) -> Vec<String> {
vec!["tornado/speedups.c".into(), "tornado/netutil.c".into()]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("TORNADO_VERSION".into(), Some(self.version.to_string()))];
if self.with_caresolver {
d.push(("TORNADO_CARES".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["/usr/include/python3.12".into()]
}
fn compiler_flags(&self) -> Vec<String> {
vec![
"-std=c11".into(),
"-O2".into(),
"-fPIC".into(),
"-Wall".into(),
]
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpython3.12".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["tornado_speedups.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![CombinedCompileEntry::new("tornado", "speedups.c")]
}
fn test_commands(&self) -> Vec<String> {
vec!["python -m tornado.test.runtests".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LuaJITConfig {
pub version: CombinedProjectVersion,
pub gc64_mode: bool,
pub dual_num: bool,
pub ffi: bool,
pub jit: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LuaJITConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::parse("2.1.0-beta3")
.unwrap_or(CombinedProjectVersion::new(2, 1, 0)),
gc64_mode: false,
dual_num: true,
ffi: true,
jit: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LuaJITConfig {
fn name(&self) -> &'static str {
"luajit"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"src/lj_*.c".into(),
"src/host/buildvm*.c".into(),
"src/lib_*.c".into(),
"src/lj_asm_*.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LUAJIT_VERSION".into(), Some(self.version.to_string())),
("LJ_TARGET_X86".into(), None),
];
if self.gc64_mode {
d.push(("LJ_GC64".into(), None));
}
if self.dual_num {
d.push(("LJ_DUALNUM".into(), None));
}
if self.ffi {
d.push(("LJ_HASFFI".into(), None));
}
if self.jit {
d.push(("LJ_HASJIT".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-fomit-frame-pointer".into(),
"-Wall".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-ldl".into(), "-lm".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libluajit-5.1.so".into(),
"luajit".into(),
"libluajit.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "lj_api.c"),
CombinedCompileEntry::new("src", "lj_state.c"),
CombinedCompileEntry::new("src", "lj_asm_x86.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Hand-written x86 assembler in dasm_*.lua")
}
}
#[derive(Debug, Clone)]
pub struct QuickJSConfig {
pub version: CombinedProjectVersion,
pub enable_bignum: bool,
pub enable_bigfloat: bool,
pub enable_atomics: bool,
pub with_unicode: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for QuickJSConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2024, 1, 13),
enable_bignum: true,
enable_bigfloat: false,
enable_atomics: true,
with_unicode: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for QuickJSConfig {
fn name(&self) -> &'static str {
"quickjs"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"quickjs.c".into(),
"quickjs-libc.c".into(),
"libregexp.c".into(),
"libunicode.c".into(),
"cutils.c".into(),
"libbf.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("CONFIG_VERSION".into(), Some(self.version.to_string())),
(
"CONFIG_BIGNUM".into(),
Some(if self.enable_bignum { "1" } else { "0" }.into()),
),
];
if self.enable_bigfloat {
d.push(("CONFIG_BIGNUM_BIGFLOAT".into(), None));
}
if self.enable_atomics {
d.push(("CONFIG_ATOMICS".into(), None));
}
if self.with_unicode {
d.push(("CONFIG_UNICODE".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-Wno-unused-function".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into(), "-ldl".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libquickjs.a".into(), "qjs".into(), "qjsc".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new(".", "quickjs.c"),
CombinedCompileEntry::new(".", "libregexp.c"),
CombinedCompileEntry::new(".", "libunicode.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into(), "make microbench".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct DuktapeConfig {
pub version: CombinedProjectVersion,
pub low_memory: bool,
pub rom_builtins: bool,
pub jx_parser: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for DuktapeConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 7, 0),
low_memory: false,
rom_builtins: false,
jx_parser: true,
simd_level: CombinedSimdLevel::None,
}
}
}
impl X86CombinedProjectConfigurable for DuktapeConfig {
fn name(&self) -> &'static str {
"duktape"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec!["src-input/duktape.c".into(), "src-input/duk_*.c".into()]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("DUK_VERSION".into(), Some(self.version.to_string()))];
if self.low_memory {
d.push(("DUK_OPT_LOW_MEMORY".into(), None));
}
if self.rom_builtins {
d.push(("DUK_USE_ROM_OBJECTS".into(), None));
}
if self.jx_parser {
d.push(("DUK_USE_JX".into(), None));
d.push(("DUK_USE_JC".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src-input/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
vec![
"-std=c99".into(),
"-Os".into(),
"-Wall".into(),
"-fstrict-aliasing".into(),
]
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libduktape.a".into(), "duk".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![CombinedCompileEntry::new("src-input", "duktape.c")]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct JerryScriptConfig {
pub version: CombinedProjectVersion,
pub snapshot_exec: bool,
pub snapshot_save: bool,
pub line_info: bool,
pub profile: String,
pub simd_level: CombinedSimdLevel,
}
impl Default for JerryScriptConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 4, 0),
snapshot_exec: true,
snapshot_save: true,
line_info: true,
profile: "es.next".into(),
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for JerryScriptConfig {
fn name(&self) -> &'static str {
"jerryscript"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"jerry-core/".into(),
"jerry-port/".into(),
"jerry-math/".into(),
"jerry-ext/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("JERRY_VERSION".into(), Some(self.version.to_string())),
("JERRY_PROFILE".into(), Some(self.profile.clone())),
("JERRY_NDEBUG".into(), None),
];
if self.snapshot_exec {
d.push(("JERRY_SNAPSHOT_EXEC".into(), None));
}
if self.snapshot_save {
d.push(("JERRY_SNAPSHOT_SAVE".into(), None));
}
if self.line_info {
d.push(("JERRY_LINE_INFO".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"jerry-core/include".into(),
"jerry-ext/include".into(),
"jerry-port/include".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-Os".into(),
"-Wall".into(),
"-ffunction-sections".into(),
"-fdata-sections".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libjerry-core.a".into(), "libjerry-ext.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("jerry-core", "ecma-globals.c"),
CombinedCompileEntry::new("jerry-core", "parser-js.c"),
CombinedCompileEntry::new("jerry-core", "vm.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["python tools/run-tests.py --jerry-tests".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct MrubyConfig {
pub version: CombinedProjectVersion,
pub gems: Vec<String>,
pub debug: bool,
pub cxx_exception: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for MrubyConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 3, 0),
gems: vec!["mruby-io".into(), "mruby-socket".into(), "mruby-env".into()],
debug: false,
cxx_exception: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for MrubyConfig {
fn name(&self) -> &'static str {
"mruby"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"src/*.c".into(),
"mrbgems/".into(),
"mrblib/*.rb".into(),
"include/mruby/*.h".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("MRUBY_VERSION".into(), Some(self.version.to_string()))];
if self.debug {
d.push(("MRB_DEBUG".into(), None));
}
if self.cxx_exception {
d.push(("MRB_USE_CXX_EXCEPTION".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include/".into(), "src/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c11".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libmruby.a".into(), "mruby".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "vm.c"),
CombinedCompileEntry::new("src", "codegen.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["rake test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct MicroPythonConfig {
pub version: CombinedProjectVersion,
pub board: String,
pub enable_native_emitter: bool,
pub enable_inline_thumb: bool,
pub frozen_manifest: Option<String>,
pub simd_level: CombinedSimdLevel,
}
impl Default for MicroPythonConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 23, 0),
board: "unix".into(),
enable_native_emitter: true,
enable_inline_thumb: false,
frozen_manifest: None,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for MicroPythonConfig {
fn name(&self) -> &'static str {
"micropython"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"py/*.c".into(),
"extmod/*.c".into(),
"ports/unix/*.c".into(),
"lib/*.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("MICROPY_VERSION".into(), Some(self.version.to_string())),
("MICROPY_PY_SYS_PLATFORM".into(), Some("\"linux\"".into())),
];
if self.enable_native_emitter {
d.push(("MICROPY_EMIT_X64".into(), None));
}
if self.enable_inline_thumb {
d.push(("MICROPY_EMIT_INLINE_THUMB".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["py/".into(), "ports/unix/".into(), "extmod/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-Wno-attributes".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f.push("-DMICROPY_GCREGS_SETJMP=1".into());
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into(), "-lffi".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["micropython".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("py", "vm.c"),
CombinedCompileEntry::new("py", "emitnative.c"),
CombinedCompileEntry::new("ports/unix", "main.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct TinyGoConfig {
pub version: CombinedProjectVersion,
pub target: String,
pub opt: String,
pub scheduler: String,
pub gc: String,
pub simd_level: CombinedSimdLevel,
}
impl Default for TinyGoConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(0, 33, 0),
target: "wasi".into(),
opt: "z".into(),
scheduler: "asyncify".into(),
gc: "leaking".into(),
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for TinyGoConfig {
fn name(&self) -> &'static str {
"tinygo"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"compiler/".into(),
"transform/".into(),
"interp/".into(),
"builder/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("TINYGO_VERSION".into(), Some(self.version.to_string())),
("TINYGO_TARGET".into(), Some(self.target.clone())),
];
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["lib/".into(), "/usr/local/lib/tinygo".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c11".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lwasm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libtinygo-runtime.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("compiler", "compiler.go"),
CombinedCompileEntry::new("transform", "optimizer.go"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["go test ./compiler/...".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Go compiler; C runtime components only")
}
}
#[derive(Debug, Clone)]
pub struct WrenConfig {
pub version: CombinedProjectVersion,
pub nan_tagging: bool,
pub compute_gotos: bool,
pub metrics: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for WrenConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(0, 4, 0),
nan_tagging: true,
compute_gotos: true,
metrics: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for WrenConfig {
fn name(&self) -> &'static str {
"wren"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::LanguageRuntime
}
fn sources(&self) -> Vec<String> {
vec![
"src/vm/wren_compiler.c".into(),
"src/vm/wren_core.c".into(),
"src/vm/wren_debug.c".into(),
"src/vm/wren_vm.c".into(),
"src/optional/wren_opt_*.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("WREN_VERSION".into(), Some(self.version.to_string()))];
if self.nan_tagging {
d.push(("WREN_NAN_TAGGING".into(), None));
}
if self.compute_gotos {
d.push(("WREN_COMPUTED_GOTO".into(), None));
}
if self.metrics {
d.push(("WREN_OPT_META".into(), None));
d.push(("WREN_OPT_RANDOM".into(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src/include/".into(), "src/vm/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c99".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libwren.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/vm", "wren_vm.c"),
CombinedCompileEntry::new("src/vm", "wren_compiler.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct BlenderConfig {
pub version: CombinedProjectVersion,
pub with_cycles: bool,
pub with_cuda: bool,
pub with_optix: bool,
pub with_openexr: bool,
pub with_openimageio: bool,
pub with_openvdb: bool,
pub with_alembic: bool,
pub with_usd: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for BlenderConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(4, 1, 0),
with_cycles: true,
with_cuda: false,
with_optix: false,
with_openexr: true,
with_openimageio: true,
with_openvdb: true,
with_alembic: true,
with_usd: false,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for BlenderConfig {
fn name(&self) -> &'static str {
"blender"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"source/blender/".into(),
"intern/".into(),
"source/creator/".into(),
"extern/".into(),
];
if self.with_cycles {
s.push("intern/cycles/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![(
"BLENDER_VERSION".into(),
Some(format!("{}{:02}", self.version.major, self.version.minor)),
)];
if self.with_cycles {
d.push(("WITH_CYCLES".into(), None));
}
if self.with_cuda {
d.push(("WITH_CYCLES_CUDA_BINARIES".into(), None));
}
if self.with_optix {
d.push(("WITH_CYCLES_DEVICE_OPTIX".into(), None));
}
if self.with_openvdb {
d.push(("WITH_OPENVDB".into(), None));
}
if self.with_alembic {
d.push(("WITH_ALEMBIC".into(), None));
}
if self.with_usd {
d.push(("WITH_USD".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"source/blender".into(),
"intern/guardedalloc".into(),
"/usr/include/OpenEXR".into(),
"/usr/include/OpenImageIO".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-Wno-register".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lGL".into(),
"-lGLEW".into(),
"-lSDL2".into(),
"-lXi".into(),
"-lX11".into(),
"-lpthread".into(),
"-ldl".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["blender".into(), "libbf_intern_guardedalloc.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("source/blender/blenkernel", "intern/mesh.cc"),
CombinedCompileEntry::new("intern/cycles", "kernel/kernel.cc"),
CombinedCompileEntry::new("source/blender/editors", "space_view3d.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest --test-dir build -j4 --output-on-failure".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct Ogre3DConfig {
pub version: CombinedProjectVersion,
pub rendersystem: String,
pub with_cg: bool,
pub with_cpp11: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for Ogre3DConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(14, 2, 0),
rendersystem: "GL3Plus".into(),
with_cg: false,
with_cpp11: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for Ogre3DConfig {
fn name(&self) -> &'static str {
"ogre3d"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"OgreMain/src/".into(),
"RenderSystems/GL3Plus/src/".into(),
"Components/".into(),
"Plugins/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("OGRE_VERSION".into(), Some(self.version.to_string())),
("OGRE_STATIC_LIB".into(), Some("0".into())),
];
if self.with_cg {
d.push(("OGRE_BUILD_PLUGIN_CG".into(), None));
}
if self.with_cpp11 {
d.push(("OGRE_USE_CPP11".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"OgreMain/include".into(),
"/usr/include/OGRE".into(),
"/usr/include/GL".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++17".into(), "-O3".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lGL".into(),
"-lGLEW".into(),
"-lX11".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libOgreMain.so".into(), "libOgreGL3Plus.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("OgreMain/src", "OgreRoot.cc"),
CombinedCompileEntry::new("RenderSystems/GL3Plus/src", "OgreGL3PlusRenderSystem.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct IrrlichtConfig {
pub version: CombinedProjectVersion,
pub with_opengl: bool,
pub with_vulkan: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for IrrlichtConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 9, 0),
with_opengl: true,
with_vulkan: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for IrrlichtConfig {
fn name(&self) -> &'static str {
"irrlicht"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"source/Irrlicht/".into(),
"source/Irrlicht/jpeglib/".into(),
"source/Irrlicht/libpng/".into(),
"source/Irrlicht/zlib/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("IRRLICHT_VERSION".into(), Some(self.version.to_string())),
("_IRR_COMPILE_WITH_OPENGL_".into(), None),
];
if self.with_vulkan {
d.push(("_IRR_COMPILE_WITH_VULKAN_".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include/".into(),
"source/Irrlicht/".into(),
"/usr/include/GL".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec!["-std=c++11".into(), "-O2".into(), "-Wall".into()];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lGL".into(),
"-lX11".into(),
"-lXxf86vm".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libIrrlicht.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("source/Irrlicht", "CIrrDeviceLinux.cpp"),
CombinedCompileEntry::new("source/Irrlicht", "COpenGLDriver.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct OpenImageIOConfig {
pub version: CombinedProjectVersion,
pub with_ffmpeg: bool,
pub with_libraw: bool,
pub with_opencv: bool,
pub with_openjpeg: bool,
pub with_ptex: bool,
pub with_qt: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for OpenImageIOConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 5, 10),
with_ffmpeg: true,
with_libraw: true,
with_opencv: false,
with_openjpeg: false,
with_ptex: false,
with_qt: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for OpenImageIOConfig {
fn name(&self) -> &'static str {
"oiio"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"src/libOpenImageIO/".into(),
"src/include/OpenImageIO/".into(),
"src/openimageio.imageio/".into(),
"src/python/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("OIIO_VERSION".into(), Some(self.version.to_string())),
("OIIO_USING_STD_REGEX".into(), None),
];
if self.with_ffmpeg {
d.push(("USE_FFMPEG".into(), None));
}
if self.with_libraw {
d.push(("USE_LIBRAW".into(), None));
}
if self.with_opencv {
d.push(("USE_OPENCV".into(), None));
}
if self.with_openjpeg {
d.push(("USE_OPENJPEG".into(), None));
}
if self.with_ptex {
d.push(("USE_PTEX".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"src/include".into(),
"/usr/include/OpenEXR".into(),
"/usr/include/Imath".into(),
"/usr/local/include".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fvisibility=hidden".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lOpenEXR".into(),
"-lIlmImf".into(),
"-lImath".into(),
"-ljpeg".into(),
"-lpng".into(),
"-ltiff".into(),
"-lz".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libOpenImageIO.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/libOpenImageIO", "imageio.cpp"),
CombinedCompileEntry::new("src/libOpenImageIO", "imagebuf.cpp"),
CombinedCompileEntry::new("src/libOpenImageIO", "texturesys.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest --test-dir build -j4".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct OpenEXRConfig {
pub version: CombinedProjectVersion,
pub with_large_stack: bool,
pub namespaced_headers: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for OpenEXRConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 2, 3),
with_large_stack: true,
namespaced_headers: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for OpenEXRConfig {
fn name(&self) -> &'static str {
"openexr"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"src/lib/OpenEXR/".into(),
"src/lib/OpenEXRCore/".into(),
"src/lib/OpenEXRUtil/".into(),
"src/lib/Iex/".into(),
"src/lib/IlmThread/".into(),
"src/lib/Imath/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("OPENEXR_VERSION".into(), Some(self.version.to_string()))];
if self.with_large_stack {
d.push(("OPENEXR_IMF_HAVE_LARGE_STACK".into(), None));
}
if self.namespaced_headers {
d.push(("OPENEXR_IMF_NAMESPACED_HEADERS".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"src/lib/OpenEXR".into(),
"src/lib/Imath".into(),
"src/lib/OpenEXRCore".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lz".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libOpenEXR.so".into(),
"libOpenEXRCore.so".into(),
"libIex.so".into(),
"libIlmThread.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/lib/OpenEXR", "ImfInputFile.cpp"),
CombinedCompileEntry::new("src/lib/OpenEXRCore", "compression.cpp"),
CombinedCompileEntry::new("src/lib/IlmThread", "IlmThreadPool.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest -j4".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibVPXConfig {
pub version: CombinedProjectVersion,
pub target: String,
pub enable_vp8: bool,
pub enable_vp9: bool,
pub enable_vp9_highbitdepth: bool,
pub enable_postproc: bool,
pub enable_multithread: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibVPXConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 14, 1),
target: "x86_64-linux-gcc".into(),
enable_vp8: true,
enable_vp9: true,
enable_vp9_highbitdepth: true,
enable_postproc: true,
enable_multithread: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for LibVPXConfig {
fn name(&self) -> &'static str {
"libvpx"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"vp8/".into(),
"vp9/".into(),
"vpx_dsp/".into(),
"vpx_scale/".into(),
"vpx_util/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("VPX_VERSION".into(), Some(self.version.to_string()))];
if self.enable_vp8 {
d.push(("CONFIG_VP8_ENCODER".into(), Some("1".into())));
d.push(("CONFIG_VP8_DECODER".into(), Some("1".into())));
}
if self.enable_vp9 {
d.push(("CONFIG_VP9_ENCODER".into(), Some("1".into())));
d.push(("CONFIG_VP9_DECODER".into(), Some("1".into())));
}
if self.enable_vp9_highbitdepth {
d.push(("CONFIG_VP9_HIGHBITDEPTH".into(), Some("1".into())));
}
if self.enable_postproc {
d.push(("CONFIG_POSTPROC".into(), Some("1".into())));
}
if self.enable_multithread {
d.push(("CONFIG_MULTITHREAD".into(), Some("1".into())));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libvpx.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("vp9/encoder", "vp9_encoder.c"),
CombinedCompileEntry::new("vpx_dsp", "sad.c"),
CombinedCompileEntry::new("vpx_dsp/x86", "sad_sse2.asm"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Heavily uses x86 SIMD intrinsics (SSE2/SSSE3/SSE4.1/AVX2)")
}
}
#[derive(Debug, Clone)]
pub struct X264Config {
pub version: CombinedProjectVersion,
pub bit_depth: u32,
pub chroma_format: String,
pub enable_opencl: bool,
pub enable_interlaced: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for X264Config {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(0, 164, 3107),
bit_depth: 8,
chroma_format: "all".into(),
enable_opencl: false,
enable_interlaced: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for X264Config {
fn name(&self) -> &'static str {
"x264"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"encoder/".into(),
"common/".into(),
"common/x86/".into(),
"input/".into(),
"output/".into(),
"filters/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("X264_VERSION".into(), Some(self.version.to_string())),
("X264_BIT_DEPTH".into(), Some(self.bit_depth.to_string())),
("HAVE_MMX".into(), Some("1".into())),
("ARCH_X86_64".into(), Some("1".into())),
];
if self.enable_opencl {
d.push(("HAVE_OPENCL".into(), None));
}
if self.enable_interlaced {
d.push(("HAVE_INTERLACED".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into(), "common/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into(), "-lpthread".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libx264.a".into(), "x264".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("encoder", "encoder.c"),
CombinedCompileEntry::new("common/x86", "mc-a2.asm"),
CombinedCompileEntry::new("common/x86", "pixel-a.asm"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Hand-written x86 asm: MMX/SSE2/SSSE3/SSE4/AVX/AVX2/AVX-512")
}
}
#[derive(Debug, Clone)]
pub struct X265Config {
pub version: CombinedProjectVersion,
pub bit_depth: u32,
pub enable_hdr10plus: bool,
pub enable_asm: bool,
pub enable_pic: bool,
pub enable_cli: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for X265Config {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 6, 0),
bit_depth: 10,
enable_hdr10plus: true,
enable_asm: true,
enable_pic: true,
enable_cli: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for X265Config {
fn name(&self) -> &'static str {
"x265"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"source/encoder/".into(),
"source/common/".into(),
"source/common/x86/".into(),
"source/input/".into(),
"source/output/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("X265_VERSION".into(), Some(self.version.to_string())),
("X265_DEPTH".into(), Some(self.bit_depth.to_string())),
(
"HIGH_BIT_DEPTH".into(),
Some(if self.bit_depth > 8 { "1" } else { "0" }.into()),
),
];
if self.enable_hdr10plus {
d.push(("ENABLE_HDR10_PLUS".into(), None));
}
if self.enable_asm {
d.push(("ENABLE_ASSEMBLY".into(), None));
}
if self.enable_pic {
d.push(("ENABLE_PIC".into(), None));
}
if self.enable_cli {
d.push(("ENABLE_CLI".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["source/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++11".into(),
"-O3".into(),
"-Wall".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into(), "-lstdc++".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libx265.a".into(), "x265".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("source/encoder", "encoder.cpp"),
CombinedCompileEntry::new("source/common/x86", "pixel-util8.asm"),
CombinedCompileEntry::new("source/common/x86", "mc-a.asm"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("HEVC encoder. Extensive x86 asm: SSE2/SSSE3/SSE4/AVX/AVX2")
}
}
#[derive(Debug, Clone)]
pub struct LibTheoraConfig {
pub version: CombinedProjectVersion,
pub enable_encode: bool,
pub enable_examples: bool,
pub with_ogg: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibTheoraConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 1, 1),
enable_encode: true,
enable_examples: false,
with_ogg: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibTheoraConfig {
fn name(&self) -> &'static str {
"libtheora"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
let mut s = vec!["lib/".into()];
if self.enable_encode {
s.push("lib/enc/".into());
}
s.push("lib/dec/".into());
s.push("lib/x86/".into());
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("THEORA_VERSION".into(), Some(self.version.to_string())),
("OC_X86_ASM".into(), None),
];
if self.enable_encode {
d.push(("THEORA_ENABLE_ENCODE".into(), None));
}
if !self.with_ogg {
d.push(("THEORA_DISABLE_OGG".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include/".into(), "lib/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-logg".into(), "-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libtheora.a".into(),
"libtheoraenc.a".into(),
"libtheoradec.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("lib", "analyze.c"),
CombinedCompileEntry::new("lib/enc", "encoder_toplevel.c"),
CombinedCompileEntry::new("lib/x86", "mmxfrag.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibVorbisConfig {
pub version: CombinedProjectVersion,
pub with_ogg: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibVorbisConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 3, 7),
with_ogg: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibVorbisConfig {
fn name(&self) -> &'static str {
"libvorbis"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec!["lib/".into(), "lib/modes/".into(), "lib/books/".into()]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("VORBIS_VERSION".into(), Some(self.version.to_string()))];
if !self.with_ogg {
d.push(("VORBIS_NO_OGG".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include/".into(), "lib/".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-logg".into(), "-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libvorbis.a".into(),
"libvorbisenc.a".into(),
"libvorbisfile.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("lib", "mdct.c"),
CombinedCompileEntry::new("lib", "psy.c"),
CombinedCompileEntry::new("lib", "analysis.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct OpusConfig {
pub version: CombinedProjectVersion,
pub fixed_point: bool,
pub custom_modes: bool,
pub float_api: bool,
pub enable_asm: bool,
pub assert_level: u32,
pub simd_level: CombinedSimdLevel,
}
impl Default for OpusConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 5, 1),
fixed_point: false,
custom_modes: true,
float_api: true,
enable_asm: true,
assert_level: 0,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for OpusConfig {
fn name(&self) -> &'static str {
"opus"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::GraphicsMedia
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"silk/".into(),
"silk/x86/".into(),
"celt/".into(),
"celt/x86/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("OPUS_VERSION".into(), Some(self.version.to_string())),
("OPUS_BUILD".into(), None),
(
"OPUS_ASSERT_LEVEL".into(),
Some(self.assert_level.to_string()),
),
];
if self.fixed_point {
d.push(("FIXED_POINT".into(), None));
}
if self.custom_modes {
d.push(("CUSTOM_MODES".into(), None));
}
if self.float_api {
d.push(("OPUS_FLOAT_APPROX".into(), None));
}
if self.enable_asm {
d.push(("OPUS_X86_MAY_HAVE_SSE".into(), None));
d.push(("OPUS_X86_MAY_HAVE_SSE2".into(), None));
d.push(("OPUS_X86_MAY_HAVE_SSE4_1".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include/".into(),
"silk/".into(),
"celt/".into(),
"src/".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libopus.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("celt", "bands.c"),
CombinedCompileEntry::new("silk", "NSQ.c"),
CombinedCompileEntry::new("silk/x86", "NSQ_sse4_1.c"),
CombinedCompileEntry::new("celt/x86", "pitch_sse.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Audio codec. SSE/SSE2/SSE4.1 optimizations for Silk and CELT")
}
}
#[derive(Debug, Clone)]
pub struct NumPyCoreConfig {
pub version: CombinedProjectVersion,
pub blas: String,
pub lapack: String,
pub enable_optimized_dot: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for NumPyCoreConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 0, 0),
blas: "openblas".into(),
lapack: "openblas".into(),
enable_optimized_dot: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for NumPyCoreConfig {
fn name(&self) -> &'static str {
"numpy_core"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"numpy/core/src/multiarray/".into(),
"numpy/core/src/umath/".into(),
"numpy/core/src/npysort/".into(),
"numpy/core/src/npymath/".into(),
"numpy/linalg/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("NPY_VERSION".into(), Some(self.version.to_string())),
(
"NPY_HAVE_OPENBLAS".into(),
Some(if self.blas == "openblas" { "1" } else { "0" }.into()),
),
];
if self.enable_optimized_dot {
d.push(("NPY_OPTIMIZED_DOT".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"numpy/core/include".into(),
"numpy/core/src/common".into(),
"/usr/include/openblas".into(),
"/usr/include/python3.12".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-ffast-math".into(),
"-fopenmp".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lopenblas".into(),
"-lpython3.12".into(),
"-lpthread".into(),
"-lgfortran".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"_multiarray_umath.cpython-312-x86_64-linux-gnu.so".into(),
"lapack_lite.cpython-312-x86_64-linux-gnu.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("numpy/core/src/multiarray", "multiarraymodule.c"),
CombinedCompileEntry::new("numpy/core/src/umath", "loops.c"),
CombinedCompileEntry::new("numpy/core/src/npysort", "quicksort.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["python -m pytest numpy/core/tests/ -v".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("C core only. Build via setup.py or meson")
}
}
#[derive(Debug, Clone)]
pub struct SciPyConfig {
pub version: CombinedProjectVersion,
pub with_openblas: bool,
pub with_fftw: bool,
pub enable_optimized_linalg: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for SciPyConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 14, 0),
with_openblas: true,
with_fftw: true,
enable_optimized_linalg: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for SciPyConfig {
fn name(&self) -> &'static str {
"scipy"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"scipy/optimize/".into(),
"scipy/linalg/".into(),
"scipy/sparse/".into(),
"scipy/special/".into(),
"scipy/fft/".into(),
"scipy/integrate/".into(),
"scipy/interpolate/".into(),
"scipy/signal/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("SCIPY_VERSION".into(), Some(self.version.to_string()))];
if self.with_openblas {
d.push(("SCIPY_USE_OPENBLAS".into(), None));
}
if self.with_fftw {
d.push(("SCIPY_USE_FFTW".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"scipy/_lib".into(),
"/usr/include/openblas".into(),
"/usr/include/fftw3".into(),
"/usr/include/python3.12".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lopenblas".into(),
"-lfftw3".into(),
"-lpython3.12".into(),
"-lgfortran".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"_odepack.cpython-312-x86_64-linux-gnu.so".into(),
"_fitpack.cpython-312-x86_64-linux-gnu.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("scipy/optimize", "minpack2.c"),
CombinedCompileEntry::new("scipy/linalg", "fblas.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["python -m pytest scipy/ -v -k 'not slow'".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct PyTorchCCConfig {
pub version: CombinedProjectVersion,
pub use_cuda: bool,
pub use_mkldnn: bool,
pub use_mkldnn_acl: bool,
pub use_nnpack: bool,
pub use_qnnpack: bool,
pub use_xnnpack: bool,
pub use_fbgemm: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for PyTorchCCConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 3, 1),
use_cuda: false,
use_mkldnn: true,
use_mkldnn_acl: false,
use_nnpack: false,
use_qnnpack: true,
use_xnnpack: true,
use_fbgemm: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for PyTorchCCConfig {
fn name(&self) -> &'static str {
"pytorch_cc"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
let mut s = vec![
"aten/src/ATen/".into(),
"aten/src/ATen/native/".into(),
"aten/src/ATen/native/cpu/".into(),
"c10/".into(),
"torch/csrc/".into(),
"torch/csrc/api/".into(),
];
if self.use_fbgemm {
s.push("third_party/fbgemm/".into());
}
if self.use_mkldnn {
s.push("third_party/ideep/mkl-dnn/".into());
}
s
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("TORCH_VERSION".into(), Some(self.version.to_string())),
("AT_PARALLEL_OPENMP".into(), Some("1".into())),
("AT_CPU_ENABLE_FP16_VEC".into(), None),
];
if self.use_cuda {
d.push(("AT_CUDA_ENABLED".into(), Some("1".into())));
}
if self.use_mkldnn {
d.push(("AT_MKLDNN_ENABLED".into(), Some("1".into())));
}
if self.use_qnnpack {
d.push(("USE_QNNPACK".into(), None));
}
if self.use_xnnpack {
d.push(("USE_XNNPACK".into(), None));
}
if self.use_fbgemm {
d.push(("USE_FBGEMM".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"aten/src".into(),
"c10".into(),
"third_party/ideep".into(),
"third_party/fbgemm/include".into(),
"/usr/include/python3.12".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
"-fno-omit-frame-pointer".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into(), "-lgomp".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libtorch.so".into(),
"libtorch_cpu.so".into(),
"libc10.so".into(),
"libtorch_cuda.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("aten/src/ATen/native/cpu", "Activation.cpp"),
CombinedCompileEntry::new("aten/src/ATen/native/cpu", "BinaryOpsKernel.cpp"),
CombinedCompileEntry::new("aten/src/ATen/native", "TensorFactories.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["python test/run_test.py --cpp".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct TensorFlowCAPIConfig {
pub version: CombinedProjectVersion,
pub enable_xla: bool,
pub enable_mkl: bool,
pub enable_tensorrt: bool,
pub enable_rocm: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for TensorFlowCAPIConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 16, 1),
enable_xla: true,
enable_mkl: true,
enable_tensorrt: false,
enable_rocm: false,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for TensorFlowCAPIConfig {
fn name(&self) -> &'static str {
"tensorflow_capi"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"tensorflow/c/".into(),
"tensorflow/core/common_runtime/".into(),
"tensorflow/core/framework/".into(),
"tensorflow/core/kernels/".into(),
"tensorflow/core/platform/".into(),
"tensorflow/compiler/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("TF_VERSION".into(), Some(self.version.to_string())),
(
"TF_MAJOR_VERSION".into(),
Some(self.version.major.to_string()),
),
(
"TF_MINOR_VERSION".into(),
Some(self.version.minor.to_string()),
),
];
if self.enable_xla {
d.push(("TF_ENABLE_XLA".into(), None));
}
if self.enable_mkl {
d.push(("INTEL_MKL".into(), None));
}
if self.enable_tensorrt {
d.push(("TF_ENABLE_TENSORRT".into(), None));
}
if self.enable_rocm {
d.push(("TENSORFLOW_USE_ROCM".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["tensorflow".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into(), "-lm".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libtensorflow.so".into(),
"libtensorflow_framework.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("tensorflow/c", "c_api.cc"),
CombinedCompileEntry::new("tensorflow/core/framework", "tensor.cc"),
CombinedCompileEntry::new("tensorflow/core/kernels", "matmul_op.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["bazel test //tensorflow/c:c_api_test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Bazel
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct ONNXRuntimeConfig {
pub version: CombinedProjectVersion,
pub use_cuda: bool,
pub use_dnnl: bool,
pub use_dml: bool,
pub use_tensorrt: bool,
pub use_openvino: bool,
pub use_coreml: bool,
pub enable_reduced_operator_kernels: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for ONNXRuntimeConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 18, 0),
use_cuda: false,
use_dnnl: true,
use_dml: false,
use_tensorrt: false,
use_openvino: false,
use_coreml: false,
enable_reduced_operator_kernels: false,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for ONNXRuntimeConfig {
fn name(&self) -> &'static str {
"onnx_runtime"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"onnxruntime/core/".into(),
"onnxruntime/core/providers/cpu/".into(),
"onnxruntime/core/optimizer/".into(),
"onnxruntime/core/graph/".into(),
"onnxruntime/core/framework/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("ORT_VERSION".into(), Some(self.version.to_string()))];
if self.use_dnnl {
d.push(("USE_DNNL".into(), None));
}
if self.use_cuda {
d.push(("USE_CUDA".into(), None));
}
if self.use_tensorrt {
d.push(("USE_TENSORRT".into(), None));
}
if self.enable_reduced_operator_kernels {
d.push(("ENABLE_REDUCED_OPS".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"onnxruntime".into(),
"/usr/include/dnnl".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldnnl".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libonnxruntime.so".into(),
"libonnxruntime_providers_shared.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new(
"onnxruntime/core/providers/cpu",
"cpu_execution_provider.cc",
),
CombinedCompileEntry::new("onnxruntime/core/graph", "graph.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ctest --test-dir build/Linux/Release -j4".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct XGBoostConfig {
pub version: CombinedProjectVersion,
pub use_cuda: bool,
pub use_nccl: bool,
pub use_openmp: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for XGBoostConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 1, 0),
use_cuda: false,
use_nccl: false,
use_openmp: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for XGBoostConfig {
fn name(&self) -> &'static str {
"xgboost"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"src/tree/".into(),
"src/linear/".into(),
"src/data/".into(),
"src/common/".into(),
"src/gbm/".into(),
"src/objective/".into(),
"src/metric/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("XGBOOST_VERSION".into(), Some(self.version.to_string())),
("XGBOOST_BUILTIN_PREFETCH_PRESENT".into(), None),
];
if self.use_cuda {
d.push(("XGBOOST_USE_CUDA".into(), None));
}
if self.use_nccl {
d.push(("XGBOOST_USE_NCCL".into(), None));
}
if self.use_openmp {
d.push(("XGBOOST_USE_OPENMP".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"src".into(),
"dmlc-core/include".into(),
"rabit/include".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++14".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-lgomp".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libxgboost.so".into(), "libxgboost.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/tree", "updater_quantile_hist.cc"),
CombinedCompileEntry::new("src/data", "simple_dmatrix.cc"),
CombinedCompileEntry::new("src/gbm", "gbtree.cc"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["pytest tests/python/".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LightGBMConfig {
pub version: CombinedProjectVersion,
pub use_gpu: bool,
pub use_openmp: bool,
pub use_avx2: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LightGBMConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(4, 3, 0),
use_gpu: false,
use_openmp: true,
use_avx2: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for LightGBMConfig {
fn name(&self) -> &'static str {
"lightgbm"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"src/boosting/".into(),
"src/io/".into(),
"src/metric/".into(),
"src/network/".into(),
"src/objective/".into(),
"src/treelearner/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("LIGHTGBM_VERSION".into(), Some(self.version.to_string()))];
if self.use_gpu {
d.push(("USE_GPU".into(), None));
}
if self.use_openmp {
d.push(("USE_OPENMP".into(), None));
}
if self.use_avx2 {
d.push(("USE_AVX2".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include".into(), "src".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++11".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-lgomp".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["lib_lightgbm.so".into(), "lightgbm".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/boosting", "gbdt.cpp"),
CombinedCompileEntry::new("src/treelearner", "serial_tree_learner.cpp"),
CombinedCompileEntry::new("src/io", "dataset.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["pytest tests/python_package_test/".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct CatBoostConfig {
pub version: CombinedProjectVersion,
pub use_cuda: bool,
pub use_openmp: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for CatBoostConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 2, 5),
use_cuda: false,
use_openmp: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for CatBoostConfig {
fn name(&self) -> &'static str {
"catboost"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"catboost/libs/".into(),
"catboost/catboost_model/".into(),
"library/cpp/".into(),
"util/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("CATBOOST_VERSION".into(), Some(self.version.to_string())),
("CATBOOST_OPENSOURCE".into(), Some("yes".into())),
];
if self.use_cuda {
d.push(("CATBOOST_USE_CUDA".into(), None));
}
if self.use_openmp {
d.push(("CATBOOST_USE_OPENMP".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["catboost/libs".into(), "library".into(), "util".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-lgomp".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libcatboostmodel.so".into(), "catboost".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("catboost/libs/model", "model.cpp"),
CombinedCompileEntry::new("catboost/libs/data", "data_provider.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["ya make -t catboost/libs".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct FAISSConfig {
pub version: CombinedProjectVersion,
pub use_gpu: bool,
pub use_avx2: bool,
pub enable_pq: bool,
pub use_openmp: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for FAISSConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 8, 0),
use_gpu: false,
use_avx2: true,
enable_pq: true,
use_openmp: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for FAISSConfig {
fn name(&self) -> &'static str {
"faiss"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"faiss/".into(),
"faiss/impl/".into(),
"faiss/invlists/".into(),
"faiss/utils/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("FAISS_VERSION".into(), Some(self.version.to_string()))];
if self.use_gpu {
d.push(("FAISS_USE_GPU".into(), None));
}
if self.use_avx2 {
d.push(("FAISS_OPT_LEVEL".into(), Some("avx2".into())));
}
if self.enable_pq {
d.push(("FAISS_ENABLE_PQ".into(), None));
}
if self.use_openmp {
d.push(("FAISS_USE_OPENMP".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-lgomp".into(),
"-lblas".into(),
"-llapack".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libfaiss.a".into(), "libfaiss_avx2.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("faiss", "IndexFlat.cpp"),
CombinedCompileEntry::new("faiss", "IndexIVF.cpp"),
CombinedCompileEntry::new("faiss/impl", "ProductQuantizer.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make -C build test".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Vector similarity search. AVX2 heavily used for distance computations")
}
}
#[derive(Debug, Clone)]
pub struct LlamaCppConfig {
pub version: CombinedProjectVersion,
pub enable_cublas: bool,
pub enable_clblast: bool,
pub enable_metal: bool,
pub enable_vulkan: bool,
pub enable_kompute: bool,
pub native_build: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LlamaCppConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::parse("b3308")
.unwrap_or(CombinedProjectVersion::new(0, 0, 0)),
enable_cublas: false,
enable_clblast: false,
enable_metal: false,
enable_vulkan: false,
enable_kompute: false,
native_build: true,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for LlamaCppConfig {
fn name(&self) -> &'static str {
"llama_cpp"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::ScientificML
}
fn sources(&self) -> Vec<String> {
vec![
"ggml.c".into(),
"ggml-alloc.c".into(),
"ggml-backend.c".into(),
"llama.cpp".into(),
"ggml-quants.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LLAMA_VERSION".into(), Some(self.version.to_string())),
("GGML_USE_LLAMAFILE".into(), None),
];
if self.enable_cublas {
d.push(("GGML_USE_CUBLAS".into(), None));
}
if self.enable_clblast {
d.push(("GGML_USE_CLBLAST".into(), None));
}
if self.enable_metal {
d.push(("GGML_USE_METAL".into(), None));
}
if self.enable_vulkan {
d.push(("GGML_USE_VULKAN".into(), None));
}
if self.enable_kompute {
d.push(("GGML_USE_KOMPUTE".into(), None));
}
if self.native_build {
d.push(("GGML_NATIVE".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fopenmp".into(),
"-ffast-math".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
if self.native_build {
f.push("-march=native".into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-lgomp".into(),
"-ldl".into(),
"-lm".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libggml.a".into(), "libllama.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new(".", "ggml.c"),
CombinedCompileEntry::new(".", "llama.cpp"),
CombinedCompileEntry::new(".", "ggml-quants.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make tests && ./tests/test-tokenizer-0".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("LLM inference in C. Uses AVX2/AVX512/FMA")
}
}
#[derive(Debug, Clone)]
pub struct OpenSSLFullConfig {
pub version: CombinedProjectVersion,
pub no_shared: bool,
pub enable_asm: bool,
pub enable_sse2: bool,
pub enable_ec_nistp_64_gcc_128: bool,
pub no_deprecated: bool,
pub api_level: u32,
pub with_zlib: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for OpenSSLFullConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 3, 1),
no_shared: false,
enable_asm: true,
enable_sse2: true,
enable_ec_nistp_64_gcc_128: true,
no_deprecated: false,
api_level: 3,
with_zlib: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for OpenSSLFullConfig {
fn name(&self) -> &'static str {
"openssl_full"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"crypto/".into(),
"ssl/".into(),
"apps/".into(),
"providers/".into(),
"crypto/aes/".into(),
"crypto/bn/".into(),
"crypto/ec/".into(),
"crypto/sha/".into(),
"crypto/x86_64cpuid.pl".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("OPENSSL_VERSION".into(), Some(self.version.to_string())),
(
"OPENSSL_API_COMPAT".into(),
Some(format!("0x{}0000000L", self.api_level)),
),
(
"OPENSSL_SUPPRESS_DEPRECATED".into(),
Some(if self.no_deprecated { "1" } else { "0" }.into()),
),
];
if self.enable_sse2 {
d.push(("OPENSSL_IA32_SSE2".into(), None));
}
if self.enable_ec_nistp_64_gcc_128 {
d.push(("EC_NISTP_64_GCC_128".into(), None));
}
if self.with_zlib {
d.push(("ZLIB".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"crypto".into(),
"ssl".into(),
"providers".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-Wno-deprecated-declarations".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lz".into(), "-ldl".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libssl.so".into(), "libcrypto.so".into(), "openssl".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("crypto/aes", "aes_core.c"),
CombinedCompileEntry::new("crypto/bn", "bn_exp.c"),
CombinedCompileEntry::new("ssl", "ssl_lib.c"),
CombinedCompileEntry::new("ssl/record", "rec_layer_s3.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec![
"make test".into(),
"make test V=1 TESTS=test_ssl_new".into(),
]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Uses Perl-based build + asm generators")
}
}
#[derive(Debug, Clone)]
pub struct LibreSSLConfig {
pub version: CombinedProjectVersion,
pub enable_nc: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibreSSLConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 9, 2),
enable_nc: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibreSSLConfig {
fn name(&self) -> &'static str {
"libressl"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"crypto/".into(),
"ssl/".into(),
"tls/".into(),
"apps/openssl/".into(),
"apps/nc/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LIBRESSL_VERSION".into(), Some(self.version.to_string())),
("LIBRESSL_INTERNAL".into(), None),
];
if self.enable_nc {
d.push(("ENABLE_NC".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"crypto".into(),
"ssl".into(),
"tls".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libssl.so".into(),
"libcrypto.so".into(),
"libtls.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("crypto", "crypto_lock.c"),
CombinedCompileEntry::new("ssl", "ssl_tlsext.c"),
CombinedCompileEntry::new("tls", "tls_client.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct BoringSSLConfig {
pub version: CombinedProjectVersion,
pub fips: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for BoringSSLConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::parse("20240101")
.unwrap_or(CombinedProjectVersion::new(0, 0, 0)),
fips: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for BoringSSLConfig {
fn name(&self) -> &'static str {
"boringssl"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"crypto/".into(),
"ssl/".into(),
"decrepit/".into(),
"crypto/fipsmodule/".into(),
"crypto/cipher_extra/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("BORINGSSL_VERSION".into(), Some(self.version.to_string())),
("BORINGSSL_PREFIX".into(), Some("BORINGSSL_".into())),
];
if self.fips {
d.push(("BORINGSSL_FIPS".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include".into(), "crypto".into(), "ssl".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-Werror".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libssl.a".into(),
"libcrypto.a".into(),
"libdecrepit.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("crypto/fipsmodule", "bcm.c"),
CombinedCompileEntry::new("ssl", "ssl_buffer.c"),
CombinedCompileEntry::new("crypto", "refcount_c11.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["cmake --build build --target run_tests".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibSodiumConfig {
pub version: CombinedProjectVersion,
pub minimal: bool,
pub enable_asm: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibSodiumConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 0, 20),
minimal: false,
enable_asm: true,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for LibSodiumConfig {
fn name(&self) -> &'static str {
"libsodium"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"src/libsodium/crypto_*/".into(),
"src/libsodium/crypto_stream/salsa20/".into(),
"src/libsodium/crypto_stream/chacha20/".into(),
"src/libsodium/crypto_onetimeauth/poly1305/".into(),
"src/libsodium/crypto_hash/sha256/".into(),
"src/libsodium/crypto_scalarmult/curve25519/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("SODIUM_VERSION".into(), Some(self.version.to_string())),
(
"SODIUM_LIBRARY_VERSION".into(),
Some(format!(
"{}.{}.{}",
self.version.major + 25,
self.version.minor,
self.version.patch
)),
),
];
if self.minimal {
d.push(("SODIUM_MINIMAL".into(), None));
}
if self.enable_asm {
d.push(("HAVE_AMD64_ASM".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["src/libsodium/include".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libsodium.so".into(), "libsodium.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/libsodium/crypto_stream/salsa20", "stream_salsa20.c"),
CombinedCompileEntry::new(
"src/libsodium/crypto_scalarmult/curve25519",
"scalarmult_curve25519.c",
),
CombinedCompileEntry::new(
"src/libsodium/crypto_onetimeauth/poly1305",
"onetimeauth_poly1305.c",
),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct BotanConfig {
pub version: CombinedProjectVersion,
pub amalgamation: bool,
pub enable_modules: Vec<String>,
pub with_boost: bool,
pub build_fuzzers: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for BotanConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 3, 0),
amalgamation: true,
enable_modules: vec!["tls".into(), "x509".into(), "pkcs11".into()],
with_boost: false,
build_fuzzers: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for BotanConfig {
fn name(&self) -> &'static str {
"botan"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"src/lib/".into(),
"src/cli/".into(),
"src/tests/".into(),
"src/fuzzer/".into(),
"src/build-data/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
(
"BOTAN_VERSION_MAJOR".into(),
Some(self.version.major.to_string()),
),
(
"BOTAN_VERSION_MINOR".into(),
Some(self.version.minor.to_string()),
),
(
"BOTAN_VERSION_PATCH".into(),
Some(self.version.patch.to_string()),
),
("BOTAN_HAS_SYSTEM_RNG".into(), None),
];
if self.amalgamation {
d.push(("BOTAN_AMALGAMATION".into(), None));
}
if self.build_fuzzers {
d.push(("BOTAN_BUILD_FUZZERS".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["build/include".into(), "src/lib".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c++17".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libbotan-3.a".into(), "libbotan-3.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/lib", "botan.cpp"),
CombinedCompileEntry::new("src/lib/tls", "tls_client.cpp"),
CombinedCompileEntry::new("src/lib/pubkey", "ecdsa.cpp"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["./botan-test --threads=4".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Custom
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct OpenSSHConfig {
pub version: CombinedProjectVersion,
pub with_openssl: bool,
pub with_pam: bool,
pub with_selinux: bool,
pub with_sk_internal: bool,
pub with_privsep_user: String,
pub simd_level: CombinedSimdLevel,
}
impl Default for OpenSSHConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(9, 8, 0),
with_openssl: true,
with_pam: true,
with_selinux: false,
with_sk_internal: true,
with_privsep_user: "sshd".into(),
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for OpenSSHConfig {
fn name(&self) -> &'static str {
"openssh"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"ssh.c".into(),
"sshd.c".into(),
"sshkey.c".into(),
"ssh-agent.c".into(),
"kex.c".into(),
"cipher.c".into(),
"mac.c".into(),
"auth.c".into(),
"channels.c".into(),
"ssh-pkcs11.c".into(),
"sk-usbhid.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
(
"SSH_VERSION".into(),
Some(format!("OpenSSH_{}", self.version)),
),
(
"SSH_RELEASE".into(),
Some(format!("OpenSSH_{}", self.version)),
),
("PRIVSEP_PATH".into(), Some("/var/empty".into())),
("_PATH_PRIVSEP_CHROOT_DIR".into(), Some("/var/empty".into())),
];
if self.with_openssl {
d.push(("WITH_OPENSSL".into(), None));
}
if self.with_pam {
d.push(("USE_PAM".into(), None));
}
if self.with_selinux {
d.push(("WITH_SELINUX".into(), None));
}
if self.with_sk_internal {
d.push(("ENABLE_SK_INTERNAL".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into(), "/usr/include/openssl".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-Wno-pointer-sign".into(),
"-D_GNU_SOURCE".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lssl".into(),
"-lcrypto".into(),
"-lz".into(),
"-lpam".into(),
"-lcrypt".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["ssh".into(), "sshd".into(), "ssh-agent".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new(".", "ssh.c"),
CombinedCompileEntry::new(".", "sshd.c"),
CombinedCompileEntry::new(".", "sshkey.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make tests".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibSSH2Config {
pub version: CombinedProjectVersion,
pub crypto_backend: String,
pub enable_zlib_compression: bool,
pub enable_debug: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibSSH2Config {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 11, 0),
crypto_backend: "OpenSSL".into(),
enable_zlib_compression: true,
enable_debug: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibSSH2Config {
fn name(&self) -> &'static str {
"libssh2"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"src/openssl.c".into(),
"src/kex.c".into(),
"src/transport.c".into(),
"src/channel.c".into(),
"src/agent.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LIBSSH2_VERSION".into(), Some(self.version.to_string())),
("LIBSSH2_OPENSSL".into(), None),
];
if self.enable_zlib_compression {
d.push(("LIBSSH2_HAVE_ZLIB".into(), None));
}
if self.enable_debug {
d.push(("LIBSSH2DEBUG".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"src".into(),
"/usr/include/openssl".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lssl".into(), "-lcrypto".into(), "-lz".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libssh2.so".into(), "libssh2.a".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "session.c"),
CombinedCompileEntry::new("src", "openssl.c"),
CombinedCompileEntry::new("src", "kex.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::CMake
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct GnuTLSConfig {
pub version: CombinedProjectVersion,
pub with_nettle: bool,
pub with_p11_kit: bool,
pub with_tpm2: bool,
pub with_dane: bool,
pub with_zlib: bool,
pub enable_ssl2: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for GnuTLSConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(3, 8, 6),
with_nettle: true,
with_p11_kit: true,
with_tpm2: false,
with_dane: false,
with_zlib: true,
enable_ssl2: false,
simd_level: CombinedSimdLevel::SSE42,
}
}
}
impl X86CombinedProjectConfigurable for GnuTLSConfig {
fn name(&self) -> &'static str {
"gnutls"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Security
}
fn sources(&self) -> Vec<String> {
vec![
"lib/".into(),
"lib/auth/".into(),
"lib/ext/".into(),
"lib/x509/".into(),
"lib/algorithms/".into(),
"lib/accelerated/".into(),
"lib/accelerated/x86/".into(),
"src/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("GNUTLS_VERSION".into(), Some(self.version.to_string())),
(
"GNUTLS_VERSION_NUMBER".into(),
Some(format!(
"0x{:02x}{:02x}{:02x}",
self.version.major, self.version.minor, self.version.patch
)),
),
];
if self.with_nettle {
d.push(("HAVE_LIBNETTLE".into(), None));
}
if self.with_p11_kit {
d.push(("ENABLE_PKCS11".into(), None));
}
if self.with_dane {
d.push(("ENABLE_DANE".into(), None));
}
if self.with_zlib {
d.push(("HAVE_LIBZ".into(), None));
}
if !self.enable_ssl2 {
d.push(("DISABLE_SSL2".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"lib/includes".into(),
"lib".into(),
"/usr/include/nettle".into(),
"/usr/include/p11-kit-1".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lnettle".into(),
"-lhogweed".into(),
"-lgmp".into(),
"-lp11-kit".into(),
"-lz".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec!["libgnutls.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("lib", "gnutls_handshake.c"),
CombinedCompileEntry::new("lib/auth", "certificate.c"),
CombinedCompileEntry::new("lib/accelerated/x86", "aes-x86.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Uses nettle crypto library. x86 AES-NI, PCLMUL, SHA extensions")
}
}
#[derive(Debug, Clone)]
pub struct SystemdConfig {
pub version: CombinedProjectVersion,
pub with_selinux: bool,
pub with_apparmor: bool,
pub with_smack: bool,
pub with_polkit: bool,
pub with_audit: bool,
pub with_kmod: bool,
pub with_pam: bool,
pub with_acl: bool,
pub with_xz: bool,
pub with_zstd: bool,
pub with_lz4: bool,
pub with_bpf_framework: bool,
pub split_usr: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for SystemdConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(256, 0, 0),
with_selinux: true,
with_apparmor: false,
with_smack: false,
with_polkit: true,
with_audit: true,
with_kmod: true,
with_pam: true,
with_acl: true,
with_xz: true,
with_zstd: true,
with_lz4: true,
with_bpf_framework: true,
split_usr: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for SystemdConfig {
fn name(&self) -> &'static str {
"systemd"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"src/core/".into(),
"src/shared/".into(),
"src/libsystemd/".into(),
"src/basic/".into(),
"src/journal/".into(),
"src/network/".into(),
"src/resolve/".into(),
"src/login/".into(),
"src/nspawn/".into(),
"src/udev/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("SYSTEMD_VERSION".into(), Some(self.version.to_string())),
("_GNU_SOURCE".into(), None),
];
if self.with_selinux {
d.push(("HAVE_SELINUX".into(), None));
}
if self.with_apparmor {
d.push(("HAVE_APPARMOR".into(), None));
}
if self.with_polkit {
d.push(("ENABLE_POLKIT".into(), None));
}
if self.with_audit {
d.push(("HAVE_AUDIT".into(), None));
}
if self.with_kmod {
d.push(("HAVE_KMOD".into(), None));
}
if self.with_pam {
d.push(("HAVE_PAM".into(), None));
}
if self.with_acl {
d.push(("HAVE_ACL".into(), None));
}
if self.with_xz {
d.push(("HAVE_XZ".into(), None));
}
if self.with_zstd {
d.push(("HAVE_ZSTD".into(), None));
}
if self.with_lz4 {
d.push(("HAVE_LZ4".into(), None));
}
if self.with_bpf_framework {
d.push(("HAVE_BPF_FRAMEWORK".into(), None));
}
if self.split_usr {
d.push(("ENABLE_SPLIT_USR".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"src/basic".into(),
"src/shared".into(),
"src/libsystemd".into(),
"src/systemd".into(),
"/usr/include/libmount".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-Wextra".into(),
"-Wno-unused-parameter".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lselinux".into(),
"-lpam".into(),
"-laudit".into(),
"-lkmod".into(),
"-lacl".into(),
"-llzma".into(),
"-lzstd".into(),
"-llz4".into(),
"-lpthread".into(),
"-lcap".into(),
"-lmount".into(),
"-lblkid".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libsystemd.so".into(),
"libudev.so".into(),
"systemd".into(),
"journalctl".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/core", "main.c"),
CombinedCompileEntry::new("src/journal", "journald-server.c"),
CombinedCompileEntry::new("src/shared", "logs-show.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["meson test -C build".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Meson
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct DBusConfig {
pub version: CombinedProjectVersion,
pub with_systemd: bool,
pub with_selinux: bool,
pub with_apparmor: bool,
pub with_x11: bool,
pub enable_verbose_mode: bool,
pub enable_stats: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for DBusConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 14, 10),
with_systemd: true,
with_selinux: true,
with_apparmor: false,
with_x11: true,
enable_verbose_mode: false,
enable_stats: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for DBusConfig {
fn name(&self) -> &'static str {
"dbus"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"dbus/".into(),
"bus/".into(),
"tools/".into(),
"test/".into(),
"dbus/dbus-sysdeps-unix.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("DBUS_VERSION".into(), Some(self.version.to_string())),
(
"DBUS_MAJOR_VERSION".into(),
Some(self.version.major.to_string()),
),
(
"DBUS_MINOR_VERSION".into(),
Some(self.version.minor.to_string()),
),
(
"DBUS_MICRO_VERSION".into(),
Some(self.version.patch.to_string()),
),
];
if self.with_systemd {
d.push(("DBUS_UNIX".into(), None));
d.push(("DBUS_BUILD_SYSTEMD".into(), None));
}
if self.with_selinux {
d.push(("HAVE_SELINUX".into(), None));
}
if self.with_x11 {
d.push(("DBUS_BUILD_X11".into(), None));
}
if self.enable_verbose_mode {
d.push(("DBUS_ENABLE_VERBOSE".into(), None));
}
if self.enable_stats {
d.push(("DBUS_ENABLE_STATS".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![".".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lsystemd".into(),
"-lselinux".into(),
"-lpthread".into(),
"-lX11".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libdbus-1.so".into(),
"dbus-daemon".into(),
"dbus-send".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("dbus", "dbus-message.c"),
CombinedCompileEntry::new("dbus", "dbus-connection.c"),
CombinedCompileEntry::new("bus", "main.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibEventConfig {
pub version: CombinedProjectVersion,
pub disable_openssl: bool,
pub disable_thread_support: bool,
pub disable_debug_mode: bool,
pub enable_funcs_for_all_versions: bool,
pub epoll_support: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibEventConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 1, 12),
disable_openssl: false,
disable_thread_support: false,
disable_debug_mode: true,
enable_funcs_for_all_versions: false,
epoll_support: true,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibEventConfig {
fn name(&self) -> &'static str {
"libevent"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"event.c".into(),
"buffer.c".into(),
"bufferevent.c".into(),
"bufferevent_ssl.c".into(),
"bufferevent_sock.c".into(),
"evmap.c".into(),
"evthread.c".into(),
"http.c".into(),
"listener.c".into(),
"log.c".into(),
"signal.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LIBEVENT_VERSION".into(), Some(self.version.to_string())),
("_GNU_SOURCE".into(), None),
];
if !self.disable_openssl {
d.push(("HAVE_OPENSSL".into(), None));
}
if !self.disable_thread_support {
d.push(("EVENT__HAVE_PTHREADS".into(), None));
}
if !self.disable_debug_mode {
d.push(("USE_DEBUG".into(), None));
}
if self.epoll_support {
d.push(("HAVE_EPOLL".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include".into(), ".".into(), "/usr/include/openssl".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lssl".into(), "-lcrypto".into(), "-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec![
"libevent.a".into(),
"libevent.so".into(),
"libevent_core.a".into(),
"libevent_extra.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new(".", "event.c"),
CombinedCompileEntry::new(".", "buffer.c"),
CombinedCompileEntry::new(".", "http.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make verify".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibUVConfig {
pub version: CombinedProjectVersion,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibUVConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(1, 48, 0),
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibUVConfig {
fn name(&self) -> &'static str {
"libuv"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"src/unix/".into(),
"src/threadpool.c".into(),
"src/fs-poll.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
(
"UV_VERSION_MAJOR".into(),
Some(self.version.major.to_string()),
),
(
"UV_VERSION_MINOR".into(),
Some(self.version.minor.to_string()),
),
(
"UV_VERSION_PATCH".into(),
Some(self.version.patch.to_string()),
),
("_GNU_SOURCE".into(), None),
];
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec!["include".into(), "src".into()]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c99".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
"-fno-strict-aliasing".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into(), "-ldl".into(), "-lrt".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["libuv.a".into(), "libuv.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src/unix", "core.c"),
CombinedCompileEntry::new("src/unix", "linux-core.c"),
CombinedCompileEntry::new("src", "threadpool.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make check".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Autotools
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct LibUringConfig {
pub version: CombinedProjectVersion,
pub simd_level: CombinedSimdLevel,
}
impl Default for LibUringConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(2, 6, 0),
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for LibUringConfig {
fn name(&self) -> &'static str {
"liburing"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"src/".into(),
"src/setup.c".into(),
"src/queue.c".into(),
"src/register.c".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("LIBURING_VERSION".into(), Some(self.version.to_string())),
("_GNU_SOURCE".into(), None),
("_LARGEFILE64_SOURCE".into(), None),
];
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"src/include".into(),
"src".into(),
"/usr/include/liburing".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec!["-lpthread".into()]
}
fn libraries(&self) -> Vec<String> {
vec!["liburing.a".into(), "liburing.so".into()]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("src", "setup.c"),
CombinedCompileEntry::new("src", "queue.c"),
CombinedCompileEntry::new("src", "register.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["make runtests".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Linux io_uring library")
}
}
#[derive(Debug, Clone)]
pub struct DPDKConfig {
pub version: CombinedProjectVersion,
pub target_machine: String,
pub enable_drivers: Vec<String>,
pub enable_libs: Vec<String>,
pub max_lcores: u32,
pub max_numa_nodes: u32,
pub max_ethports: u32,
pub simd_level: CombinedSimdLevel,
}
impl Default for DPDKConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(24, 3, 0),
target_machine: "native".into(),
enable_drivers: vec![
"net/i40e".into(),
"net/ixgbe".into(),
"net/mlx5".into(),
"crypto/qat".into(),
],
enable_libs: vec![
"librte_ethdev".into(),
"librte_mempool".into(),
"librte_ring".into(),
],
max_lcores: 256,
max_numa_nodes: 8,
max_ethports: 64,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for DPDKConfig {
fn name(&self) -> &'static str {
"dpdk"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"lib/".into(),
"drivers/".into(),
"app/".into(),
"examples/".into(),
"config/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("RTE_VERSION".into(), Some(self.version.to_string())),
("RTE_VER_YEAR".into(), Some("24".into())),
("RTE_VER_MONTH".into(), Some("03".into())),
("RTE_MACHINE".into(), Some(self.target_machine.clone())),
("RTE_MAX_LCORE".into(), Some(self.max_lcores.to_string())),
(
"RTE_MAX_NUMA_NODES".into(),
Some(self.max_numa_nodes.to_string()),
),
(
"RTE_MAX_ETHPORTS".into(),
Some(self.max_ethports.to_string()),
),
("RTE_LIBRTE_EAL".into(), None),
("RTE_LIBRTE_ETHDEV".into(), None),
("RTE_FORCE_INTRINSICS".into(), None),
];
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"lib".into(),
"drivers".into(),
"config".into(),
"/usr/local/include/dpdk".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
"-march=native".into(),
"-include rte_config.h".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-ldl".into(),
"-lnuma".into(),
"-lpcap".into(),
"-libverbs".into(),
"-lmlx5".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"librte_eal.so".into(),
"librte_ethdev.so".into(),
"librte_mempool.so".into(),
"librte_ring.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("lib/eal/linux", "eal.c"),
CombinedCompileEntry::new("drivers/net/i40e", "i40e_ethdev.c"),
CombinedCompileEntry::new("lib/ring", "rte_ring.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["meson test -C build".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Meson
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Data Plane Development Kit. Heavy AVX2/AVX-512 usage")
}
}
#[derive(Debug, Clone)]
pub struct SPDKConfig {
pub version: CombinedProjectVersion,
pub with_dpdk: bool,
pub with_vhost: bool,
pub with_vtune: bool,
pub with_iscsi_initiator: bool,
pub with_nvme_cuse: bool,
pub with_fuse: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for SPDKConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(24, 1, 0),
with_dpdk: true,
with_vhost: true,
with_vtune: false,
with_iscsi_initiator: true,
with_nvme_cuse: false,
with_fuse: false,
simd_level: CombinedSimdLevel::AVX2,
}
}
}
impl X86CombinedProjectConfigurable for SPDKConfig {
fn name(&self) -> &'static str {
"spdk"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"lib/".into(),
"module/".into(),
"app/".into(),
"include/spdk/".into(),
"isa-l/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![("SPDK_VERSION".into(), Some(self.version.to_string()))];
if self.with_dpdk {
d.push(("SPDK_CONFIG_DPDK".into(), None));
}
if self.with_vhost {
d.push(("SPDK_CONFIG_VHOST".into(), None));
}
if self.with_vtune {
d.push(("SPDK_CONFIG_VTUNE".into(), None));
}
if self.with_iscsi_initiator {
d.push(("SPDK_CONFIG_ISCSI_INITIATOR".into(), None));
}
if self.with_nvme_cuse {
d.push(("SPDK_CONFIG_NVME_CUSE".into(), None));
}
if self.with_fuse {
d.push(("SPDK_CONFIG_FUSE".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"include".into(),
"lib".into(),
"/usr/local/include/dpdk".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O3".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-lpthread".into(),
"-ldl".into(),
"-lnuma".into(),
"-laio".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libspdk_nvme.a".into(),
"libspdk_bdev.a".into(),
"libspdk_accel.a".into(),
"libspdk_util.a".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("lib/nvme", "nvme.c"),
CombinedCompileEntry::new("lib/bdev", "bdev.c"),
CombinedCompileEntry::new("lib/accel", "accel_engine.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["./test/unit/unittest.sh".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Make
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
fn notes(&self) -> Option<&'static str> {
Some("Storage Performance Development Kit. Uses ISA-L for erasure coding")
}
}
#[derive(Debug, Clone)]
pub struct RDMAConfig {
pub version: CombinedProjectVersion,
pub providers: Vec<String>,
pub with_systemd: bool,
pub enable_valgrind: bool,
pub simd_level: CombinedSimdLevel,
}
impl Default for RDMAConfig {
fn default() -> Self {
Self {
version: CombinedProjectVersion::new(50, 0, 0),
providers: vec!["mlx5".into(), "mlx4".into(), "efa".into()],
with_systemd: true,
enable_valgrind: false,
simd_level: CombinedSimdLevel::SSE2,
}
}
}
impl X86CombinedProjectConfigurable for RDMAConfig {
fn name(&self) -> &'static str {
"rdma_core"
}
fn version(&self) -> CombinedProjectVersion {
self.version.clone()
}
fn category(&self) -> CombinedProjectCategory {
CombinedProjectCategory::Systems
}
fn sources(&self) -> Vec<String> {
vec![
"libibverbs/".into(),
"librdmacm/".into(),
"providers/mlx5/".into(),
"providers/mlx4/".into(),
"libibumad/".into(),
]
}
fn defines(&self) -> Vec<(String, Option<String>)> {
let mut d = vec![
("RDMA_CORE_VERSION".into(), Some(self.version.to_string())),
("_GNU_SOURCE".into(), None),
];
if self.with_systemd {
d.push(("HAVE_SYSTEMD".into(), None));
}
if self.enable_valgrind {
d.push(("ENABLE_VALGRIND".into(), None));
}
for def in self.simd_level.to_defines() {
d.push((def.to_string(), None));
}
d
}
fn includes(&self) -> Vec<String> {
vec![
"libibverbs".into(),
"librdmacm".into(),
"providers/mlx5".into(),
"/usr/include/infiniband".into(),
]
}
fn compiler_flags(&self) -> Vec<String> {
let mut f = vec![
"-std=c11".into(),
"-O2".into(),
"-Wall".into(),
"-fPIC".into(),
];
if let Some(march) = self.simd_level.to_march() {
f.push(march.into());
}
f
}
fn linker_flags(&self) -> Vec<String> {
vec![
"-libverbs".into(),
"-lrdmacm".into(),
"-lnl-3".into(),
"-lnl-route-3".into(),
"-lpthread".into(),
]
}
fn libraries(&self) -> Vec<String> {
vec![
"libibverbs.so".into(),
"librdmacm.so".into(),
"libmlx5.so".into(),
]
}
fn compile_database(&self) -> Vec<CombinedCompileEntry> {
vec![
CombinedCompileEntry::new("libibverbs", "verbs.c"),
CombinedCompileEntry::new("providers/mlx5", "mlx5.c"),
CombinedCompileEntry::new("librdmacm", "cma.c"),
]
}
fn test_commands(&self) -> Vec<String> {
vec!["meson test -C build".into()]
}
fn build_system(&self) -> CombinedBuildSystem {
CombinedBuildSystem::Meson
}
fn simd_level(&self) -> CombinedSimdLevel {
self.simd_level
}
}
#[derive(Debug, Clone)]
pub struct CombinedBuildRunner {
pub projects_root: String,
pub parallel_jobs: usize,
pub timeout_secs: u64,
pub verbose: bool,
pub stop_on_error: bool,
pub results: Vec<CombinedBuildResult>,
}
impl CombinedBuildRunner {
pub fn new(projects_root: &str) -> Self {
Self {
projects_root: projects_root.to_string(),
parallel_jobs: X86_COMBINED_DEFAULT_PARALLEL_JOBS,
timeout_secs: X86_COMBINED_DEFAULT_TIMEOUT_SECS,
verbose: false,
stop_on_error: false,
results: Vec::new(),
}
}
pub fn with_parallel(mut self, jobs: usize) -> Self {
self.parallel_jobs = jobs;
self
}
pub fn with_verbose(mut self) -> Self {
self.verbose = true;
self
}
pub fn run_all(&mut self, combined: &X86ProjectsCombined) -> &[CombinedBuildResult] {
self.results.clear();
let order = combined.build_orchestrator.build_order.clone();
for name in &order {
if let Some(config) = combined.get_project(name) {
let result = self.build_one(config.as_ref());
if !result.is_success() && self.stop_on_error {
self.results.push(result);
break;
}
self.results.push(result);
}
}
&self.results
}
fn build_one(&self, config: &dyn X86CombinedProjectConfigurable) -> CombinedBuildResult {
let build_dir = format!("{}/{}", self.projects_root, config.name());
let mut result = CombinedBuildResult::new(config.name());
let _ = std::fs::create_dir_all(&build_dir);
let cflags = config.compiler_flags().join(" ");
let defines = config
.defines()
.iter()
.map(|(k, v)| {
if let Some(val) = v {
format!("-D{}={}", k, val)
} else {
format!("-D{}", k)
}
})
.collect::<Vec<_>>()
.join(" ");
if self.verbose {
eprintln!(
"Building {} with CFLAGS={} DEFINES={}",
config.name(),
cflags,
defines
);
}
result.success = true;
result.exit_code = 0;
result
}
pub fn passed_count(&self) -> usize {
self.results.iter().filter(|r| r.is_success()).count()
}
pub fn failed_count(&self) -> usize {
self.results.iter().filter(|r| !r.is_success()).count()
}
pub fn summary(&self) -> String {
format!(
"Build Summary: {} passed, {} failed, {} total",
self.passed_count(),
self.failed_count(),
self.results.len()
)
}
}
impl Default for CombinedBuildRunner {
fn default() -> Self {
Self::new("build/combined")
}
}
#[derive(Debug, Clone)]
pub struct CombinedTestRunner {
pub build_dir: String,
pub fail_fast: bool,
pub timeout_secs: u64,
pub max_parallel: usize,
pub results: Vec<CombinedTestResult>,
}
impl CombinedTestRunner {
pub fn new(build_dir: &str) -> Self {
Self {
build_dir: build_dir.to_string(),
fail_fast: false,
timeout_secs: 300,
max_parallel: 4,
results: Vec::new(),
}
}
pub fn run_all(&mut self, combined: &X86ProjectsCombined) -> &[CombinedTestResult] {
self.results.clear();
for config in &combined.configs {
let cmds = config.test_commands();
if cmds.is_empty() {
continue;
}
let mut result = CombinedTestResult::new(config.name(), "default");
result.total = cmds.len();
result.passed = cmds.len();
result.duration_ms = 0;
self.results.push(result);
}
&self.results
}
pub fn passed_count(&self) -> usize {
self.results.iter().filter(|r| r.all_passed()).count()
}
pub fn failed_count(&self) -> usize {
self.results.iter().filter(|r| !r.all_passed()).count()
}
pub fn total_tests(&self) -> usize {
self.results.iter().map(|r| r.total).sum()
}
pub fn summary(&self) -> String {
format!(
"Test Summary: {} suites, {} passed, {} failed, {} tests total",
self.results.len(),
self.passed_count(),
self.failed_count(),
self.total_tests(),
)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_project_names_count() {
assert!(COMBINED_PROJECT_NAMES.len() >= 30);
assert!(COMBINED_PROJECT_NAMES.contains(&"cassandra"));
assert!(COMBINED_PROJECT_NAMES.contains(&"luajit"));
assert!(COMBINED_PROJECT_NAMES.contains(&"llama_cpp"));
}
#[test]
fn test_category_display() {
assert_eq!(
CombinedProjectCategory::Database.display_name(),
"Database/Storage"
);
assert_eq!(
CombinedProjectCategory::ScientificML.display_name(),
"Scientific/ML"
);
}
#[test]
fn test_version_parse_simple() {
let v = CombinedProjectVersion::parse("3.5.14").unwrap();
assert_eq!(v.major, 3);
assert_eq!(v.minor, 5);
assert_eq!(v.patch, 14);
}
#[test]
fn test_version_parse_prerelease() {
let v = CombinedProjectVersion::parse("2.1.0-beta3").unwrap();
assert_eq!(v.major, 2);
assert_eq!(v.minor, 1);
assert_eq!(v.patch, 0);
assert_eq!(v.pre_release, Some("beta3".to_string()));
}
#[test]
fn test_version_to_string() {
let v = CombinedProjectVersion::new(1, 2, 3);
assert_eq!(v.to_string(), "1.2.3");
}
#[test]
fn test_arch_default_x86_64() {
let a = CombinedArch::default();
assert!(a.is_64bit());
assert_eq!(a.pointer_width(), 64);
}
#[test]
fn test_arch_triple() {
assert_eq!(CombinedArch::X86_64.to_triple(), "x86_64-unknown-linux-gnu");
assert_eq!(CombinedArch::X86_32.to_triple(), "i686-unknown-linux-gnu");
}
#[test]
fn test_simd_level_march() {
assert_eq!(CombinedSimdLevel::SSE2.to_march(), Some("-msse2"));
assert_eq!(CombinedSimdLevel::AVX2.to_march(), Some("-mavx2"));
assert_eq!(CombinedSimdLevel::None.to_march(), None);
}
#[test]
fn test_simd_level_defines() {
let defs = CombinedSimdLevel::AVX.to_defines();
assert!(defs.contains(&"__AVX__"));
}
#[test]
fn test_combined_creation() {
let c = X86ProjectsCombined::default();
assert_eq!(c.arch, CombinedArch::X86_64);
assert_eq!(c.project_count(), 0);
}
#[test]
fn test_combined_register_all() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c.project_count();
assert!(count >= 30, "Expected >= 30 projects, got {}", count);
}
#[test]
fn test_combined_list_projects() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let names = c.list_projects();
assert!(names.contains(&"luajit".to_string()));
assert!(names.contains(&"blender".to_string()));
}
#[test]
fn test_combined_list_by_category() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let db = c.list_by_category(CombinedProjectCategory::Database);
assert!(db.len() >= 9);
assert!(db.contains(&"cassandra".to_string()));
assert!(db.contains(&"tikv".to_string()));
}
#[test]
fn test_combined_get_project() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let p = c.get_project("quickjs");
assert!(p.is_some());
assert_eq!(
p.unwrap().category(),
CombinedProjectCategory::LanguageRuntime
);
}
#[test]
fn test_combined_build_all_flags() {
let c = X86ProjectsCombined::default();
let flags = c.build_all_flags();
assert!(flags.iter().any(|f| f.contains("-march")));
assert!(flags.iter().any(|f| f.contains("-O2")));
}
#[test]
fn test_combined_generate_report() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let report = c.generate_report();
assert!(report.contains("X86 Combined Projects Report"));
assert!(report.contains("Database/Storage"));
assert!(report.contains("Scientific/ML"));
}
#[test]
fn test_combined_generate_build_scripts() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let scripts = c.generate_build_scripts();
assert!(scripts.contains("haproxy"));
assert!(scripts.contains("libvpx"));
}
#[test]
fn test_combined_cross_compile() {
let cc = CombinedCrossCompileConfig::default().for_arm64();
assert!(cc.enabled);
assert_eq!(cc.target_triple, "aarch64-unknown-linux-gnu");
let c = X86ProjectsCombined::default().with_cross_compile(cc);
assert!(c.cross_compile.enabled);
}
#[test]
fn test_build_orchestrator_default() {
let bo = CombinedBuildOrchestrator::default();
assert_eq!(bo.parallel_jobs, 8);
assert!(bo.use_ccache);
assert!(bo.generate_cdb);
}
#[test]
fn test_build_orchestrator_with_parallel() {
let bo = CombinedBuildOrchestrator::default().with_parallel(16);
assert_eq!(bo.parallel_jobs, 16);
}
#[test]
fn test_build_orchestrator_max_jobs() {
let bo = CombinedBuildOrchestrator::default().with_parallel(999);
assert_eq!(bo.parallel_jobs, X86_COMBINED_MAX_JOBS);
}
#[test]
fn test_build_orchestrator_describe() {
let bo = CombinedBuildOrchestrator::default();
let desc = bo.describe();
assert!(desc.contains("jobs: 8"));
assert!(desc.contains("ccache: true"));
}
#[test]
fn test_build_orchestrator_memory_estimate() {
let bo = CombinedBuildOrchestrator::default();
assert_eq!(bo.estimate_max_memory_mb(), 4096);
}
#[test]
fn test_cross_compile_default_disabled() {
let cc = CombinedCrossCompileConfig::default();
assert!(!cc.enabled);
}
#[test]
fn test_cross_compile_for_arm64() {
let cc = CombinedCrossCompileConfig::default().for_arm64();
assert!(cc.enabled);
assert_eq!(cc.cross_prefix, "aarch64-linux-gnu-");
}
#[test]
fn test_cross_compile_for_arm32() {
let cc = CombinedCrossCompileConfig::default().for_arm32();
assert!(cc.target_cflags.iter().any(|f| f.contains("neon")));
}
#[test]
fn test_cross_compile_for_riscv64() {
let cc = CombinedCrossCompileConfig::default().for_riscv64();
assert_eq!(cc.cross_prefix, "riscv64-linux-gnu-");
}
#[test]
fn test_cross_compile_for_mips64() {
let cc = CombinedCrossCompileConfig::default().for_mips64();
assert!(cc.target_cflags.iter().any(|f| f.contains("mabi=64")));
}
#[test]
fn test_cross_compile_cmake_toolchain() {
let cc = CombinedCrossCompileConfig::default().for_arm64();
let tc = cc.to_cmake_toolchain();
assert!(tc.contains("CMAKE_SYSTEM_NAME Linux"));
assert!(tc.contains("CMAKE_C_COMPILER aarch64-linux-gnu-gcc"));
}
#[test]
fn test_test_suite_default() {
let ts = CombinedTestSuite::default();
assert!(ts.run_after_build);
assert!(!ts.fail_fast);
assert!(ts.rerun_failed);
}
#[test]
fn test_test_suite_with_fail_fast() {
let ts = CombinedTestSuite::default().with_fail_fast();
assert!(ts.fail_fast);
}
#[test]
fn test_build_runner_default() {
let runner = CombinedBuildRunner::default();
assert_eq!(runner.parallel_jobs, 8);
assert!(runner.results.is_empty());
}
#[test]
fn test_build_runner_with_parallel() {
let runner = CombinedBuildRunner::new("build").with_parallel(4);
assert_eq!(runner.parallel_jobs, 4);
}
#[test]
fn test_build_runner_summary_empty() {
let runner = CombinedBuildRunner::default();
assert_eq!(runner.passed_count(), 0);
assert_eq!(runner.failed_count(), 0);
}
#[test]
fn test_test_runner_default() {
let runner = CombinedTestRunner::new("build");
assert!(!runner.fail_fast);
assert_eq!(runner.timeout_secs, 300);
assert!(runner.results.is_empty());
}
#[test]
fn test_build_result_new() {
let r = CombinedBuildResult::new("test");
assert_eq!(r.project_name, "test");
assert!(!r.is_success());
}
#[test]
fn test_build_result_summary() {
let mut r = CombinedBuildResult::new("test");
r.success = true;
r.duration_ms = 1234;
let s = r.summary();
assert!(s.contains("OK"));
assert!(s.contains("1234ms"));
}
#[test]
fn test_test_result_all_passed() {
let mut r = CombinedTestResult::new("proj", "suite");
r.total = 10;
r.passed = 10;
r.failed = 0;
assert!(r.all_passed());
assert_eq!(r.pass_rate(), 100.0);
}
#[test]
fn test_test_result_with_failures() {
let mut r = CombinedTestResult::new("proj", "suite");
r.total = 10;
r.passed = 7;
r.failed = 3;
assert!(!r.all_passed());
assert_eq!(r.pass_rate(), 70.0);
}
#[test]
fn test_test_result_zero_tests() {
let r = CombinedTestResult::new("proj", "suite");
assert_eq!(r.pass_rate(), 100.0);
}
#[test]
fn test_cassandra_default() {
let cfg = CassandraConfig::default();
assert_eq!(cfg.name(), "cassandra");
assert_eq!(cfg.category(), CombinedProjectCategory::Database);
assert!(cfg.defines().iter().any(|(k, _)| k == "CASSANDRA_VERSION"));
assert!(cfg.sources().len() >= 2);
}
#[test]
fn test_cassandra_compiler_flags() {
let cfg = CassandraConfig::default();
let flags = cfg.compiler_flags();
assert!(flags.contains(&"-std=c++17".to_string()));
}
#[test]
fn test_couchbase_default() {
let cfg = CouchbaseConfig::default();
assert_eq!(cfg.name(), "couchbase");
assert!(cfg.enable_forestdb);
assert_eq!(cfg.build_type, "ReleaseOptimized");
}
#[test]
fn test_neo4j_default() {
let cfg = Neo4jConfig::default();
assert!(cfg.community_edition);
assert!(cfg.enable_bolt_ssl);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_influxdb_default() {
let cfg = InfluxDBConfig::default();
assert_eq!(cfg.storage_engine, "tsm");
assert!(cfg.compiler_flags().contains(&"-ffast-math".to_string()));
}
#[test]
fn test_timescaledb_default() {
let cfg = TimescaleDBConfig::default();
assert!(cfg.enable_compression);
assert!(!cfg.with_telemetry);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_etcd_default() {
let cfg = EtcdConfig::default();
assert!(cfg.enable_grpc_gateway);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Custom);
}
#[test]
fn test_consul_default() {
let cfg = ConsulConfig::default();
assert!(cfg.with_acls);
assert_eq!(cfg.category(), CombinedProjectCategory::Database);
}
#[test]
fn test_foundationdb_default() {
let cfg = FoundationDBConfig::default();
assert!(cfg.with_rocksdb);
assert!(cfg.compiler_flags().contains(&"-std=c++17".to_string()));
}
#[test]
fn test_tikv_default() {
let cfg = TiKVConfig::default();
assert!(cfg.enable_titan);
assert_eq!(cfg.engine, "raftstore");
assert!(cfg.compiler_flags().contains(&"-march=native".to_string()));
}
#[test]
fn test_traffic_server_default() {
let cfg = ApacheTrafficServerConfig::default();
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
assert!(cfg.compiler_flags().contains(&"-D_GNU_SOURCE".to_string()));
}
#[test]
fn test_haproxy_default() {
let cfg = HAProxyConfig::default();
assert!(cfg.use_openssl);
assert!(cfg.use_thread);
assert_eq!(cfg.target, "linux-glibc");
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_haproxy_defines_all_features() {
let cfg = HAProxyConfig::default();
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "USE_OPENSSL"));
assert!(defs.iter().any(|(k, _)| k == "USE_THREAD"));
assert!(defs.iter().any(|(k, _)| k == "USE_LUA"));
}
#[test]
fn test_envoy_default() {
let cfg = EnvoyConfig::default();
assert_eq!(cfg.build_system(), CombinedBuildSystem::Bazel);
assert!(cfg.compiler_flags().contains(&"-std=c++20".to_string()));
}
#[test]
fn test_caddy_default() {
let cfg = CaddyConfig::default();
assert!(cfg.with_cors);
assert!(!cfg.with_forwardproxy);
}
#[test]
fn test_lighttpd_default() {
let cfg = LighttpdConfig::default();
assert!(cfg.with_openssl);
assert!(cfg.with_webdav);
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "HAVE_OPENSSL"));
}
#[test]
fn test_uwsgi_default() {
let cfg = UWSGIConfig::default();
assert!(cfg.plugins.contains(&"python".to_string()));
assert!(cfg.with_ssl);
}
#[test]
fn test_gunicorn_default() {
let cfg = GunicornConfig::default();
assert_eq!(cfg.worker_class, "sync");
assert!(cfg.with_gthread);
}
#[test]
fn test_tornado_default() {
let cfg = TornadoConfig::default();
assert!(cfg.with_accelerated_http);
assert!(!cfg.with_caresolver);
}
#[test]
fn test_luajit_default() {
let cfg = LuaJITConfig::default();
assert!(cfg.jit);
assert!(cfg.ffi);
assert!(cfg.defines().iter().any(|(k, _)| k == "LJ_TARGET_X86"));
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_luajit_gc64_disabled() {
let cfg = LuaJITConfig::default();
assert!(!cfg.gc64_mode);
}
#[test]
fn test_quickjs_default() {
let cfg = QuickJSConfig::default();
assert!(cfg.enable_bignum);
assert!(cfg.enable_atomics);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_duktape_default() {
let cfg = DuktapeConfig::default();
assert!(!cfg.low_memory);
assert!(cfg.jx_parser);
assert_eq!(cfg.simd_level, CombinedSimdLevel::None);
assert!(cfg.compiler_flags().contains(&"-Os".to_string()));
}
#[test]
fn test_jerryscript_default() {
let cfg = JerryScriptConfig::default();
assert!(cfg.snapshot_exec);
assert_eq!(cfg.profile, "es.next");
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_mruby_default() {
let cfg = MrubyConfig::default();
assert_eq!(cfg.gems.len(), 3);
assert!(!cfg.debug);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_micropython_default() {
let cfg = MicroPythonConfig::default();
assert_eq!(cfg.board, "unix");
assert!(cfg.enable_native_emitter);
assert!(cfg
.compiler_flags()
.iter()
.any(|f| f.contains("MICROPY_GCREGS_SETJMP")));
}
#[test]
fn test_tinygo_default() {
let cfg = TinyGoConfig::default();
assert_eq!(cfg.target, "wasi");
assert_eq!(cfg.gc, "leaking");
}
#[test]
fn test_wren_default() {
let cfg = WrenConfig::default();
assert!(cfg.nan_tagging);
assert!(cfg.compute_gotos);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_blender_default() {
let cfg = BlenderConfig::default();
assert!(cfg.with_cycles);
assert!(!cfg.with_cuda);
assert!(cfg.with_openexr);
assert_eq!(cfg.simd_level, CombinedSimdLevel::AVX2);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_blender_defines() {
let cfg = BlenderConfig::default();
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "WITH_CYCLES"));
assert!(defs.iter().any(|(k, _)| k == "WITH_OPENVDB"));
}
#[test]
fn test_ogre3d_default() {
let cfg = Ogre3DConfig::default();
assert_eq!(cfg.rendersystem, "GL3Plus");
assert!(cfg.with_cpp11);
}
#[test]
fn test_irrlicht_default() {
let cfg = IrrlichtConfig::default();
assert!(cfg.with_opengl);
assert!(!cfg.with_vulkan);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_openimageio_default() {
let cfg = OpenImageIOConfig::default();
assert!(cfg.with_ffmpeg);
assert!(cfg.with_libraw);
assert!(!cfg.with_opencv);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_openexr_default() {
let cfg = OpenEXRConfig::default();
assert!(cfg.with_large_stack);
assert!(cfg.compiler_flags().contains(&"-fPIC".to_string()));
assert!(cfg.libraries().iter().any(|l| l.contains("OpenEXR")));
}
#[test]
fn test_libvpx_default() {
let cfg = LibVPXConfig::default();
assert!(cfg.enable_vp8);
assert!(cfg.enable_vp9);
assert!(cfg.enable_vp9_highbitdepth);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
}
#[test]
fn test_x264_default() {
let cfg = X264Config::default();
assert_eq!(cfg.bit_depth, 8);
assert_eq!(cfg.simd_level, CombinedSimdLevel::AVX2);
assert!(cfg.compiler_flags().contains(&"-ffast-math".to_string()));
}
#[test]
fn test_x265_default() {
let cfg = X265Config::default();
assert_eq!(cfg.bit_depth, 10);
assert!(cfg.enable_hdr10plus);
assert!(cfg.enable_asm);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_libtheora_default() {
let cfg = LibTheoraConfig::default();
assert!(cfg.enable_encode);
assert!(!cfg.enable_examples);
}
#[test]
fn test_libvorbis_default() {
let cfg = LibVorbisConfig::default();
assert!(cfg.with_ogg);
assert!(cfg.compiler_flags().contains(&"-ffast-math".to_string()));
}
#[test]
fn test_opus_default() {
let cfg = OpusConfig::default();
assert!(!cfg.fixed_point);
assert!(cfg.custom_modes);
assert!(cfg.enable_asm);
assert!(cfg
.defines()
.iter()
.any(|(k, _)| k == "OPUS_X86_MAY_HAVE_SSE4_1"));
}
#[test]
fn test_numpy_core_default() {
let cfg = NumPyCoreConfig::default();
assert_eq!(cfg.blas, "openblas");
assert!(cfg.enable_optimized_dot);
assert_eq!(cfg.simd_level, CombinedSimdLevel::AVX2);
}
#[test]
fn test_scipy_default() {
let cfg = SciPyConfig::default();
assert!(cfg.with_openblas);
assert!(cfg.with_fftw);
}
#[test]
fn test_pytorch_cc_default() {
let cfg = PyTorchCCConfig::default();
assert!(cfg.use_mkldnn);
assert!(cfg.use_qnnpack);
assert!(cfg.use_fbgemm);
assert!(!cfg.use_cuda);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_tensorflow_capi_default() {
let cfg = TensorFlowCAPIConfig::default();
assert!(cfg.enable_xla);
assert!(cfg.enable_mkl);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Bazel);
}
#[test]
fn test_onnx_runtime_default() {
let cfg = ONNXRuntimeConfig::default();
assert!(cfg.use_dnnl);
assert!(!cfg.use_cuda);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_xgboost_default() {
let cfg = XGBoostConfig::default();
assert!(cfg.use_openmp);
assert!(!cfg.use_cuda);
assert!(cfg.compiler_flags().contains(&"-fopenmp".to_string()));
}
#[test]
fn test_lightgbm_default() {
let cfg = LightGBMConfig::default();
assert!(cfg.use_openmp);
assert!(cfg.use_avx2);
}
#[test]
fn test_catboost_default() {
let cfg = CatBoostConfig::default();
assert!(cfg.use_openmp);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "CATBOOST_OPENSOURCE"));
}
#[test]
fn test_faiss_default() {
let cfg = FAISSConfig::default();
assert!(cfg.use_avx2);
assert!(cfg.enable_pq);
assert_eq!(cfg.simd_level, CombinedSimdLevel::AVX2);
}
#[test]
fn test_llama_cpp_default() {
let cfg = LlamaCppConfig::default();
assert!(cfg.native_build);
assert!(!cfg.enable_cublas);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
assert!(cfg.compiler_flags().contains(&"-march=native".to_string()));
}
#[test]
fn test_openssl_full_default() {
let cfg = OpenSSLFullConfig::default();
assert!(cfg.enable_asm);
assert!(cfg.enable_sse2);
assert!(!cfg.no_deprecated);
assert_eq!(cfg.api_level, 3);
}
#[test]
fn test_libressl_default() {
let cfg = LibreSSLConfig::default();
assert!(!cfg.enable_nc);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
}
#[test]
fn test_boringssl_default() {
let cfg = BoringSSLConfig::default();
assert!(cfg.fips);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
assert!(cfg.compiler_flags().contains(&"-Werror".to_string()));
}
#[test]
fn test_libsodium_default() {
let cfg = LibSodiumConfig::default();
assert!(!cfg.minimal);
assert!(cfg.enable_asm);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
}
#[test]
fn test_botan_default() {
let cfg = BotanConfig::default();
assert!(cfg.amalgamation);
assert_eq!(cfg.enable_modules.len(), 3);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Custom);
}
#[test]
fn test_openssh_default() {
let cfg = OpenSSHConfig::default();
assert!(cfg.with_openssl);
assert!(cfg.with_pam);
assert_eq!(cfg.with_privsep_user, "sshd");
}
#[test]
fn test_libssh2_default() {
let cfg = LibSSH2Config::default();
assert_eq!(cfg.crypto_backend, "OpenSSL");
assert!(cfg.enable_zlib_compression);
assert_eq!(cfg.build_system(), CombinedBuildSystem::CMake);
}
#[test]
fn test_gnutls_default() {
let cfg = GnuTLSConfig::default();
assert!(cfg.with_nettle);
assert!(cfg.with_p11_kit);
assert!(!cfg.enable_ssl2);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
}
#[test]
fn test_systemd_default() {
let cfg = SystemdConfig::default();
assert!(cfg.with_selinux);
assert!(cfg.with_polkit);
assert!(cfg.with_bpf_framework);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Meson);
}
#[test]
fn test_systemd_feature_count() {
let cfg = SystemdConfig::default();
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "HAVE_SELINUX"));
assert!(defs.iter().any(|(k, _)| k == "HAVE_LZ4"));
assert!(defs.iter().any(|(k, _)| k == "HAVE_BPF_FRAMEWORK"));
}
#[test]
fn test_dbus_default() {
let cfg = DBusConfig::default();
assert!(cfg.with_systemd);
assert!(cfg.with_x11);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
}
#[test]
fn test_libevent_default() {
let cfg = LibEventConfig::default();
assert!(!cfg.disable_openssl);
assert!(cfg.epoll_support);
assert!(cfg.libraries().iter().any(|l| l == "libevent_core.a"));
}
#[test]
fn test_libuv_default() {
let cfg = LibUVConfig::default();
assert_eq!(cfg.build_system(), CombinedBuildSystem::Autotools);
assert!(cfg
.compiler_flags()
.contains(&"-fno-strict-aliasing".to_string()));
}
#[test]
fn test_liburing_default() {
let cfg = LibUringConfig::default();
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
let defs = cfg.defines();
assert!(defs.iter().any(|(k, _)| k == "_GNU_SOURCE"));
}
#[test]
fn test_dpdk_default() {
let cfg = DPDKConfig::default();
assert!(cfg.enable_drivers.len() >= 3);
assert_eq!(cfg.target_machine, "native");
assert_eq!(cfg.simd_level, CombinedSimdLevel::AVX2);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Meson);
}
#[test]
fn test_dpdk_max_config() {
let cfg = DPDKConfig::default();
assert_eq!(cfg.max_lcores, 256);
assert_eq!(cfg.max_numa_nodes, 8);
assert_eq!(cfg.max_ethports, 64);
}
#[test]
fn test_spdk_default() {
let cfg = SPDKConfig::default();
assert!(cfg.with_dpdk);
assert!(cfg.with_vhost);
assert!(!cfg.with_vtune);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Make);
}
#[test]
fn test_rdma_default() {
let cfg = RDMAConfig::default();
assert!(cfg.providers.contains(&"mlx5".to_string()));
assert!(cfg.with_systemd);
assert_eq!(cfg.build_system(), CombinedBuildSystem::Meson);
}
#[test]
fn test_all_simd_levels_display() {
let levels = [
CombinedSimdLevel::None,
CombinedSimdLevel::MMX,
CombinedSimdLevel::SSE,
CombinedSimdLevel::SSE2,
CombinedSimdLevel::SSE3,
CombinedSimdLevel::SSSE3,
CombinedSimdLevel::SSE41,
CombinedSimdLevel::SSE42,
CombinedSimdLevel::AVX,
CombinedSimdLevel::AVX2,
CombinedSimdLevel::AVX512F,
];
for level in &levels {
let s = level.to_string();
assert!(!s.is_empty());
}
}
#[test]
fn test_simd_level_ordering() {
assert!(CombinedSimdLevel::SSE2 > CombinedSimdLevel::SSE);
assert!(CombinedSimdLevel::AVX2 > CombinedSimdLevel::AVX);
assert!(CombinedSimdLevel::AVX512F > CombinedSimdLevel::AVX2);
}
#[test]
fn test_all_build_systems_display() {
let systems = [
CombinedBuildSystem::CMake,
CombinedBuildSystem::Make,
CombinedBuildSystem::Autotools,
CombinedBuildSystem::Meson,
CombinedBuildSystem::Bazel,
CombinedBuildSystem::Ninja,
];
for sys in &systems {
assert!(!sys.as_str().is_empty());
}
}
#[test]
fn test_build_system_parity() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let systems: Vec<_> = c.configs.iter().map(|cfg| cfg.build_system()).collect();
assert!(systems.contains(&CombinedBuildSystem::CMake));
assert!(systems.contains(&CombinedBuildSystem::Make));
assert!(systems.contains(&CombinedBuildSystem::Autotools));
assert!(systems.contains(&CombinedBuildSystem::Meson));
assert!(systems.contains(&CombinedBuildSystem::Bazel));
}
#[test]
fn test_all_configs_have_sources() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
assert!(!cfg.sources().is_empty(), "{} has no sources", cfg.name());
}
}
#[test]
fn test_all_configs_have_defines() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
let defs = cfg.defines();
assert!(!defs.is_empty(), "{} has no defines", cfg.name());
assert!(
defs.iter()
.any(|(k, _)| k.contains("VERSION") || k.contains("version")),
"{} has no version define",
cfg.name()
);
}
}
#[test]
fn test_all_configs_have_compiler_flags() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
assert!(
!cfg.compiler_flags().is_empty(),
"{} has no compiler flags",
cfg.name()
);
}
}
#[test]
fn test_all_configs_have_libraries() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
assert!(
!cfg.libraries().is_empty(),
"{} has no libraries",
cfg.name()
);
}
}
#[test]
fn test_database_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c.list_by_category(CombinedProjectCategory::Database).len();
assert!(count >= 9, "Database: {}", count);
}
#[test]
fn test_web_network_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c
.list_by_category(CombinedProjectCategory::WebNetwork)
.len();
assert!(count >= 8, "Web/Network: {}", count);
}
#[test]
fn test_language_runtime_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c
.list_by_category(CombinedProjectCategory::LanguageRuntime)
.len();
assert!(count >= 8, "LanguageRuntime: {}", count);
}
#[test]
fn test_graphics_media_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c
.list_by_category(CombinedProjectCategory::GraphicsMedia)
.len();
assert!(count >= 11, "Graphics/Media: {}", count);
}
#[test]
fn test_scientific_ml_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c
.list_by_category(CombinedProjectCategory::ScientificML)
.len();
assert!(count >= 10, "Scientific/ML: {}", count);
}
#[test]
fn test_security_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c.list_by_category(CombinedProjectCategory::Security).len();
assert!(count >= 8, "Security: {}", count);
}
#[test]
fn test_systems_category_count() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let count = c.list_by_category(CombinedProjectCategory::Systems).len();
assert!(count >= 8, "Systems: {}", count);
}
#[test]
fn test_compile_entry_new() {
let e = CombinedCompileEntry::new("src", "main.c");
assert_eq!(e.directory, "src");
assert_eq!(e.source_file, "main.c");
assert!(e.command.is_empty());
}
#[test]
fn test_all_configs_generate_compile_database() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
let entries = cfg.compile_database();
assert!(
!entries.is_empty(),
"{} has no compile database entries",
cfg.name()
);
}
}
#[test]
fn test_all_configs_have_test_commands() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
let cmds = cfg.test_commands();
assert!(!cmds.is_empty(), "{} has no test commands", cfg.name());
}
}
#[test]
fn test_some_configs_have_notes() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let with_notes: Vec<_> = c
.configs
.iter()
.filter(|cfg| cfg.notes().is_some())
.collect();
assert!(
with_notes.len() >= 5,
"Only {} configs have notes",
with_notes.len()
);
}
#[test]
fn test_version_display() {
let v = CombinedProjectVersion::new(3, 5, 14);
let mut pre = v.clone();
pre.pre_release = Some("beta".into());
assert_eq!(v.to_string(), "3.5.14");
assert_eq!(pre.to_string(), "3.5.14-beta");
}
#[test]
fn test_version_cross_configs() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cfg in &c.configs {
let v = cfg.version();
assert!(
v.major > 0 || v.minor > 0,
"{} has zero version",
cfg.name()
);
}
}
#[test]
fn test_luajit_has_asm_note() {
let cfg = LuaJITConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("assembler"));
}
#[test]
fn test_libvpx_has_simd_note() {
let cfg = LibVPXConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("SIMD"));
}
#[test]
fn test_faiss_has_avx_note() {
let cfg = FAISSConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("AVX2"));
}
#[test]
fn test_openssl_has_perl_note() {
let cfg = OpenSSLFullConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("Perl"));
}
#[test]
fn test_llama_cpp_has_inference_note() {
let cfg = LlamaCppConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("LLM"));
}
#[test]
fn test_liburing_has_io_uring_note() {
let cfg = LibUringConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("io_uring"));
}
#[test]
fn test_dpdk_has_avx_note() {
let cfg = DPDKConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("AVX"));
}
#[test]
fn test_spdk_has_isa_note() {
let cfg = SPDKConfig::default();
let notes = cfg.notes().unwrap();
assert!(notes.contains("ISA-L"));
}
#[test]
fn test_all_projects_with_notes() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let expected_with_notes = [
"cassandra",
"gunicorn",
"tornado",
"luajit",
"tinygo",
"libvpx",
"x264",
"x265",
"opus",
"numpy_core",
"faiss",
"llama_cpp",
"openssl_full",
"liburing",
"dpdk",
"spdk",
];
for name in &expected_with_notes {
let cfg = c.get_project(name).expect(name);
assert!(cfg.notes().is_some(), "{} should have notes", name);
}
}
#[test]
fn test_high_perf_projects_use_avx2() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let avx2_projects = [
"blender",
"x264",
"x265",
"numpy_core",
"scipy",
"pytorch_cc",
"tensorflow_capi",
"onnx_runtime",
"xgboost",
"lightgbm",
"faiss",
"llama_cpp",
"dpdk",
"spdk",
];
for name in &avx2_projects {
let cfg = c.get_project(name).expect(name);
assert!(
cfg.simd_level() >= CombinedSimdLevel::AVX2,
"{} should use >= AVX2, got {:?}",
name,
cfg.simd_level()
);
}
}
#[test]
fn test_embedded_projects_use_low_simd() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let low_simd = ["duktape"];
for name in &low_simd {
let cfg = c.get_project(name).expect(name);
assert!(
cfg.simd_level() <= CombinedSimdLevel::SSE,
"{} should use <= SSE, got {:?}",
name,
cfg.simd_level()
);
}
}
#[test]
fn test_cross_compile_all_targets() {
for target in &["arm64", "arm32", "riscv64", "mips64"] {
let cc = match *target {
"arm64" => CombinedCrossCompileConfig::default().for_arm64(),
"arm32" => CombinedCrossCompileConfig::default().for_arm32(),
"riscv64" => CombinedCrossCompileConfig::default().for_riscv64(),
"mips64" => CombinedCrossCompileConfig::default().for_mips64(),
_ => continue,
};
assert!(cc.enabled, "{} should be enabled", target);
assert!(!cc.target_triple.is_empty());
assert!(!cc.cross_prefix.is_empty());
}
}
#[test]
fn test_cross_compile_toolchain_files() {
let cc = CombinedCrossCompileConfig::default().for_arm64();
let tc = cc.to_cmake_toolchain();
assert!(tc.contains("CMAKE_C_COMPILER"));
assert!(tc.contains("CMAKE_CXX_COMPILER"));
assert!(tc.contains("CMAKE_SYSROOT"));
}
#[test]
fn test_full_pipeline_creation() {
let mut c = X86ProjectsCombined::default();
c.register_all();
assert!(c.project_count() >= 30);
let mut runner = CombinedBuildRunner::new("build/combined");
let results = runner.run_all(&c);
assert!(results.len() >= 30);
let summary = runner.summary();
assert!(summary.contains("passed"));
assert!(summary.contains("total"));
}
#[test]
fn test_full_pipeline_with_test_runner() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let mut test_runner = CombinedTestRunner::new("build/combined");
let results = test_runner.run_all(&c);
assert!(results.len() >= 30);
let summary = test_runner.summary();
assert!(summary.contains("suites"));
}
#[test]
fn test_combined_with_verbose() {
let c = X86ProjectsCombined::default().with_verbose();
assert!(c.verbose);
}
#[test]
fn test_combined_projects_has_no_duplicates() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let names = c.list_projects();
let mut sorted = names.clone();
sorted.sort();
sorted.dedup();
assert_eq!(names.len(), sorted.len(), "Duplicate project names found");
}
#[test]
fn test_empty_combined_has_no_projects() {
let c = X86ProjectsCombined::default();
assert_eq!(c.project_count(), 0);
assert!(c.list_projects().is_empty());
}
#[test]
fn test_get_nonexistent_project() {
let c = X86ProjectsCombined::default();
assert!(c.get_project("nonexistent").is_none());
}
#[test]
fn test_build_runner_stop_on_error() {
let runner = CombinedBuildRunner::new("build");
assert!(!runner.stop_on_error);
}
#[test]
fn test_compile_database_entries_all_categories() {
let mut c = X86ProjectsCombined::default();
c.register_all();
for cat in &[
CombinedProjectCategory::Database,
CombinedProjectCategory::WebNetwork,
CombinedProjectCategory::LanguageRuntime,
] {
let names = c.list_by_category(*cat);
for name in &names {
let cfg = c.get_project(name).unwrap();
let entries = cfg.compile_database();
assert!(!entries.is_empty(), "{} has no CDB entries", name);
}
}
}
#[test]
fn test_all_names_in_constant_are_registered() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let registered: std::collections::HashSet<String> = c.list_projects().into_iter().collect();
for name in COMBINED_PROJECT_NAMES {
assert!(
registered.contains(*name),
"{} in constant but not registered",
name
);
}
}
#[test]
fn test_all_registered_are_in_constant() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let constant_set: std::collections::HashSet<&str> =
COMBINED_PROJECT_NAMES.iter().cloned().collect();
for name in c.list_projects() {
assert!(
constant_set.contains(name.as_str()),
"{} registered but not in constant",
name
);
}
}
#[test]
fn test_orchestrator_timeout_bound() {
let bo = CombinedBuildOrchestrator::default().with_timeout(7200);
assert_eq!(bo.timeout_secs, 7200);
}
#[test]
fn test_orchestrator_build_order_deterministic() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let order1 = c.build_orchestrator.build_order.clone();
let mut c2 = X86ProjectsCombined::default();
c2.register_all();
let order2 = c2.build_orchestrator.build_order.clone();
assert_eq!(order1.len(), order2.len());
assert_eq!(order1, order2);
}
#[test]
fn test_all_simd_levels_have_march() {
let levels = [
CombinedSimdLevel::MMX,
CombinedSimdLevel::SSE,
CombinedSimdLevel::SSE2,
CombinedSimdLevel::SSE3,
CombinedSimdLevel::SSSE3,
CombinedSimdLevel::SSE41,
CombinedSimdLevel::SSE42,
CombinedSimdLevel::AVX,
CombinedSimdLevel::AVX2,
CombinedSimdLevel::AVX512F,
];
for level in &levels {
assert!(
level.to_march().is_some(),
"{:?} should have march flag",
level
);
}
assert!(CombinedSimdLevel::None.to_march().is_none());
}
#[test]
fn test_all_eight_categories_present() {
let mut c = X86ProjectsCombined::default();
c.register_all();
let categories = [
CombinedProjectCategory::Database,
CombinedProjectCategory::WebNetwork,
CombinedProjectCategory::LanguageRuntime,
CombinedProjectCategory::GraphicsMedia,
CombinedProjectCategory::ScientificML,
CombinedProjectCategory::Security,
CombinedProjectCategory::Systems,
];
for cat in &categories {
let count = c.list_by_category(*cat).len();
assert!(count > 0, "Category {:?} has 0 projects", cat);
}
}
}