imphys / smlm_datafusion2d

Apache License 2.0
9 stars 4 forks source link

Create and install all mexfiles from cmake #2

Closed benvanwerkhoven closed 5 years ago

benvanwerkhoven commented 6 years ago

I've replaced the build.m matlab script by doing it all from cmake. The advantage is that we can use CMake's modules for locating dependencies such as Matlab, CUDA, and CUB. I think this has really simplified the build process, which is very nice.

This should (in theory) all work as well on Windows, possibly using 'nmake' rather than 'make', but the rest should work. I can't test it myself as I don't have a windows machine with a Matlab license.

hrheydarian commented 5 years ago

Hi Ben,

I spent quite some time on trying to run cmake on windows but unfortunately, there are still some issues that I cannot resolve.

First of all, if I run cmake ., by default, cmake assumes that I am trying to compile under 32bit architecture. This is also confirmed in the following issues: https://cmake.org/Bug/view.php?id=15786 https://github.com/luarocks/luarocks/issues/382

The solution here is to explicitly mentioned that we are compiling under 64bit architecture with: cmake -G "Visual Studio 15 20017 Win64".

This will actually generates whole visual studio solution files which are needed to be compiled using visual studio in order to get the Makefile. I tried that but then I got a lot of unresolved externeal ... error.

I searched a lot about this issue but couldn't find any alternative solution to generate Makefile.

Could you please help with that? Is there a way to skip visual studio? There are quite a lot of compatibility issues with VS depending on the installed version of the user.

benvanwerkhoven commented 5 years ago

Hi Hamidreza,

I gave it a quick try on the windows laptop I have at home this weekend. I had to remove the matlab parts from the cmakelists file because I don't have matlab there. The visual studio files were generated correctly and without errors. So I did get some visual studio project files, although I have no idea what to do with them. I should still try to see if I can at least compile the GPU libraries from there. I tried to generate a Makefile for NMake with CMake, but then suddenly the CUDA compiler could not be found and I also got errors about cl.exe. Strangely enough both errors where not there when the target was visual studio. I'm going to see if we can get help from someone wat the escience center with this.

hrheydarian commented 5 years ago

Hi @benvanwerkhoven

Thanks for having a look at that.

For me, it is also the same, I can generate the whole visual studio solution (.sln and other VS related files) without any error. Normally, in Windows one has to open .sln (here smlm.sln) with Visual Studio and then build the solution from inside the IDE. This step is always very problematic in my experience as there are lots of parameters that need to be set for example in Project Properties and ... I did also tried to build the solution using my VS with default parameters but I got lots of errors which I am pretty sure are related to VS configurations. I think it would be nice if we can rely on some free c compiler to get rid of VS in Windows.