Integrating SFML into cross-platform engine with CMake

Started by
0 comments, last by myers80 11 years, 2 months ago

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.

Advertisement

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)

This topic is closed to new replies.

Advertisement