diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e993053..d848f81 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -19,7 +19,7 @@ jobs: include: - os: ubuntu-18.04 target: x86_64-unknown-linux-gnu - channel: 1.34.0 + channel: 1.63 - os: ubuntu-18.04 target: x86_64-unknown-linux-gnu channel: stable @@ -32,21 +32,21 @@ jobs: - os: macos-10.15 target: x86_64-apple-darwin - channel: 1.34.0 + channel: 1.63 - os: macos-10.15 target: x86_64-apple-darwin channel: stable - os: windows-2019 target: x86_64-pc-windows-msvc - channel: 1.34.0 + channel: 1.63 - os: windows-2019 target: x86_64-pc-windows-msvc channel: stable - os: windows-2019 target: i686-pc-windows-msvc - channel: 1.34.0 + channel: 1.63 - os: windows-2019 target: i686-pc-windows-msvc channel: stable diff --git a/.gitignore b/.gitignore index 8c9c429..2fb5ca8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ # will have compiled files and executables target/ -# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries -# More information here http://doc.crates.io/guide.html#cargotoml-vs-cargolock -Cargo.lock - # These are backup files generated by rustfmt **/*.rs.bk diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bcb8fa2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,49 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "cc" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" +dependencies = [ + "shlex", +] + +[[package]] +name = "cmake" +version = "0.1.52" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e" +dependencies = [ + "cc", +] + +[[package]] +name = "fs_extra" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" + +[[package]] +name = "osqp" +version = "0.6.2" +dependencies = [ + "osqp-sys", +] + +[[package]] +name = "osqp-sys" +version = "0.6.2" +dependencies = [ + "cc", + "cmake", + "fs_extra", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" diff --git a/Cargo.toml b/Cargo.toml index 6b74159..d582a81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,8 @@ [package] name = "osqp" version = "0.6.2" +edition = "2015" +rust-version = "1.63" description = "The OSQP (Operator Splitting Quadratic Program) solver." authors = ["Edward Barnard "] license = "Apache-2.0" diff --git a/osqp-sys/Cargo.toml b/osqp-sys/Cargo.toml index 342834a..7ed03d2 100644 --- a/osqp-sys/Cargo.toml +++ b/osqp-sys/Cargo.toml @@ -1,6 +1,8 @@ [package] name = "osqp-sys" version = "0.6.2" +edition = "2015" +rust-version = "1.63" description = "FFI bindings to the OSQP (Operator Splitting Quadratic Program) solver." authors = ["Edward Barnard "] license = "Apache-2.0" diff --git a/osqp-sys/build.rs b/osqp-sys/build.rs index 4403da6..c4550cb 100644 --- a/osqp-sys/build.rs +++ b/osqp-sys/build.rs @@ -14,9 +14,10 @@ fn main() { } // Try to make c_int the same size as the target pointer width (i.e. 32 or 64 bits) + println!("cargo:rustc-check-cfg=cfg(osqp_dlong)"); let dlong_enabled = match &*env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap() { "64" => { - println!(r#"cargo:rustc-cfg=feature="osqp_dlong""#); + println!("cargo:rustc-cfg=osqp_dlong"); "ON" } "32" => "OFF", diff --git a/osqp-sys/src/lib.rs b/osqp-sys/src/lib.rs index 35d0001..cb67f13 100644 --- a/osqp-sys/src/lib.rs +++ b/osqp-sys/src/lib.rs @@ -5,9 +5,9 @@ mod bindings; pub use bindings::*; -#[cfg(feature = "osqp_dlong")] +#[cfg(osqp_dlong)] pub type osqp_int = ::std::os::raw::c_longlong; -#[cfg(not(feature = "osqp_dlong"))] +#[cfg(not(osqp_dlong))] pub type osqp_int = ::std::os::raw::c_int; pub type osqp_float = f64; @@ -84,7 +84,7 @@ mod tests { data.A = A; data.l = l.as_mut_ptr(); data.u = u.as_mut_ptr(); - let data = &data as *const OSQPData; + let data = &mut data as *mut OSQPData; // Define solver settings let mut settings: OSQPSettings = mem::zeroed(); @@ -96,13 +96,13 @@ mod tests { // Setup workspace let mut work: *mut OSQPWorkspace = ptr::null_mut(); - let status = osqp_setup(&mut work, data, settings); + let status = osqp_setup(&mut work, data as *const _, settings); if status != 0 { panic!("osqp_setup failed"); } // Zero data and settings on the stack to ensure osqp does not reference them - *(data as *mut OSQPData) = mem::zeroed(); + *data = mem::zeroed(); *settings = mem::zeroed(); *P = mem::zeroed(); *A = mem::zeroed();