cmake-basis/BASIS

Compiling on MSYS2 using MinGW-w64 compilers

Foadsf opened this issue · 3 comments

Following this SO question, here I want to summarize the steps I took so far using MinGW-w64 compilers in MSYS2 environment to compile BASIS:

  1. Edited the basis\include\basis\gtest\gtest.h according to here
  2. In the basis\src\utilities\cxx\stio.cxx the _dupenv_s doesn't exist on GCC, so they should be probably replaced by getenv_s
  3. The CMake command should be something like cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/<useName>/local -DBUILD_APPLICATIONS:BOOL=ON -DBUILD_EXAMPLE:BOOL=ON -DCMAKE_MAKE_PROGRAM=mingw32-make.exe .. -G "MSYS Makefiles"

Thanks for this concise list, this is very helpful. Do you want to send me a PR for the fix of gtest?

If you have one for stdio.cxx, that be great as well. Otherwise I'll make the changes myself.

Regarding CMAKE_MAKE_PROGRAM, it may be that you would need to set your PATH variable within the MSYS2 environment appropriately if you want to avoid having to set it explicitly? This seems a typical issue coming up with MinGW and MSYS generators. Not sure it's something that should be addressed on BASIS' end.

See for example, KDAB/GammaRay#239.

@schuhschuh thanks for the reply. I'm actually not at the level of confidence to send any PRs on this repository. So I would appreciate it if you could help by taking care of it yourself.

It would also very help full if you could keep this project alive. To my best understanding, there are no better alternatives for the moment.

P.S. You may wanna take a look at the Cookiecutter project.

Sorry for the delay. I fixed the compilation issues with MinGW GCC (used MSYS2 subsystem mingw64), i.e., non-MSVC compiler on Windows. See linked pull request for details.

Regarding CMake, I didn't manage myself to be able to use "MSYS Makefiles" generator with the CMake version installed with pacman. Neither the one from msys2 subsystem, nor mingw64. The generators "MinGW Makefiles" and "MSYS Makefiles" were simply not known. Instead, I simply used the native CMake Windows installation as follows:

export PATH="/c/Program\ Files/CMake/bin:$PATH"
cmake -G "MSYS Makefiles" -D BUILD_APPLICATIONS=ON -D BUILD_EXAMPLE=ON ..
cmake --build . --config Release