physimals / oxford_asl

A command line tool for quantification of perfusion from ASL data
Apache License 2.0
8 stars 7 forks source link

building from source #3

Closed boegel closed 4 years ago

boegel commented 6 years ago

I'm looking into building oxford_asl from source, to ensure it matches our system and is compiled optimally.

To build the latest release (v3.9.6) from the source tarball obtained via https://github.com/ibme-qubic/oxford_asl/releases, I had to apply the patch below to get it working.

One thing I'm still wondering about though: using the standard cmake; make; make install procedure, I only seem to be getting a part of the binaries/scripts that are mentioned, i.e. there's no basil, epi_reg, fabber_asl, etc. Is there any documentation available on how these binaries/scripts can be obtained as well?

Please consider including these changes to allow building from source outside of the cloned Git repository more easily in the future? Note: this patch does assume that you provide correct values via -DGIT_SHA1='...' -DGIT_DATE='...' to the cmake command.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7568fc4..3b844be 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -50,22 +50,27 @@ target_link_libraries(asl_file ${LIBS})
 include_directories(AFTER ${NEWMAT_INCLUDE_DIR} ${FSL_INCLUDE_DIR} ${FSL_EXT_INCLUDE_DIR})

 # Extract GIT revision for versioning
+if(NOT GIT_SHA1)
 execute_process(COMMAND
   git describe --dirty
   WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
   OUTPUT_VARIABLE GIT_SHA1
   ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif(NOT GIT_SHA1)

+if(NOT GIT_DATE)
 execute_process(COMMAND
   git log -1 --format=%ad --date=local
   WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
   OUTPUT_VARIABLE GIT_DATE
   ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
+endif(NOT GIT_DATE)

 configure_file(oxford_asl.in oxford_asl @ONLY)
 configure_file(asl_calib.in asl_calib @ONLY)
 configure_file(asl_reg.in asl_reg @ONLY)
 configure_file(quasil.in quasil @ONLY)
+configure_file(readoptions.cc.in readoptions.cc @ONLY)

 INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oxford_asl 
   ${CMAKE_CURRENT_BINARY_DIR}/asl_calib
diff --git a/readoptions.cc b/readoptions.cc.in
similarity index 95%
rename from readoptions.cc
rename to readoptions.cc.in
index fffc055..ea06e35 100644
--- a/readoptions.cc
+++ b/readoptions.cc.in
@@ -48,7 +48,7 @@ bool ReadOptions::parse_command_line(int argc, char **argv)
     }
     else if (version.value()) 
     {
-        cout << GIT_SHA1 << " (" << GIT_DATE << ")" << endl;
+        cout << "@GIT_SHA1@" << " (" << "@GIT_DATE@" << ")" << endl;
         return false;
     }
     else if (!options.check_compulsory_arguments()) 
mcraig-ibme commented 4 years ago

Hi, apologies for the lack of response, I have not been getting GitHub notifications and a number of issues have been raised here without me realising.

If you are still struggling with this let me know and I'll get some info back to you about building the code from source. However updated versions of all the oxford_asl tools are available in FSL 6.0.1 and later so in most cases it's not necessary to build from source.

mcraig-ibme commented 4 years ago

Closing historical issue