CERN / TIGRE

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

Make installation easier #523

Closed AnderBiguri closed 2 months ago

AnderBiguri commented 3 months ago

Can we automatically find the compiler/MVS version, and just rename the xml file ourselves? Ideally we don't want users to do anything other than just run the compilation script.

Can we even provide pre-compiled libraries? I think this is harder to do without loss of generality.

tsadakane commented 3 months ago

Can we use the following snippet to get the Visual Studio version?

% path to vswhere
path_to_vswhere = "c:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe";

% Run vswhere to get version string
if exist(path_to_vswhere, 'file') == 2
    [~, vs_version_string] = system('"'+path_to_vswhere+'" -latest -property installationVersion');
    fprintf('Visual Studio version: %s\n', vs_version_string);
else
    error('Error: vswhere.exe not found');
end

% Split version string
vs_versions = strsplit(vs_version_string, ".");
vs_major_version = vs_versions{1, 1};
fprintf('vs_major_version: %s\n', vs_major_version);

if strcmp("17", vs_major_version)
    fprintf("2022\n");
elseif strcmp("16", vs_major_version)
    fprintf("2019\n");
elseif strcmp("15", vs_major_version)
    fprintf("2017\n");
elseif strcmp("14", vs_major_version)
    fprintf("2015\n");
else
    error("Unknwon version %s\n", vs_major_version)
end

This worked on my environment where Matlab2022a, VS2022 and VS2019 are installed ("2022" is printed).

If this woks on other pc's, it's easy to modify Compile.m so that it uses mex...2022.xml file.