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

Author Topic: CMake support added  (Read 16552 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« on: August 19, 2010, 06:04:14 pm »
Hi

My huge commit from today adds support for the CMake build system, as well as renaming some parts of the repository tree.

Things to know:
- I haven't written CMake files for CSFML yet, this is my next task
- there's no tutorial yet, this is my second next task
- the old project files and makefiles are still maintained, but at some point before the public release they will be removed; so you'd better switch to CMake as soon as you can
- although I've spent a rather big amount of time on the CMake makefiles, there are probably mistakes and things to improve, so don't hesitate to give your feedback
Laurent Gomila - SFML developer

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
CMake support added
« Reply #1 on: August 19, 2010, 10:22:51 pm »
So you will not provide project files in the next release?  :(

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« Reply #2 on: August 19, 2010, 11:34:12 pm »
No, it is no longer necessary. If you want to recompile SFML you can generate the project files for your favorite IDE/compiler with CMake.
Laurent Gomila - SFML developer

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
CMake support added
« Reply #3 on: August 20, 2010, 01:06:58 am »
Another tool necessary to use SFML. That will increase the number of problems if you just want to recompile SFML.

You are now able to create project files easily. Please do that for the IDEs and platforms which are used most. :)

MarthKoopa

  • Guest
CMake support added
« Reply #4 on: August 20, 2010, 06:44:54 am »
I figured out how to do this, I think, but I don't see any DLLs or Libs anywhere.

I have "where is the source code" set to C:\SFML-2.0\
and "where to build the binaries" set to C:\SFML-2.0\lib\

This is the output I got for VS9 2008 on the first configure click:

Code: [Select]
Check for working C compiler using: Visual Studio 9 2008
Check for working C compiler using: Visual Studio 9 2008 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 9 2008
Check for working CXX compiler using: Visual Studio 9 2008 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - not found
Looking for stddef.h
Looking for stddef.h - found
Check size of void*
Check size of void* - done
   Entering             C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/System
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Window
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Network
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Graphics
Found Freetype: C:/SFML-2.0/extlibs/libs-msvc/freetype.lib
Found JPEG: C:/SFML-2.0/extlibs/libs-msvc/jpeg.lib
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Audio
Found OpenAL: C:/SFML-2.0/extlibs/libs-msvc/OpenAL32.lib
Found SNDFILE: C:/SFML-2.0/extlibs/headers
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Main
   Returning to         C:/SFML-2.0/src/SFML
   Returning to         C:/SFML-2.0
Configuring done


I clicked it again, because generate wasn't clickable, then generate became clickable and I got this:

Code: [Select]
  Entering             C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/System
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Window
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Network
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Graphics
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Audio
   Returning to         C:/SFML-2.0/src/SFML
   Entering             C:/SFML-2.0/src/SFML/Main
   Returning to         C:/SFML-2.0/src/SFML
   Returning to         C:/SFML-2.0
Configuring done
Generating done

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« Reply #5 on: August 20, 2010, 08:57:46 am »
Quote
Another tool necessary to use SFML. That will increase the number of problems if you just want to recompile SFML

Once the projects are generated, you don't have to care about CMake anymore, just run the generated makefiles/projects (they will even update themselves automatically if the CMake configuration has changed).
Please, at least try it before arguing, you'll see how simple and powerful it is ;)

And this is actually reducing the number of problems, maintaining a single generic build configuration for every platform/compiler rather than a different one for each of those, is much less error prone. And it gives access to previously unsupported compilers/platforms, for free.

By the way, I asked the community about a month ago about this modification, now it's too late to be against it.

Quote
I figured out how to do this, I think, but I don't see any DLLs or Libs anywhere.

You just configured the project, ie. you created the makefiles/projects. Now you have to use them to actually build SFML.
Please read CMake tutorials, if you really want to use it before I write my own tutorial for compiling SFML.
Laurent Gomila - SFML developer

Mr. X

  • Jr. Member
  • **
  • Posts: 80
    • View Profile
CMake support added
« Reply #6 on: August 20, 2010, 10:10:07 pm »
Quote from: "Laurent"
Quote
Another tool necessary to use SFML. That will increase the number of problems if you just want to recompile SFML

Once the projects are generated, you don't have to care about CMake anymore, just run the generated makefiles/projects (they will even update themselves automatically if the CMake configuration has changed).
Please, at least try it before arguing, you'll see how simple and powerful it is ;)

And this is actually reducing the number of problems, maintaining a single generic build configuration for every platform/compiler rather than a different one for each of those, is much less error prone. And it gives access to previously unsupported compilers/platforms, for free.

By the way, I asked the community about a month ago about this modification, now it's too late to be against it.


I am not against CMake. You have now the ability (using CMake) to create the project files even more easily than before so I see no reason why to drop it (Maybe, to reduce the effort you can drop the support for very old IDEs (vc2005) ;) ).
Another point is, that it becomes more difficult to explain other people how to compile SFML if they have to do more steps than before. Its another Step where problems appear.
I am also not talking about putting those project files into the repo any more (because refreshing those project files every commit is painful) but just giving project files each release.

So, please neither drop the support for the project files (which can be generated easily now) nor the support for CMake (I never asked for that, and I know, that its usefull to maintain a project for different platforms.)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« Reply #7 on: August 20, 2010, 10:51:05 pm »
The problem is that project files generated by CMake are pretty ugly... not really ready to be distributed.
In fact there's no point generating/distributing them anymore, except for me and other SFML developers. To simply compile SFML, makefiles are always much better.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
CMake support added
« Reply #8 on: August 21, 2010, 05:23:18 pm »
I think Mr. X is right. Sure, the generated project files are ugly (computers never had a sense of beauty, right? ;)), but better ugly project files for a release than none.

This of course only applies for full binary releases. For everything else, everybody should be able to read the fine manual and get things working.

However, it's great that you switched to CMake, good work.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« Reply #9 on: August 22, 2010, 09:18:53 pm »
I don't think it's complicated, even for a beginner, to understand how to generate them.

Here are the reasons why I don't want to distribute the final projects/makefiles:

1. The projects/makefiles are ugly, but there are also a full hierarchy of CMake specific files that come with them ; it becomes really ugly to distribute, and unnecessary.

2. CMake generates a cache of the paths that it detects, and these paths are absolute; so if I distribute my generated projects/makefiles, it's simply not going to work.

3. There are so many ways to generate build files for a given compiler with CMake, I can't distribute one that makes everybody happy. For example, to build with Visual Studio I can generate VC++ projects or nmake makefiles. Some people will prefer the former, and some others will prefer the latter. The build tree can be generated inside the source tree, or outside. Again, some will like and some won't. You can also setup the install path when you create makefiles/projects, for the "install" rule. You can also choose or not to compile the doc, the examples, etc...

So I prefer to leave users with the huge flexibility of CMake, and customize their SFML build the way they like, with the cost of executing a small command to generate the build files.
Laurent Gomila - SFML developer

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
CMake support added
« Reply #10 on: August 23, 2010, 02:16:31 pm »
From a first look at the lists it looks like a good job and clean work. I have yet to try it out. Thanks for your work, Laurent.

CMake will finally allow me to cross-compile properly.

There will always be naysayers but they might not be experienced enough to judge the situation in its entirety. CMake is currently the only sane choice for cross-platform applications and libraries unless you want to do all the maintenance yourself which is error prone anyway.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
CMake support added
« Reply #11 on: August 23, 2010, 07:45:52 pm »
Quote from: "Svenstaro"
will always be naysayers but they might not be experienced enough to judge the situation in its entirety. CMake is currently the only sane choice for cross-platform applications and libraries unless you want to do all the maintenance yours
elf which is error prone anyway.

This has nothing to do with being a "naysayer", it's called a discussion where everybody who may concern can take part with his own personal opinion. And guess what, sometimes these discussions can lead to new and maybe better solutions.

Nobody says "You are doing it wrong", but instead "I think maybe this or that could be an improvement". You have the same opinion like the maintainer, so you are happy, but don't call other people unexperienced because they have another one. Indeed CMake is not the only tool to keep good cross-platform capabilities for the build system.

And, to get a bit more personal (yep, I feel being pissed at): Don't mix this or any other discussion with personal stuff regarding to me or Mr.X. PM me in case of interest.

Galaxy613

  • Newbie
  • *
  • Posts: 3
    • MSN Messenger - the_ckarl@hotmail.com
    • AOL Instant Messenger - Galaxy613
    • View Profile
CMake support added
« Reply #12 on: August 24, 2010, 03:47:14 am »
CMake does sound pretty sweet. But I get what Mr. X and Tank are saying about maintaining pre-made projects for n00bies like me. But honestly that can wait until the release of v2.0 IMHO. It sounds like cmake relieves Laurent of the responsibility of maintaining different project and make file setups for different projects so he can focus on actually making improvements on SFML.

There is no reason to get annoyed at each other over this. :roll: The switch to cmake is very young and Laurent hasn't even made a tutorial yet. Nothing is stopping Laurent or someone else from making cleaner projects in the future.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
CMake support added
« Reply #13 on: August 24, 2010, 12:07:26 pm »
The switch to CMake was a very good decision in my eyes, I have nothing to complain about. :) Indeed using CMake is easy, and with a little step-by-step guide everybody should be able to generate project files. However, I still think providing at least project files for the latest and most popular IDEs wouldn't be wrong (not for all possible configurations, versions, platforms etc.).

Quote
There is no reason to get annoyed at each other over this.

This has actually nothing to do with CMake in the first place. I'm sorry that I brought this to a public table.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
CMake support added
« Reply #14 on: August 24, 2010, 12:32:29 pm »
Quote
However, I still think providing at least project files for the latest and most popular IDEs wouldn't be wrong

Technically, I think the following reasons make it unfeasible
Quote
1. The projects/makefiles are ugly, but there are also a full hierarchy of CMake specific files that come with them ; it becomes really ugly to distribute, and unnecessary.

2. CMake generates a cache of the paths that it detects, and these paths are absolute; so if I distribute my generated projects/makefiles, it's simply not going to work.

In fact I don't think that CMake generated files are made for being distributed.
Laurent Gomila - SFML developer