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

Author Topic: Abandoned SFML because of the install process  (Read 2848 times)

0 Members and 1 Guest are viewing this topic.

npnrj308

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Abandoned SFML because of the install process
« on: January 09, 2021, 10:09:29 am »
I'll probably get flamed for this - but here goes. I wanted to take a quick look at SFML to see if it was suitable for a small project I'm contemplating. But there is no pre-built SFML for Visual Studio 2019 and the VS project created by cmake-gui just doesn't work. It defaults to X64, which isn't what I want and it doesn't seem to want to change. The Install sub-project fails on some complex statement, probably because paths aren't right. I managed to compile a demo program but linking failed with all sorts of missing symbols, even when I explicitly included the SFML libraries with a #pragma. So I lost the will to live and have abandoned my evaluation of SFML and will go look at other platform independent tools.

I'm sure that if I persisted for a couple of days and got lots of help from this forum I could make it work. But that's not the point. There ought to be an easy path to getting your first working SFML app, and that doesn't seem to be the case. IMHO this will deter people from looking at what might well be an excellent piece of technology. So can I suggest that there ought to be a simple installation process that works with the latest Visual Studio release using something idiot-proof like MSI. Complex and inadequately-documented build processes are fine when you have lots of time and need fine control over configurations, but they deter beginners.

I'm sure people will argue that the problem is my lack of commitment or knowledge about the finer details of cmake. But that's missing the point. I know C++ very well, and I don't want to have to become an expert on cmake for Windows just to find out if a technology is useful or not. IMHO SFML installation fails the key principle defined by the great Alan Kay: simple things should be simple and complex things should be possible. 

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Abandoned SFML because of the install process
« Reply #1 on: January 09, 2021, 10:48:24 am »
Hi

Let's take all these issues one by one.

Versions of VC++ should be compatible starting at Visual Studio 2015, so downloading the VS2017 build of SFML should work fine with VS2019.

Cmake-gui (don't know if that's what you used) explicitly states, when you choose the VS2019 generator, that the default is x64; the second combobox allows you to choose the Win32 preset if you prefer a 32-bit build.

I generated the SFML solution with CMake, with all default options, opened it, built it, no problem. Then compiled the INSTALL target, which failed as I expected it would. Why does it fail? Because the default install path, which is in C:/Program Files, requires admin rights to create and write stuff. Changing CMAKE_INSTALL_PREFIX to anything else solves the problem.

Is it an issue with Windows, that by default you can't write to where you're supposed to install program? Most likely, or we don't (want to) understand access rights enough. Is it a problem with CMake, which uses a default install path where regular users can't write? Most likely, but it can't be blamed for following the OS rules. Is it an issue with SFML, to simply use the CMake/OS defaults? I don't know. But one thing's sure: as a developer, you must know that C:/Program Files requires admin rights for writing. You can't blame other tools or middlewares for that.

I don't know what you did with your example program, and why you got linker errors. But I'm pretty sure it's something that's explained in the "Getting started" tutorial.

I don't know if you want to elaborate on the remaining problems, or if you just don't care. Both ways are fine ;) But remember one thing: every environment is different, as it's a complex combination of OS, tools, configurations, etc. all with their specific version. You can't expect something to always work smoothly for 100% of users. There will always be problems, and understanding them is, in my opinion, a much better solution (as a developer) than giving up and losing the will to live ;)
Laurent Gomila - SFML developer

jacmoe

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Abandoned SFML because of the install process
« Reply #2 on: January 10, 2021, 04:37:03 pm »
There actually is an option that you overlooked: vcpkg.
Since vcpkg is a Microsoft thing it integrates seamlessly with Visual Studio.
To get SFML you simply use vcpkg to fetch and compile the whole thing.
You don't have to deal with CMake at all :)

https://docs.microsoft.com/en-us/cpp/build/vcpkg?view=msvc-160

What I did to get SFML was to run the following commands in the terminal/prompt (from the project directory):

Code: [Select]
git clone https://github.com/microsoft/vcpkg
cd .\vcpkg\
.\bootstrap-vcpkg.bat
.\vcpkg.exe install sfml --triplet x64-windows-static
I chose a static x64 build, but you can obviously choose to install  the default by omitting the triplet argument.
Make sure you install the Visual Studio vcpkg integration, and you are going to have your SFML cake and eat it too.
« Last Edit: January 10, 2021, 04:50:50 pm by jacmoe »
Too many projects; too much time

 

anything