Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Change to MinGW-W64 and everything is broken  (Read 3363 times)

0 Members and 1 Guest are viewing this topic.

de5cartes

  • Newbie
  • *
  • Posts: 9
    • View Profile
Change to MinGW-W64 and everything is broken
« on: May 16, 2020, 09:25:49 pm »
Hi

I used MinGW with SFML without a problem for months now, however I added a library that require std::threads so I had to change to MinGW-W64.
Tried to recompile everything and reconfigure the enviornment, but everything got messed up and broken.
I think I'm fairly confused about whats going on, probably because my noob experience with cmake.

I would like to start from scratch, lets say from a simple hello world for SFML using MinGW-W64 (which is configured in my PATH and I can run a cout << "Hello World" with it).

Here are my questions:
1. First a general question, if I compile SFML myself, do I still need the windows DLL files (sfml-system-2.dll etc...) to be inside my executable folder? I would rather everything go inside one .exe file.

2. After I build SFML (I successfully built it to \program files...\SFML) how should I integrate it to my project CMakeLists file ? I tried all sort of things (find_package, add_subdirectory...) nothing works.

3. Can I instead just build SFML with my project? I tried adding SFML git source to my project in directory lib/SFML-2.5.1/ and in my project cmake file write add_subdirectory(...) to that directory. The hello world build but he ask for the DLL files. I also tried retrieving the DLL files and adding them to the executable directory using file(COPY...) command, and it does copy the file but my hello world program complains it does not find the DLL files (altough they are on the same directrory!)


I'm really sorry for the noob questions, but I've invested the past couple of months developing my software which uses SFML and not nothing works and i'm wasting hours on that...

Thank you !
« Last Edit: May 16, 2020, 09:27:37 pm by de5cartes »

de5cartes

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Change to MinGW-W64 and everything is broken
« Reply #1 on: May 16, 2020, 10:08:58 pm »
I dont know what is going on here, after a full day I tried again the following configuration and it worked, (but was different than what I did earlier).

1. Downloaded SFML, compiled with MinGW64 abd cmake and installed in \program files...\SFML\
2. in my CMake file I added find_package(SFML 2.5 COMPONENTS graphics audio REQUIRED)
3. This gave me and error "Requested SFML configuration (Shared) was not found"
4. Added set(SFML_STATIC_LIBRARIES TRUE) to the cmake
5. Everything build and run well.

Can you atleast let me know what is going on (and maybe even answer my previous questions) ?
« Last Edit: May 16, 2020, 10:25:23 pm by de5cartes »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Change to MinGW-W64 and everything is broken
« Reply #2 on: May 17, 2020, 09:23:57 am »
Hi

1. If you make a dynamic build, yes, if you make a static build, no.

2. There's a sticky post on the forum that explains how to use SFML in a CMake configuration. Don't forget to build the "install" rule after you compile it, to get a usable release of SFML.

3. Yes, add_subdirectory should work fine. If you have a DLL problem it's not related to how you build SFML. Just make those DLLs available (same folder as exe should work).

For you second post: you probably built only a static configuration of SFML.
Laurent Gomila - SFML developer