Skip to content

Commit 1f58326

Browse files
committed
fix cmake build warnings
1 parent 66f2c53 commit 1f58326

7 files changed

Lines changed: 27 additions & 10 deletions

File tree

Clarabel.rs

rust_wrapper/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ add_custom_target(
187187
COMMAND cargo build ${clarabel_c_build_flags}
188188
COMMAND cargo install cbindgen
189189
# Generate the C header
190-
COMMAND cbindgen --config cbindgen.toml --crate clarabel_c --output ./headers/clarabel.h --lang c
190+
COMMAND cbindgen --config cbindgen.toml --quiet --crate clarabel_c --output ./headers/clarabel.h --lang c
191191
# Generate the C++ header
192-
COMMAND cbindgen --config cbindgen.toml --crate clarabel_c --output ./headers/clarabel.hpp
192+
COMMAND cbindgen --config cbindgen.toml --quiet --crate clarabel_c --output ./headers/clarabel.hpp
193193
BYPRODUCTS
194194
"${LIBCLARABEL_C_SHARED_PATH}"
195195
"${LIBCLARABEL_C_STATIC_PATH}"

rust_wrapper/cbindgen.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,19 @@ documentation = false
1212

1313
[defines]
1414
"feature = sdp" = "FEATURE_SDP"
15+
"feature = serde" = "FEATURE_SERDE"
1516
"feature = faer-sparse" = "FEATURE_FAER_SPARSE"
16-
"feature = serde" = "FEATURE_SERDE"
17+
"feature = pardiso-mkl" = "FEATURE_PARDISO_MKL"
18+
"feature = pardiso-panua" = "FEATURE_PARDISO_PANUA"
19+
20+
[parse]
21+
parse_deps = true
22+
include = ["clarabel"]
23+
exclude = ["indexmap"]
24+
25+
[export]
26+
include = [
27+
"SolverStatusFFI",
28+
"DefaultInfoFFI",
29+
"DefaultSettingsFFI",
30+
]

rust_wrapper/src/algebra.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub struct ClarabelCscMatrix<T = f64> {
99
pub n: usize,
1010
/// CSC format column pointer.
1111
///
12-
/// Ths field should have length `n+1`. The last entry corresponds
12+
/// This field should have length `n+1`. The last entry corresponds
1313
/// to the the number of nonzeros and should agree with the lengths
1414
/// of the `rowval` and `nzval` fields.
1515
pub colptr: *const usize,

rust_wrapper/src/core.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ pub mod cones {
1919
/// The exponential cone in R^3.
2020
///
2121
/// This cone takes no parameters
22-
ExponentialConeT(),
22+
/// NB: Just a plain enum variant and not a unit type (i.e. not ExponentialConeT())
23+
/// as in the clarabel crate to avoid ZST / FFI complaints from cbindgen
24+
ExponentialConeT,
2325
/// The power cone in R^3.
2426
///
2527
/// The parameter indicates the power.

rust_wrapper/src/solver/implementations/default/solver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::solver::implementations::default::settings::{
77
ClarabelDefaultSettings, ClarabelDefaultSettings_f32, ClarabelDefaultSettings_f64,
88
};
99
use crate::utils;
10+
use clarabel::solver::ffi::SolverStatusFFI;
1011

1112
use clarabel::algebra::FloatT;
1213
use clarabel::io::ConfigurablePrintTarget;
@@ -29,7 +30,7 @@ use super::solution::DefaultSolution;
2930
pub type ClarabelDefaultSolver_f32 = c_void;
3031
pub type ClarabelDefaultSolver_f64 = c_void;
3132

32-
pub type ClarabelSolverStatus = clarabel::solver::ffi::SolverStatusFFI;
33+
pub type ClarabelSolverStatus = SolverStatusFFI;
3334

3435
// Wrapper function to create a DefaultSolver object from C using dynamic memory allocation
3536
// - Matrices and vectors are constructed from raw pointers

rust_wrapper/src/utils/supported_cones_T.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ pub fn convert_from_C_cone<T: FloatT>(cone: &ClarabelSupportedConeT<T>) -> lib::
2828
ClarabelSupportedConeT::SecondOrderConeT(payload) => {
2929
lib::SupportedConeT::SecondOrderConeT(*payload)
3030
}
31-
ClarabelSupportedConeT::ExponentialConeT() => lib::SupportedConeT::ExponentialConeT(),
31+
ClarabelSupportedConeT::ExponentialConeT => lib::SupportedConeT::ExponentialConeT(),
3232
ClarabelSupportedConeT::PowerConeT(payload) => lib::SupportedConeT::PowerConeT(*payload),
33-
ClarabelSupportedConeT::GenPowerConeT(ptr_alpha,dim1,dim2) => {
33+
ClarabelSupportedConeT::GenPowerConeT(ptr_alpha, dim1, dim2) => {
3434
let alpha = unsafe { std::slice::from_raw_parts(*ptr_alpha, *dim1) };
35-
lib::SupportedConeT::GenPowerConeT(alpha.to_vec(),*dim2)
35+
lib::SupportedConeT::GenPowerConeT(alpha.to_vec(), *dim2)
3636
}
3737
#[cfg(feature = "sdp")]
3838
ClarabelSupportedConeT::PSDTriangleConeT(payload) => {

0 commit comments

Comments
 (0)