From fb5f1b816313ecafe96823fe8b014f2491b4d0b4 Mon Sep 17 00:00:00 2001 From: Rob J Goedman Date: Thu, 19 Jan 2023 07:20:01 -0700 Subject: [PATCH] Rel 7.0.2 - Prevent installing BridgeStan if Juile < v1.8, use make and stanc flags --- Project.toml | 2 +- src/StanSample.jl | 15 ++++++++++----- test/test_bridgestan/test_bridgestan.jl | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Project.toml b/Project.toml index 2481c1a..c5c832c 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "StanSample" uuid = "c1514b29-d3a0-5178-b312-660c88baa699" authors = ["Rob J Goedman "] -version = "7.0.1" +version = "7.0.2" [deps] CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" diff --git a/src/StanSample.jl b/src/StanSample.jl index 54e6610..d5df1c7 100644 --- a/src/StanSample.jl +++ b/src/StanSample.jl @@ -84,11 +84,16 @@ export set_make_string if isdir(joinpath(CMDSTAN_HOME, "..", "bridgestan")) - const BRIDGESTAN_PATH = get!(ENV, "BRIDGESTAN", abspath(joinpath(CMDSTAN_HOME, "..", "bridgestan"))) - include(joinpath(BRIDGESTAN_PATH, "julia", "src", "BridgeStan.jl")) - const BS = BridgeStan - BS.set_bridgestan_path!(BRIDGESTAN_PATH) - export BS, BRIDGESTAN_HOME, StanModel + if Int(VERSION.minor) < 8 + @warn "Julia-$VERSION < Julia-1.8 too old for BridgeStan, skipping inclusing support for BridgeStan." + else + @info "BridgeStan support available." + const BRIDGESTAN_PATH = get!(ENV, "BRIDGESTAN", abspath(joinpath(CMDSTAN_HOME, "..", "bridgestan"))) + include(joinpath(BRIDGESTAN_PATH, "julia", "src", "BridgeStan.jl")) + const BS = BridgeStan + BS.set_bridgestan_path!(BRIDGESTAN_PATH) + export BS, BRIDGESTAN_HOME, StanModel + end else BRIDGESTAN_PATH = "" end diff --git a/test/test_bridgestan/test_bridgestan.jl b/test/test_bridgestan/test_bridgestan.jl index f27d021..b363681 100644 --- a/test/test_bridgestan/test_bridgestan.jl +++ b/test/test_bridgestan/test_bridgestan.jl @@ -28,8 +28,10 @@ if success(rc) post = read_samples(sm, :dataframe) end -smb = BS.StanModel( +smb = BS.StanModel(; stan_file = joinpath(sm.tmpdir, sm.name*".stan"), + stanc_args=["--warn-pedantic --O1"], + make_args=["CXX=clang++", "STAN_THREADS=true"], data = joinpath(sm.tmpdir, "$(sm.name)_data_1.json") )