How do I setup a CMake project with both Allegro and MSVC? - c++

Lately I've been experimenting with the Allegro game library, but I'm having some trouble setting it up in the following scenario:
I would like to create a cross-platform project (for at least Linux and Windows binaries, preferably also OS X) using CMake that utilizes the Allegro game library, but is able to build using MSVC instead of MinGW for the Windows Binaries.
I tried linking statically to the MinGW standard libraries, but the supplied Allegro binaries for MinGW are still dynamically linked, so I'd rather just use the proper Windows compiler.
Does anyone know if it is possible to extract the binaries from the Nuget package or if there's a more proper way to use MSVC and Allegro while still maintaining a cross-platform source code?
I'd prefer not having to build Allegro from source, but if I have to, any links to guides would be helpful.

Related

What is an easy way to install a unix terminal with a C++ mingw compiler?

I'm going to teach students to use SFML with C++, and I'm afraid the school doesn't have visual studio C++ installed, or will be a bit heavy to use for those students.
I want to have a plan B and have the option of a simple makefile that I can build on windows with SFML.
https://www.sfml-dev.org/download/sfml/2.5.1/ this page offers binaries compiled with different, specific versions of mingw with their respective mingw package links, unfortunately mingw doesn't include an unix terminal, like the one included with git-bash, so I can run a makefile.
What are the steps required to have a problem unix terminal, running in windows, minsys, msys2 or not, that can work well with those mingw packages? I have trouble finding help or proper instructions.
You want https://www.msys2.org/
It provides bash terminal and already contains mingw compiler. Perhaps it even has SFML packages already.

Using BOOST_STACKTRACE_USE_BACKTRACE on Windows with MinGW64

I am building a Qt application using Windows and MinGW64. I need to use Boost Stacktrace to generate stack traces like the Linux build of the application already does.
The corresponding switch BOOST_STACKTRACE_USE_BACKTRACE (as described in https://www.boost.org/doc/libs/1_65_1/doc/html/stacktrace/configuration_and_build.html) is set and everything works fine on Linux.
However on Windows the libbacktrace library is missing. The above boost page contains two links to the sources of libbacktrace but I couldn't find a prebuilt binary for Windows/MinGW nor could I find any build instructions or usage documentation for my environment.
How can I use BOOST_STACKTRACE_USE_BACKTRACE with Windows/MinGW64?
I solved this problem (and some more issues) by switching to MSYS2 UCRT. MSYS2 provides a precompiled libbacktrace package.

Build ZBar for 64bit WIndows

The ZBar library is distributed with a 32bit binary lib file and dll. I need to use ZBar in a 64bit Windows application. It seems that the only way to get 64bit version of ZBar is to build it yourself.
According to this faq, the only way to build ZBar is by using MinGW. I also found this patch for patching ZBar in order to produce a 64bit build.
Of course I can try to follow these suggestions and try to build ZBar, but since I have never built ZBar before, and I don't know MinGW at all (I am a VC++ user), I was wandering if anyone has built a 64bit version of ZBar for Windows successfully. Maybe there is even someone that can share the binaries with the rest of us. Any suggestion is welcome!
Thanks.
Since there were no answers I assume that there is no available 64 build. I therefore decided to do it myself. Since I don't know MinGW and the link from the zbar faq seems to be broken, I decided to build using VS2013.
The code for the VS2013 project and the adapted ZBar code can be found in https://github.com/dani4/ZBarWin64. I also added the built libraries themselves. See the README for details.
I am new to github so possibly my choice to change a fork of ZBar wasn't the right one, and I should have created a new repository. Anyway I think that the library can be used in this form as well.

How do I set up OpenCV for MinGW project?

I regularly use Code::Blocks and MinGW for my C/C++ projects. I would like to be able to use OpenCV, since it has a nice library for computer vision projects. They have dropped support for MinGW. I have heard you can build it on your own somehow, but I have no experience doing this with 3rd party libraries. Can someone explain how to build it in a simple way for MinGW?
There is, or at least there was at least until 2.4.6, precompiled version of opencv that works out of the box with mingw as long as you use the dw2(standard) version of mingw.
since i needed sjlj support i had to build my own version of openCV 2.4.6
I did he following - i am pretty sure it will work for the current openCV version as well
Setup your preferred Mingw Environment - i would strongly recommend to use gcc 4.5 or newer
Intstall Msys
Intall Cmake - you can get a binary package
Start the Cmake GUI
Select the openCV source folder
Click Configure and select MSYS-Makfiles
Errors in the first run of Configure might be resolved if you run Configure again
Click Generate
use MSYS make to run the generated makefile
Copy all desired libraries and include files to your mingw-installation or your project

Installing C++ Boost library on Windows without Visual Studio

I would like to install Boost library without the need of Visual Studio compiler, preferably by downloading the pre-compiled binaries. We are working on a cross-platform C++ project in Eclipse, so VS is out of option.
About a year ago, I found an installer, but it does not longer exists.
The best match I have found so far is from:
http://www.boostpro.com/download/
but it seems like this one includes a lot of stuff related to VS.
If there is no installer available, is there an easy way of compiling it like the on *NIX platforms?
(I know that the majority of the library is header-only, but I would like some parts which are not)
Whichever toolchain that you are going to use on Windows, you can use that toolchain to compile Boost easily.
For example, if you use Eclipse CDT for C++ on Windows, you can use either MinGW or Cygwin toolchain. Then simply start the command prompt that has those toolchains (make, gcc, ...) in your path. Go to the Boost folder you downloaded. Run the bootstrap file to generate bjam. Then run bjam.
On a side note, if you want a cross-platform C++ project, you don't have to use a cross-platform IDE. You can use CMake as your build generator and then use any IDE you want.
One option is to get the full Boost source and then compile your own application to statically link in everything from Boost. If you manage to do this correctly, there will be no need to bundle the Boost binaries on any platform.