diff --git a/.github/workflows/ubuntu-2004.yml b/.github/workflows/ubuntu-2004.yml index 512b740..ad871e1 100644 --- a/.github/workflows/ubuntu-2004.yml +++ b/.github/workflows/ubuntu-2004.yml @@ -56,6 +56,14 @@ jobs: - name: cmake configure run: nice -n 10 cmake -DCMAKE_BUILD_TYPE=Release .. working-directory: Chaste/build + + - name: remove cellml + run: rm -rf ApPredict/src/cellml + working-directory: Chaste/projects + + - name: cmake configure again + run: nice -n 10 cmake -DCMAKE_BUILD_TYPE=Release .. + working-directory: Chaste/build - name: build core libraries run: nice -n 10 cmake --build . --parallel ${NPROC} --target chaste_core diff --git a/CMakeLists.txt b/CMakeLists.txt index f128769..4b4ea75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,36 +42,41 @@ # # Note that the order in which components are specified does not matter. -include(FetchContent) -message (STATUS "Downloading ApPredict cellml files to ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml") -Set(FETCHCONTENT_UPDATES_DISCONNECTED ON) -FetchContent_Declare(CellML_repo_appredict - GIT_REPOSITORY https://github.com/Chaste/cellml.git - GIT_TAG e394aba8a7ca50f72ee212e21431045eae8b5ca4 - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml) -FetchContent_MakeAvailable(CellML_repo_appredict) +set(ApPredict_CELLML_TAG e394aba8a7ca50f72ee212e21431045eae8b5ca4) +set(ApPredict_CELLML_URL "https://raw.githubusercontent.com/Chaste/cellml/${ApPredict_CELLML_TAG}/cellml") +set(ApPredict_CELLML_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/cellml") +set(ApPredict_CELLML_FILES + davies_isap_2012.cellml + decker_2009.cellml + faber_rudy_2000.cellml + grandi_pasqualini_bers_2010_ss.cellml + hund_rudy_2004.cellml + livshitz_rudy_2007.cellml + mahajan_shiferaw_2008.cellml + ohara_rudy_2011_endo.cellml + ohara_rudy_cipa_v1_2017.cellml + paci_hyttinen_aaltosetala_severi_ventricularVersion.cellml + priebe_beuckelmann_1998.cellml + shannon_wang_puglisi_weber_bers_2004.cellml + ten_tusscher_model_2006_epi.cellml +) -# remove .git folder to prevent accidentally checking in deletion of cellml files -file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml/.git) - -# remove cellml files that are not required -file(GLOB cellml_files ${CMAKE_CURRENT_SOURCE_DIR}/src/cellml/cellml/*.cellml) -foreach(cellml_file ${cellml_files}) - if (NOT ${cellml_file} MATCHES davies_isap_2012.cellml - AND NOT ${cellml_file} MATCHES decker_2009.cellml - AND NOT ${cellml_file} MATCHES faber_rudy_2000.cellml - AND NOT ${cellml_file} MATCHES grandi_pasqualini_bers_2010_ss.cellml - AND NOT ${cellml_file} MATCHES hund_rudy_2004.cellml - AND NOT ${cellml_file} MATCHES livshitz_rudy_2007.cellml - AND NOT ${cellml_file} MATCHES mahajan_shiferaw_2008.cellml - AND NOT ${cellml_file} MATCHES ohara_rudy_2011_endo.cellml - AND NOT ${cellml_file} MATCHES ohara_rudy_cipa_v1_2017.cellml - AND NOT ${cellml_file} MATCHES paci_hyttinen_aaltosetala_severi_ventricularVersion.cellml - AND NOT ${cellml_file} MATCHES priebe_beuckelmann_1998.cellml - AND NOT ${cellml_file} MATCHES shannon_wang_puglisi_weber_bers_2004.cellml - AND NOT ${cellml_file} MATCHES ten_tusscher_model_2006_epi.cellml) - file(REMOVE ${cellml_file}) - endif() +message (STATUS "Downloading ApPredict cellml files to ${ApPredict_CELLML_SRC}") +foreach(cellml_file ${ApPredict_CELLML_FILES}) + if (NOT EXISTS "${ApPredict_CELLML_SRC}/${cellml_file}") + file(DOWNLOAD + "${ApPredict_CELLML_URL}/${cellml_file}" + "${ApPredict_CELLML_SRC}/${cellml_file}" + TIMEOUT 10 + TLS_VERIFY ON + STATUS dl_status + ) + list (GET dl_status 0 dl_status_code) + if (NOT dl_status_code EQUAL 0) + file(REMOVE "${ApPredict_CELLML_SRC}/${cellml_file}") # remove stub + message (WARNING "Could not download ${cellml_file}") + endif () + endif () endforeach() # Here we just depend on core components (nothing application-specific). diff --git a/README.md b/README.md index 756f50b..0d79233 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,6 @@ so that all the file paths can be picked up correctly (replacing ``` diff --git a/src/extra_models/README b/src/extra_models/README index 1769df6..bc613b2 100644 --- a/src/extra_models/README +++ b/src/extra_models/README @@ -3,7 +3,7 @@ Users can put additional cellml models in this directory. Once the project is built these will be available as pre-compiled models and can be used with --model . -Please note: The additional cellml file cannot have the same name as one of the pre-included cellml files in src/cellml/cellml +Please note: The additional cellml file cannot have the same name as one of the pre-included cellml files in src/cellml as these would generate model code with conflicting names. In case you receive a compile error with regards to duplicate definitions, we suggest renaming the additional cellml files to avoid conflicts. diff --git a/test/TestApPredict.hpp b/test/TestApPredict.hpp index 33ed8d3..ac027dc 100644 --- a/test/TestApPredict.hpp +++ b/test/TestApPredict.hpp @@ -112,7 +112,7 @@ class TestApPredict : public CxxTest::TestSuite "No model matches this index: 99999"); } { - CommandLineArgumentsMocker wrapper("--cellml projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long"); + CommandLineArgumentsMocker wrapper("--cellml projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long"); ApPredictMethods methods; TS_ASSERT_EQUALS(Warnings::Instance()->GetNextWarningMessage(), "Argument --cellml is deprecated: use --model instead."); diff --git a/test/TestApPredictLong.hpp b/test/TestApPredictLong.hpp index aec169e..d383927 100644 --- a/test/TestApPredictLong.hpp +++ b/test/TestApPredictLong.hpp @@ -64,12 +64,12 @@ class TestApPredictLong : public CxxTest::TestSuite // loop over hardcoded and dynamically loaded. // try both --model --cellml and --cellml and try both relative and absolute paths - FileFinder cellm_file("projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml", RelativeTo::CWD); + FileFinder cellm_file("projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml", RelativeTo::CWD); std::vector model_args = { "--model 2", "--model ten_tusscher_model_2006_epi", - "--model projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml", + "--model projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml", "--model " + cellm_file.GetAbsolutePath(), - "--cellml projects/ApPredict/src/cellml/cellml/ten_tusscher_model_2006_epi.cellml"}; + "--cellml projects/ApPredict/src/cellml/ten_tusscher_model_2006_epi.cellml"}; for (unsigned i = 0; i < model_args.size(); i++) { CommandLineArgumentsMocker wrapper(model_args[i] + " --plasma-concs 1 10 --pic50-herg 4.5 --plasma-conc-logscale false --output-dir ApPredict_output_long");