From 4d37d611be6d009c2f6d6e95fc6b12d134285fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Sun, 12 Jan 2020 15:28:03 -0700 Subject: Use a template --- src/main.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index ddcb335..9252c56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,24 +26,25 @@ fn collect_source_files() -> Vec { fn build() { let files = collect_source_files(); + let mut files2: String = String::new(); for file in &files { println!("File: {}", file.to_str().unwrap()); + if !file.to_str().unwrap().ends_with("main.f90") { + let s1:String = files2.to_string(); + let s2:String = file.to_str().unwrap().to_string(); + files2 = s1 + " " + &s2; + } } println!("Files: {:?}", files); - let s = "\ + let s = format!("\ cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR) enable_language(Fortran) project(p1) -set(SRC - a.f90 - b.f90 -) - -add_executable(p1 main.f90 ${SRC}) -"; +add_executable(p1 main.f90 {}) +", files2); std::fs::write("CMakeLists.txt", s).unwrap(); let output = std::process::Command::new("cmake") .args(&["-B", "build", "."]) -- cgit v1.2.3 From 99847aa3ca84a507758f0fe690c062064e393b57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Sun, 12 Jan 2020 15:38:41 -0700 Subject: Add another test --- tests/2/main.f90 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/2/main.f90 diff --git a/tests/2/main.f90 b/tests/2/main.f90 new file mode 100644 index 0000000..580da98 --- /dev/null +++ b/tests/2/main.f90 @@ -0,0 +1,5 @@ +program test2 +implicit none + +print *, "OK" +end -- cgit v1.2.3 From 8547d5b5c31d9b2f5bde16965027c2feffa01f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C4=8Cert=C3=ADk?= Date: Sun, 12 Jan 2020 15:40:27 -0700 Subject: Run the test --- run_tests.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/run_tests.sh b/run_tests.sh index d47133b..8a517cc 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -7,3 +7,9 @@ fpm=$(pwd)/target/debug/fpm cd tests/1 ${fpm} build ${fpm} run +cd ../.. + +cd tests/2 +${fpm} build +${fpm} run +cd ../.. -- cgit v1.2.3