diff --git a/recipes/msdfgen/all/conandata.yml b/recipes/msdfgen/all/conandata.yml index 2d80e884e7bf9..f68f3c7d5e83e 100644 --- a/recipes/msdfgen/all/conandata.yml +++ b/recipes/msdfgen/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.11": + url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.11.tar.gz" + sha256: "fad74e33274f591e72511bc0546189e7aec439f2a512ef1b2fde243554d457cb" "1.10": url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.10.tar.gz" sha256: "2754d1687bfb80968d9c682e0c4c04c8fcf72df1421d076baf44ea0d87aa3662" @@ -10,8 +13,8 @@ sources: sha256: "909eb88c71268dc00cdda244a1fa40a0feefae45f68a779fbfddd5463559fa40" patches: "1.10": - - patch_file: "patches/1.10-0001-fix-cmake.patch" - patch_description: "move project position to top" + - patch_file: "patches/1.10-0001-honor-msvc-runtime.patch" + patch_description: "Remove hardcoded vc runtime" patch_type: "conan" "1.9.1": - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" diff --git a/recipes/msdfgen/all/conanfile.py b/recipes/msdfgen/all/conanfile.py index 03f96bc253715..3465d1f3da467 100644 --- a/recipes/msdfgen/all/conanfile.py +++ b/recipes/msdfgen/all/conanfile.py @@ -2,7 +2,7 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os @@ -17,7 +17,7 @@ class MsdfgenConan(ConanFile): topics = ("msdf", "shape", "glyph", "font") homepage = "https://github.com/Chlumsky/msdfgen" url = "https://github.com/conan-io/conan-center-index" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,11 +49,11 @@ def layout(self): cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.12.1") + self.requires("freetype/2.13.2") if Version(self.version) < "1.10": self.requires("lodepng/cci.20200615") else: - self.requires("libpng/1.6.39") + self.requires("libpng/[>=1.6 <2]") self.requires("tinyxml2/9.0.0") def validate(self): @@ -65,59 +65,45 @@ def validate(self): raise ConanInvalidConfiguration("skia recipe not available yet in CCI") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility - tc.variables["MSDFGEN_USE_OPENMP"] = self.options.with_openmp - tc.variables["MSDFGEN_USE_CPP11"] = True - tc.variables["MSDFGEN_USE_SKIA"] = self.options.with_skia - tc.variables["MSDFGEN_INSTALL"] = True + tc.cache_variables["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility + tc.cache_variables["MSDFGEN_USE_OPENMP"] = self.options.with_openmp + tc.cache_variables["MSDFGEN_USE_CPP11"] = True + tc.cache_variables["MSDFGEN_USE_SKIA"] = self.options.with_skia + tc.cache_variables["MSDFGEN_INSTALL"] = True if Version(self.version) >= "1.10": - tc.variables["MSDFGEN_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) - tc.variables["MSDFGEN_USE_VCPKG"] = False + tc.cache_variables["MSDFGEN_USE_VCPKG"] = False + # Because in upstream CMakeLists, project() is called after some logic based on BUILD_SHARED_LIBS + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + if Version(self.version) >= "1.11": + tc.cache_variables["MSDFGEN_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + if self.settings.os == "Linux": + # Workaround for https://github.com/conan-io/conan/issues/13560 + libdirs_host = [l for dependency in self.dependencies.host.values() for l in dependency.cpp_info.aggregated_components().libdirs] + tc.variables["CMAKE_BUILD_RPATH"] = ";".join(libdirs_host) tc.generate() deps = CMakeDeps(self) deps.generate() def _patch_sources(self): apply_conandata_patches(self) - cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - # workaround against CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in conan toolchain - replace_in_file(self, cmakelists, "find_package(Freetype REQUIRED)", "find_package(Freetype REQUIRED MODULE)") - # remove bundled lodepng & tinyxml2 - rmdir(self, os.path.join(self.source_folder, "lib")) - rmdir(self, os.path.join(self.source_folder, "include")) - # very weird but required for Visual Studio when libs are unvendored (at least for Ninja generator) - if is_msvc(self): - if Version(self.version) < "1.10": + + if Version(self.version) < "1.10": + # remove bundled lodepng & tinyxml2 + rmdir(self, os.path.join(self.source_folder, "lib")) + rmdir(self, os.path.join(self.source_folder, "include")) + + # very weird but required for Visual Studio when libs are unvendored (at least for Ninja generator) + if is_msvc(self): replace_in_file( self, - cmakelists, + os.path.join(self.source_folder, "CMakeLists.txt"), "set_target_properties(msdfgen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdfgen)", "set_target_properties(msdfgen-standalone PROPERTIES OUTPUT_NAME msdfgen IMPORT_PREFIX foo)", ) - else: - replace_in_file( - self, - cmakelists, - 'set_property(TARGET msdfgen-core PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")', - '' - ) - replace_in_file( - self, - cmakelists, - 'set_property(TARGET msdfgen-ext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")', - '' - ) - replace_in_file( - self, - cmakelists, - 'set_property(TARGET msdfgen PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>")', - '' - ) def build(self): self._patch_sources() @@ -130,6 +116,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "msdfgen") @@ -167,7 +154,6 @@ def package_info(self): if self.options.with_skia: self.cpp_info.components["msdfgen-ext"].defines.append("MSDFGEN_USE_SKIA") + # TODO: to remove once conan v1 support dropped if self.options.utility: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/msdfgen/all/patches/1.10-0001-fix-cmake.patch b/recipes/msdfgen/all/patches/1.10-0001-fix-cmake.patch deleted file mode 100644 index 50b04c4c1e5d9..0000000000000 --- a/recipes/msdfgen/all/patches/1.10-0001-fix-cmake.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6dec916..432f218 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2,6 +2,9 @@ - cmake_minimum_required(VERSION 3.15) - include(cmake/version.cmake) - -+# Version is specified in vcpkg.json -+project(msdfgen VERSION ${MSDFGEN_VERSION} LANGUAGES CXX) -+ - option(MSDFGEN_CORE_ONLY "Only build the core library with no dependencies" OFF) - option(MSDFGEN_BUILD_STANDALONE "Build the msdfgen standalone executable" ON) - option(MSDFGEN_USE_VCPKG "Use vcpkg package manager to link project dependencies" ON) -@@ -67,9 +70,6 @@ if(MSDFGEN_USE_VCPKG) - endif() - endif() - --# Version is specified in vcpkg.json --project(msdfgen VERSION ${MSDFGEN_VERSION} LANGUAGES CXX) -- - file(GLOB_RECURSE MSDFGEN_CORE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "core/*.h" "core/*.hpp") - file(GLOB_RECURSE MSDFGEN_CORE_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "core/*.cpp") - file(GLOB_RECURSE MSDFGEN_EXT_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ext/*.h" "ext/*.hpp") diff --git a/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch b/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch new file mode 100644 index 0000000000000..c0f9784ad23cf --- /dev/null +++ b/recipes/msdfgen/all/patches/1.10-0001-honor-msvc-runtime.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,7 +79,6 @@ file(GLOB_RECURSE MSDFGEN_EXT_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ext/ + add_library(msdfgen-core "${CMAKE_CURRENT_SOURCE_DIR}/msdfgen.h" ${MSDFGEN_CORE_HEADERS} ${MSDFGEN_CORE_SOURCES}) + add_library(msdfgen::msdfgen-core ALIAS msdfgen-core) + set_target_properties(msdfgen-core PROPERTIES PUBLIC_HEADER "${MSDFGEN_CORE_HEADERS}") +-set_property(TARGET msdfgen-core PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_compile_definitions(msdfgen-core PUBLIC + MSDFGEN_VERSION=${MSDFGEN_VERSION} + MSDFGEN_VERSION_MAJOR=${MSDFGEN_VERSION_MAJOR} +@@ -127,7 +126,6 @@ if(NOT MSDFGEN_CORE_ONLY) + add_library(msdfgen-ext "${CMAKE_CURRENT_SOURCE_DIR}/msdfgen-ext.h" ${MSDFGEN_EXT_HEADERS} ${MSDFGEN_EXT_SOURCES}) + add_library(msdfgen::msdfgen-ext ALIAS msdfgen-ext) + set_target_properties(msdfgen-ext PROPERTIES PUBLIC_HEADER "${MSDFGEN_EXT_HEADERS}") +- set_property(TARGET msdfgen-ext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_compile_definitions(msdfgen-ext PUBLIC MSDFGEN_USE_LIBPNG) + target_link_libraries(msdfgen-ext PRIVATE msdfgen::msdfgen-core Freetype::Freetype tinyxml2::tinyxml2 PNG::PNG) + target_include_directories(msdfgen-ext +@@ -171,7 +169,6 @@ if(MSDFGEN_BUILD_STANDALONE) + add_executable(msdfgen ${MSDFGEN_STANDALONE_SOURCES}) + target_compile_definitions(msdfgen PUBLIC MSDFGEN_STANDALONE) + target_compile_definitions(msdfgen PRIVATE MSDFGEN_VERSION_UNDERLINE=${MSDFGEN_VERSION_UNDERLINE}) +- set_property(TARGET msdfgen PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + target_link_libraries(msdfgen PRIVATE msdfgen::msdfgen) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT msdfgen) + endif() diff --git a/recipes/msdfgen/config.yml b/recipes/msdfgen/config.yml index 9f326bdd6e1a4..91cf4a222ec6c 100644 --- a/recipes/msdfgen/config.yml +++ b/recipes/msdfgen/config.yml @@ -1,4 +1,6 @@ versions: + "1.11": + folder: all "1.10": folder: all "1.9.1":