This grew out of my work creating an sfml port for macports, but should
be helpful for package maintainers of various distributions:
* add an SFML_USE_SYSTEM_DEPS option to ignore everything in extlibs/
except for headers/stb_image, and use the system versions
* install pkg-config files if a pkg-config program is found
and either lib/pkgconfig or libdata/pkgconfig exists under the
INSTALL_PREFIX, or the SFML_INSTALL_PKGCONFIG_FILES flag is set
explicitly
* install pkg-config files for static libs too, add the necessary
Requires.private and Libs.private entries to the .pc files to support
static linking
* on OS X, honor all INSTALL_NAME and RPATH related cmake variables and
only set the INSTALL_NAME_DIR to "@rpath" if none of them is set, this
preserves the default behavior of using @rpath but also allows
overriding by the usual cmake mechanisms
- The installation paths are no longer hard coded; cmake now configures them so that Frameworks and libs can be installed somewhere else.
- No longer copy sndfile.framework but instead copy the new dependencies of the audio module.
- No longer copy .DS_Store to the install directory.
Since the @loader_path was replaced with @rpath, to correctly load
binaries from within a bundle app we need to add the Frameworks
subdirectory to the run path list.
For some reason, one might want to recompile the extlibs but this is a tedious task. That's why these scripts are provided.
Please read readme.txt before using them!
What's new in the templates:
- Removed support for 32 bits and gcc
- Removed useless code
- Removed custom warnings settings – let Xcode decide with its default values
- Set default target version to CMAKE_OSX_DEPLOYMENT_TARGET
What's new in cmake script:
- Added cmake options for archs and deployment target
- Added minimum requirements checking
The modules provided are:
- sfml-system
- sfml-graphics
- sfml-window
- sfml-audio
- sfml-network
- sfml-all (depends on all the above modules)
They are installed to ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig/
which is the standard location for pkg-config files on Linux.
An example use if using autotools:
# configure.ac
AC_INIT([sfml-example],[1.0],[example@example.com])
AM_INIT_AUTOMAKE([foreign])
AC_PROG_CXX
PKG_CHECK_MODULES([sfml],
[sfml-all >= 2.0.0],
[], [AC_MSG_ERROR([SFML is required])])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
# Makefile.am
bin_PROGRAMS = sfml_example
sfml_example_SOURCES = src/sfml_example.cpp
sfml_example_CFLAGS = $(sfml_CFLAGS)
sfml_example_LIBS = $(sfml_LIBS)
An example if using hand-written Makefiles:
# Makefile
sfml-example: src/sfml-example.cpp
g++ `pkg-config --cflags --libs sfml-all` -o $@ $^