CERN / TIGRE

TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
BSD 3-Clause "New" or "Revised" License
527 stars 180 forks source link

Enh make installation easier #528

Closed tsadakane closed 2 months ago

tsadakane commented 3 months ago

A solution for #523

The users only have to run the compilation script Compile.m. It detects the version of the latest visual studio, copies the appropriate xml file to "mex_CUDA_win64.xml", and starts compilation.

Matlab, windows.

Tested on a system that Visual studio 2019, 2022 and Matlab 2022a are installed.

AnderBiguri commented 3 months ago

Looks good!

I haven't tried, but I wonder what happens if vscode is not in path_to_vswhere . The XML does try to find it in some other places, I think (e.g. envvars)? Maybe I need to test it in a machine with non-standard vscode install location to double check.

tsadakane commented 3 months ago

Hi, @AnderBiguri , Thank you for your reply.

what happens if vscode is not in path_to_vswhere

vswhere is an utility that detects Visual Studio instances. According to this page,

vswhere.exe is automatically included in Visual Studio 2017 and later, 
or you can download it from [the vswhere releases page](https://github.com/Microsoft/vswhere/releases)

If vswhere was not found in Compile.m, it dies at L55.

I think there should be an option to specify the version of the Visual Studio, and I'd like to make additional modification to this PR.

AnderBiguri commented 3 months ago

Didn't know that! Thanks for explaining :) So I assume vswhere is always installed in the same place, regardless of user choice in installation locations? If that is true, then super nice tool!

Sure, do let me know when its ready for review 👍

tsadakane commented 3 months ago

@AnderBiguri , Please review my PR.

To compile using the latest Visual Studio installed, just

>> Compile

This detects the latest installed visual studio and copies the appropriate xml file to mex_CUDA_win64.xml.

To compile using MVS 2013 even if MVS2022 is installed, for example,

>> Compile -mex_xml mex_CUDA_win64_MVS2013.xml

when -mex_xml option is set, the specified xml file is copied to mex_CUDA_win64.xml and is used for the setup. If the specified file was not found, Compile dies.

In the both cases above, mex_CUDA_win64.xml will be overwritten if it exists before Compile is run.

Note: Test env.

AnderBiguri commented 3 months ago

Looks really good!

We should also add this to the install instructions README. I will test later today just for sanity check, and then we can merge.

tsadakane commented 3 months ago

@AnderBiguri , Compile.m is updated to support VSs which do not have vswhere.

I'd like to refrain from editing README/Instructions due to my English language skills. I can suggest the following:

AnderBiguri commented 3 months ago

Hi @tsadakane, yes apologies, I was going to do it myself, just life got in the way. Thanks for the hard work. I'll do a commit to this branch with the updated readme and then I will merge.