Skip to content

Commit c8626a6

Browse files
committed
Fix for build on windows
1 parent ed8be08 commit c8626a6

3 files changed

Lines changed: 55 additions & 37 deletions

File tree

‎.travis.yml‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@ os:
77
- linux
88
- osx
99
- windows
10-
cache: cargo
10+
before_install:
11+
- |
12+
case $TRAVIS_OS_NAME in
13+
"windows")
14+
choco upgrade --no-progress -y make
15+
;;
16+
esac
17+
cache:
18+
cargo: true
19+
directories:
20+
- $HOME/AppData/Local/Temp/chocolatey
21+
- /C/tools/install
1122
script:
12-
- (cd aubio-sys && cargo test --release)
13-
- (cd aubio-lib && cargo test --release)
14-
- (cd aubio-lib && cargo test --release --features with-fftw3)
15-
- (cd aubio-rs && cargo test --release --features log)
23+
- (cd aubio-sys && cargo test)
24+
- (cd aubio-lib && if [ "$TRAVIS_OS_NAME" != "windows" ]; then cargo test --features with-fftw3; else cargo test -vvv; fi)
25+
- (cd aubio-rs && cargo test --features log)
1626
jobs:
1727
allow_failures:
1828
- rust: nightly

‎aubio-lib/build.rs‎

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#[cfg(not(feature = "rustdoc"))]
22
mod source {
3-
//pub const REPOSITORY: &str = "https://github.com/aubio/aubio";
4-
//pub const VERSION: &str = "0.4.9";
5-
pub const REPOSITORY: &str = "https://github.com/katyo/aubio";
6-
pub const VERSION: &str = "master";
3+
pub const REPOSITORY: &str = "https://aubio.org/pub/aubio-";
4+
pub const VERSION: &str = "0.4.9";
75

86
#[cfg(feature = "with-fftw3")]
97
pub mod fftw3 {
@@ -96,7 +94,7 @@ mod utils {
9694
use fetch_unroll::Fetch;
9795

9896
if !out_dir.is_dir() {
99-
let src_url = format!("{repo}/archive/{ver}.tar.gz",
97+
let src_url = format!("{repo}{ver}.tar.gz",
10098
repo = src.repository,
10199
ver = src.version);
102100

@@ -199,8 +197,8 @@ mod utils {
199197
let profile = env::var("PROFILE")
200198
.expect("The PROFILE is set by cargo.");
201199

202-
let num_jobs = env::var("NUM_JOBS")
203-
.expect("The NUM_JOBS is set by cargo.");
200+
//let num_jobs = env::var("NUM_JOBS")
201+
// .expect("The NUM_JOBS is set by cargo.");
204202

205203
let mut wafopts = String::new();
206204

@@ -247,11 +245,22 @@ mod utils {
247245
env_vars.push(("PKG_CONFIG_PATH", pkg_config_path.join(":")));
248246
}
249247

250-
run_command(Command::new("make")
248+
env_vars.push(("WAFOPTS", wafopts));
249+
250+
let make = env::var("MAKE")
251+
.unwrap_or("make".into());
252+
253+
run_command(Command::new(&make)
254+
.envs(env_vars.clone())
255+
.current_dir(src_dir)
256+
//.arg(format!("-j{}", num_jobs))
257+
.arg("checkwaf"));
258+
259+
run_command(Command::new(&make)
260+
.envs(env_vars.clone())
251261
.current_dir(src_dir)
252-
.arg(format!("-j{}", num_jobs))
253-
.env("WAFOPTS", wafopts)
254-
.envs(env_vars));
262+
//.arg(format!("-j{}", num_jobs))
263+
.arg("build"));
255264
}
256265

257266
println!("cargo:rustc-link-search=native={}", lib_dir.display());
@@ -270,16 +279,9 @@ mod utils {
270279

271280
#[cfg(feature = "with-fftw3")]
272281
pub mod fftw3 {
273-
use super::{
274-
toolchain_env,
275-
run_command,
276-
lib_file,
277-
};
282+
use super::lib_file;
278283

279-
use std::{
280-
env,
281-
path::Path,
282-
};
284+
use std::path::Path;
283285

284286
pub struct Source {
285287
pub location: String,
@@ -314,14 +316,22 @@ mod utils {
314316

315317
create_dir_all(out_dir).unwrap();
316318

317-
let library = Config::new(src_dir)
318-
.define("BUILD_SHARED_LIBS", if cfg!(feature = "shared-fftw3") { "ON" } else { "OFF" })
319-
.define("BUILD_TESTS", "OFF")
320-
.define("ENABLE_FLOAT", if cfg!(feature = "with-double") { "OFF" } else { "ON" })
321-
.define("DISABLE_FORTRAN", "ON")
319+
fn bool_flag(flag: bool) -> &'static str {
320+
if flag { "ON" } else { "OFF" }
321+
}
322+
323+
let _library = Config::new(src_dir)
324+
.define("BUILD_SHARED_LIBS", bool_flag(cfg!(feature = "shared-fftw3")))
325+
.define("BUILD_TESTS", bool_flag(false))
326+
.define("ENABLE_FLOAT", bool_flag(!cfg!(feature = "with-double")))
327+
.define("DISABLE_FORTRAN", bool_flag(true))
328+
.define("ENABLE_SSE", bool_flag(cfg!(target_feature = "sse")))
329+
.define("ENABLE_SSE2", bool_flag(cfg!(target_feature = "sse2")))
330+
.define("ENABLE_AVX", bool_flag(cfg!(target_feature = "avx")))
331+
.define("ENABLE_AVX2", bool_flag(cfg!(target_feature = "avx2")))
322332
.define("CMAKE_INSTALL_LIBDIR", "lib")
323-
.define("CMAKE_C_COMPILER_WORKS", "1")
324-
.define("CMAKE_CXX_COMPILER_WORKS", "1")
333+
.define("CMAKE_C_COMPILER_WORKS", bool_flag(true))
334+
.define("CMAKE_CXX_COMPILER_WORKS", bool_flag(true))
325335
.always_configure(true)
326336
.very_verbose(true)
327337
.out_dir(out_dir)

‎aubio-sys/build.rs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#[cfg(feature = "generate-bindings")]
22
mod source {
3-
//pub const REPOSITORY: &str = "https://github.com/aubio/aubio";
4-
//pub const VERSION: &str = "0.4.9";
5-
pub const REPOSITORY: &str = "https://github.com/katyo/aubio";
6-
pub const VERSION: &str = "master";
3+
pub const REPOSITORY: &str = "https://aubio.org/pub/aubio-";
4+
pub const VERSION: &str = "0.4.9";
75
}
86

97
fn main() {
@@ -51,7 +49,7 @@ mod utils {
5149
use fetch_unroll::Fetch;
5250

5351
if !out_dir.is_dir() {
54-
let src_url = format!("{repo}/archive/{ver}.tar.gz",
52+
let src_url = format!("{repo}{ver}.tar.gz",
5553
repo = src.repository,
5654
ver = src.version);
5755

0 commit comments

Comments
 (0)