From b1051832acf25a157c09f6e8c1a8332a52364f74 Mon Sep 17 00:00:00 2001 From: Yoann Potinet Date: Sat, 8 Aug 2020 17:27:01 -0400 Subject: [PATCH 1/6] Add sfml 2.5.1 --- recipes/sfml/all/CMakeLists.txt | 7 + recipes/sfml/all/conandata.yml | 8 + recipes/sfml/all/conanfile.py | 190 ++++++++++++++++++ .../001_disable_deps_installation.patch | 100 +++++++++ recipes/sfml/all/test_package/CMakeLists.txt | 38 ++++ recipes/sfml/all/test_package/conanfile.py | 21 ++ .../sfml/all/test_package/test_package.cpp | 46 +++++ recipes/sfml/config.yml | 3 + 8 files changed, 413 insertions(+) create mode 100644 recipes/sfml/all/CMakeLists.txt create mode 100644 recipes/sfml/all/conandata.yml create mode 100644 recipes/sfml/all/conanfile.py create mode 100644 recipes/sfml/all/patches/001_disable_deps_installation.patch create mode 100644 recipes/sfml/all/test_package/CMakeLists.txt create mode 100644 recipes/sfml/all/test_package/conanfile.py create mode 100644 recipes/sfml/all/test_package/test_package.cpp create mode 100644 recipes/sfml/config.yml diff --git a/recipes/sfml/all/CMakeLists.txt b/recipes/sfml/all/CMakeLists.txt new file mode 100644 index 0000000000000..a69305eb3971f --- /dev/null +++ b/recipes/sfml/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml new file mode 100644 index 0000000000000..eeeda4cb94b35 --- /dev/null +++ b/recipes/sfml/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "2.5.1": + url: "https://github.com/SFML/SFML/archive/2.5.1.tar.gz" + sha256: "438c91a917cc8aa19e82c6f59f8714da353c488584a007d401efac8368e1c785" +patches: + "2.5.1": + - patch_file: "patches/001_disable_deps_installation.patch" + base_path: "source_subfolder" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py new file mode 100644 index 0000000000000..4faeae0b0f109 --- /dev/null +++ b/recipes/sfml/all/conanfile.py @@ -0,0 +1,190 @@ +from conans import ConanFile, CMake, tools +import os + + +class SFMLConan(ConanFile): + name = 'sfml' + description = 'Simple and Fast Multimedia Library' + license = "Zlib" + topics = ('conan', 'sfml', 'multimedia') + homepage = 'https://github.com/SFML/SFML' + url = 'https://github.com/conan-io/conan-center-index' + exports_sources = ['CMakeLists.txt', 'patches/*'] + generators = 'cmake' + settings = 'os', 'compiler', 'build_type', 'arch' + options = { + 'shared': [True, False], + 'fPIC': [True, False], + 'window': [True, False], + 'graphics': [True, False], + 'network': [True, False], + 'audio': [True, False], + } + default_options = { + 'shared': False, + 'fPIC': True, + 'window': True, + 'graphics': True, + 'network': True, + 'audio': True, + } + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def requirements(self): + if self.options.graphics: + self.requires('freetype/2.10.1') + self.requires('stb/20200203') + if self.options.audio: + self.requires('openal/1.19.1') + self.requires('flac/1.3.3') + self.requires('ogg/1.3.4') + self.requires('vorbis/1.3.6') + if self.options.window: + if self.settings.os in ['Linux', 'FreeBSD']: + self.requires('xorg/system') + self.requires('opengl/system') + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + extracted_dir = 'SFML-' + self.version + os.rename(extracted_dir, self._source_subfolder) + tools.rmdir(os.path.join(self._source_subfolder, "extlibs")) + + def _configure_cmake(self): + if self._cmake: + return self.cmake + self.cmake = CMake(self) + + self.cmake.definitions['SFML_BUILD_WINDOW'] = self.options.window + self.cmake.definitions['SFML_BUILD_GRAPHICS'] = self.options.graphics + self.cmake.definitions['SFML_BUILD_NETWORK'] = self.options.network + self.cmake.definitions['SFML_BUILD_AUDIO'] = self.options.audio + + self.cmake.definitions['SFML_INSTALL_PKGCONFIG_FILES'] = False + self.cmake.definitions['SFML_GENERATE_PDB'] = False + + self.cmake.configure(build_folder=self._build_subfolder) + return self.cmake + + def build(self): + for patch in self.conan_data.get("patches",{}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("license.md", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + os.remove(os.path.join(self.package_folder, "license.md")) + os.remove(os.path.join(self.package_folder, "readme.md")) + + def _get_decorated_lib(self, name): + suffix = '-s' if not self.options.shared else '' + suffix += '-d' if self.settings.build_type == 'Debug' else '' + return name + suffix + + def package_info(self): + + self.cpp_info.names["cmake_find_package"] = "SFML" + self.cpp_info.names["cmake_find_package_multi"] = "SFML" + self.cpp_info.names["pkg_config"] = "SFML" + + self.cpp_info.components["System"].names["cmake_find_package"] = "system" + self.cpp_info.components["System"].names["cmake_find_package_multi"] = "system" + self.cpp_info.components["System"].libs = [self._get_decorated_lib("sfml-system")] + if not self.options.shared: + self.cpp_info.components["System"].defines = ['SFML_STATIC'] + if self.settings.os == 'Windows': + self.cpp_info.components["System"].system_libs = ['winmm'] + elif self.settings.os == 'Linux': + self.cpp_info.components["System"].system_libs = ['rt'] + elif self.settings.os == 'Android': + self.cpp_info.components["System"].system_libs = ['android', 'log'] + if self.settings.os != 'Windows': + self.cpp_info.components["System"].system_libs = ['pthread'] + + if self.settings.os in ['Windows', 'Android', 'iOS']: + sfml_main_suffix = '-d' if self.settings.build_type == 'Debug' else '' + self.cpp_info.components["Main"].names["cmake_find_package"] = "main" + self.cpp_info.components["Main"].names["cmake_find_package_multi"] = "main" + self.cpp_info.components["Main"].libs = ["sfml-main" + sfml_main_suffix] + if not self.options.shared: + self.cpp_info.components["Main"].defines = ['SFML_STATIC'] + if self.settings.os == 'Android': + self.cpp_info.components["Main"].libs.append(self._get_decorated_lib("sfml-activity")) + self.cpp_info.components["Main"].system_libs = ['android', 'log'] + + if self.options.window or self.options.graphics: + self.cpp_info.components["Window"].names["cmake_find_package"] = "window" + self.cpp_info.components["Window"].names["cmake_find_package_multi"] = "window" + self.cpp_info.components["Window"].libs = [self._get_decorated_lib("sfml-window")] + self.cpp_info.components["Window"].requires = ["opengl::opengl", "System"] + if self.settings.os in ['Linux', 'FreeBSD']: + self.cpp_info.components["Window"].requires.append('xorg::xorg') + if not self.options.shared: + self.cpp_info.components["Window"].defines = ['SFML_STATIC'] + if self.settings.os == 'Windows': + self.cpp_info.components["Window"].system_libs = ['winmm', 'gdi32'] + if self.settings.os == 'Linux': + self.cpp_info.components["Window"].system_libs = ['udev'] + if self.settings.os == 'FreeBSD': + self.cpp_info.components["Window"].system_libs = ['usbhid'] + elif self.settings.os == "Macos": + self.cpp_info.components["Window"].frameworks['Foundation', 'AppKit', 'IOKit', 'Carbon'] + if not self.options.shared: + self.cpp_info.components["Window"].exelinkflags.append("-ObjC") + self.cpp_info.components["Window"].sharedlinkflags = self.cpp_info.components["Window"].exelinkflags + elif self.settings.os == "iOS": + self.cpp_info.frameworks['Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore', 'CoreMotion'] + elif self.settings.os == "Android": + self.cpp_info.components["Window"].system_libs = ['android'] + + if self.options.graphics: + self.cpp_info.components["Graphics"].names["cmake_find_package"] = "graphics" + self.cpp_info.components["Graphics"].names["cmake_find_package_multi"] = "graphics" + self.cpp_info.components["Graphics"].libs = [self._get_decorated_lib("sfml-graphics")] + self.cpp_info.components["Graphics"].requires = ["freetype::freetype", "stb::stb", "Window"] + if not self.options.shared: + self.cpp_info.components["Graphics"].defines = ['SFML_STATIC'] + if self.settings.os == 'Linux': + self.cpp_info.components["Graphics"].system_libs = ['udev'] + + if self.options.network: + self.cpp_info.components["Network"].names["cmake_find_package"] = "network" + self.cpp_info.components["Network"].names["cmake_find_package_multi"] = "network" + self.cpp_info.components["Network"].libs = [self._get_decorated_lib("sfml-network")] + self.cpp_info.components["Network"].requires = ["System"] + if not self.options.shared: + self.cpp_info.components["Network"].defines = ['SFML_STATIC'] + if self.settings.os == 'Windows': + self.cpp_info.components["Window"].system_libs = ['ws2_32'] + + if self.options.audio: + self.cpp_info.components["Audio"].names["cmake_find_package"] = "audio" + self.cpp_info.components["Audio"].names["cmake_find_package_multi"] = "audio" + self.cpp_info.components["Audio"].libs = [self._get_decorated_lib("sfml-audio")] + self.cpp_info.components["Audio"].requires = ["openal::openal", "flac::flac", "ogg::ogg", "vorbis::vorbis"] + if not self.options.shared: + self.cpp_info.components["Audio"].defines = ['SFML_STATIC'] + if self.settings.os == "Android": + self.cpp_info.components["Audio"].system_libs = ['android'] diff --git a/recipes/sfml/all/patches/001_disable_deps_installation.patch b/recipes/sfml/all/patches/001_disable_deps_installation.patch new file mode 100644 index 0000000000000..cb53e1f4d0256 --- /dev/null +++ b/recipes/sfml/all/patches/001_disable_deps_installation.patch @@ -0,0 +1,100 @@ +--- CMakeLists.txt 2018-10-15 15:41:39.000000000 -0400 ++++ CMakeLists.txt 2020-08-08 16:27:05.283895800 -0400 +@@ -404,62 +404,9 @@ + # install 3rd-party libraries and tools + if(SFML_OS_WINDOWS) + +- if(NOT SFML_USE_SYSTEM_DEPS) +- # install the binaries of SFML dependencies +- if(ARCH_32BITS) +- install(DIRECTORY extlibs/bin/x86/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/bin) +- if(SFML_COMPILER_MSVC AND SFML_MSVC_VERSION LESS 14) +- install(DIRECTORY extlibs/libs-msvc/x86/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- elseif(SFML_COMPILER_MSVC) +- install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- else() +- install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- endif() +- elseif(ARCH_64BITS) +- install(DIRECTORY extlibs/bin/x64/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/bin) +- if(SFML_COMPILER_MSVC AND SFML_MSVC_VERSION LESS 14) +- install(DIRECTORY extlibs/libs-msvc/x64/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- elseif(SFML_COMPILER_MSVC) +- install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- else() +- install(DIRECTORY extlibs/libs-mingw/x64/ DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}/lib) +- endif() +- endif() +- endif() + + elseif(SFML_OS_MACOSX) + # install extlibs dependencies only when used +- if(SFML_BUILD_GRAPHICS) +- if(FREETYPE_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/freetype.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/freetype.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- endif() +- +- if(SFML_BUILD_AUDIO) +- if(FLAC_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/FLAC.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/FLAC.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- +- if(OGG_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/ogg.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/ogg.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- +- if(VORBIS_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbis.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/vorbis.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- +- if(VORBISENC_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbisenc.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/vorbisenc.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- +- if(VORBISFILE_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/vorbisfile.framework") +- install(DIRECTORY extlibs/libs-osx/Frameworks/vorbisfile.framework DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- +- if(OPENAL_LIBRARY STREQUAL "${SFML_SOURCE_DIR}/extlibs/libs-osx/Frameworks/OpenAL.framework") +- install(DIRECTORY "${OPENAL_LIBRARY}" DESTINATION ${SFML_DEPENDENCIES_INSTALL_PREFIX}) +- endif() +- endif() + + # install the Xcode templates if requested + if(SFML_INSTALL_XCODE_TEMPLATES) +@@ -479,34 +426,9 @@ + elseif(SFML_OS_IOS) + + # fix CMake install rules broken for iOS (see http://public.kitware.com/Bug/view.php?id=12506) +- install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/\$ENV{CONFIGURATION}/" DESTINATION lib${LIB_SUFFIX}) +- +- if(NOT SFML_USE_SYSTEM_DEPS) +- # since the iOS libraries are built as static, we must install the SFML dependencies +- # too so that the end user can easily link them to its final application +- if(SFML_BUILD_GRAPHICS) +- install(FILES extlibs/libs-ios/libfreetype.a DESTINATION lib) +- endif() +- +- if(SFML_BUILD_AUDIO) +- install(FILES extlibs/libs-ios/libflac.a +- extlibs/libs-ios/libvorbis.a +- extlibs/libs-ios/libogg.a +- DESTINATION lib) +- endif() +- endif() + + elseif(SFML_OS_ANDROID) + +- if(NOT SFML_USE_SYSTEM_DEPS) +- # install extlibs +- install(DIRECTORY extlibs/libs-android/${CMAKE_ANDROID_ARCH_ABI} DESTINATION extlibs/lib) +- install(FILES extlibs/Android.mk DESTINATION extlibs) +- endif() +- +- # install Android.mk so the NDK knows how to set up SFML +- install(FILES src/SFML/Android.mk DESTINATION .) +- + endif() + + sfml_export_targets() diff --git a/recipes/sfml/all/test_package/CMakeLists.txt b/recipes/sfml/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..23706ad620563 --- /dev/null +++ b/recipes/sfml/all/test_package/CMakeLists.txt @@ -0,0 +1,38 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +set(SFML_components system) +if (WITH_WINDOW) + list(APPEND SFML_components window) +endif() +if (WITH_GRAPHICS) + list(APPEND SFML_components graphics) +endif() +if (WITH_AUDIO) + list(APPEND SFML_components audio) +endif() +if (WITH_NETWORK) + list(APPEND SFML_components network) +endif() + +find_package(SFML 2 COMPONENTS ${SFML_components} REQUIRED) + +add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) +target_link_libraries(${CMAKE_PROJECT_NAME} ${SFML_LIBRARIES}) +set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) + +if(WITH_WINDOW) + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "WITH_WINDOW") +endif() +if(WITH_GRAPHICS) + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "WITH_GRAPHICS") +endif() +if(WITH_AUDIO) + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "WITH_AUDIO") +endif() +if(WITH_NETWORK) + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "WITH_NETWORK") +endif() diff --git a/recipes/sfml/all/test_package/conanfile.py b/recipes/sfml/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7e0a2853110a4 --- /dev/null +++ b/recipes/sfml/all/test_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.definitions['WITH_WINDOW'] = self.options['sfml'].window + cmake.definitions['WITH_GRAPHICS'] = self.options['sfml'].graphics + cmake.definitions['WITH_AUDIO'] = self.options['sfml'].audio + cmake.definitions['WITH_NETWORK'] = self.options['sfml'].network + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sfml/all/test_package/test_package.cpp b/recipes/sfml/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b21254f4e0c73 --- /dev/null +++ b/recipes/sfml/all/test_package/test_package.cpp @@ -0,0 +1,46 @@ +#include +#include + +#include + +#ifdef WITH_WINDOW + #include +#endif +#ifdef WITH_GRAPHICS + #include +#endif +#ifdef WITH_AUDIO + #include +#endif +#ifdef WITH_NETWORK + #include +#endif + + +int main(int argc, char **argv) +{ + sf::Clock clock; + clock.getElapsedTime().asSeconds(); + + #ifdef WITH_WINDOW + sf::VideoMode videoMode(720, 480); + #endif + + #ifdef WITH_GRAPHICS + sf::RectangleShape shape; + shape.setFillColor(sf::Color::Cyan); + #endif + + #ifdef WITH_AUDIO + sf::SoundBuffer buffer; + sf::Sound sound; + sound.setBuffer(buffer); + #endif + + #ifdef WITH_NETWORK + sf::TcpListener listener; + listener.isBlocking(); + #endif + + return EXIT_SUCCESS; +} diff --git a/recipes/sfml/config.yml b/recipes/sfml/config.yml new file mode 100644 index 0000000000000..eab83a303df52 --- /dev/null +++ b/recipes/sfml/config.yml @@ -0,0 +1,3 @@ +versions: + "2.5.1": + folder: all From c895d51e2c3b4103d5f3df971e0a6ed3db25a9b9 Mon Sep 17 00:00:00 2001 From: Yoann Potinet Date: Sat, 8 Aug 2020 17:44:43 -0400 Subject: [PATCH 2/6] sfml: Fix shared --- recipes/sfml/all/conandata.yml | 2 ++ recipes/sfml/all/conanfile.py | 2 +- .../001_disable_deps_installation.patch | 4 +-- recipes/sfml/all/patches/002_fix_shared.patch | 32 +++++++++++++++++++ 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 recipes/sfml/all/patches/002_fix_shared.patch diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index eeeda4cb94b35..3771535ae6082 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -6,3 +6,5 @@ patches: "2.5.1": - patch_file: "patches/001_disable_deps_installation.patch" base_path: "source_subfolder" + - patch_file: "patches/002_fix_shared.patch" + base_path: "source_subfolder" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index 4faeae0b0f109..6b0ce0a772808 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -10,7 +10,7 @@ class SFMLConan(ConanFile): homepage = 'https://github.com/SFML/SFML' url = 'https://github.com/conan-io/conan-center-index' exports_sources = ['CMakeLists.txt', 'patches/*'] - generators = 'cmake' + generators = 'cmake', 'cmake_find_package' settings = 'os', 'compiler', 'build_type', 'arch' options = { 'shared': [True, False], diff --git a/recipes/sfml/all/patches/001_disable_deps_installation.patch b/recipes/sfml/all/patches/001_disable_deps_installation.patch index cb53e1f4d0256..c30f94da4cd28 100644 --- a/recipes/sfml/all/patches/001_disable_deps_installation.patch +++ b/recipes/sfml/all/patches/001_disable_deps_installation.patch @@ -1,5 +1,5 @@ ---- CMakeLists.txt 2018-10-15 15:41:39.000000000 -0400 -+++ CMakeLists.txt 2020-08-08 16:27:05.283895800 -0400 +--- CMakeLists.txt ++++ CMakeLists.txt @@ -404,62 +404,9 @@ # install 3rd-party libraries and tools if(SFML_OS_WINDOWS) diff --git a/recipes/sfml/all/patches/002_fix_shared.patch b/recipes/sfml/all/patches/002_fix_shared.patch new file mode 100644 index 0000000000000..5a43e7eda949d --- /dev/null +++ b/recipes/sfml/all/patches/002_fix_shared.patch @@ -0,0 +1,32 @@ +--- cmake/Modules/FindFreetype.cmake ++++ cmake/Modules/FindFreetype.cmake +@@ -95,6 +95,7 @@ find_library(FREETYPE_LIBRARY + NAMES + freetype + libfreetype ++ freetyped + freetype219 + HINTS + ENV FREETYPE_DIR +--- src/SFML/Audio/CMakeLists.txt ++++ src/SFML/Audio/CMakeLists.txt +@@ -79,7 +79,7 @@ sfml_add_library(sfml-audio + SOURCES ${SRC} ${CODECS_SRC}) + + # setup dependencies +-target_link_libraries(sfml-audio PRIVATE OpenAL) ++target_link_libraries(sfml-audio PRIVATE ${CONAN_LIBS} ${SFML_OSX_FRAMEWORK}) + + if(SFML_OS_ANDROID) + target_link_libraries(sfml-audio PRIVATE android OpenSLES) +--- src/SFML/Graphics/CMakeLists.txt ++++ src/SFML/Graphics/CMakeLists.txt +@@ -135,7 +135,7 @@ if(SFML_OS_ANDROID) + endif() + + sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") +-target_link_libraries(sfml-graphics PRIVATE Freetype) ++target_link_libraries(sfml-graphics PRIVATE ${CONAN_LIBS}) + + # add preprocessor symbols + target_compile_definitions(sfml-graphics PRIVATE "STBI_FAILURE_USERMSG") From 802d78c6dd3c5f3ed9b032a7aa6f8d2578e6e891 Mon Sep 17 00:00:00 2001 From: Yoann Potinet Date: Sat, 8 Aug 2020 18:00:36 -0400 Subject: [PATCH 3/6] sfml: add udev as system requirement --- recipes/sfml/all/conanfile.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index 6b0ce0a772808..de7bdc5a241a8 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -53,6 +53,16 @@ def requirements(self): self.requires('xorg/system') self.requires('opengl/system') + def system_requirements(self): + if self.settings.os == 'Linux' and tools.os_info.is_linux: + if tools.os_info.with_apt: + installer = tools.SystemPackageTool() + packages = [] + if self.options.window: + packages.extend(['libudev-dev']) + for package in packages: + installer.install(package) + def configure(self): if self.options.shared: del self.options.fPIC From 8663066dbab668b56d2bdeed47c4bdd9ec346f8d Mon Sep 17 00:00:00 2001 From: Yoann Potinet Date: Mon, 10 Aug 2020 08:37:15 -0400 Subject: [PATCH 4/6] sfml: fix --- recipes/sfml/all/conanfile.py | 78 +++++++++++++++-------------------- 1 file changed, 33 insertions(+), 45 deletions(-) diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index de7bdc5a241a8..44bea6c842024 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -119,82 +119,70 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "SFML" self.cpp_info.names["pkg_config"] = "SFML" - self.cpp_info.components["System"].names["cmake_find_package"] = "system" - self.cpp_info.components["System"].names["cmake_find_package_multi"] = "system" - self.cpp_info.components["System"].libs = [self._get_decorated_lib("sfml-system")] + self.cpp_info.components["system"].libs = [self._get_decorated_lib("sfml-system")] if not self.options.shared: - self.cpp_info.components["System"].defines = ['SFML_STATIC'] + self.cpp_info.components["system"].defines = ['SFML_STATIC'] if self.settings.os == 'Windows': - self.cpp_info.components["System"].system_libs = ['winmm'] + self.cpp_info.components["system"].system_libs = ['winmm'] elif self.settings.os == 'Linux': - self.cpp_info.components["System"].system_libs = ['rt'] + self.cpp_info.components["system"].system_libs = ['rt'] elif self.settings.os == 'Android': - self.cpp_info.components["System"].system_libs = ['android', 'log'] + self.cpp_info.components["system"].system_libs = ['android', 'log'] if self.settings.os != 'Windows': - self.cpp_info.components["System"].system_libs = ['pthread'] + self.cpp_info.components["system"].system_libs = ['pthread'] if self.settings.os in ['Windows', 'Android', 'iOS']: sfml_main_suffix = '-d' if self.settings.build_type == 'Debug' else '' - self.cpp_info.components["Main"].names["cmake_find_package"] = "main" - self.cpp_info.components["Main"].names["cmake_find_package_multi"] = "main" - self.cpp_info.components["Main"].libs = ["sfml-main" + sfml_main_suffix] + self.cpp_info.components["main"].libs = ["sfml-main" + sfml_main_suffix] if not self.options.shared: - self.cpp_info.components["Main"].defines = ['SFML_STATIC'] + self.cpp_info.components["main"].defines = ['SFML_STATIC'] if self.settings.os == 'Android': - self.cpp_info.components["Main"].libs.append(self._get_decorated_lib("sfml-activity")) - self.cpp_info.components["Main"].system_libs = ['android', 'log'] + self.cpp_info.components["main"].libs.append(self._get_decorated_lib("sfml-activity")) + self.cpp_info.components["main"].system_libs = ['android', 'log'] if self.options.window or self.options.graphics: - self.cpp_info.components["Window"].names["cmake_find_package"] = "window" - self.cpp_info.components["Window"].names["cmake_find_package_multi"] = "window" - self.cpp_info.components["Window"].libs = [self._get_decorated_lib("sfml-window")] - self.cpp_info.components["Window"].requires = ["opengl::opengl", "System"] + self.cpp_info.components["window"].libs = [self._get_decorated_lib("sfml-window")] + self.cpp_info.components["window"].requires = ["opengl::opengl", "system"] if self.settings.os in ['Linux', 'FreeBSD']: - self.cpp_info.components["Window"].requires.append('xorg::xorg') + self.cpp_info.components["window"].requires.append('xorg::xorg') if not self.options.shared: - self.cpp_info.components["Window"].defines = ['SFML_STATIC'] + self.cpp_info.components["window"].defines = ['SFML_STATIC'] if self.settings.os == 'Windows': - self.cpp_info.components["Window"].system_libs = ['winmm', 'gdi32'] + self.cpp_info.components["window"].system_libs = ['winmm', 'gdi32'] if self.settings.os == 'Linux': - self.cpp_info.components["Window"].system_libs = ['udev'] + self.cpp_info.components["window"].system_libs = ['udev'] if self.settings.os == 'FreeBSD': - self.cpp_info.components["Window"].system_libs = ['usbhid'] + self.cpp_info.components["window"].system_libs = ['usbhid'] elif self.settings.os == "Macos": - self.cpp_info.components["Window"].frameworks['Foundation', 'AppKit', 'IOKit', 'Carbon'] + self.cpp_info.components["window"].frameworks['Foundation', 'AppKit', 'IOKit', 'Carbon'] if not self.options.shared: - self.cpp_info.components["Window"].exelinkflags.append("-ObjC") - self.cpp_info.components["Window"].sharedlinkflags = self.cpp_info.components["Window"].exelinkflags + self.cpp_info.components["window"].exelinkflags.append("-ObjC") + self.cpp_info.components["window"].sharedlinkflags = self.cpp_info.components["window"].exelinkflags elif self.settings.os == "iOS": self.cpp_info.frameworks['Foundation', 'UIKit', 'CoreGraphics', 'QuartzCore', 'CoreMotion'] elif self.settings.os == "Android": - self.cpp_info.components["Window"].system_libs = ['android'] + self.cpp_info.components["window"].system_libs = ['android'] if self.options.graphics: - self.cpp_info.components["Graphics"].names["cmake_find_package"] = "graphics" - self.cpp_info.components["Graphics"].names["cmake_find_package_multi"] = "graphics" - self.cpp_info.components["Graphics"].libs = [self._get_decorated_lib("sfml-graphics")] - self.cpp_info.components["Graphics"].requires = ["freetype::freetype", "stb::stb", "Window"] + self.cpp_info.components["graphics"].libs = [self._get_decorated_lib("sfml-graphics")] + self.cpp_info.components["graphics"].requires = ["freetype::freetype", "stb::stb", "window"] if not self.options.shared: - self.cpp_info.components["Graphics"].defines = ['SFML_STATIC'] + self.cpp_info.components["graphics"].defines = ['SFML_STATIC'] if self.settings.os == 'Linux': - self.cpp_info.components["Graphics"].system_libs = ['udev'] + self.cpp_info.components["graphics"].system_libs = ['udev'] if self.options.network: - self.cpp_info.components["Network"].names["cmake_find_package"] = "network" - self.cpp_info.components["Network"].names["cmake_find_package_multi"] = "network" - self.cpp_info.components["Network"].libs = [self._get_decorated_lib("sfml-network")] - self.cpp_info.components["Network"].requires = ["System"] + self.cpp_info.components["network"].libs = [self._get_decorated_lib("sfml-network")] + self.cpp_info.components["network"].requires = ["system"] if not self.options.shared: - self.cpp_info.components["Network"].defines = ['SFML_STATIC'] + self.cpp_info.components["network"].defines = ['SFML_STATIC'] if self.settings.os == 'Windows': - self.cpp_info.components["Window"].system_libs = ['ws2_32'] + self.cpp_info.components["network"].system_libs = ['ws2_32'] if self.options.audio: - self.cpp_info.components["Audio"].names["cmake_find_package"] = "audio" - self.cpp_info.components["Audio"].names["cmake_find_package_multi"] = "audio" - self.cpp_info.components["Audio"].libs = [self._get_decorated_lib("sfml-audio")] - self.cpp_info.components["Audio"].requires = ["openal::openal", "flac::flac", "ogg::ogg", "vorbis::vorbis"] + self.cpp_info.components["audio"].libs = [self._get_decorated_lib("sfml-audio")] + self.cpp_info.components["audio"].requires = ["openal::openal", "flac::flac", "ogg::ogg", "vorbis::vorbis"] if not self.options.shared: - self.cpp_info.components["Audio"].defines = ['SFML_STATIC'] + self.cpp_info.components["audio"].defines = ['SFML_STATIC'] if self.settings.os == "Android": - self.cpp_info.components["Audio"].system_libs = ['android'] + self.cpp_info.components["audio"].system_libs = ['android'] From 5d69762dce65232a457094aea840f40a30f9cfdb Mon Sep 17 00:00:00 2001 From: Martin Miralles-Cordal Date: Sat, 10 Oct 2020 20:53:58 -0400 Subject: [PATCH 5/6] sfml: audio component depends on system, bumped openal version --- recipes/sfml/all/conanfile.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index 44bea6c842024..7db3b074e3b1d 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -44,7 +44,7 @@ def requirements(self): self.requires('freetype/2.10.1') self.requires('stb/20200203') if self.options.audio: - self.requires('openal/1.19.1') + self.requires('openal/1.20.1') self.requires('flac/1.3.3') self.requires('ogg/1.3.4') self.requires('vorbis/1.3.6') @@ -105,8 +105,6 @@ def package(self): cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - os.remove(os.path.join(self.package_folder, "license.md")) - os.remove(os.path.join(self.package_folder, "readme.md")) def _get_decorated_lib(self, name): suffix = '-s' if not self.options.shared else '' @@ -181,7 +179,7 @@ def package_info(self): if self.options.audio: self.cpp_info.components["audio"].libs = [self._get_decorated_lib("sfml-audio")] - self.cpp_info.components["audio"].requires = ["openal::openal", "flac::flac", "ogg::ogg", "vorbis::vorbis"] + self.cpp_info.components["audio"].requires = ["openal::openal", "flac::flac", "ogg::ogg", "vorbis::vorbis", "system"] if not self.options.shared: self.cpp_info.components["audio"].defines = ['SFML_STATIC'] if self.settings.os == "Android": From 48d9b85b23ec5ffe5c50e8baf7fae9472add0aaf Mon Sep 17 00:00:00 2001 From: Martin Miralles-Cordal Date: Sun, 1 Nov 2020 01:40:03 -0400 Subject: [PATCH 6/6] sfml: patched out install of readme file. --- .../all/patches/001_disable_deps_installation.patch | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipes/sfml/all/patches/001_disable_deps_installation.patch b/recipes/sfml/all/patches/001_disable_deps_installation.patch index c30f94da4cd28..c8b9da8849a3f 100644 --- a/recipes/sfml/all/patches/001_disable_deps_installation.patch +++ b/recipes/sfml/all/patches/001_disable_deps_installation.patch @@ -1,6 +1,12 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -404,62 +404,9 @@ +@@ -398,68 +398,12 @@ + COMPONENT devel) + endif() + +-install(FILES license.md DESTINATION ${SFML_MISC_INSTALL_PREFIX}) +-install(FILES readme.md DESTINATION ${SFML_MISC_INSTALL_PREFIX}) +- # install 3rd-party libraries and tools if(SFML_OS_WINDOWS) @@ -63,7 +69,7 @@ # install the Xcode templates if requested if(SFML_INSTALL_XCODE_TEMPLATES) -@@ -479,34 +426,9 @@ +@@ -479,34 +423,9 @@ elseif(SFML_OS_IOS) # fix CMake install rules broken for iOS (see http://public.kitware.com/Bug/view.php?id=12506)