Jump to content

  • Log In with Google      Sign In   
  • Create Account

Integrating SFML into cross-platform engine with CMake


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 myers80   Members   -  Reputation: 194

Like
0Likes
Like

Posted 08 February 2013 - 01:02 PM

I'm creating a c++ game engine, and I intend to use SFML for the graphics, audio, and input.  I'm also using cmake to generate my build files, so that I have an easy way to test it across multiple OS'.  I'm wondering what the correct/proper approach is to integrating SFML into a setup like this.

 

Should I have a copy of the SFML libraries for each OS (win/unix/mac), and somehow specify in CMake which of the libraries to include?  Or do I include the SFML source into my project source and build the libraries along with my project?

 

My engine is building its own shared libraries and linking to those, so I understand the basics of this.  I'm just not sure how I should be including other people's libraries into my project, and making it so that it functions across multiple OS'.  Thanks.



Sponsor:

#2 myers80   Members   -  Reputation: 194

Like
0Likes
Like

Posted 09 February 2013 - 02:24 PM

Well for anyone curious, I found a good tutorial and was able to figure it out.  There were a few additional things I had to do that the tutorial didn't really cover.

 

I placed a copy of the Windows SFML 2.0 release client in my project directoy.  I also placed lib files from the Unix version of SFML into the lib folder of my SFML copy.

 

Before calling, find_package(SFML..., I had to set the directory for where SFML was located:

    set(SFMLDIR "${CMAKE_SOURCE_DIR}/../SFML-2.0-rc")

 

I couldn't find a way to get the SFML dlls to copy to where the executable is generated, so I just statically linked them (which is probably what I should be doing anyways):

    set(SFML_STATIC_LIBRARIES TRUE)






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS