Skip to content

Commit

Permalink
Merge pull request #2111 from danimtb/fix/corrade
Browse files Browse the repository at this point in the history
Update corrade recipe
  • Loading branch information
SSE4 authored Jul 6, 2020
2 parents 58e3de0 + 3589795 commit d1b554f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
44 changes: 21 additions & 23 deletions recipes/corrade/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@
import os


def sort_libs(correct_order, libs, lib_suffix="", reverse_result=False):
# Add suffix for correct string matching
correct_order[:] = [s.__add__(lib_suffix) for s in correct_order]

result = []
for expectedLib in correct_order:
for lib in libs:
if expectedLib == lib:
result.append(lib)

if reverse_result:
# Linking happens in reversed order
result.reverse()

return result


class CorradeConan(ConanFile):
name = "corrade"
description = "Corrade is a multiplatform utility library written in C++11/C++14."
Expand Down Expand Up @@ -62,10 +45,10 @@ def config_options(self):
del self.options.fPIC

def configure(self):
if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) < 14:
if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 14:
raise ConanInvalidConfiguration("Corrade requires Visual Studio version 14 or greater")
if tools.cross_building(self.settings):
raise ConanInvalidConfiguration("This Corrade recipe doesn't support cross building yet")
if tools.cross_building(self):
self.output.warn("This Corrade recipe could not be prepared for cross building")

def source(self):
tools.get(**self.conan_data["sources"][self.version])
Expand All @@ -79,10 +62,10 @@ def _configure_cmake(self):
self._cmake.definitions["BUILD_DEPRECARED"] = self.options["build_deprecated"]
self._cmake.definitions["WITH_INTERCONNECT"] = self.options["with_interconnect"]
self._cmake.definitions["WITH_MAIN"] = self.options["with_main"]
self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options["with_pluginmanager"]
self._cmake.definitions["WITH_PLUGINMANAGER"] = self.options["with_pluginmanager"]
self._cmake.definitions["WITH_TESTSUITE"] = self.options["with_testsuite"]
self._cmake.definitions["WITH_UTILITY"] = self.options["with_utility"]
self._cmake.definitions["WITH_RC"] = "ON"
self._cmake.definitions["WITH_RC"] = "ON"

# Corrade uses suffix on the resulting "lib"-folder when running cmake.install()
# Set it explicitly to empty, else Corrade might set it implicitly (eg. to "64")
Expand Down Expand Up @@ -111,6 +94,21 @@ def package(self):
self.copy("CorradeLibSuffix.cmake", src=share_cmake, dst=os.path.join(self.package_folder, "lib", "cmake", "Corrade"))
tools.rmdir(os.path.join(self.package_folder, "share"))

def _sort_libs(self, correct_order, libs, lib_suffix="", reverse_result=False):
# Add suffix for correct string matching
correct_order[:] = [s.__add__(lib_suffix) for s in correct_order]

result = []
for expectedLib in correct_order:
for lib in libs:
if expectedLib == lib:
result.append(lib)

if reverse_result:
# Linking happens in reversed order
result.reverse()
return result

def package_info(self):
self.cpp_info.names["cmake_find_package"] = "Corrade"
self.cpp_info.names["cmake_find_package_multi"] = "Corrade"
Expand All @@ -134,7 +132,7 @@ def package_info(self):
# Sort all built libs according to above, and reverse result for correct link order
suffix = "-d" if self.settings.build_type == "Debug" else ""
builtLibs = tools.collect_libs(self)
self.cpp_info.libs = sort_libs(correct_order=allLibs, libs=builtLibs, lib_suffix=suffix, reverse_result=True)
self.cpp_info.libs = self._sort_libs(allLibs, builtLibs, suffix, True)
if self.settings.os == "Linux":
self.cpp_info.system_libs = ["m", "dl"]

Expand Down
2 changes: 0 additions & 2 deletions recipes/corrade/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.8.12)
project(test_package)

set(CMAKE_VERBOSE_MAKEFILE TRUE)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

Expand Down

0 comments on commit d1b554f

Please sign in to comment.