From 2ac7653608dc90247ea1667ef513fa7846545496 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Tue, 10 Jan 2012 21:08:20 +0000 Subject: [PATCH] Add pkg-config files, optionally installed by CMake on Linux builds. 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 $@ $^ --- CMakeLists.txt | 20 ++++++++++++++++++++ tools/pkg-config/sfml-all.pc.in | 10 ++++++++++ tools/pkg-config/sfml-audio.pc.in | 11 +++++++++++ tools/pkg-config/sfml-graphics.pc.in | 11 +++++++++++ tools/pkg-config/sfml-network.pc.in | 11 +++++++++++ tools/pkg-config/sfml-system.pc.in | 11 +++++++++++ tools/pkg-config/sfml-window.pc.in | 11 +++++++++++ 7 files changed, 85 insertions(+) create mode 100644 tools/pkg-config/sfml-all.pc.in create mode 100644 tools/pkg-config/sfml-audio.pc.in create mode 100644 tools/pkg-config/sfml-graphics.pc.in create mode 100644 tools/pkg-config/sfml-network.pc.in create mode 100644 tools/pkg-config/sfml-system.pc.in create mode 100644 tools/pkg-config/sfml-window.pc.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b807a4e..d1544dd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -127,6 +127,26 @@ if(MACOSX) endif() endif() +if(LINUX) + if(BUILD_SHARED_LIBS) + sfml_set_option(INSTALL_PKGCONFIG_FILES TRUE BOOL "TRUE to automatically install pkg-config files so other projects can find SFML") + if(INSTALL_PKGCONFIG_FILES) + foreach(sfml_module IN ITEMS all system window graphics audio network) + CONFIGURE_FILE( + "tools/pkg-config/sfml-${sfml_module}.pc.in" + "tools/pkg-config/sfml-${sfml_module}.pc" + @ONLY) + INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/tools/pkg-config/sfml-${sfml_module}.pc" + DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/pkgconfig") + endforeach() + endif() + else() + if(INSTALL_PKGCONFIG_FILES) + message(WARNING "No pkg-config files are provided for the static SFML libraries (INSTALL_PKGCONFIG_FILES will be ignored).") + endif() + endif() +endif() + # add the subdirectories add_subdirectory(src/SFML) if(BUILD_EXAMPLES) diff --git a/tools/pkg-config/sfml-all.pc.in b/tools/pkg-config/sfml-all.pc.in new file mode 100644 index 00000000..dd2d4c36 --- /dev/null +++ b/tools/pkg-config/sfml-all.pc.in @@ -0,0 +1,10 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-all +Description: The Simple and Fast Multimedia Library, all modules. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Requires: sfml-system, sfml-window, sfml-graphics, sfml-audio, sfml-network diff --git a/tools/pkg-config/sfml-audio.pc.in b/tools/pkg-config/sfml-audio.pc.in new file mode 100644 index 00000000..ee4f4ed2 --- /dev/null +++ b/tools/pkg-config/sfml-audio.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-audio +Description: The Simple and Fast Multimedia Library, audio module. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Libs: -L${libdir} -lsfml-audio +Cflags: -I${includedir} diff --git a/tools/pkg-config/sfml-graphics.pc.in b/tools/pkg-config/sfml-graphics.pc.in new file mode 100644 index 00000000..747262b1 --- /dev/null +++ b/tools/pkg-config/sfml-graphics.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-graphics +Description: The Simple and Fast Multimedia Library, graphics module. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Libs: -L${libdir} -lsfml-graphics +Cflags: -I${includedir} diff --git a/tools/pkg-config/sfml-network.pc.in b/tools/pkg-config/sfml-network.pc.in new file mode 100644 index 00000000..faae4eb0 --- /dev/null +++ b/tools/pkg-config/sfml-network.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-network +Description: The Simple and Fast Multimedia Library, network module. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Libs: -L${libdir} -lsfml-network +Cflags: -I${includedir} diff --git a/tools/pkg-config/sfml-system.pc.in b/tools/pkg-config/sfml-system.pc.in new file mode 100644 index 00000000..647ab53c --- /dev/null +++ b/tools/pkg-config/sfml-system.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-system +Description: The Simple and Fast Multimedia Library, system module. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Libs: -L${libdir} -lsfml-system +Cflags: -I${includedir} diff --git a/tools/pkg-config/sfml-window.pc.in b/tools/pkg-config/sfml-window.pc.in new file mode 100644 index 00000000..6bc4976a --- /dev/null +++ b/tools/pkg-config/sfml-window.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib@LIB_SUFFIX@ +includedir=${prefix}/include + +Name: SFML-window +Description: The Simple and Fast Multimedia Library, window module. +URL: http://www.sfml-dev.org +Version: @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@ +Libs: -L${libdir} -lsfml-window +Cflags: -I${includedir}